Rakefile in mkmf-lite-0.2.4 vs Rakefile in mkmf-lite-0.2.5

- old
+ new

@@ -1,26 +1,31 @@ -require 'rake' -require 'rake/clean' -require 'rake/testtask' - -CLEAN.include("**/*.gem", "**/*.rbc") - -namespace 'gem' do - desc 'Create the mkmf-lite gem.' - task :create => [:clean] do - spec = eval(IO.read('mkmf-lite.gemspec')) - Gem::Builder.new(spec).build - end - - desc 'Install the mkmf-lite gem.' - task :install => [:create] do - file = Dir["*.gem"].first - sh "gem install #{file}" - end -end - -Rake::TestTask.new do |t| - t.verbose = true - t.warning = true -end - -task :default => :test +require 'rake' +require 'rake/clean' +require 'rake/testtask' + +CLEAN.include("**/*.gem", "**/*.rbc") + +namespace 'gem' do + desc 'Create the mkmf-lite gem.' + task :create => [:clean] do + spec = eval(IO.read('mkmf-lite.gemspec')) + if Gem::VERSION.to_f < 2.0 + Gem::Builder.new(spec).build + else + require 'rubygems/package' + Gem::Package.build(spec) + end + end + + desc 'Install the mkmf-lite gem.' + task :install => [:create] do + file = Dir["*.gem"].first + sh "gem install -l #{file}" + end +end + +Rake::TestTask.new do |t| + t.verbose = true + t.warning = true +end + +task :default => :test