diff --git a/Rakefile b/Rakefile index fd34a1f91..b6f6d68a1 100644 --- a/Rakefile +++ b/Rakefile @@ -1,16 +1,16 @@ -require 'bundler/gem_tasks' +require "bundler/gem_tasks" -require 'rake/testtask' +require "rake/testtask" Rake::TestTask.new(:unit) do |t| t.libs.push "lib" - t.test_files = FileList['spec/**/*_spec.rb'] + t.test_files = FileList["spec/**/*_spec.rb"] t.verbose = true end -require 'cucumber' -require 'cucumber/rake/task' +require "cucumber" +require "cucumber/rake/task" Cucumber::Rake::Task.new(:features) do |t| - t.cucumber_opts = ['features', '-x', '--format progress'] + t.cucumber_opts = ["features", "-x", "--format progress"] end desc "Run all test suites" @@ -24,11 +24,11 @@ task :stats do sh "countloc -r spec features" end -if RUBY_ENGINE != 'jruby' - require 'cane/rake_task' +if RUBY_ENGINE != "jruby" + require "cane/rake_task" desc "Run cane to check quality metrics" Cane::RakeTask.new do |cane| - cane.canefile = './.cane' + cane.canefile = "./.cane" end desc "Run all quality tasks" @@ -38,7 +38,7 @@ else task :quality => [:stats] end -require 'yard' +require "yard" YARD::Rake::YardocTask.new task :default => [:test, :quality] diff --git a/bin/kitchen b/bin/kitchen index eff46b795..374fad31b 100755 --- a/bin/kitchen +++ b/bin/kitchen @@ -6,8 +6,8 @@ Signal.trap("INT") { exit 1 } $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib]) -require 'rubygems' -require 'kitchen/cli' -require 'kitchen/errors' +require "rubygems" +require "kitchen/cli" +require "kitchen/errors" Kitchen.with_friendly_errors { Kitchen::CLI.start } diff --git a/features/kitchen_init_command.feature b/features/kitchen_init_command.feature index 748aa9bdd..5d916fa6d 100644 --- a/features/kitchen_init_command.feature +++ b/features/kitchen_init_command.feature @@ -36,8 +36,14 @@ Feature: Add Test Kitchen support to an existing project Scenario: Running init that creates a Gemfile When I successfully run `kitchen init --create-gemfile` Then the file "Gemfile" should contain "https://rubygems.org" - And the file "Gemfile" should contain "gem 'test-kitchen'" - And the file "Gemfile" should contain "gem 'kitchen-vagrant'" + And the file "Gemfile" should contain: + """ + gem "test-kitchen" + """ + And the file "Gemfile" should contain: + """ + gem "kitchen-vagrant" + """ And the output should contain "You must run `bundle install'" Scenario: Running init with an existing Gemfile appends to the Gemfile @@ -52,8 +58,8 @@ Feature: Add Test Kitchen support to an existing project """ source "https://rubygems.org" - gem 'test-kitchen' - gem 'kitchen-vagrant' + gem "test-kitchen" + gem "kitchen-vagrant" """ And the output should contain "You must run `bundle install'" @@ -64,7 +70,7 @@ Feature: Add Test Kitchen support to an existing project """ source "https://rubygems.org" - gem "test-kitchen" + gem 'test-kitchen' """ When I successfully run `kitchen init` @@ -72,8 +78,8 @@ Feature: Add Test Kitchen support to an existing project """ source "https://rubygems.org" - gem "test-kitchen" - gem 'kitchen-vagrant' + gem 'test-kitchen' + gem "kitchen-vagrant" """ And the output should contain "You must run `bundle install'" @@ -84,8 +90,8 @@ Feature: Add Test Kitchen support to an existing project """ source "https://rubygems.org" - gem "test-kitchen" - gem "kitchen-ec2" + gem 'test-kitchen' + gem 'kitchen-ec2' """ When I successfully run `kitchen init --driver=kitchen-ec2` @@ -93,8 +99,8 @@ Feature: Add Test Kitchen support to an existing project """ source "https://rubygems.org" - gem "test-kitchen" - gem "kitchen-ec2" + gem 'test-kitchen' + gem 'kitchen-ec2' """ And the output should not contain "You must run `bundle install'" @@ -102,8 +108,14 @@ Feature: Add Test Kitchen support to an existing project Scenario: Running init with multiple drivers appends to the Gemfile Given an empty file named "Gemfile" When I successfully run `kitchen init --driver=kitchen-bluebox kitchen-wakka` - Then the file "Gemfile" should contain "gem 'kitchen-bluebox'" - And the file "Gemfile" should contain "gem 'kitchen-wakka'" + Then the file "Gemfile" should contain: + """ + gem "kitchen-bluebox" + """ + And the file "Gemfile" should contain: + """ + gem "kitchen-wakka" + """ And the output should contain "You must run `bundle install'" Scenario: Running init with multiple driver sets the plugin_driver to the @@ -152,10 +164,10 @@ Feature: Add Test Kitchen support to an existing project Then the file "Rakefile" should contain: """ begin - require 'kitchen/rake_tasks' + require "kitchen/rake_tasks" Kitchen::RakeTasks.new rescue LoadError - puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI'] + puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"] end """ @@ -171,10 +183,10 @@ Feature: Add Test Kitchen support to an existing project Then the file "Thorfile" should contain: """ begin - require 'kitchen/thor_tasks' + require "kitchen/thor_tasks" Kitchen::ThorTasks.new rescue LoadError - puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI'] + puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"] end """ diff --git a/features/step_definitions/gem_steps.rb b/features/step_definitions/gem_steps.rb index 287e34848..6852b41d9 100644 --- a/features/step_definitions/gem_steps.rb +++ b/features/step_definitions/gem_steps.rb @@ -1,15 +1,15 @@ -require 'tmpdir' -require 'pathname' +require "tmpdir" +require "pathname" Given(/^a sandboxed GEM_HOME directory named "(.*?)"$/) do |name| - backup_envvar('GEM_HOME') - backup_envvar('GEM_PATH') + backup_envvar("GEM_HOME") + backup_envvar("GEM_PATH") @aruba_timeout_seconds = 30 gem_home = Pathname.new(Dir.mktmpdir(name)) - ENV['GEM_HOME'] = gem_home.to_s - ENV['GEM_PATH'] = [gem_home.to_s, ENV['GEM_PATH']].join(':') + ENV["GEM_HOME"] = gem_home.to_s + ENV["GEM_PATH"] = [gem_home.to_s, ENV["GEM_PATH"]].join(":") @cleanup_dirs << gem_home end diff --git a/features/step_definitions/git_steps.rb b/features/step_definitions/git_steps.rb index 65194a571..2089ce4b4 100644 --- a/features/step_definitions/git_steps.rb +++ b/features/step_definitions/git_steps.rb @@ -1,3 +1,3 @@ Given(/I have a git repository/) do - create_dir('.git') + create_dir(".git") end diff --git a/features/support/env.rb b/features/support/env.rb index 8d5eee527..0f2860018 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,9 +1,9 @@ # Set up the environment for testing -require 'aruba/cucumber' -require 'aruba/in_process' -require 'aruba/spawn_process' -require 'kitchen' -require 'kitchen/cli' +require "aruba/cucumber" +require "aruba/in_process" +require "aruba/spawn_process" +require "kitchen" +require "kitchen/cli" class ArubaHelper def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) @@ -28,7 +28,7 @@ def execute! Aruba.process = Aruba::InProcess end -Before('@spawn') do +Before("@spawn") do Aruba.process = Aruba::SpawnProcess end @@ -41,7 +41,7 @@ def execute! # Restore environment variables to their original settings, if they have # been saved off ENV.keys.select { |key| key =~ /^_CUKE_/ }.each do |backup_key| - ENV[backup_key.sub(/^_CUKE_/, '')] = ENV.delete(backup_key) + ENV[backup_key.sub(/^_CUKE_/, "")] = ENV.delete(backup_key) end @cleanup_dirs.each { |dir| FileUtils.rm_rf(dir) } diff --git a/lib/kitchen.rb b/lib/kitchen.rb index c4b4d0049..fb1928f4c 100644 --- a/lib/kitchen.rb +++ b/lib/kitchen.rb @@ -16,35 +16,35 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'pathname' -require 'thread' - -require 'kitchen/errors' -require 'kitchen/logger' -require 'kitchen/logging' -require 'kitchen/shell_out' -require 'kitchen/configurable' -require 'kitchen/util' - -require 'kitchen/provisioner' -require 'kitchen/provisioner/base' -require 'kitchen/busser' -require 'kitchen/color' -require 'kitchen/collection' -require 'kitchen/config' -require 'kitchen/data_munger' -require 'kitchen/driver' -require 'kitchen/driver/base' -require 'kitchen/driver/ssh_base' -require 'kitchen/driver/proxy' -require 'kitchen/instance' -require 'kitchen/loader/yaml' -require 'kitchen/metadata_chopper' -require 'kitchen/platform' -require 'kitchen/state_file' -require 'kitchen/ssh' -require 'kitchen/suite' -require 'kitchen/version' +require "pathname" +require "thread" + +require "kitchen/errors" +require "kitchen/logger" +require "kitchen/logging" +require "kitchen/shell_out" +require "kitchen/configurable" +require "kitchen/util" + +require "kitchen/provisioner" +require "kitchen/provisioner/base" +require "kitchen/busser" +require "kitchen/color" +require "kitchen/collection" +require "kitchen/config" +require "kitchen/data_munger" +require "kitchen/driver" +require "kitchen/driver/base" +require "kitchen/driver/ssh_base" +require "kitchen/driver/proxy" +require "kitchen/instance" +require "kitchen/loader/yaml" +require "kitchen/metadata_chopper" +require "kitchen/platform" +require "kitchen/state_file" +require "kitchen/ssh" +require "kitchen/suite" +require "kitchen/version" # Test Kitchen base module. # @@ -63,7 +63,7 @@ class << self # # @return [Pathname] root path of gem def source_root - @source_root ||= Pathname.new(File.expand_path('../../', __FILE__)) + @source_root ||= Pathname.new(File.expand_path("../../", __FILE__)) end # Returns a default logger which emits on standard output. @@ -90,7 +90,7 @@ def default_file_logger # @return [Integer,nil] a log level or nil if not set # @api private def env_log - level = ENV['KITCHEN_LOG'] && ENV['KITCHEN_LOG'].downcase.to_sym + level = ENV["KITCHEN_LOG"] && ENV["KITCHEN_LOG"].downcase.to_sym level = Util.to_logger_level(level) unless level.nil? level end diff --git a/lib/kitchen/busser.rb b/lib/kitchen/busser.rb index e6ece1768..d9482549d 100644 --- a/lib/kitchen/busser.rb +++ b/lib/kitchen/busser.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'base64' -require 'digest' +require "base64" +require "digest" module Kitchen @@ -101,7 +101,7 @@ def setup_cmd gem = sudo("#{config[:ruby_bindir]}/gem") busser = sudo(config[:busser_bin]) - cmd = <<-CMD.gsub(/^ {8}/, '') + cmd = <<-CMD.gsub(/^ {8}/, "") #{busser_setup_env} gem_bindir=`#{ruby} -rrubygems -e "puts Gem.bindir"` @@ -109,7 +109,7 @@ def setup_cmd #{gem} install #{gem_install_args} fi #{sudo("${gem_bindir}")}/busser setup - #{busser} plugin install #{plugins.join(' ')} + #{busser} plugin install #{plugins.join(" ")} CMD Util.wrap_command(cmd) end @@ -125,7 +125,7 @@ def setup_cmd def sync_cmd return if local_suite_files.empty? - cmd = <<-CMD.gsub(/^ {8}/, '') + cmd = <<-CMD.gsub(/^ {8}/, "") #{busser_setup_env} #{sudo(config[:busser_bin])} suite cleanup @@ -151,7 +151,7 @@ def sync_cmd def run_cmd return if local_suite_files.empty? - cmd = <<-CMD.gsub(/^ {8}/, '') + cmd = <<-CMD.gsub(/^ {8}/, "") #{busser_setup_env} #{sudo(config[:busser_bin])} test @@ -181,7 +181,7 @@ def validate_options(suite_name) raise ClientError, "Busser#new requires a suite_name" end - if suite_name == 'helper' + if suite_name == "helper" raise UserError, "Suite name invalid: 'helper' is a reserved directory name." end @@ -245,7 +245,7 @@ def helper_files def remote_file(file, dir) local_prefix = File.join(config[:test_base_path], dir) "`#{sudo(config[:busser_bin])} suite path`/". - concat(file.sub(%r{^#{local_prefix}/}, '')) + concat(file.sub(%r{^#{local_prefix}/}, "")) end # Returns a command string that will, once evaluated, result in the copying @@ -257,7 +257,7 @@ def remote_file(file, dir) # @api private def stream_file(local_path, remote_path) local_file = IO.read(local_path) - encoded_file = Base64.encode64(local_file).gsub("\n", '') + encoded_file = Base64.encode64(local_file).gsub("\n", "") md5 = Digest::MD5.hexdigest(local_file) perms = format("%o", File.stat(local_path).mode)[2, 4] stream_cmd = [ diff --git a/lib/kitchen/cli.rb b/lib/kitchen/cli.rb index 9ced1b960..485019e2e 100644 --- a/lib/kitchen/cli.rb +++ b/lib/kitchen/cli.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor' +require "thor" -require 'kitchen' -require 'kitchen/generator/driver_create' -require 'kitchen/generator/init' +require "kitchen" +require "kitchen/generator/driver_create" +require "kitchen/generator/init" module Kitchen @@ -70,13 +70,13 @@ def initialize(*args) $stdout.sync = true Kitchen.logger = Kitchen.default_file_logger @loader = Kitchen::Loader::YAML.new( - :project_config => ENV['KITCHEN_YAML'], - :local_config => ENV['KITCHEN_LOCAL_YAML'], - :global_config => ENV['KITCHEN_GLOBAL_YAML'] + :project_config => ENV["KITCHEN_YAML"], + :local_config => ENV["KITCHEN_LOCAL_YAML"], + :global_config => ENV["KITCHEN_GLOBAL_YAML"] ) @config = Kitchen::Config.new( :loader => @loader, - :log_level => ENV.fetch('KITCHEN_LOG', "info").downcase.to_sym + :log_level => ENV.fetch("KITCHEN_LOG", "info").downcase.to_sym ) end @@ -125,14 +125,14 @@ def diagnose(*args) :aliases => "-c", :type => :numeric, :lazy_default => MAX_CONCURRENCY, - :desc => <<-DESC.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-DESC.gsub(/^\s+/, "").gsub(/\n/, " ") Run a #{action} against all matching instances concurrently. Only N instances will run at the same time if a number is given. DESC method_option :parallel, :aliases => "-p", :type => :boolean, - :desc => <<-DESC.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-DESC.gsub(/^\s+/, "").gsub(/\n/, " ") [Future DEPRECATION, use --concurrency] Run a #{action} against all matching instances concurrently. DESC @@ -160,14 +160,14 @@ def diagnose(*args) :aliases => "-c", :type => :numeric, :lazy_default => MAX_CONCURRENCY, - :desc => <<-DESC.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-DESC.gsub(/^\s+/, "").gsub(/\n/, " ") Run a test against all matching instances concurrently. Only N instances will run at the same time if a number is given. DESC method_option :parallel, :aliases => "-p", :type => :boolean, - :desc => <<-DESC.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-DESC.gsub(/^\s+/, "").gsub(/\n/, " ") [Future DEPRECATION, use --concurrency] Run a test against all matching instances concurrently. DESC @@ -314,7 +314,7 @@ def update_config! # # @api private def ensure_initialized - yaml = ENV['KITCHEN_YAML'] || '.kitchen.yml' + yaml = ENV["KITCHEN_YAML"] || ".kitchen.yml" if options[:auto_init] && !File.exist?(yaml) banner "Invoking init as '#{yaml}' file is missing" diff --git a/lib/kitchen/collection.rb b/lib/kitchen/collection.rb index 5d78ca667..3b1d88a79 100644 --- a/lib/kitchen/collection.rb +++ b/lib/kitchen/collection.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'delegate' +require "delegate" module Kitchen diff --git a/lib/kitchen/command.rb b/lib/kitchen/command.rb index 4d588ccc7..bebe74d11 100644 --- a/lib/kitchen/command.rb +++ b/lib/kitchen/command.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thread' +require "thread" module Kitchen diff --git a/lib/kitchen/command/action.rb b/lib/kitchen/command/action.rb index 6ab9dee77..296c796c0 100644 --- a/lib/kitchen/command/action.rb +++ b/lib/kitchen/command/action.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" -require 'benchmark' +require "benchmark" module Kitchen diff --git a/lib/kitchen/command/console.rb b/lib/kitchen/command/console.rb index 968d765be..328aee82d 100644 --- a/lib/kitchen/command/console.rb +++ b/lib/kitchen/command/console.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" module Kitchen @@ -29,7 +29,7 @@ class Console < Kitchen::Command::Base # Invoke the command. def call - require 'pry' + require "pry" Pry.start(@config, :prompt => [prompt(">"), prompt("*")]) rescue LoadError warn %{Make sure you have the pry gem installed. You can install it with:} diff --git a/lib/kitchen/command/diagnose.rb b/lib/kitchen/command/diagnose.rb index ef6091663..6536dd11a 100644 --- a/lib/kitchen/command/diagnose.rb +++ b/lib/kitchen/command/diagnose.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' -require 'kitchen/diagnostic' +require "kitchen/command" +require "kitchen/diagnostic" -require 'yaml' +require "yaml" module Kitchen diff --git a/lib/kitchen/command/driver_discover.rb b/lib/kitchen/command/driver_discover.rb index bef9668b3..a69355b07 100644 --- a/lib/kitchen/command/driver_discover.rb +++ b/lib/kitchen/command/driver_discover.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" -require 'rubygems/spec_fetcher' +require "rubygems/spec_fetcher" module Kitchen diff --git a/lib/kitchen/command/list.rb b/lib/kitchen/command/list.rb index bbef695bc..6fa059732 100644 --- a/lib/kitchen/command/list.rb +++ b/lib/kitchen/command/list.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" module Kitchen @@ -73,10 +73,10 @@ def display_instance(instance) # @api private def format_last_action(last_action) case last_action - when 'create' then colorize("Created", :cyan) - when 'converge' then colorize("Converged", :magenta) - when 'setup' then colorize("Set Up", :blue) - when 'verify' then colorize("Verified", :yellow) + when "create" then colorize("Created", :cyan) + when "converge" then colorize("Converged", :magenta) + when "setup" then colorize("Set Up", :blue) + when "verify" then colorize("Verified", :yellow) when nil then colorize("", :red) else colorize("", :white) end diff --git a/lib/kitchen/command/login.rb b/lib/kitchen/command/login.rb index b66592915..858291aba 100644 --- a/lib/kitchen/command/login.rb +++ b/lib/kitchen/command/login.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" module Kitchen diff --git a/lib/kitchen/command/sink.rb b/lib/kitchen/command/sink.rb index 6cabce547..237b37bde 100644 --- a/lib/kitchen/command/sink.rb +++ b/lib/kitchen/command/sink.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" module Kitchen diff --git a/lib/kitchen/command/test.rb b/lib/kitchen/command/test.rb index a44670dc8..316f9949f 100644 --- a/lib/kitchen/command/test.rb +++ b/lib/kitchen/command/test.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/command' +require "kitchen/command" -require 'benchmark' +require "benchmark" module Kitchen @@ -40,7 +40,7 @@ def call banner "Starting Kitchen (v#{Kitchen::VERSION})" elapsed = Benchmark.measure do destroy_mode = options[:destroy].to_sym - results = parse_subcommand(args.join('|')) + results = parse_subcommand(args.join("|")) run_action(:test, results, destroy_mode) end diff --git a/lib/kitchen/configurable.rb b/lib/kitchen/configurable.rb index c5f19afc9..2ff8105df 100644 --- a/lib/kitchen/configurable.rb +++ b/lib/kitchen/configurable.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor/util' +require "thor/util" -require 'kitchen/lazy_hash' +require "kitchen/lazy_hash" module Kitchen diff --git a/lib/kitchen/data_munger.rb b/lib/kitchen/data_munger.rb index dd6c2f95c..392a464d3 100644 --- a/lib/kitchen/data_munger.rb +++ b/lib/kitchen/data_munger.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'vendor/hash_recursive_merge' +require "vendor/hash_recursive_merge" module Kitchen diff --git a/lib/kitchen/diagnostic.rb b/lib/kitchen/diagnostic.rb index 9e6872e87..1fa241e18 100644 --- a/lib/kitchen/diagnostic.rb +++ b/lib/kitchen/diagnostic.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/util' -require 'kitchen/version' +require "kitchen/util" +require "kitchen/version" module Kitchen diff --git a/lib/kitchen/driver.rb b/lib/kitchen/driver.rb index e1a98600e..0719ac7cb 100644 --- a/lib/kitchen/driver.rb +++ b/lib/kitchen/driver.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor/util' +require "thor/util" module Kitchen diff --git a/lib/kitchen/driver/base.rb b/lib/kitchen/driver/base.rb index eabcf89c7..04cfe9c61 100644 --- a/lib/kitchen/driver/base.rb +++ b/lib/kitchen/driver/base.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor/util' +require "thor/util" -require 'kitchen/lazy_hash' +require "kitchen/lazy_hash" module Kitchen @@ -45,7 +45,7 @@ def initialize(config = {}) # # @return [String] name of this driver def name - self.class.name.split('::').last + self.class.name.split("::").last end # Creates an instance. diff --git a/lib/kitchen/driver/dummy.rb b/lib/kitchen/driver/dummy.rb index 7ec7c005c..addaad98f 100644 --- a/lib/kitchen/driver/dummy.rb +++ b/lib/kitchen/driver/dummy.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen' +require "kitchen" module Kitchen diff --git a/lib/kitchen/driver/proxy.rb b/lib/kitchen/driver/proxy.rb index d7683cbf2..7414ddfab 100644 --- a/lib/kitchen/driver/proxy.rb +++ b/lib/kitchen/driver/proxy.rb @@ -18,7 +18,7 @@ # limitations under the License. # -require 'kitchen' +require "kitchen" module Kitchen diff --git a/lib/kitchen/generator/driver_create.rb b/lib/kitchen/generator/driver_create.rb index d239b97bc..6e2a3f810 100644 --- a/lib/kitchen/generator/driver_create.rb +++ b/lib/kitchen/generator/driver_create.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor/group' -require 'thor/util' +require "thor/group" +require "thor/util" module Kitchen @@ -170,7 +170,7 @@ def license_filename # @api private def license_comment @license_comment ||= IO.read(File.join(target_dir, license_filename)). - gsub(/^/, '# ').gsub(/\s+$/, '') + gsub(/^/, "# ").gsub(/\s+$/, "") end end end diff --git a/lib/kitchen/generator/init.rb b/lib/kitchen/generator/init.rb index 77680b5d4..8562134ac 100644 --- a/lib/kitchen/generator/init.rb +++ b/lib/kitchen/generator/init.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor/group' +require "thor/group" module Kitchen @@ -34,7 +34,7 @@ class Init < Thor::Group :type => :array, :aliases => "-D", :default => "kitchen-vagrant", - :desc => <<-D.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-D.gsub(/^\s+/, "").gsub(/\n/, " ") One or more Kitchen Driver gems to be installed or added to a Gemfile D @@ -43,14 +43,14 @@ class Init < Thor::Group :type => :string, :aliases => "-P", :default => "chef_solo", - :desc => <<-D.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-D.gsub(/^\s+/, "").gsub(/\n/, " ") The default Kitchen Provisioner to use D class_option :create_gemfile, :type => :boolean, :default => false, - :desc => <<-D.gsub(/^\s+/, '').gsub(/\n/, ' ') + :desc => <<-D.gsub(/^\s+/, "").gsub(/\n/, " ") Whether or not to create a Gemfile if one does not exist. Default: false D @@ -75,16 +75,16 @@ def init # # @api private def create_kitchen_yaml - cookbook_name = if File.exist?(File.expand_path('metadata.rb')) - MetadataChopper.extract('metadata.rb').first + cookbook_name = if File.exist?(File.expand_path("metadata.rb")) + MetadataChopper.extract("metadata.rb").first else nil end run_list = cookbook_name ? "recipe[#{cookbook_name}::default]" : nil - driver_plugin = Array(options[:driver]).first || 'dummy' + driver_plugin = Array(options[:driver]).first || "dummy" template("kitchen.yml.erb", ".kitchen.yml", - :driver_plugin => driver_plugin.sub(/^kitchen-/, ''), + :driver_plugin => driver_plugin.sub(/^kitchen-/, ""), :provisioner => options[:provisioner], :run_list => Array(run_list) ) @@ -122,7 +122,7 @@ def init_test_dir? # initialized # @api private def init_git? - File.directory?(File.join(destination_root, '.git')) + File.directory?(File.join(destination_root, ".git")) end # Prepares a Rakefile. @@ -131,13 +131,13 @@ def init_git? def prepare_rakefile return unless init_rakefile? - rakedoc = <<-RAKE.gsub(/^ {10}/, '') + rakedoc = <<-RAKE.gsub(/^ {10}/, "") begin - require 'kitchen/rake_tasks' + require "kitchen/rake_tasks" Kitchen::RakeTasks.new rescue LoadError - puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI'] + puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"] end RAKE append_to_file(File.join(destination_root, "Rakefile"), rakedoc) @@ -149,13 +149,13 @@ def prepare_rakefile def prepare_thorfile return unless init_thorfile? - thordoc = <<-THOR.gsub(/^ {10}/, '') + thordoc = <<-THOR.gsub(/^ {10}/, "") begin - require 'kitchen/thor_tasks' + require "kitchen/thor_tasks" Kitchen::ThorTasks.new rescue LoadError - puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI'] + puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"] end THOR append_to_file(File.join(destination_root, "Thorfile"), thordoc) @@ -204,7 +204,7 @@ def prepare_gemfile # @api private def create_gemfile_if_missing unless File.exist?(File.join(destination_root, "Gemfile")) - create_file("Gemfile", %{source 'https://rubygems.org'\n\n}) + create_file("Gemfile", %{source "https://rubygems.org"\n\n}) end end @@ -213,7 +213,7 @@ def create_gemfile_if_missing # @api private def add_gem_to_gemfile if not_in_file?("Gemfile", %r{gem ('|")test-kitchen('|")}) - append_to_file("Gemfile", %{gem 'test-kitchen'\n}) + append_to_file("Gemfile", %{gem "test-kitchen"\n}) @display_bundle_msg = true end end @@ -238,7 +238,7 @@ def add_drivers # @api private def add_driver_to_gemfile(driver_gem) if not_in_file?("Gemfile", %r{gem ('|")#{driver_gem}('|")}) - append_to_file("Gemfile", %{gem '#{driver_gem}'\n}) + append_to_file("Gemfile", %{gem "#{driver_gem}"\n}) @display_bundle_msg = true end end diff --git a/lib/kitchen/instance.rb b/lib/kitchen/instance.rb index 10e47a50f..dbdbe0f87 100644 --- a/lib/kitchen/instance.rb +++ b/lib/kitchen/instance.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'benchmark' -require 'fileutils' +require "benchmark" +require "fileutils" module Kitchen @@ -42,7 +42,7 @@ class << self # @param platform [Platform,#name] a Platform # @return [String] a normalized, consistent name for an instance def name_for(suite, platform) - "#{suite.name}-#{platform.name}".gsub(/_/, '-').gsub(/\./, '') + "#{suite.name}-#{platform.name}".gsub(/_/, "-").gsub(/\./, "") end end @@ -197,11 +197,11 @@ def test(destroy_mode = :passing) # @see Driver::Base#login_command def login login_command = driver.login_command(state_file.read) - command, *args = login_command.cmd_array + cmd, *args = login_command.cmd_array options = login_command.options - debug("Login command: #{command} #{args.join(' ')} (Options: #{options})") - Kernel.exec(command, *args, options) + debug(%{Login command: #{cmd} #{args.join(" ")} (Options: #{options})}) + Kernel.exec(cmd, *args, options) end # Returns a Hash of configuration and other useful diagnostic information. diff --git a/lib/kitchen/lazy_hash.rb b/lib/kitchen/lazy_hash.rb index 7059779c2..d4b5a2270 100644 --- a/lib/kitchen/lazy_hash.rb +++ b/lib/kitchen/lazy_hash.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'delegate' +require "delegate" module Kitchen diff --git a/lib/kitchen/loader/yaml.rb b/lib/kitchen/loader/yaml.rb index 52b9eeb05..e58726c62 100644 --- a/lib/kitchen/loader/yaml.rb +++ b/lib/kitchen/loader/yaml.rb @@ -16,15 +16,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'erb' -require 'vendor/hash_recursive_merge' +require "erb" +require "vendor/hash_recursive_merge" if RUBY_VERSION <= "1.9.3" # ensure that Psych and not Syck is used for Ruby 1.9.2 - require 'yaml' - YAML::ENGINE.yamler = 'psych' + require "yaml" + YAML::ENGINE.yamler = "psych" end -require 'safe_yaml/load' +require "safe_yaml/load" module Kitchen @@ -197,7 +197,7 @@ def read_file(file) # @return [String] an absolute path to a Kitchen config YAML file # @api private def default_config_file - File.join(Dir.pwd, '.kitchen.yml') + File.join(Dir.pwd, ".kitchen.yml") end # Determines the default absolute path to the Kitchen local YAML file, diff --git a/lib/kitchen/logger.rb b/lib/kitchen/logger.rb index 8958e8cdd..cbe977e77 100644 --- a/lib/kitchen/logger.rb +++ b/lib/kitchen/logger.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'fileutils' -require 'logger' +require "fileutils" +require "logger" module Kitchen @@ -319,9 +319,9 @@ def banner(msg = nil, &block) # @api private def format_line(line) case line - when %r{^-----> } then banner(line.gsub(%r{^[ >-]{6} }, '')) - when %r{^>>>>>> } then error(line.gsub(%r{^[ >-]{6} }, '')) - when %r{^ } then info(line.gsub(%r{^[ >-]{6} }, '')) + when %r{^-----> } then banner(line.gsub(%r{^[ >-]{6} }, "")) + when %r{^>>>>>> } then error(line.gsub(%r{^[ >-]{6} }, "")) + when %r{^ } then info(line.gsub(%r{^[ >-]{6} }, "")) else info(line) end end diff --git a/lib/kitchen/provisioner.rb b/lib/kitchen/provisioner.rb index 13cc96c14..236b5b344 100644 --- a/lib/kitchen/provisioner.rb +++ b/lib/kitchen/provisioner.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor/util' +require "thor/util" module Kitchen diff --git a/lib/kitchen/provisioner/base.rb b/lib/kitchen/provisioner/base.rb index d7efe3715..db4ff53b9 100644 --- a/lib/kitchen/provisioner/base.rb +++ b/lib/kitchen/provisioner/base.rb @@ -59,7 +59,7 @@ def finalize_config!(instance) # # @return [String] name of this driver def name - self.class.name.split('::').last + self.class.name.split("::").last end # Generates a command string which will install and configure the diff --git a/lib/kitchen/provisioner/chef/berkshelf.rb b/lib/kitchen/provisioner/chef/berkshelf.rb index fb5d0f016..dbc2b4e00 100644 --- a/lib/kitchen/provisioner/chef/berkshelf.rb +++ b/lib/kitchen/provisioner/chef/berkshelf.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/errors' -require 'kitchen/logging' +require "kitchen/errors" +require "kitchen/logging" module Kitchen @@ -92,7 +92,7 @@ def resolve # @raise [UserError] if the library couldn't be loaded # @api private def self.load_berkshelf!(logger) - first_load = require 'berkshelf' + first_load = require "berkshelf" version = ::Berkshelf::VERSION if first_load diff --git a/lib/kitchen/provisioner/chef/librarian.rb b/lib/kitchen/provisioner/chef/librarian.rb index cef9c1d7b..ae2b3a45d 100644 --- a/lib/kitchen/provisioner/chef/librarian.rb +++ b/lib/kitchen/provisioner/chef/librarian.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/errors' -require 'kitchen/logging' +require "kitchen/errors" +require "kitchen/logging" module Kitchen @@ -88,9 +88,9 @@ def resolve # @raise [UserError] if the library couldn't be loaded # @api private def self.load_librarian!(logger) - first_load = require 'librarian/chef/environment' - require 'librarian/action/resolve' - require 'librarian/action/install' + first_load = require "librarian/chef/environment" + require "librarian/action/resolve" + require "librarian/action/install" version = ::Librarian::Chef::VERSION if first_load diff --git a/lib/kitchen/provisioner/chef_base.rb b/lib/kitchen/provisioner/chef_base.rb index 3ce3739bb..33bff68dc 100644 --- a/lib/kitchen/provisioner/chef_base.rb +++ b/lib/kitchen/provisioner/chef_base.rb @@ -16,13 +16,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'fileutils' -require 'pathname' -require 'json' +require "fileutils" +require "pathname" +require "json" -require 'kitchen/provisioner/chef/berkshelf' -require 'kitchen/provisioner/chef/librarian' -require 'kitchen/util' +require "kitchen/provisioner/chef/berkshelf" +require "kitchen/provisioner/chef/librarian" +require "kitchen/util" module Kitchen @@ -91,7 +91,7 @@ def install_command def init_command dirs = %w[cookbooks data data_bags environments roles clients]. map { |dir| File.join(config[:root_path], dir) }.join(" ") - lines = ["#{sudo('rm')} -rf #{dirs}", "mkdir -p #{config[:root_path]}"] + lines = ["#{sudo("rm")} -rf #{dirs}", "mkdir -p #{config[:root_path]}"] Util.wrap_command(lines.join("\n")) end @@ -155,11 +155,11 @@ def chef_install_function end install_flags = %w[latest true].include?(version) ? "" : "-v #{version}" - <<-INSTALL.gsub(/^ {10}/, '') + <<-INSTALL.gsub(/^ {10}/, "") if should_update_chef "/opt/chef" "#{version}" ; then echo "-----> Installing Chef Omnibus (#{pretty_version})" do_download #{config[:chef_omnibus_url]} /tmp/install.sh - #{sudo('sh')} /tmp/install.sh #{install_flags} + #{sudo("sh")} /tmp/install.sh #{install_flags} else echo "-----> Chef Omnibus installation detected (#{pretty_version})" fi diff --git a/lib/kitchen/provisioner/chef_solo.rb b/lib/kitchen/provisioner/chef_solo.rb index c6795bfd9..01f72a1ad 100644 --- a/lib/kitchen/provisioner/chef_solo.rb +++ b/lib/kitchen/provisioner/chef_solo.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/provisioner/chef_base' +require "kitchen/provisioner/chef_base" module Kitchen diff --git a/lib/kitchen/provisioner/chef_zero.rb b/lib/kitchen/provisioner/chef_zero.rb index 3fead0183..a6564d721 100644 --- a/lib/kitchen/provisioner/chef_zero.rb +++ b/lib/kitchen/provisioner/chef_zero.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/provisioner/chef_base' +require "kitchen/provisioner/chef_base" module Kitchen @@ -47,7 +47,7 @@ def prepare_command # we are installing latest chef in order to get chef-zero and # Chef::ChefFS only. The version of Chef that gets run will be # the installed omnibus package. Yep, this is funky :) - cmd = <<-PREPARE.gsub(/^ {10}/, '') + cmd = <<-PREPARE.gsub(/^ {10}/, "") #{chef_client_zero_env(:export)} if ! #{sudo("#{ruby_bin}/gem")} list chef-zero -i >/dev/null; then echo ">>>>>> Attempting to use chef-zero with old version of Chef" diff --git a/lib/kitchen/provisioner/dummy.rb b/lib/kitchen/provisioner/dummy.rb index c15550f74..7ae9f2b8e 100644 --- a/lib/kitchen/provisioner/dummy.rb +++ b/lib/kitchen/provisioner/dummy.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen' +require "kitchen" module Kitchen diff --git a/lib/kitchen/provisioner/shell.rb b/lib/kitchen/provisioner/shell.rb index 941b0a431..b331a7c59 100644 --- a/lib/kitchen/provisioner/shell.rb +++ b/lib/kitchen/provisioner/shell.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'kitchen/provisioner/base' +require "kitchen/provisioner/base" module Kitchen @@ -47,7 +47,7 @@ def create_sandbox # (see Base#init_command) def init_command data = File.join(config[:root_path], "data") - cmd = "#{sudo('rm')} -rf #{data} ; mkdir -p #{config[:root_path]}" + cmd = "#{sudo("rm")} -rf #{data} ; mkdir -p #{config[:root_path]}" Util.wrap_command(cmd) end diff --git a/lib/kitchen/rake_tasks.rb b/lib/kitchen/rake_tasks.rb index 5ac2091d3..105063aa0 100644 --- a/lib/kitchen/rake_tasks.rb +++ b/lib/kitchen/rake_tasks.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'rake/tasklib' +require "rake/tasklib" -require 'kitchen' +require "kitchen" module Kitchen diff --git a/lib/kitchen/shell_out.rb b/lib/kitchen/shell_out.rb index 0582eaba1..d362060da 100644 --- a/lib/kitchen/shell_out.rb +++ b/lib/kitchen/shell_out.rb @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'mixlib/shellout' +require "mixlib/shellout" module Kitchen diff --git a/lib/kitchen/ssh.rb b/lib/kitchen/ssh.rb index 2d8a32662..3fba32d53 100644 --- a/lib/kitchen/ssh.rb +++ b/lib/kitchen/ssh.rb @@ -16,13 +16,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'logger' -require 'net/ssh' -require 'net/scp' -require 'socket' +require "logger" +require "net/ssh" +require "net/scp" +require "socket" -require 'kitchen/errors' -require 'kitchen/login_command' +require "kitchen/errors" +require "kitchen/login_command" module Kitchen diff --git a/lib/kitchen/state_file.rb b/lib/kitchen/state_file.rb index 4c003c8b2..776fce31e 100644 --- a/lib/kitchen/state_file.rb +++ b/lib/kitchen/state_file.rb @@ -18,10 +18,10 @@ if RUBY_VERSION <= "1.9.3" # ensure that Psych and not Syck is used for Ruby 1.9.2 - require 'yaml' - YAML::ENGINE.yamler = 'psych' + require "yaml" + YAML::ENGINE.yamler = "psych" end -require 'safe_yaml/load' +require "safe_yaml/load" module Kitchen diff --git a/lib/kitchen/thor_tasks.rb b/lib/kitchen/thor_tasks.rb index 3987e7c5c..027404ddc 100644 --- a/lib/kitchen/thor_tasks.rb +++ b/lib/kitchen/thor_tasks.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'thor' +require "thor" -require 'kitchen' +require "kitchen" module Kitchen @@ -52,14 +52,14 @@ def initialize(*args) def define config.instances.each do |instance| self.class.desc instance.name, "Run #{instance.name} test instance" - self.class.send(:define_method, instance.name.gsub(/-/, '_')) do + self.class.send(:define_method, instance.name.gsub(/-/, "_")) do instance.test(:always) end end self.class.desc "all", "Run all test instances" self.class.send(:define_method, :all) do - config.instances.each { |i| invoke i.name.gsub(/-/, '_') } + config.instances.each { |i| invoke i.name.gsub(/-/, "_") } end end end diff --git a/lib/kitchen/util.rb b/lib/kitchen/util.rb index 054cc83d7..19dada2f9 100644 --- a/lib/kitchen/util.rb +++ b/lib/kitchen/util.rb @@ -110,7 +110,7 @@ def self.duration(total) def self.wrap_command(cmd) cmd = "false" if cmd.nil? cmd = "true" if cmd.to_s.empty? - cmd = cmd.sub(/\n\Z/, '') if cmd =~ /\n\Z/ + cmd = cmd.sub(/\n\Z/, "") if cmd =~ /\n\Z/ "sh -c '\n#{cmd}\n'" end @@ -130,7 +130,7 @@ def self.wrap_command(cmd) # @param string [String] the string that will be modified # @return [String] the modified string def self.outdent!(string) - string.gsub!(/^ {#{string.index(/[^ ]/)}}/, '') + string.gsub!(/^ {#{string.index(/[^ ]/)}}/, "") end # Returns a set of Bourne Shell (AKA /bin/sh) compatible helper diff --git a/spec/kitchen/collection_spec.rb b/spec/kitchen/collection_spec.rb index f1997d7bb..73da47d5b 100644 --- a/spec/kitchen/collection_spec.rb +++ b/spec/kitchen/collection_spec.rb @@ -16,16 +16,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' -require 'ostruct' +require_relative "../spec_helper" +require "ostruct" -require 'kitchen/collection' +require "kitchen/collection" describe Kitchen::Collection do let(:collection) do Kitchen::Collection.new([ - obj('one'), obj('two', 'a'), obj('two', 'b'), obj('three') + obj("one"), obj("two", "a"), obj("two", "b"), obj("three") ]) end @@ -36,15 +36,15 @@ describe "#get" do it "returns a single object by its name" do - collection.get('three').must_equal obj('three') + collection.get("three").must_equal obj("three") end it "returns the first occurance of an object by its name" do - collection.get('two').must_equal obj('two', 'a') + collection.get("two").must_equal obj("two", "a") end it "returns nil if an object cannot be found by its name" do - collection.get('nope').must_be_nil + collection.get("nope").must_be_nil end end @@ -53,8 +53,8 @@ it "returns a Collection of objects whose name matches the regex" do result = collection.get_all(/(one|three)/) result.size.must_equal 2 - result[0].must_equal obj('one') - result[1].must_equal obj('three') + result[0].must_equal obj("one") + result[1].must_equal obj("three") result.get_all(/one/).size.must_equal 1 end diff --git a/spec/kitchen/color_spec.rb b/spec/kitchen/color_spec.rb index 79dc17f0e..51f28c499 100644 --- a/spec/kitchen/color_spec.rb +++ b/spec/kitchen/color_spec.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/color' +require "kitchen/color" describe Kitchen::Color do diff --git a/spec/kitchen/config_spec.rb b/spec/kitchen/config_spec.rb index ae5f4ccf5..8a3d640b1 100644 --- a/spec/kitchen/config_spec.rb +++ b/spec/kitchen/config_spec.rb @@ -16,18 +16,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' - -require 'kitchen' -require 'kitchen/logging' -require 'kitchen/collection' -require 'kitchen/config' -require 'kitchen/driver' -require 'kitchen/instance' -require 'kitchen/platform' -require 'kitchen/provisioner' -require 'kitchen/suite' -require 'kitchen/util' +require_relative "../spec_helper" + +require "kitchen" +require "kitchen/logging" +require "kitchen/collection" +require "kitchen/config" +require "kitchen/driver" +require "kitchen/instance" +require "kitchen/platform" +require "kitchen/provisioner" +require "kitchen/suite" +require "kitchen/util" module Kitchen diff --git a/spec/kitchen/configurable_spec.rb b/spec/kitchen/configurable_spec.rb index 25cc5d17b..7b95c15cc 100644 --- a/spec/kitchen/configurable_spec.rb +++ b/spec/kitchen/configurable_spec.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' -require 'stringio' +require_relative "../spec_helper" +require "stringio" -require 'kitchen/errors' -require 'kitchen/configurable' +require "kitchen/errors" +require "kitchen/configurable" module Kitchen @@ -40,7 +40,7 @@ class StaticDefaults include Kitchen::Configurable default_config :beans, "kidney" - default_config :tunables, 'flimflam' => 'positate' + default_config :tunables, "flimflam" => "positate" default_config :edible, true default_config :fetch_command, "curl" default_config :success_path, "./success" @@ -138,7 +138,7 @@ class SubclassDefaults < StaticDefaults it "uses defaults" do subject[:beans].must_equal "kidney" - subject[:tunables]['flimflam'].must_equal 'positate' + subject[:tunables]["flimflam"].must_equal "positate" subject[:edible].must_equal true end @@ -180,7 +180,7 @@ class SubclassDefaults < StaticDefaults it "contains defaults from superclass" do subject[:beans].must_equal "kidney" - subject[:tunables]['flimflam'].must_equal 'positate' + subject[:tunables]["flimflam"].must_equal "positate" subject[:edible].must_equal true subject[:yea].must_equal "ya" end diff --git a/spec/kitchen/data_munger_spec.rb b/spec/kitchen/data_munger_spec.rb index 53c605e22..85cc73a22 100644 --- a/spec/kitchen/data_munger_spec.rb +++ b/spec/kitchen/data_munger_spec.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/data_munger' +require "kitchen/data_munger" module Kitchen diff --git a/spec/kitchen/driver/base_spec.rb b/spec/kitchen/driver/base_spec.rb index 60b520f43..35a9da4e8 100644 --- a/spec/kitchen/driver/base_spec.rb +++ b/spec/kitchen/driver/base_spec.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' -require 'logger' -require 'stringio' +require_relative "../../spec_helper" +require "logger" +require "stringio" -require 'kitchen' +require "kitchen" module Kitchen diff --git a/spec/kitchen/driver/dummy_spec.rb b/spec/kitchen/driver/dummy_spec.rb index 9c4733af3..9ee9d2489 100644 --- a/spec/kitchen/driver/dummy_spec.rb +++ b/spec/kitchen/driver/dummy_spec.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' -require 'logger' -require 'stringio' +require_relative "../../spec_helper" +require "logger" +require "stringio" -require 'kitchen/driver/dummy' +require "kitchen/driver/dummy" describe Kitchen::Driver::Dummy do diff --git a/spec/kitchen/driver/proxy_spec.rb b/spec/kitchen/driver/proxy_spec.rb index d3569e9cd..5f00d520f 100644 --- a/spec/kitchen/driver/proxy_spec.rb +++ b/spec/kitchen/driver/proxy_spec.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' +require_relative "../../spec_helper" -require 'kitchen/driver/proxy' +require "kitchen/driver/proxy" describe Kitchen::Driver::Proxy do diff --git a/spec/kitchen/driver_spec.rb b/spec/kitchen/driver_spec.rb index 1ef9f1bdf..7b958d636 100644 --- a/spec/kitchen/driver_spec.rb +++ b/spec/kitchen/driver_spec.rb @@ -16,13 +16,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/errors' -require 'kitchen/logging' -require 'kitchen/shell_out' -require 'kitchen/driver' -require 'kitchen/driver/base' +require "kitchen/errors" +require "kitchen/logging" +require "kitchen/shell_out" +require "kitchen/driver" +require "kitchen/driver/base" module Kitchen @@ -63,28 +63,28 @@ def verify_dependencies end it "returns a driver object of the correct class" do - driver = Kitchen::Driver.for_plugin('coolbeans', {}) + driver = Kitchen::Driver.for_plugin("coolbeans", {}) driver.must_be_kind_of Kitchen::Driver::Coolbeans end it "returns a driver initialized with its config" do - driver = Kitchen::Driver.for_plugin('coolbeans', :jelly => 'beans') + driver = Kitchen::Driver.for_plugin("coolbeans", :jelly => "beans") - driver[:jelly].must_equal 'beans' + driver[:jelly].must_equal "beans" end it "calls #verify_dependencies on the driver object" do - driver = Kitchen::Driver.for_plugin('it_depends', {}) + driver = Kitchen::Driver.for_plugin("it_depends", {}) driver.verify_call_count.must_equal 1 end it "calls #verify_dependencies once per driver require" do Kitchen::Driver.stubs(:require).returns(true, false) - driver1 = Kitchen::Driver.for_plugin('it_depends', {}) + driver1 = Kitchen::Driver.for_plugin("it_depends", {}) driver1.verify_call_count.must_equal 1 - driver2 = Kitchen::Driver.for_plugin('it_depends', {}) + driver2 = Kitchen::Driver.for_plugin("it_depends", {}) driver2.verify_call_count.must_equal 0 end @@ -92,19 +92,19 @@ def verify_dependencies it "raises ClientError if the driver could not be required" do Kitchen::Driver.stubs(:require).raises(LoadError) - proc { Kitchen::Driver.for_plugin('coolbeans', {}) }. + proc { Kitchen::Driver.for_plugin("coolbeans", {}) }. must_raise Kitchen::ClientError end it "raises ClientError if the driver's class constant could not be found" do Kitchen::Driver.stubs(:require).returns(true) # pretend require worked - proc { Kitchen::Driver.for_plugin('nope', {}) }. + proc { Kitchen::Driver.for_plugin("nope", {}) }. must_raise Kitchen::ClientError end it "raises UserError if #verify_dependencies fails" do - proc { Kitchen::Driver.for_plugin('unstable_depends', {}) }. + proc { Kitchen::Driver.for_plugin("unstable_depends", {}) }. must_raise Kitchen::UserError end end diff --git a/spec/kitchen/errors_spec.rb b/spec/kitchen/errors_spec.rb index 7a777d75b..9b229933c 100644 --- a/spec/kitchen/errors_spec.rb +++ b/spec/kitchen/errors_spec.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen' -require 'kitchen/errors' +require "kitchen" +require "kitchen/errors" describe Kitchen::Error do diff --git a/spec/kitchen/instance_spec.rb b/spec/kitchen/instance_spec.rb index 32e959473..4e725d448 100644 --- a/spec/kitchen/instance_spec.rb +++ b/spec/kitchen/instance_spec.rb @@ -16,17 +16,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' -require 'stringio' - -require 'kitchen/logging' -require 'kitchen/instance' -require 'kitchen/driver' -require 'kitchen/driver/dummy' -require 'kitchen/platform' -require 'kitchen/provisioner' -require 'kitchen/provisioner/dummy' -require 'kitchen/suite' +require_relative "../spec_helper" +require "stringio" + +require "kitchen/logging" +require "kitchen/instance" +require "kitchen/driver" +require "kitchen/driver/dummy" +require "kitchen/platform" +require "kitchen/provisioner" +require "kitchen/provisioner/dummy" +require "kitchen/suite" class DummyStateFile diff --git a/spec/kitchen/lazy_hash_spec.rb b/spec/kitchen/lazy_hash_spec.rb index 7daae4970..c7de64a14 100644 --- a/spec/kitchen/lazy_hash_spec.rb +++ b/spec/kitchen/lazy_hash_spec.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/lazy_hash' +require "kitchen/lazy_hash" describe Kitchen::LazyHash do diff --git a/spec/kitchen/loader/yaml_spec.rb b/spec/kitchen/loader/yaml_spec.rb index 4142cb009..026a4071e 100644 --- a/spec/kitchen/loader/yaml_spec.rb +++ b/spec/kitchen/loader/yaml_spec.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' +require_relative "../../spec_helper" -require 'kitchen/errors' -require 'kitchen/util' -require 'kitchen/loader/yaml' +require "kitchen/errors" +require "kitchen/util" +require "kitchen/loader/yaml" class Yamled attr_accessor :foo @@ -45,60 +45,60 @@ class Yamled describe ".initialize" do it "sets project_config based on Dir.pwd by default" do - stub_file(File.join(Dir.pwd, '.kitchen.yml'), Hash.new) + stub_file(File.join(Dir.pwd, ".kitchen.yml"), Hash.new) loader = Kitchen::Loader::YAML.new loader.diagnose[:project_config][:filename]. - must_equal File.expand_path(File.join(Dir.pwd, '.kitchen.yml')) + must_equal File.expand_path(File.join(Dir.pwd, ".kitchen.yml")) end it "sets project_config from parameter, if given" do - stub_file('/tmp/crazyfunkytown.file', Hash.new) + stub_file("/tmp/crazyfunkytown.file", Hash.new) loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/crazyfunkytown.file') + :project_config => "/tmp/crazyfunkytown.file") loader.diagnose[:project_config][:filename]. must_match %r{/tmp/crazyfunkytown.file$} end it "sets local_config based on Dir.pwd by default" do - stub_file(File.join(Dir.pwd, '.kitchen.local.yml'), Hash.new) + stub_file(File.join(Dir.pwd, ".kitchen.local.yml"), Hash.new) loader = Kitchen::Loader::YAML.new loader.diagnose[:local_config][:filename]. - must_equal File.expand_path(File.join(Dir.pwd, '.kitchen.local.yml')) + must_equal File.expand_path(File.join(Dir.pwd, ".kitchen.local.yml")) end it "sets local_config based on location of project_config by default" do - stub_file('/tmp/.kitchen.local.yml', Hash.new) + stub_file("/tmp/.kitchen.local.yml", Hash.new) loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml') + :project_config => "/tmp/.kitchen.yml") loader.diagnose[:local_config][:filename]. must_match %r{/tmp/.kitchen.local.yml$} end it "sets local_config from parameter, if given" do - stub_file('/tmp/crazyfunkytown.file', Hash.new) + stub_file("/tmp/crazyfunkytown.file", Hash.new) loader = Kitchen::Loader::YAML.new( - :local_config => '/tmp/crazyfunkytown.file') + :local_config => "/tmp/crazyfunkytown.file") loader.diagnose[:local_config][:filename]. must_match %r{/tmp/crazyfunkytown.file$} end it "sets global_config based on ENV['HOME'] by default" do - stub_file(File.join(ENV['HOME'], '.kitchen/config.yml'), Hash.new) + stub_file(File.join(ENV["HOME"], ".kitchen/config.yml"), Hash.new) loader = Kitchen::Loader::YAML.new loader.diagnose[:global_config][:filename].must_equal File.expand_path( - File.join(ENV['HOME'], '.kitchen/config.yml')) + File.join(ENV["HOME"], ".kitchen/config.yml")) end it "sets global_config from parameter, if given" do - stub_file('/tmp/crazyfunkytown.file', Hash.new) + stub_file("/tmp/crazyfunkytown.file", Hash.new) loader = Kitchen::Loader::YAML.new( - :global_config => '/tmp/crazyfunkytown.file') + :global_config => "/tmp/crazyfunkytown.file") loader.diagnose[:global_config][:filename]. must_match %r{/tmp/crazyfunkytown.file$} @@ -109,74 +109,74 @@ class Yamled it "returns a hash of kitchen.yml with symbolized keys" do stub_yaml!( - 'foo' => 'bar' + "foo" => "bar" ) - loader.read.must_equal(:foo => 'bar') + loader.read.must_equal(:foo => "bar") end it "deep merges in kitchen.local.yml configuration with kitchen.yml" do stub_yaml!(".kitchen.yml", - 'common' => { 'xx' => 1 }, - 'a' => 'b' + "common" => { "xx" => 1 }, + "a" => "b" ) stub_yaml!(".kitchen.local.yml", - 'common' => { 'yy' => 2 }, - 'c' => 'd' + "common" => { "yy" => 2 }, + "c" => "d" ) loader.read.must_equal( - :a => 'b', - :c => 'd', + :a => "b", + :c => "d", :common => { :xx => 1, :yy => 2 } ) end it "deep merges in a global config file with all other configs" do stub_yaml!(".kitchen.yml", - 'common' => { 'xx' => 1 }, - 'a' => 'b' + "common" => { "xx" => 1 }, + "a" => "b" ) stub_yaml!(".kitchen.local.yml", - 'common' => { 'yy' => 2 }, - 'c' => 'd' + "common" => { "yy" => 2 }, + "c" => "d" ) stub_global!( - 'common' => { 'zz' => 3 }, - 'e' => 'f' + "common" => { "zz" => 3 }, + "e" => "f" ) loader.read.must_equal( - :a => 'b', - :c => 'd', - :e => 'f', + :a => "b", + :c => "d", + :e => "f", :common => { :xx => 1, :yy => 2, :zz => 3 } ) end it "merges kitchen.local.yml over configuration in kitchen.yml" do stub_yaml!(".kitchen.yml", - 'common' => { 'thekey' => 'nope' } + "common" => { "thekey" => "nope" } ) stub_yaml!(".kitchen.local.yml", - 'common' => { 'thekey' => 'yep' } + "common" => { "thekey" => "yep" } ) - loader.read.must_equal(:common => { :thekey => 'yep' }) + loader.read.must_equal(:common => { :thekey => "yep" }) end it "merges global config over both kitchen.local.yml and kitchen.yml" do stub_yaml!(".kitchen.yml", - 'common' => { 'thekey' => 'nope' } + "common" => { "thekey" => "nope" } ) stub_yaml!(".kitchen.local.yml", - 'common' => { 'thekey' => 'yep' } + "common" => { "thekey" => "yep" } ) stub_global!( - 'common' => { 'thekey' => 'kinda' } + "common" => { "thekey" => "kinda" } ) - loader.read.must_equal(:common => { :thekey => 'kinda' }) + loader.read.must_equal(:common => { :thekey => "kinda" }) end NORMALIZED_KEYS = { @@ -191,46 +191,46 @@ class Yamled it "merges local with #{key} string value over yaml with hash value" do stub_yaml!(".kitchen.yml", - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) stub_yaml!(".kitchen.local.yml", - key => 'namey' + key => "namey" ) loader.read.must_equal( - key.to_sym => { default_key.to_sym => "namey", :dakey => 'ya' } + key.to_sym => { default_key.to_sym => "namey", :dakey => "ya" } ) end it "merges local with #{key} hash value over yaml with string value" do stub_yaml!(".kitchen.yml", - key => 'namey' + key => "namey" ) stub_yaml!(".kitchen.local.yml", - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) loader.read.must_equal( - key.to_sym => { default_key.to_sym => "namey", :dakey => 'ya' } + key.to_sym => { default_key.to_sym => "namey", :dakey => "ya" } ) end it "merges local with #{key} nil value over yaml with hash value" do stub_yaml!(".kitchen.yml", - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) stub_yaml!(".kitchen.local.yml", key => nil ) loader.read.must_equal( - key.to_sym => { :dakey => 'ya' } + key.to_sym => { :dakey => "ya" } ) end it "merges local with #{key} hash value over yaml with nil value" do stub_yaml!(".kitchen.yml", - key => 'namey' + key => "namey" ) stub_yaml!(".kitchen.local.yml", key => nil @@ -243,40 +243,40 @@ class Yamled it "merges global with #{key} string value over yaml with hash value" do stub_yaml!(".kitchen.yml", - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) stub_global!( - key => 'namey' + key => "namey" ) loader.read.must_equal( - key.to_sym => { default_key.to_sym => "namey", :dakey => 'ya' } + key.to_sym => { default_key.to_sym => "namey", :dakey => "ya" } ) end it "merges global with #{key} hash value over yaml with string value" do stub_yaml!(".kitchen.yml", - key => 'namey' + key => "namey" ) stub_global!( - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) loader.read.must_equal( - key.to_sym => { default_key.to_sym => "namey", :dakey => 'ya' } + key.to_sym => { default_key.to_sym => "namey", :dakey => "ya" } ) end it "merges global with #{key} nil value over yaml with hash value" do stub_yaml!(".kitchen.yml", - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) stub_global!( key => nil ) loader.read.must_equal( - key.to_sym => { :dakey => 'ya' } + key.to_sym => { :dakey => "ya" } ) end @@ -285,11 +285,11 @@ class Yamled key => nil ) stub_global!( - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) loader.read.must_equal( - key.to_sym => { :dakey => 'ya' } + key.to_sym => { :dakey => "ya" } ) end @@ -301,11 +301,11 @@ class Yamled key => "namey" ) stub_global!( - key => { 'dakey' => 'ya' } + key => { "dakey" => "ya" } ) loader.read.must_equal( - key.to_sym => { default_key.to_sym => "namey", :dakey => 'ya' } + key.to_sym => { default_key.to_sym => "namey", :dakey => "ya" } ) end end @@ -313,29 +313,29 @@ class Yamled it "handles a kitchen.local.yml with no yaml elements" do stub_yaml!(".kitchen.yml", - 'a' => 'b' + "a" => "b" ) stub_yaml!(".kitchen.local.yml", Hash.new) - loader.read.must_equal(:a => 'b') + loader.read.must_equal(:a => "b") end it "handles a kitchen.yml with no yaml elements" do stub_yaml!(".kitchen.yml", Hash.new) stub_yaml!(".kitchen.local.yml", - 'a' => 'b' + "a" => "b" ) - loader.read.must_equal(:a => 'b') + loader.read.must_equal(:a => "b") end it "handles a kitchen.yml with yaml elements that parse as nil" do stub_yaml!(".kitchen.yml", nil) stub_yaml!(".kitchen.local.yml", - 'a' => 'b' + "a" => "b" ) - loader.read.must_equal(:a => 'b') + loader.read.must_equal(:a => "b") end it "raises an UserError if the config_file does not exist" do @@ -345,7 +345,7 @@ class Yamled it "arbitrary objects aren't deserialized in kitchen.yml" do FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.yml", "wb") do |f| - f.write <<-YAML.gsub(/^ {10}/, '') + f.write <<-YAML.gsub(/^ {10}/, "") --- !ruby/object:Yamled foo: bar YAML @@ -353,13 +353,13 @@ class Yamled loader.read.class.wont_equal Yamled loader.read.class.must_equal Hash - loader.read.must_equal(:foo => 'bar') + loader.read.must_equal(:foo => "bar") end it "arbitrary objects aren't deserialized in kitchen.local.yml" do FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.local.yml", "wb") do |f| - f.write <<-YAML.gsub(/^ {10}/, '') + f.write <<-YAML.gsub(/^ {10}/, "") --- !ruby/object:Yamled wakka: boop YAML @@ -368,12 +368,12 @@ class Yamled loader.read.class.wont_equal Yamled loader.read.class.must_equal Hash - loader.read.must_equal(:wakka => 'boop') + loader.read.must_equal(:wakka => "boop") end it "raises a UserError if kitchen.yml cannot be parsed" do FileUtils.mkdir_p "/tmp" - File.open("/tmp/.kitchen.yml", "wb") { |f| f.write '&*%^*' } + File.open("/tmp/.kitchen.yml", "wb") { |f| f.write "&*%^*" } err = proc { loader.read }.must_raise Kitchen::UserError err.message.must_match Regexp.new( @@ -382,7 +382,7 @@ class Yamled it "raises a UserError if kitchen.yml cannot be parsed" do FileUtils.mkdir_p "/tmp" - File.open("/tmp/.kitchen.yml", "wb") { |f| f.write 'uhoh' } + File.open("/tmp/.kitchen.yml", "wb") { |f| f.write "uhoh" } err = proc { loader.read }.must_raise Kitchen::UserError err.message.must_match Regexp.new( @@ -398,7 +398,7 @@ class Yamled it "raises a UserError if kitchen.local.yml cannot be parsed" do FileUtils.mkdir_p "/tmp" - File.open("/tmp/.kitchen.local.yml", "wb") { |f| f.write '&*%^*' } + File.open("/tmp/.kitchen.local.yml", "wb") { |f| f.write "&*%^*" } stub_yaml!(".kitchen.yml", Hash.new) proc { loader.read }.must_raise Kitchen::UserError @@ -407,7 +407,7 @@ class Yamled it "evaluates kitchen.yml through erb before loading by default" do FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.yml", "wb") do |f| - f.write <<-'YAML'.gsub(/^ {10}/, '') + f.write <<-'YAML'.gsub(/^ {10}/, "") --- name: <%= "AHH".downcase + "choo" %> YAML @@ -419,7 +419,7 @@ class Yamled it "raises a UserError if there is an ERB processing error" do FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.yml", "wb") do |f| - f.write <<-'YAML'.gsub(/^ {10}/, '') + f.write <<-'YAML'.gsub(/^ {10}/, "") --- <%= poop %>: yep YAML @@ -433,28 +433,28 @@ class Yamled it "evaluates kitchen.local.yml through erb before loading by default" do FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.local.yml", "wb") do |f| - f.write <<-'YAML'.gsub(/^ {10}/, '') + f.write <<-'YAML'.gsub(/^ {10}/, "") --- <% %w{noodle mushroom}.each do |kind| %> <%= kind %>: soup <% end %> YAML end - stub_yaml!(".kitchen.yml", 'spinach' => 'salad') + stub_yaml!(".kitchen.yml", "spinach" => "salad") loader.read.must_equal( - :spinach => 'salad', - :noodle => 'soup', - :mushroom => 'soup' + :spinach => "salad", + :noodle => "soup", + :mushroom => "soup" ) end it "skips evaluating kitchen.yml through erb if disabled" do loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_erb => false) + :project_config => "/tmp/.kitchen.yml", :process_erb => false) FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.yml", "wb") do |f| - f.write <<-'YAML'.gsub(/^ {10}/, '') + f.write <<-'YAML'.gsub(/^ {10}/, "") --- name: <%= "AHH".downcase %> YAML @@ -465,10 +465,10 @@ class Yamled it "skips evaluating kitchen.local.yml through erb if disabled" do loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_erb => false) + :project_config => "/tmp/.kitchen.yml", :process_erb => false) FileUtils.mkdir_p "/tmp" File.open("/tmp/.kitchen.local.yml", "wb") do |f| - f.write <<-'YAML'.gsub(/^ {10}/, '') + f.write <<-'YAML'.gsub(/^ {10}/, "") --- name: <%= "AHH".downcase %> YAML @@ -480,28 +480,28 @@ class Yamled it "skips kitchen.local.yml if disabled" do loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_local => false) + :project_config => "/tmp/.kitchen.yml", :process_local => false) stub_yaml!(".kitchen.yml", - 'a' => 'b' + "a" => "b" ) stub_yaml!(".kitchen.local.yml", - 'superawesomesauceadditions' => 'enabled, yo' + "superawesomesauceadditions" => "enabled, yo" ) - loader.read.must_equal(:a => 'b') + loader.read.must_equal(:a => "b") end it "skips the global config if disabled" do loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_global => false) + :project_config => "/tmp/.kitchen.yml", :process_global => false) stub_yaml!(".kitchen.yml", - 'a' => 'b' + "a" => "b" ) stub_global!( - 'superawesomesauceadditions' => 'enabled, yo' + "superawesomesauceadditions" => "enabled, yo" ) - loader.read.must_equal(:a => 'b') + loader.read.must_equal(:a => "b") end end @@ -522,7 +522,7 @@ class Yamled it "contains erb processing information when false" do stub_yaml!(Hash.new) loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_erb => false) + :project_config => "/tmp/.kitchen.yml", :process_erb => false) loader.diagnose[:process_erb].must_equal false end @@ -536,7 +536,7 @@ class Yamled it "contains local processing information when false" do stub_yaml!(Hash.new) loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_local => false) + :project_config => "/tmp/.kitchen.yml", :process_local => false) loader.diagnose[:process_local].must_equal false end @@ -550,7 +550,7 @@ class Yamled it "contains global processing information when false" do stub_yaml!(Hash.new) loader = Kitchen::Loader::YAML.new( - :project_config => '/tmp/.kitchen.yml', :process_global => false) + :project_config => "/tmp/.kitchen.yml", :process_global => false) loader.diagnose[:process_global].must_equal false end @@ -631,7 +631,7 @@ class Yamled before do FileUtils.mkdir_p(File.join(ENV["HOME"], ".kitchen")) File.open(File.join(ENV["HOME"], ".kitchen/config.yml"), "wb") do |f| - f.write '&*%^*' + f.write "&*%^*" end end @@ -660,7 +660,7 @@ class Yamled before do File.open("/tmp/.kitchen.yml", "wb") do |f| - f.write '&*%^*' + f.write "&*%^*" end end @@ -689,7 +689,7 @@ class Yamled before do File.open("/tmp/.kitchen.local.yml", "wb") do |f| - f.write '&*%^*' + f.write "&*%^*" end end @@ -718,7 +718,7 @@ class Yamled before do File.open("/tmp/.kitchen.yml", "wb") do |f| - f.write '&*%^*' + f.write "&*%^*" end end diff --git a/spec/kitchen/logger_spec.rb b/spec/kitchen/logger_spec.rb index edc631730..1a25d55a4 100644 --- a/spec/kitchen/logger_spec.rb +++ b/spec/kitchen/logger_spec.rb @@ -254,7 +254,7 @@ def colorize(*args) describe "file IO logdev-based logger" do - let(:logfile) { Dir::Tmpname.make_tmpname(['kitchen', '.log'], nil) } + let(:logfile) { Dir::Tmpname.make_tmpname(%w[kitchen .log], nil) } before do opts[:logdev] = logfile diff --git a/spec/kitchen/login_command_spec.rb b/spec/kitchen/login_command_spec.rb index 3c3a878ae..1478735f4 100644 --- a/spec/kitchen/login_command_spec.rb +++ b/spec/kitchen/login_command_spec.rb @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/login_command' +require "kitchen/login_command" describe Kitchen::LoginCommand do diff --git a/spec/kitchen/metadata_chopper_spec.rb b/spec/kitchen/metadata_chopper_spec.rb index 13075ef76..c8dddf13f 100644 --- a/spec/kitchen/metadata_chopper_spec.rb +++ b/spec/kitchen/metadata_chopper_spec.rb @@ -68,7 +68,7 @@ def stub_metadata!(name = "foobar", version = "5.2.1") File.open("/tmp/metadata.rb", "wb") do |f| - f.write <<-METADATA_RB.gsub(/^ {8}/, '') + f.write <<-METADATA_RB.gsub(/^ {8}/, "") name "#{name}" maintainer "Michael Bluth" maintainer_email "michael@bluth.com" diff --git a/spec/kitchen/platform_spec.rb b/spec/kitchen/platform_spec.rb index 981497d7c..27ea709d2 100644 --- a/spec/kitchen/platform_spec.rb +++ b/spec/kitchen/platform_spec.rb @@ -16,14 +16,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/errors' -require 'kitchen/platform' +require "kitchen/errors" +require "kitchen/platform" describe Kitchen::Platform do - let(:opts) do; { :name => 'plata' }; end + let(:opts) do; { :name => "plata" }; end let(:platform) { Kitchen::Platform.new(opts) } it "raises an ArgumentError if name is missing" do diff --git a/spec/kitchen/provisioner/base_spec.rb b/spec/kitchen/provisioner/base_spec.rb index c39afa4b3..daae0c238 100644 --- a/spec/kitchen/provisioner/base_spec.rb +++ b/spec/kitchen/provisioner/base_spec.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' -require 'logger' -require 'stringio' +require_relative "../../spec_helper" +require "logger" +require "stringio" -require 'kitchen' +require "kitchen" describe Kitchen::Provisioner::Base do diff --git a/spec/kitchen/provisioner/chef_base_spec.rb b/spec/kitchen/provisioner/chef_base_spec.rb index 1f4a0c6fd..93d9d5458 100644 --- a/spec/kitchen/provisioner/chef_base_spec.rb +++ b/spec/kitchen/provisioner/chef_base_spec.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' +require_relative "../../spec_helper" -require 'kitchen' -require 'kitchen/provisioner/chef_base' +require "kitchen" +require "kitchen/provisioner/chef_base" describe Kitchen::Provisioner::ChefBase do diff --git a/spec/kitchen/provisioner/chef_solo_spec.rb b/spec/kitchen/provisioner/chef_solo_spec.rb index 95d66d97e..3792bb215 100644 --- a/spec/kitchen/provisioner/chef_solo_spec.rb +++ b/spec/kitchen/provisioner/chef_solo_spec.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' +require_relative "../../spec_helper" -require 'kitchen' -require 'kitchen/provisioner/chef_solo' +require "kitchen" +require "kitchen/provisioner/chef_solo" describe Kitchen::Provisioner::ChefSolo do diff --git a/spec/kitchen/provisioner/chef_zero_spec.rb b/spec/kitchen/provisioner/chef_zero_spec.rb index 456c0a42d..0b4f0fd2e 100644 --- a/spec/kitchen/provisioner/chef_zero_spec.rb +++ b/spec/kitchen/provisioner/chef_zero_spec.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' +require_relative "../../spec_helper" -require 'kitchen' -require 'kitchen/provisioner/chef_zero' +require "kitchen" +require "kitchen/provisioner/chef_zero" describe Kitchen::Provisioner::ChefZero do diff --git a/spec/kitchen/provisioner/shell_spec.rb b/spec/kitchen/provisioner/shell_spec.rb index 8181b2dff..5b86e54b3 100644 --- a/spec/kitchen/provisioner/shell_spec.rb +++ b/spec/kitchen/provisioner/shell_spec.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../../spec_helper' +require_relative "../../spec_helper" -require 'kitchen' -require 'kitchen/provisioner/shell' +require "kitchen" +require "kitchen/provisioner/shell" describe Kitchen::Provisioner::Shell do diff --git a/spec/kitchen/provisioner_spec.rb b/spec/kitchen/provisioner_spec.rb index 61c7989bd..4a8f18396 100644 --- a/spec/kitchen/provisioner_spec.rb +++ b/spec/kitchen/provisioner_spec.rb @@ -16,12 +16,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/errors' -require 'kitchen/logging' -require 'kitchen/provisioner' -require 'kitchen/provisioner/base' +require "kitchen/errors" +require "kitchen/logging" +require "kitchen/provisioner" +require "kitchen/provisioner/base" module Kitchen @@ -63,7 +63,7 @@ class Coolbeans < Kitchen::Provisioner::Base # pretend require worked Kitchen::Provisioner.stubs(:require).returns(true) - proc { Kitchen::Provisioner.for_plugin('nope', {}) }. + proc { Kitchen::Provisioner.for_plugin("nope", {}) }. must_raise Kitchen::ClientError end end diff --git a/spec/kitchen/state_file_spec.rb b/spec/kitchen/state_file_spec.rb index c76f1270d..f3dcb1825 100644 --- a/spec/kitchen/state_file_spec.rb +++ b/spec/kitchen/state_file_spec.rb @@ -16,11 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/errors' -require 'kitchen/state_file' -require 'kitchen/util' +require "kitchen/errors" +require "kitchen/state_file" +require "kitchen/util" class YamledState attr_accessor :yoinks @@ -28,8 +28,8 @@ class YamledState describe Kitchen::StateFile do - let(:state_file) { Kitchen::StateFile.new('/tmp', 'oftheunion') } - let(:file_name) { '/tmp/.kitchen/oftheunion.yml' } + let(:state_file) { Kitchen::StateFile.new("/tmp", "oftheunion") } + let(:file_name) { "/tmp/.kitchen/oftheunion.yml" } before do FakeFS.activate! @@ -52,23 +52,23 @@ class YamledState state_file.read.must_equal( :cloud_id => 42, - :flavor => 'extra_crispy' + :flavor => "extra_crispy" ) end it "arbitrary objects aren't deserialized from state file" do - stub_state_file! <<-'YAML'.gsub(/^ {8}/, '') + stub_state_file! <<-'YAML'.gsub(/^ {8}/, "") --- !ruby/object:YamledState yoinks: zoinks YAML state_file.read.class.wont_equal YamledState state_file.read.class.must_equal Hash - state_file.read.must_equal(:yoinks => 'zoinks') + state_file.read.must_equal(:yoinks => "zoinks") end it "raises a StateFileLoadError if the state file cannot be parsed" do - stub_state_file!('&*%^*') + stub_state_file!("&*%^*") proc { state_file.read }.must_raise Kitchen::StateFileLoadError end @@ -77,15 +77,15 @@ class YamledState describe "#write" do it "creates the directory path to the state file" do - File.directory?('/tmp/.kitchen').must_equal false + File.directory?("/tmp/.kitchen").must_equal false state_file.write({}) - File.directory?('/tmp/.kitchen').must_equal true + File.directory?("/tmp/.kitchen").must_equal true end it "writes a state file with stringified keys" do - state_file.write(:thekey => 'thyself') + state_file.write(:thekey => "thyself") - IO.read(file_name).split("\n").must_include 'thekey: thyself' + IO.read(file_name).split("\n").must_include "thekey: thyself" end end @@ -109,7 +109,7 @@ class YamledState def stub_state_file!(yaml_string = nil) if yaml_string.nil? - yaml_string = <<-'YAML'.gsub(/^ {8}/, '') + yaml_string = <<-'YAML'.gsub(/^ {8}/, "") --- cloud_id: 42 flavor: extra_crispy @@ -117,6 +117,6 @@ def stub_state_file!(yaml_string = nil) end FileUtils.mkdir_p(File.dirname(file_name)) - File.open(file_name, 'wb') { |f| f.write(yaml_string) } + File.open(file_name, "wb") { |f| f.write(yaml_string) } end end diff --git a/spec/kitchen/suite_spec.rb b/spec/kitchen/suite_spec.rb index d1cc7e53c..589c5bb61 100644 --- a/spec/kitchen/suite_spec.rb +++ b/spec/kitchen/suite_spec.rb @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'kitchen/errors' -require 'kitchen/suite' +require "kitchen/errors" +require "kitchen/suite" describe Kitchen::Suite do diff --git a/spec/kitchen/util_spec.rb b/spec/kitchen/util_spec.rb index a882d2154..35777660d 100644 --- a/spec/kitchen/util_spec.rb +++ b/spec/kitchen/util_spec.rb @@ -16,15 +16,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -require_relative '../spec_helper' +require_relative "../spec_helper" -require 'logger' +require "logger" -require 'kitchen/util' +require "kitchen/util" describe Kitchen::Util do - describe '.to_logger_level' do + describe ".to_logger_level" do it "returns nil for invalid symbols" do Kitchen::Util.to_logger_level(:nope).must_be_nil diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 497bbabcf..4fca24277 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,26 +16,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -gem 'minitest' +gem "minitest" if ENV["COVERAGE"] - require 'simplecov' - SimpleCov.profiles.define 'gem' do - command_name 'Specs' + require "simplecov" + SimpleCov.profiles.define "gem" do + command_name "Specs" - add_filter '.gem/' - add_filter '/spec/' - add_filter '/lib/vendor/' + add_filter ".gem/" + add_filter "/spec/" + add_filter "/lib/vendor/" - add_group 'Libraries', '/lib/' + add_group "Libraries", "/lib/" end - SimpleCov.start 'gem' + SimpleCov.start "gem" end -require 'fakefs/safe' -require 'minitest/autorun' -require 'mocha/setup' -require 'tempfile' +require "fakefs/safe" +require "minitest/autorun" +require "mocha/setup" +require "tempfile" # Nasty hack to redefine IO.read in terms of File#read for fakefs class IO diff --git a/support/chef-client-zero.rb b/support/chef-client-zero.rb index fd46cf51e..5f4a25ac2 100755 --- a/support/chef-client-zero.rb +++ b/support/chef-client-zero.rb @@ -17,20 +17,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'rubygems' -require 'chef/config' -require 'chef_zero/server' -require 'chef/chef_fs/chef_fs_data_store' -require 'chef/chef_fs/config' -require 'English' -require 'fileutils' +require "rubygems" +require "chef/config" +require "chef_zero/server" +require "chef/chef_fs/chef_fs_data_store" +require "chef/chef_fs/config" +require "English" +require "fileutils" # Bust out of our self-imposed sandbox before running chef-client so # gems installed via gem_package land in Chef's GEM_HOME. # # https://github.com/opscode/test-kitchen/issues/240 # -ENV['GEM_HOME'] = ENV['GEM_PATH'] = ENV['GEM_CACHE'] = nil +ENV["GEM_HOME"] = ENV["GEM_PATH"] = ENV["GEM_CACHE"] = nil class ChefClientZero @@ -65,7 +65,7 @@ def create_chef_zero_server end def repo_path - ENV.fetch('CHEF_REPO_PATH', Dir.pwd) + ENV.fetch("CHEF_REPO_PATH", Dir.pwd) end def run_chef_client diff --git a/test-kitchen.gemspec b/test-kitchen.gemspec index c0278b3bd..9362b07f2 100644 --- a/test-kitchen.gemspec +++ b/test-kitchen.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |gem| gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) gem.executables = %w[kitchen] gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) - gem.require_paths = ['lib'] + gem.require_paths = ["lib"] gem.required_ruby_version = ">= 1.9.1"