Rakefile in enumerable-extra-0.1.2 vs Rakefile in enumerable-extra-0.2.0
- old
+ new
@@ -1,26 +1,31 @@
require 'rake'
require 'rake/testtask'
+require 'rake/clean'
-desc "Install the enumerable-extra library (non-gem)"
-task :install do
- dest = File.join(Config::CONFIG['sitelibdir'], 'enumerable')
- Dir.mkdir(dest) unless File.exists? dest
- cp 'lib/enumerable/extra.rb', dest, :verbose => true
-end
+CLEAN.include("*.gem", "*.rbc")
-desc 'Build the enumerable-extra gem'
-task :gem do
- spec = eval(IO.read('enumerable-extra.gemspec'))
- Gem::Builder.new(spec).build
-end
+namespace :gem do
+ desc 'Build the enumerable-extra gem'
+ task :create => [:clean] do
+ spec = eval(IO.read('enumerable-extra.gemspec'))
+ if Gem::VERSION < "2.0"
+ Gem::Builder.new(spec).build
+ else
+ require 'rubygems/package'
+ Gem::Package.build(spec)
+ end
+ end
-desc "Install the enumerable-extra library as a gem"
-task :install_gem => [:gem] do
- file = Dir["*.gem"].first
- sh "gem install #{file}"
+ desc "Install the enumerable-extra library as a gem"
+ task :install => [:create] do
+ file = Dir["*.gem"].first
+ sh "gem install -l #{file}"
+ end
end
Rake::TestTask.new do |t|
- t.warning = true
- t.verbose = true
+ t.warning = true
+ t.verbose = true
end
+
+task :default => :test