diff options
Diffstat (limited to 'tasks/external_tests.rb')
-rw-r--r-- | tasks/external_tests.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tasks/external_tests.rb b/tasks/external_tests.rb index 805ea323cb..f3a0da062f 100644 --- a/tasks/external_tests.rb +++ b/tasks/external_tests.rb @@ -1,15 +1,15 @@ -require 'tempfile' -require 'bundler' +require "tempfile" +require "bundler" -CURRENT_GEM_NAME = 'chef' -CURRENT_GEM_PATH = File.expand_path('../..', __FILE__) +CURRENT_GEM_NAME = "chef" +CURRENT_GEM_PATH = File.expand_path("../..", __FILE__) def bundle_exec_with_chef(test_gem, commands) gem_path = Bundler.environment.specs[test_gem].first.full_gem_path gemfile_path = File.join(gem_path, "Gemfile.#{CURRENT_GEM_NAME}-external-test") gemfile = File.open(gemfile_path, "w") begin - IO.read(File.join(gem_path, 'Gemfile')).each_line do |line| + IO.read(File.join(gem_path, "Gemfile")).each_line do |line| if line =~ /^\s*gemspec/ next elsif line =~ /^\s*gem '#{CURRENT_GEM_NAME}'|\s*gem "#{CURRENT_GEM_NAME}"/ @@ -26,11 +26,11 @@ def bundle_exec_with_chef(test_gem, commands) gemfile.close Dir.chdir(gem_path) do Bundler.with_clean_env do - unless system({ 'BUNDLE_GEMFILE' => gemfile_path, 'RUBYOPT' => nil, 'GEMFILE_MOD' => nil }, "bundle update") + unless system({ "BUNDLE_GEMFILE" => gemfile_path, "RUBYOPT" => nil, "GEMFILE_MOD" => nil }, "bundle update") raise "Error running bundle update of #{gemfile_path} in #{gem_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}" end Array(commands).each do |command| - unless system({ 'BUNDLE_GEMFILE' => gemfile_path, 'RUBYOPT' => nil, 'GEMFILE_MOD' => nil }, "bundle exec #{command}") + unless system({ "BUNDLE_GEMFILE" => gemfile_path, "RUBYOPT" => nil, "GEMFILE_MOD" => nil }, "bundle exec #{command}") raise "Error running bundle exec #{command} in #{gem_path} with BUNDLE_GEMFILE=#{gemfile_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}" end end @@ -58,7 +58,7 @@ EXTERNAL_PROJECTS = { task :external_specs => EXTERNAL_PROJECTS.keys.map { |g| :"#{g.sub("-","_")}_spec" } EXTERNAL_PROJECTS.each do |test_gem, commands| - task :"#{test_gem.gsub('-','_')}_spec" do + task :"#{test_gem.gsub("-","_")}_spec" do bundle_exec_with_chef(test_gem, commands) end end |