Rakefile in mrjoy-bundler-audit-0.3.3 vs Rakefile in mrjoy-bundler-audit-0.3.4

- old
+ new

@@ -1,25 +1,17 @@ # encoding: utf-8 require 'rubygems' begin - require 'bundler' + require 'bundler/setup' rescue LoadError => e warn e.message warn "Run `gem install bundler` to install Bundler." exit -1 end -begin - Bundler.setup(:default, :development) -rescue Bundler::BundlerError => e - warn e.message - warn "Run `bundle install` to install missing gems." - exit e.status_code -end - require 'rake' require 'time' require 'rubygems/tasks' Gem::Tasks.new @@ -48,11 +40,21 @@ namespace :spec do task :bundle do root = 'spec/bundle' - %w[secure unpatched_gems insecure_sources].each do |bundle| +# Skip this test on any Ruby below 1.9.3. +version = RUBY_VERSION.split(/\./).map(&:to_i) +if((version[0] == 1 && version[1] >= 9 && version[2] >= 3) || (version[0] >= 2)) + chdir(File.join(root,"secure")) do + FileUtils.rm("Gemfile.lock") if(File.exist?("Gemfile.lock")) + sh 'BUNDLE_BIN_PATH="" BUNDLE_GEMFILE="" RUBYOPT="" bundle install --path ../../../vendor/bundle' + end +end + + %w[unpatched_gems insecure_sources].each do |bundle| chdir(File.join(root,bundle)) do + FileUtils.rm("Gemfile.lock") if(File.exist?("Gemfile.lock")) sh 'BUNDLE_BIN_PATH="" BUNDLE_GEMFILE="" RUBYOPT="" bundle install --path ../../../vendor/bundle' end end end end