Rakefile in getopt-declare-1.22 vs Rakefile in getopt-declare-1.23

- old
+ new

@@ -1,18 +1,19 @@ #!/usr/bin/env ruby require 'rake/gempackagetask' require 'rake/rdoctask' +require 'rake/testtask' rdoc_files = ["Declare.rdoc", 'HISTORY.txt'] + Dir.glob('lib/*/*.rb') # # TASK: Gem specification and creation ('gem') # spec = Gem::Specification.new do |spec| spec.name = "getopt-declare" - spec.version = '1.22' + spec.version = '1.23' spec.author = "Gonzalo Garramuno" spec.email = 'ggarra@advancedsl.com.ar, GGarramuno@aol.com' spec.homepage = 'http://www.rubyforge.org/projects/getoptdeclare/' spec.summary = 'Getopt-Declare is a command-line argument parser.' spec.require_path = "lib" @@ -60,9 +61,42 @@ sh "scp -r #{html_dir}/* #{rubyforge_user}@rubyforge.org:#{rubyforge_path}" end +desc 'Zip directory as an archive.' +task 'zip' => ['rdoc'] do + dir = File.basename(Dir.pwd) + zipfile = spec.name + "-" + spec.version.to_s + ".zip" + Dir.chdir('..') + File.unlink(zipfile) if File.exists?(zipfile) + sh "zip -9rv #{zipfile} #{dir} -x '*~' -x '#*#' -x '*docs/*' -x '*pkg/*' -x '.*'" + Dir.chdir(dir) +end + +desc 'Run unit tests' +Rake::TestTask.new do |t| + t.libs << 'test' + t.test_files = FileList['test/*.rb'] + t.verbose = true + t.warning = true + # t.loader = :testrb + # p t.methods - Object.methods +end + +desc 'upload gem' +task 'upload-gem' => ['test', 'gem'] do +end + +desc 'upload zip' +task 'upload-zip' => ['zip'] do +end + +desc 'Upload gem, docs and zip file' +task 'upload' => [ 'upload-gem', 'upload-zip', 'upload-docs' ] + + + # # Main task # -task :default => ['gem', 'upload-docs'] +task :default => ['upload']