From f5498fe23f5b915ff5bb2707784191d9ab626a11 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Mon, 3 Nov 2014 16:08:48 -0800 Subject: Updating from comments - simplifying code --- spec/support/pedant/Gemfile | 2 +- spec/support/pedant/run_pedant.rb | 20 +++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/spec/support/pedant/Gemfile b/spec/support/pedant/Gemfile index fee339f49c..d4224cd439 100644 --- a/spec/support/pedant/Gemfile +++ b/spec/support/pedant/Gemfile @@ -1,3 +1,3 @@ source "https://rubygems.org" -gem 'chef-pedant', :github => 'opscode/chef-pedant', :branch => "rspec-3-update" +gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => "server-cli-option" diff --git a/spec/support/pedant/run_pedant.rb b/spec/support/pedant/run_pedant.rb index d52be36ba7..aac2c2df1a 100644 --- a/spec/support/pedant/run_pedant.rb +++ b/spec/support/pedant/run_pedant.rb @@ -38,35 +38,25 @@ begin # Capture setup data into master_chef_repo_path server = start_server(chef_repo_path) - - # We can no longer specify the server on the command line, must put it into the config - open('spec/support/pedant/pedant_config.rb', 'a+') { |f| - f.puts "chef_server '#{server.url}'" unless f.grep(/^chef_server/) - } + so = nil include Chef::Mixin::ShellOut - so = nil - Bundler.with_clean_env do - cmd = Mixlib::ShellOut.new("bundle install --gemfile spec/support/pedant/Gemfile") - cmd.live_stream = STDOUT - cmd.run_command + shell_out("bundle install --gemfile spec/support/pedant/Gemfile", :live_stream => STDOUT) pedant_cmd = "chef-pedant " + " --config spec/support/pedant/pedant_config.rb" + - #" --server #{server.url}" + + " --server '#{server.url}'" + " --skip-knife --skip-validation --skip-authentication" + " --skip-authorization --skip-omnibus" - cmd = Mixlib::ShellOut.new("bundle exec #{pedant_cmd}", :env => {'BUNDLE_GEMFILE' => 'spec/support/pedant/Gemfile'}) - cmd.live_stream = STDOUT - cmd.run_command + so = shell_out("bundle exec #{pedant_cmd}", :live_stream => STDOUT, :env => {'BUNDLE_GEMFILE' => 'spec/support/pedant/Gemfile'}) - server.stop if server.running? end ensure + server.stop if server && server.running? FileUtils.remove_entry_secure(tmpdir) if tmpdir end -- cgit v1.2.1