Ruby-WordNet
changeset 84:faf85b52afb3 rakefile-work
* Fixed the test for an existing data directory in the conversion script
* Set coverage minimum to 83% until I can get more tests written
* Removed some more old files
| author | Michael Granger <ged@FaerieMUD.org> |
|---|---|
| date | Thu, 10 Jul 2008 13:27:07 +0000 |
| parents | 4f0448f5feaa |
| children | d957ef3d9f1e |
| files | MANIFEST Rakefile convertdb.rb makedist.rb |
| diffstat | 4 files changed, 2 insertions(+), 274 deletions(-) [+] |
line diff
1.1 --- a/MANIFEST Wed Jul 09 23:52:38 2008 +0000 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,25 +0,0 @@ 1.4 -# -*- default-generic -*- 1.5 -# 1.6 -# Time-stamp: <06-Aug-2003 01:41:49 deveiant> 1.7 -# $Id$ 1.8 -# 1.9 -# This is the list of files that belong in distributions. It is used by 1.10 -# makedist.rb and a few other utilities. It is read by functions in utils.rb. 1.11 -# 1.12 -# 1.13 - 1.14 -ChangeLog 1.15 -INSTALL 1.16 -MANIFEST 1.17 -README 1.18 -TODO 1.19 -convertdb.rb 1.20 -docs/CATALOG 1.21 -docs/COPYRIGHT 1.22 -docs/makedocs.rb 1.23 -install.rb 1.24 -lib/**/*.rb 1.25 -test.rb 1.26 -tests/**/* 1.27 -utils.rb 1.28 -examples/*.rb
2.1 --- a/Rakefile Wed Jul 09 23:52:38 2008 +0000 2.2 +++ b/Rakefile Thu Jul 10 13:27:07 2008 +0000 2.3 @@ -59,6 +59,7 @@ 2.4 SPEC_FILES = Pathname.glob( SPECDIR + '**/*_spec.rb' ).delete_if {|item| item =~ /\.svn/ } 2.5 SPEC_EXCLUDES = 'spec,/Library/Ruby,/var/lib,/usr/local/lib' 2.6 2.7 +COVERAGE_MINIMUM = 83.0 2.8 2.9 RELEASE_FILES = FileList[ TEXT_FILES + SPEC_FILES + LIB_FILES + EXT_FILES ] 2.10
3.1 --- a/convertdb.rb Wed Jul 09 23:52:38 2008 +0000 3.2 +++ b/convertdb.rb Thu Jul 10 13:27:07 2008 +0000 3.3 @@ -99,7 +99,7 @@ 3.4 3.5 # Open the database and check to be sure it's empty. Confirm overwrite if 3.6 # not. Checkpoint and set up logging proc if debugging. 3.7 - if @builddir.exist? && @builddir.entries.include?( 'data' ) 3.8 + if @builddir.exist? && ( @builddir + 'data' ).exist? 3.9 message ">>> Warning: Existing data in the Ruby-WordNet databases\n"\ 3.10 "will be overwritten.\n" 3.11 abort( "user cancelled." ) unless
4.1 --- a/makedist.rb Wed Jul 09 23:52:38 2008 +0000 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,248 +0,0 @@ 4.4 -#!/usr/bin/ruby 4.5 -# 4.6 -# Distribution Maker Script 4.7 -# $Id$ 4.8 -# 4.9 -# Copyright (c) 2001-2005, The FaerieMUD Consortium. 4.10 -# 4.11 -# This is free software. You may use, modify, and/or redistribute this 4.12 -# software under the terms of the Perl Artistic License. (See 4.13 -# http://language.perl.com/misc/Artistic.html) 4.14 -# 4.15 - 4.16 -BEGIN { 4.17 - basedir = File::dirname( File::expand_path(__FILE__) ) 4.18 - require "#{basedir}/utils.rb" 4.19 -} 4.20 - 4.21 -require 'optparse' 4.22 -require 'fileutils' 4.23 -require 'rbconfig' 4.24 - 4.25 -include UtilityFunctions, FileUtils, Config 4.26 - 4.27 - 4.28 -# SVN Revision 4.29 -SVNRev = %q$Rev$ 4.30 - 4.31 -# SVN Id 4.32 -SVNId = %q$Id$ 4.33 - 4.34 -# SVN URL 4.35 -SVNURL = %q$URL$ 4.36 - 4.37 -$Programs = { 4.38 - 'tar' => nil, 4.39 - 'zip' => nil, 4.40 - 'cvs' => nil, 4.41 - 'svn' => nil, 4.42 -} 4.43 - 4.44 -Distros = [ 4.45 - 4.46 - # Tar+gzipped 4.47 - { 4.48 - 'type' => 'Tar+Gzipped', 4.49 - 'makeProc' => lambda {|distName| 4.50 - gzArchiveName = "%s.tar.gz" % distName 4.51 - if File::exists?( gzArchiveName ) 4.52 - message "Removing old archive #{gzArchiveName}..." 4.53 - File.delete( gzArchiveName ) 4.54 - end 4.55 - system( $Programs['tar'], '-czf', gzArchiveName, distName ) or abort( "tar+gzip failed: #{$?}" ) 4.56 - } 4.57 - }, 4.58 - 4.59 - # Tar+bzipped 4.60 - { 4.61 - 'type' => 'Tar+Bzipped', 4.62 - 'makeProc' => lambda {|distName| 4.63 - bzArchiveName = "%s.tar.bz2" % distName 4.64 - if File::exists?( bzArchiveName ) 4.65 - message "Removing old archive #{bzArchiveName}..." 4.66 - File.delete( bzArchiveName ) 4.67 - end 4.68 - system( $Programs['tar'], '-cjf', bzArchiveName, distName ) or 4.69 - abort( "tar failed: #{$?}" ) 4.70 - } 4.71 - }, 4.72 - 4.73 - # Zipped 4.74 - { 4.75 - 'type' => 'Zipped', 4.76 - 'makeProc' => lambda {|distName| 4.77 - zipArchiveName = "%s.zip" % distName 4.78 - if File::exists?( zipArchiveName ) 4.79 - message "Removing old archive #{zipArchiveName}..." 4.80 - File.delete( zipArchiveName ) 4.81 - end 4.82 - system( $Programs['zip'], '-lrq9', zipArchiveName, distName ) or 4.83 - abort( "zip failed: #{$?}" ) 4.84 - } 4.85 - }, 4.86 - 4.87 - # Gem 4.88 - { 4.89 - 'type' => 'RubyGem', 4.90 - 'makeProc' => lambda {|distName| 4.91 - gemName = "%s.gem" % distName 4.92 - if File::exists?( ".gemspec" ) 4.93 - if File::exists?( gemName ) 4.94 - message "Removing old gem #{gemName}..." 4.95 - File::delete( gemName ) 4.96 - end 4.97 - 4.98 - system( CONFIG['RUBY_INSTALL_NAME'], ".gemspec" ) or 4.99 - abort( "Gem create failed: #{$?}" ) 4.100 - else 4.101 - message "Skipping Gem: no .gemspec" 4.102 - end 4.103 - } 4.104 - } 4.105 -] 4.106 - 4.107 - 4.108 -# Set interrupt handler to restore tty before exiting 4.109 -#stty_save = `stty -g`.chomp 4.110 -#trap("INT") { system "stty", stty_save; exit } 4.111 - 4.112 -### Main function 4.113 -def main 4.114 - filelist = [] 4.115 - snapshot = false 4.116 - wantsTag = true 4.117 - wantsPrompt = true 4.118 - 4.119 - # Read command-line options 4.120 - ARGV.options do |oparser| 4.121 - oparser.banner = "Usage: #$0 [options] [VERSION]\n" 4.122 - 4.123 - oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) do 4.124 - $VERBOSE = true 4.125 - debugMsg "Turned verbose on." 4.126 - end 4.127 - 4.128 - oparser.on( "--snapshot", "-s", TrueClass, 4.129 - "Make a snapshot distribution instead of a versioned release" ) do 4.130 - snapshot = true 4.131 - debugMsg "Making snapshot instead of release." 4.132 - end 4.133 - 4.134 - oparser.on( "--no-tag", "-n", TrueClass, "Don't tag the release." ) do 4.135 - wantsTag = false 4.136 - end 4.137 - 4.138 - oparser.on( "--yes", "-y", TrueClass, 4.139 - "Accept all the defaults instead of prompting." ) do 4.140 - wantsPrompt = false 4.141 - end 4.142 - 4.143 - # Handle the 'help' option 4.144 - oparser.on( "--help", "-h", "Display this text." ) do 4.145 - $stderr.puts oparser 4.146 - exit!(0) 4.147 - end 4.148 - 4.149 - oparser.parse! 4.150 - end 4.151 - 4.152 - userversion = ARGV.shift 4.153 - 4.154 - # Find the project name 4.155 - header "Distribution Maker" 4.156 - project = extractProjectName() 4.157 - if wantsPrompt && project.nil? 4.158 - project = prompt( "Project name?" ) 4.159 - end 4.160 - abort( "No project name" ) unless project && !project.empty? 4.161 - message( "Making distribution archives for %s\n" % project ) 4.162 - 4.163 - # Look for programs to use 4.164 - message "Finding necessary programs...\n\n" 4.165 - for prog in $Programs.keys 4.166 - $Programs[ prog ] = findProgram( prog ) or 4.167 - abort "Required program #{prog} not found." 4.168 - message( " #{prog}: %s\n" % $Programs[prog] ) 4.169 - end 4.170 - message( "All required programs found.\n" ) 4.171 - 4.172 - # Fetch the MANIFEST 4.173 - filelist = getVettedManifest() 4.174 - 4.175 - # Prompt for version/snapshot date 4.176 - version = distName = nil 4.177 - if snapshot 4.178 - verboseMsg( "Making a snapshot distname." ) 4.179 - 4.180 - if userversion 4.181 - version = userversion 4.182 - else 4.183 - version = Time::now.strftime('%Y%m%d') 4.184 - version = promptWithDefault( "Snapshot version", version ) if wantsPrompt 4.185 - end 4.186 - 4.187 - verboseMsg( "Using version %p" % [version] ) 4.188 - distName = "%s-%s" % [ project, version ] 4.189 - tag = "SNAPSHOT_%s" % version 4.190 - else 4.191 - verboseMsg( "Making a release distname." ) 4.192 - 4.193 - if userversion 4.194 - version = userversion 4.195 - else 4.196 - version = extractNextVersion().join('.') 4.197 - version = promptWithDefault( "Distribution version", version ) if wantsPrompt 4.198 - end 4.199 - 4.200 - verboseMsg( "Using version %p" % [version] ) 4.201 - distName = "%s-%s" % [ project, version ] 4.202 - tag = "RELEASE_%s" % version.gsub( /\./, '_' ) 4.203 - end 4.204 - verboseMsg( "Distname = %p" % [distName] ) 4.205 - 4.206 - # Tag if desired 4.207 - if wantsTag 4.208 - verboseMsg( "Tagging." ) 4.209 - 4.210 - tagFlag = promptWithDefault( "Tag '%s' with %s" % [ project, tag ], 'y' ) 4.211 - if /^y/i.match( tagFlag ) 4.212 - if File::directory?( "CVS" ) 4.213 - message "Running #{$Programs['cvs']} -q tag #{tag}\n" 4.214 - system $Programs['cvs'], '-q', 'tag', tag 4.215 - elsif File::directory?( ".svn" ) 4.216 - uri = getSvnUri() 4.217 - taguri = uri + "tags/#{tag}" 4.218 - message "SVN tag URI: %s\n" % [ taguri ] 4.219 - system( $Programs['svn'], 'cp', uri.to_s, taguri.to_s, 4.220 - '-m', "Tagging for version %s" % [version] ) 4.221 - else 4.222 - errorMessage "No supported version control system. Skipping tag." 4.223 - end 4.224 - end 4.225 - end 4.226 - 4.227 - # Make the distdir 4.228 - message "Making distribution directory #{distName}...\n" 4.229 - Dir.mkdir( distName ) unless FileTest.directory?( distName ) 4.230 - for file in filelist 4.231 - FileUtils.mkdir_p( File.dirname(File.join(distName,file)), :verbose => true ) 4.232 - FileUtils.ln( file, File.join(distName,file), :verbose => true ) 4.233 - end 4.234 - 4.235 - # Make an archive file for each known kind 4.236 - for distro in Distros 4.237 - message "Making #{distro['type']} distribution..." 4.238 - distro['makeProc'].call( distName ) 4.239 - message "done.\n" 4.240 - end 4.241 - 4.242 - # Remove the distdir 4.243 - message "removing dist build directory..." 4.244 - rm_rf distName, :verbose => $VERBOSE 4.245 - message "done.\n\n" 4.246 -end 4.247 - 4.248 -main 4.249 - 4.250 - 4.251 -
