summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-01-18 09:12:29 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-18 09:12:29 -0800
commit86643d99789002eca3f064f3450fe48dcd316753 (patch)
tree525ffeff996a1333a498d33821fe7257281a8337
parentca084429991a141127c80e9d2a08cb1bb68585c4 (diff)
downloadchef-86643d99789002eca3f064f3450fe48dcd316753.tar.gz
Autofixing Style/PercentLiteralDelimeterslcg/percentliteraldelimeters
See chef/chefstyle#11 for analysis and discussion. We select '{}' since audit of our source code shows that is the most common, and that used to be the dominant learning paradigm (e.g. in ruby 1.9 pickaxe book.
-rw-r--r--chef-config/chef-config.gemspec4
-rw-r--r--chef-windows.gemspec4
-rw-r--r--chef.gemspec8
-rw-r--r--kitchen-tests/cookbooks/webapp/recipes/default.rb2
-rw-r--r--kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb2
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb24
-rw-r--r--lib/chef/chef_fs/config.rb6
-rw-r--r--lib/chef/chef_fs/data_handler/environment_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/role_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acls_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb2
-rw-r--r--lib/chef/chef_fs/knife.rb2
-rw-r--r--lib/chef/client.rb2
-rw-r--r--lib/chef/dsl/chef_provisioning.rb4
-rw-r--r--lib/chef/dsl/cheffish.rb4
-rw-r--r--lib/chef/dsl/recipe.rb4
-rw-r--r--lib/chef/encrypted_data_bag_item/encryptor.rb6
-rw-r--r--lib/chef/exceptions.rb2
-rw-r--r--lib/chef/http/http_request.rb2
-rw-r--r--lib/chef/knife.rb2
-rw-r--r--lib/chef/knife/core/node_editor.rb4
-rw-r--r--lib/chef/knife/serve.rb2
-rw-r--r--lib/chef/knife/ssh.rb2
-rw-r--r--lib/chef/mixin/path_sanity.rb4
-rw-r--r--lib/chef/platform/service_helpers.rb4
-rw-r--r--lib/chef/provider/cron.rb2
-rw-r--r--lib/chef/provider/git.rb2
-rw-r--r--lib/chef/provider/group/usermod.rb2
-rw-r--r--lib/chef/provider/ifconfig/aix.rb2
-rw-r--r--lib/chef/provider/ifconfig/debian.rb4
-rw-r--r--lib/chef/provider/ifconfig/redhat.rb2
-rw-r--r--lib/chef/provider/mount/aix.rb2
-rw-r--r--lib/chef/provider/mount/mount.rb2
-rw-r--r--lib/chef/provider/mount/solaris.rb4
-rw-r--r--lib/chef/provider/package/ips.rb2
-rw-r--r--lib/chef/provider/package/rpm.rb2
-rw-r--r--lib/chef/provider/package/rubygems.rb2
-rw-r--r--lib/chef/provider/package/yum.rb2
-rw-r--r--lib/chef/provider/service.rb2
-rw-r--r--lib/chef/provider/service/debian.rb2
-rw-r--r--lib/chef/provider/service/insserv.rb2
-rw-r--r--lib/chef/provider/service/redhat.rb2
-rw-r--r--lib/chef/provider/user/aix.rb2
-rw-r--r--lib/chef/provider/user/pw.rb2
-rw-r--r--lib/chef/provider/user/solaris.rb2
-rw-r--r--lib/chef/run_context.rb8
-rw-r--r--lib/chef/tasks/chef_repo.rake12
-rw-r--r--lib/chef/version_constraint.rb4
-rw-r--r--spec/functional/resource/deploy_revision_spec.rb24
-rw-r--r--spec/functional/resource/user/useradd_spec.rb2
-rw-r--r--spec/integration/client/client_spec.rb2
-rw-r--r--spec/integration/client/ipv6_spec.rb2
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb20
-rw-r--r--spec/integration/knife/deps_spec.rb16
-rw-r--r--spec/spec_helper.rb4
-rw-r--r--spec/support/shared/integration/integration_helper.rb4
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb4
-rw-r--r--spec/unit/application/client_spec.rb2
-rw-r--r--spec/unit/chef_fs/data_handler/group_handler_spec.rb10
-rw-r--r--spec/unit/chef_fs/parallelizer.rb4
-rw-r--r--spec/unit/client_spec.rb2
-rw-r--r--spec/unit/config_fetcher_spec.rb2
-rw-r--r--spec/unit/cookbook/chefignore_spec.rb8
-rw-r--r--spec/unit/cookbook/file_vendor_spec.rb2
-rw-r--r--spec/unit/cookbook/synchronizer_spec.rb2
-rw-r--r--spec/unit/cookbook_version_spec.rb2
-rw-r--r--spec/unit/dsl/data_query_spec.rb2
-rw-r--r--spec/unit/environment_spec.rb2
-rw-r--r--spec/unit/key_spec.rb10
-rw-r--r--spec/unit/knife/bootstrap/client_builder_spec.rb4
-rw-r--r--spec/unit/knife/bootstrap_spec.rb8
-rw-r--r--spec/unit/knife/core/gem_glob_loader_spec.rb4
-rw-r--r--spec/unit/knife/core/node_editor_spec.rb16
-rw-r--r--spec/unit/knife/data_bag_show_spec.rb8
-rw-r--r--spec/unit/knife/node_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/tag_list_spec.rb2
-rw-r--r--spec/unit/knife_spec.rb44
-rw-r--r--spec/unit/mixin/deep_merge_spec.rb10
-rw-r--r--spec/unit/node/attribute_spec.rb2
-rw-r--r--spec/unit/node/immutable_collections_spec.rb6
-rw-r--r--spec/unit/provider/package/rpm_spec.rb2
-rw-r--r--spec/unit/provider/package/yum_spec.rb2
-rw-r--r--spec/unit/provider/route_spec.rb2
-rw-r--r--spec/unit/provider_resolver_spec.rb12
-rw-r--r--spec/unit/recipe_spec.rb4
-rw-r--r--spec/unit/resource_spec.rb2
-rw-r--r--spec/unit/rest_spec.rb2
-rw-r--r--spec/unit/run_list/versioned_recipe_list_spec.rb10
-rw-r--r--spec/unit/version/platform_spec.rb2
-rw-r--r--spec/unit/version_class_spec.rb2
-rw-r--r--tasks/maintainers.rb4
93 files changed, 225 insertions, 225 deletions
diff --git a/chef-config/chef-config.gemspec b/chef-config/chef-config.gemspec
index f67f3010ca..12373ac8fb 100644
--- a/chef-config/chef-config.gemspec
+++ b/chef-config/chef-config.gemspec
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", "~> 10.0"
- %w(rspec-core rspec-expectations rspec-mocks).each do |rspec|
+ %w{rspec-core rspec-expectations rspec-mocks}.each do |rspec|
spec.add_development_dependency(rspec, "~> 3.2")
end
- spec.files = %w(Rakefile LICENSE README.md) + Dir.glob("*.gemspec") +
+ spec.files = %w{Rakefile LICENSE README.md} + Dir.glob("*.gemspec") +
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
spec.bindir = "bin"
diff --git a/chef-windows.gemspec b/chef-windows.gemspec
index 4dffc595f4..2ebcc1ecf1 100644
--- a/chef-windows.gemspec
+++ b/chef-windows.gemspec
@@ -17,8 +17,8 @@ gemspec.add_dependency "win32-service", "~> 0.8.7"
gemspec.add_dependency "windows-api", "~> 0.4.4"
gemspec.add_dependency "wmi-lite", "~> 1.0"
gemspec.extensions << "ext/win32-eventlog/Rakefile"
-gemspec.files += %w(ext/win32-eventlog/Rakefile ext/win32-eventlog/chef-log.man)
+gemspec.files += %w{ext/win32-eventlog/Rakefile ext/win32-eventlog/chef-log.man}
-gemspec.executables += %w( chef-service-manager chef-windows-service )
+gemspec.executables += %w{ chef-service-manager chef-windows-service }
gemspec
diff --git a/chef.gemspec b/chef.gemspec
index 3a1db4ee63..7df1571f29 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
s.add_dependency "plist", "~> 3.1.0"
# Audit mode requires these, so they are non-developmental dependencies now
- %w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_dependency gem, "~> 3.4" }
+ %w{rspec-core rspec-expectations rspec-mocks}.each { |gem| s.add_dependency gem, "~> 3.4" }
s.add_dependency "rspec_junit_formatter", "~> 0.2.0"
s.add_dependency "serverspec", "~> 2.7"
s.add_dependency "specinfra", "~> 2.10"
@@ -52,8 +52,8 @@ Gem::Specification.new do |s|
s.add_development_dependency "rake", "~> 10.1"
s.bindir = "bin"
- s.executables = %w( chef-client chef-solo knife chef-shell chef-apply )
+ s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply }
- s.require_path = %w( lib lib-backcompat )
- s.files = %w(Gemfile Rakefile LICENSE README.md CONTRIBUTING.md) + Dir.glob("{distro,lib,lib-backcompat,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + Dir.glob("*.gemspec")
+ s.require_path = %w{ lib lib-backcompat }
+ s.files = %w{Gemfile Rakefile LICENSE README.md CONTRIBUTING.md} + Dir.glob("{distro,lib,lib-backcompat,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + Dir.glob("*.gemspec")
end
diff --git a/kitchen-tests/cookbooks/webapp/recipes/default.rb b/kitchen-tests/cookbooks/webapp/recipes/default.rb
index 3dc22ea0fa..2b3459b794 100644
--- a/kitchen-tests/cookbooks/webapp/recipes/default.rb
+++ b/kitchen-tests/cookbooks/webapp/recipes/default.rb
@@ -10,7 +10,7 @@ include_recipe "database::mysql"
include_recipe "php"
creds = Hash.new
-%w(mysql webapp).each do |item_name|
+%w{mysql webapp}.each do |item_name|
creds[item_name] = data_bag_item("passwords", item_name)
end
diff --git a/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb b/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb
index 64c9121a6f..992e4f7683 100644
--- a/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb
+++ b/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb
@@ -90,7 +90,7 @@ describe "webapp::default", :end_to_end => true do
end
end
- %w(select update insert delete create).each do |priv|
+ %w{select update insert delete create}.each do |priv|
include_examples "a privilege", priv do
end
end
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 37f30dde45..ab161c7fb2 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -288,7 +288,7 @@ class Chef
end
# GET /cookbooks/NAME/VERSION or /cookbook_artifacts/NAME/IDENTIFIER
- elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 3
+ elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 3
with_entry(path) do |entry|
cookbook_type = path[0]
result = nil
@@ -325,8 +325,8 @@ class Chef
result['metadata'] = result['metadata'].to_hash
result['metadata'].delete_if do |key,value|
value == [] ||
- (value == {} && !%w(dependencies attributes recipes).include?(key)) ||
- (value == "" && %w(source_url issues_url).include?(key)) ||
+ (value == {} && !%w{dependencies attributes recipes}.include?(key)) ||
+ (value == "" && %w{source_url issues_url}.include?(key)) ||
(value == false && key == "privacy")
end
end
@@ -354,7 +354,7 @@ class Chef
end
# Write out the files!
- if %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 3
+ if %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 3
write_cookbook(path, data, *options)
# Handle /policy_groups/some_policy_group/policies/some_policy_name
@@ -418,7 +418,7 @@ class Chef
else
with_entry(path) do |entry|
begin
- if %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length >= 3
+ if %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length >= 3
entry.delete(true)
else
entry.delete(false)
@@ -499,7 +499,7 @@ class Chef
policies.keys
end
- elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 1
+ elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 1
with_entry(path) do |entry|
begin
if path[0] == "cookbook_artifacts"
@@ -516,7 +516,7 @@ class Chef
end
end
- elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 2
+ elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 2
if chef_fs.versioned_cookbooks || path[0] == "cookbook_artifacts"
result = with_entry([ path[0] ]) do |entry|
# list /cookbooks/name = filter /cookbooks/name-version down to name
@@ -551,7 +551,7 @@ class Chef
# Older versions of chef-zero do not understand policies and cookbook_artifacts,
# don't give that stuff to them
if path == [] && ChefZero::VERSION.to_f < 4.4
- result.reject! { |child| %w(policies policy_data cookbook_artifacts).include?(child) }
+ result.reject! { |child| %w{policies policy_data cookbook_artifacts}.include?(child) }
end
result
end
@@ -575,7 +575,7 @@ class Chef
if use_memory_store?(path)
@memory_store.exists_dir?(path)
- elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 2
+ elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 2
list([ path[0] ]).include?(path[1])
# /policies/NAME
@@ -661,7 +661,7 @@ class Chef
elsif path[0] == "policies" && path[2] == "revisions" && path.length >= 4
path = [ "policies", "#{path[1]}-#{path[3]}.json" ]
- elsif %w(cookbooks cookbook_artifacts).include?(path[0])
+ elsif %w{cookbooks cookbook_artifacts}.include?(path[0])
if path.length == 2
raise ChefZero::DataStore::DataNotFoundError.new(path)
elsif path.length >= 3
@@ -707,7 +707,7 @@ class Chef
path[2] = path[2][0..-6]
end
- elsif %w(cookbooks cookbook_artifacts).include?(path[0])
+ elsif %w{cookbooks cookbook_artifacts}.include?(path[0])
if chef_fs.versioned_cookbooks || path[0] == "cookbook_artifacts"
# cookbooks/name-version/... -> cookbooks/name/version/...
if path.length >= 2
@@ -741,7 +741,7 @@ class Chef
end
def path_always_exists?(path)
- return path.length == 1 && %w(clients cookbooks data environments nodes roles users).include?(path[0])
+ return path.length == 1 && %w{clients cookbooks data environments nodes roles users}.include?(path[0])
end
def with_entry(path)
diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb
index 5b9d34441b..07c014e2ab 100644
--- a/lib/chef/chef_fs/config.rb
+++ b/lib/chef/chef_fs/config.rb
@@ -234,11 +234,11 @@ class Chef
result = {}
case @chef_config[:repo_mode]
when "static"
- object_names = %w(cookbooks data_bags environments roles)
+ object_names = %w{cookbooks data_bags environments roles}
when "hosted_everything"
- object_names = %w(acls clients cookbooks cookbook_artifacts containers data_bags environments groups nodes roles policies policy_groups)
+ object_names = %w{acls clients cookbooks cookbook_artifacts containers data_bags environments groups nodes roles policies policy_groups}
else
- object_names = %w(clients cookbooks data_bags environments nodes roles users)
+ object_names = %w{clients cookbooks data_bags environments nodes roles users}
end
object_names.each do |object_name|
# cookbooks -> cookbook_path
diff --git a/lib/chef/chef_fs/data_handler/environment_data_handler.rb b/lib/chef/chef_fs/data_handler/environment_data_handler.rb
index 2480415f85..3b9d5b4ec7 100644
--- a/lib/chef/chef_fs/data_handler/environment_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/environment_data_handler.rb
@@ -26,7 +26,7 @@ class Chef
end
def to_ruby(object)
- result = to_ruby_keys(object, %w(name description default_attributes override_attributes))
+ result = to_ruby_keys(object, %w{name description default_attributes override_attributes})
if object["cookbook_versions"]
object["cookbook_versions"].each_pair do |name, version|
result << "cookbook #{name.inspect}, #{version.inspect}"
diff --git a/lib/chef/chef_fs/data_handler/role_data_handler.rb b/lib/chef/chef_fs/data_handler/role_data_handler.rb
index a3a1a31dc7..eb10f7bb4a 100644
--- a/lib/chef/chef_fs/data_handler/role_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/role_data_handler.rb
@@ -32,7 +32,7 @@ class Chef
end
def to_ruby(object)
- to_ruby_keys(object, %w(name description default_attributes override_attributes run_list env_run_lists))
+ to_ruby_keys(object, %w{name description default_attributes override_attributes run_list env_run_lists})
end
end
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
index 4a602ba66d..4fec51a9b1 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
@@ -26,7 +26,7 @@ class Chef
module FileSystem
module ChefServer
class AclEntry < RestListEntry
- PERMISSIONS = %w(create read update delete grant)
+ PERMISSIONS = %w{create read update delete grant}
def api_path
"#{super}/_acl"
diff --git a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
index aa1ebf159e..4f8fff1bda 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
@@ -27,7 +27,7 @@ class Chef
module FileSystem
module ChefServer
class AclsDir < BaseFSDir
- ENTITY_TYPES = %w(clients containers cookbooks data_bags environments groups nodes roles) # we don't read sandboxes, so we don't read their acls
+ ENTITY_TYPES = %w{clients containers cookbooks data_bags environments groups nodes roles} # we don't read sandboxes, so we don't read their acls
def data_handler
@data_handler ||= Chef::ChefFS::DataHandler::AclDataHandler.new
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
index 00c1c71b71..2e45b74450 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
@@ -42,7 +42,7 @@ class Chef
begin
rest.post(api_path, "username" => member)
rescue Net::HTTPServerException => e
- if %w(404 405).include?(e.response.code)
+ if %w{404 405}.include?(e.response.code)
raise "Chef server at #{api_path} does not allow you to directly add members. Please either upgrade your Chef server or move the users you want into invitations.json instead of members.json."
else
raise
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
index a3a3dfc6b9..24017acc13 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
@@ -73,7 +73,7 @@ class Chef
attr_reader :child_paths
attr_reader :versioned_cookbooks
- CHILDREN = %w(org.json invitations.json members.json)
+ CHILDREN = %w{org.json invitations.json members.json}
def children
@children ||= begin
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 83adf6a495..4501aeea0f 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -145,7 +145,7 @@ class Chef
end
def discover_repo_dir(dir)
- %w(.chef cookbooks data_bags environments roles).each do |subdir|
+ %w{.chef cookbooks data_bags environments roles}.each do |subdir|
return dir if File.directory?(File.join(dir, subdir))
end
# If this isn't it, check the parent
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 2362c14db1..a524a9cd54 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -536,7 +536,7 @@ class Chef
# @api private
#
def run_ohai
- filter = Chef::Config[:minimal_ohai] ? %w[fqdn machinename hostname platform platform_version os os_version] : nil
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
ohai.all_plugins(filter)
events.ohai_completed(node)
end
diff --git a/lib/chef/dsl/chef_provisioning.rb b/lib/chef/dsl/chef_provisioning.rb
index 35f175296b..27458dc04a 100644
--- a/lib/chef/dsl/chef_provisioning.rb
+++ b/lib/chef/dsl/chef_provisioning.rb
@@ -23,7 +23,7 @@ class Chef
# require 'chef-provisioning' (which will define the actual method) and then call the
# method chef-provisioning defined.
module ChefProvisioning
- %w(
+ %w{
add_machine_options
current_image_options
current_machine_options
@@ -36,7 +36,7 @@ class Chef
with_driver
with_image_options
with_machine_options
- ).each do |method_name|
+ }.each do |method_name|
eval(<<-EOM, binding, __FILE__, __LINE__+1)
def #{method_name}(*args, &block)
Chef::DSL::ChefProvisioning.load_chef_provisioning
diff --git a/lib/chef/dsl/cheffish.rb b/lib/chef/dsl/cheffish.rb
index 736ad52add..019dadd3f2 100644
--- a/lib/chef/dsl/cheffish.rb
+++ b/lib/chef/dsl/cheffish.rb
@@ -23,7 +23,7 @@ class Chef
# require 'cheffish' (which will define the actual method) and then call the
# method cheffish defined.
module Cheffish
- %w(
+ %w{
chef_acl
chef_client
chef_container
@@ -43,7 +43,7 @@ class Chef
with_chef_server
with_chef_local_server
get_private_key
- ).each do |method_name|
+ }.each do |method_name|
eval(<<-EOM, binding, __FILE__, __LINE__+1)
def #{method_name}(*args, &block)
Chef::DSL::Cheffish.load_cheffish
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb
index 8a25328023..5e39919158 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -51,9 +51,9 @@ class Chef
def describe_self_for_error
if respond_to?(:name)
- %Q[`#{self.class} "#{name}"']
+ %Q{`#{self.class} "#{name}"'}
elsif respond_to?(:recipe_name)
- %Q[`#{self.class} "#{recipe_name}"']
+ %Q{`#{self.class} "#{recipe_name}"'}
else
to_s
end
diff --git a/lib/chef/encrypted_data_bag_item/encryptor.rb b/lib/chef/encrypted_data_bag_item/encryptor.rb
index 98c83f3201..5edf5b9530 100644
--- a/lib/chef/encrypted_data_bag_item/encryptor.rb
+++ b/lib/chef/encrypted_data_bag_item/encryptor.rb
@@ -127,7 +127,7 @@ class Chef::EncryptedDataBagItem
end
def self.encryptor_keys
- %w( encrypted_data iv version cipher )
+ %w{ encrypted_data iv version cipher }
end
end
@@ -155,7 +155,7 @@ class Chef::EncryptedDataBagItem
end
def self.encryptor_keys
- super + %w( hmac )
+ super + %w{ hmac }
end
end
@@ -216,7 +216,7 @@ class Chef::EncryptedDataBagItem
end
def self.encryptor_keys
- super + %w( auth_tag )
+ super + %w{ auth_tag }
end
end
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 25f2735b7d..dfc5a6efbb 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -220,7 +220,7 @@ class Chef
class ImmutableAttributeModification < NoMethodError
def initialize
super "Node attributes are read-only when you do not specify which precedence level to set. " +
- %Q(To set an attribute use code like `node.default["key"] = "value"')
+ %Q{To set an attribute use code like `node.default["key"] = "value"'}
end
end
diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb
index 891ffef05e..2dec4d8267 100644
--- a/lib/chef/http/http_request.rb
+++ b/lib/chef/http/http_request.rb
@@ -125,7 +125,7 @@ class Chef
rescue NoMethodError => e
# http://redmine.ruby-lang.org/issues/show/2708
# http://redmine.ruby-lang.org/issues/show/2758
- if e.to_s =~ /#{Regexp.escape(%q|undefined method `closed?' for nil:NilClass|)}/
+ if e.to_s =~ /#{Regexp.escape(%q{undefined method `closed?' for nil:NilClass})}/
Chef::Log.debug("Rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http")
Chef::Log.debug("#{e.class.name}: #{e}")
Chef::Log.debug(e.backtrace.join("\n"))
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index fdc34d1c49..a070c6c858 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -230,7 +230,7 @@ class Chef
private
- OFFICIAL_PLUGINS = %w[ec2 rackspace windows openstack terremark bluebox]
+ OFFICIAL_PLUGINS = %w{ec2 rackspace windows openstack terremark bluebox}
def self.path_from_caller(caller_line)
caller_line.split(/:\d+/).first
diff --git a/lib/chef/knife/core/node_editor.rb b/lib/chef/knife/core/node_editor.rb
index 9896195a97..897d00932e 100644
--- a/lib/chef/knife/core/node_editor.rb
+++ b/lib/chef/knife/core/node_editor.rb
@@ -57,7 +57,7 @@ class Chef
pristine_copy = Chef::JSONCompat.parse(Chef::JSONCompat.to_json(node))
updated_copy = Chef::JSONCompat.parse(Chef::JSONCompat.to_json(@updated_node))
- updated_properties = %w[
+ updated_properties = %w{
name
chef_environment
automatic
@@ -67,7 +67,7 @@ class Chef
policy_name
policy_group
run_list
- ].reject do |key|
+ }.reject do |key|
pristine_copy[key] == updated_copy[key]
end
diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb
index 4cb698c968..3f97962eae 100644
--- a/lib/chef/knife/serve.rb
+++ b/lib/chef/knife/serve.rb
@@ -27,7 +27,7 @@ class Chef
# --chef-repo-path forcibly overrides all other paths
if config[:chef_repo_path]
Chef::Config.chef_repo_path = config[:chef_repo_path]
- %w(acl client cookbook container data_bag environment group node role user).each do |variable_name|
+ %w{acl client cookbook container data_bag environment group node role user}.each do |variable_name|
Chef::Config.delete("#{variable_name}_path".to_sym)
end
end
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index bf2f0d4bf0..2b2a367f18 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -463,7 +463,7 @@ class Chef
def cssh
cssh_cmd = nil
- %w[csshX cssh].each do |cmd|
+ %w{csshX cssh}.each do |cmd|
begin
# Unix and Mac only
cssh_cmd = shell_out!("which #{cmd}").stdout.strip
diff --git a/lib/chef/mixin/path_sanity.rb b/lib/chef/mixin/path_sanity.rb
index 00eba5876e..ef04bf288f 100644
--- a/lib/chef/mixin/path_sanity.rb
+++ b/lib/chef/mixin/path_sanity.rb
@@ -48,9 +48,9 @@ class Chef
def sane_paths
@sane_paths ||= begin
if Chef::Platform.windows?
- %w[]
+ %w{}
else
- %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin]
+ %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
end
end
end
diff --git a/lib/chef/platform/service_helpers.rb b/lib/chef/platform/service_helpers.rb
index 09b6acb897..1a7e739169 100644
--- a/lib/chef/platform/service_helpers.rb
+++ b/lib/chef/platform/service_helpers.rb
@@ -103,7 +103,7 @@ class Chef
end
def has_systemd_service_unit?(svc_name)
- %w( /etc /usr/lib /lib /run ).any? do |load_path|
+ %w{ /etc /usr/lib /lib /run }.any? do |load_path|
::File.exist?(
Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service")
)
@@ -112,7 +112,7 @@ class Chef
def has_systemd_unit?(svc_name)
# TODO: stop supporting non-service units with service resource
- %w( /etc /usr/lib /lib /run ).any? do |load_path|
+ %w{ /etc /usr/lib /lib /run }.any? do |load_path|
::File.exist?(Chef.path_to("#{load_path}/systemd/system/#{svc_name}"))
end
end
diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb
index fbd6510121..361691aa0a 100644
--- a/lib/chef/provider/cron.rb
+++ b/lib/chef/provider/cron.rb
@@ -199,7 +199,7 @@ class Chef
private
def set_environment_var(attr_name, attr_value)
- if %w(MAILTO PATH SHELL HOME).include?(attr_name)
+ if %w{MAILTO PATH SHELL HOME}.include?(attr_name)
@current_resource.send(attr_name.downcase.to_sym, attr_value)
else
@current_resource.environment(@current_resource.environment.merge(attr_name => attr_value))
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 07008b98f6..a0f6d076df 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -283,7 +283,7 @@ class Chef
end
def git_ls_remote(rev_pattern)
- command = git(%Q(ls-remote "#{@new_resource.repository}" "#{rev_pattern}"))
+ command = git(%Q{ls-remote "#{@new_resource.repository}" "#{rev_pattern}"})
shell_out!(command, run_options).stdout
end
diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb
index 51b14234ba..f4f3ac55ae 100644
--- a/lib/chef/provider/group/usermod.rb
+++ b/lib/chef/provider/group/usermod.rb
@@ -23,7 +23,7 @@ class Chef
class Group
class Usermod < Chef::Provider::Group::Groupadd
- provides :group, os: %w(openbsd solaris2 hpux)
+ provides :group, os: %w{openbsd solaris2 hpux}
provides :group, platform: "opensuse"
def load_current_resource
diff --git a/lib/chef/provider/ifconfig/aix.rb b/lib/chef/provider/ifconfig/aix.rb
index 4ceb7866db..30e702fe10 100644
--- a/lib/chef/provider/ifconfig/aix.rb
+++ b/lib/chef/provider/ifconfig/aix.rb
@@ -22,7 +22,7 @@ class Chef
class Provider
class Ifconfig
class Aix < Chef::Provider::Ifconfig
- provides :ifconfig, platform: %w(aix)
+ provides :ifconfig, platform: %w{aix}
def load_current_resource
@current_resource = Chef::Resource::Ifconfig.new(@new_resource.name)
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb
index b7e4adc0a3..3885e55998 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -23,8 +23,8 @@ class Chef
class Provider
class Ifconfig
class Debian < Chef::Provider::Ifconfig
- provides :ifconfig, platform: %w(ubuntu), platform_version: ">= 11.10"
- provides :ifconfig, platform: %w(debian), platform_version: ">= 7.0"
+ provides :ifconfig, platform: %w{ubuntu}, platform_version: ">= 11.10"
+ provides :ifconfig, platform: %w{debian}, platform_version: ">= 7.0"
INTERFACES_FILE = "/etc/network/interfaces"
INTERFACES_DOT_D_DIR = "/etc/network/interfaces.d"
diff --git a/lib/chef/provider/ifconfig/redhat.rb b/lib/chef/provider/ifconfig/redhat.rb
index b0131f8f5a..8c02c1be07 100644
--- a/lib/chef/provider/ifconfig/redhat.rb
+++ b/lib/chef/provider/ifconfig/redhat.rb
@@ -22,7 +22,7 @@ class Chef
class Provider
class Ifconfig
class Redhat < Chef::Provider::Ifconfig
- provides :ifconfig, platform_family: %w(fedora rhel)
+ provides :ifconfig, platform_family: %w{fedora rhel}
def initialize(new_resource, run_context)
super(new_resource, run_context)
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb
index 577505ac69..a6fccfadf4 100644
--- a/lib/chef/provider/mount/aix.rb
+++ b/lib/chef/provider/mount/aix.rb
@@ -22,7 +22,7 @@ class Chef
class Provider
class Mount
class Aix < Chef::Provider::Mount::Mount
- provides :mount, platform: %w(aix)
+ provides :mount, platform: %w{aix}
# Override for aix specific handling
def initialize(new_resource, run_context)
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index fe657659ad..e0bddb454a 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -193,7 +193,7 @@ class Chef
def device_should_exist?
( @new_resource.device != "none" ) &&
( not network_device? ) &&
- ( not %w[ cgroup tmpfs fuse ].include? @new_resource.fstype )
+ ( not %w{ cgroup tmpfs fuse }.include? @new_resource.fstype )
end
private
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb
index f61b9e673b..76f1ac0137 100644
--- a/lib/chef/provider/mount/solaris.rb
+++ b/lib/chef/provider/mount/solaris.rb
@@ -27,7 +27,7 @@ class Chef
class Mount
# Mount Solaris File systems
class Solaris < Chef::Provider::Mount
- provides :mount, platform: %w(openindiana opensolaris nexentacore omnios solaris2 smartos)
+ provides :mount, platform: %w{openindiana opensolaris nexentacore omnios solaris2 smartos}
extend Forwardable
@@ -202,7 +202,7 @@ class Chef
end
def device_should_exist?
- !%w(tmpfs nfs ctfs proc mntfs objfs sharefs fd smbfs vxfs).include?(fstype)
+ !%w{tmpfs nfs ctfs proc mntfs objfs sharefs fd smbfs vxfs}.include?(fstype)
end
def mount_at_boot?
diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb
index 84cb19486f..a69a2e24e0 100644
--- a/lib/chef/provider/package/ips.rb
+++ b/lib/chef/provider/package/ips.rb
@@ -27,7 +27,7 @@ class Chef
class Package
class Ips < Chef::Provider::Package
- provides :package, platform: %w(openindiana opensolaris omnios solaris2)
+ provides :package, platform: %w{openindiana opensolaris omnios solaris2}
provides :ips_package, os: "solaris2"
attr_accessor :virtual
diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb
index 019d26d92e..9ab10b062d 100644
--- a/lib/chef/provider/package/rpm.rb
+++ b/lib/chef/provider/package/rpm.rb
@@ -113,7 +113,7 @@ class Chef
def uri_scheme?(str)
scheme = URI.split(str).first
return false unless scheme
- %w(http https ftp file).include?(scheme.downcase)
+ %w{http https ftp file}.include?(scheme.downcase)
rescue URI::InvalidURIError
return false
end
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 034f526060..85796e8b9a 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -394,7 +394,7 @@ class Chef
end
def is_omnibus?
- if RbConfig::CONFIG["bindir"] =~ %r!/(opscode|chef|chefdk)/embedded/bin!
+ if RbConfig::CONFIG["bindir"] =~ %r{/(opscode|chef|chefdk)/embedded/bin}
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
# Omnibus installs to a static path because of linking on unix, find it.
true
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index 7b291d5f00..c3fd3f69ec 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -28,7 +28,7 @@ class Chef
class Package
class Yum < Chef::Provider::Package
- provides :package, platform_family: %w(rhel fedora)
+ provides :package, platform_family: %w{rhel fedora}
provides :yum_package, os: "linux"
class RPMUtils
diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb
index 1c0738112a..6e1d0b4064 100644
--- a/lib/chef/provider/service.rb
+++ b/lib/chef/provider/service.rb
@@ -205,7 +205,7 @@ class Chef
Chef.set_provider_priority_array :service, [ Systemd, Arch ], platform_family: "arch"
Chef.set_provider_priority_array :service, [ Systemd, Gentoo ], platform_family: "gentoo"
Chef.set_provider_priority_array :service, [ Systemd, Upstart, Insserv, Debian, Invokercd ], platform_family: "debian"
- Chef.set_provider_priority_array :service, [ Systemd, Insserv, Redhat ], platform_family: %w(rhel fedora suse)
+ Chef.set_provider_priority_array :service, [ Systemd, Insserv, Redhat ], platform_family: %w{rhel fedora suse}
end
end
end
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index 9d80f5f924..559ad48418 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -109,7 +109,7 @@ class Chef
priority.each { |runlevel, arguments|
Chef::Log.debug("#{new_resource} runlevel #{runlevel}, action #{arguments[0]}, priority #{arguments[1]}")
# if we are in a update-rc.d default startup runlevel && we start in this runlevel
- if %w[ 1 2 3 4 5 S ].include?(runlevel) && arguments[0] == :start
+ if %w{ 1 2 3 4 5 S }.include?(runlevel) && arguments[0] == :start
enabled = true
end
}
diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb
index 87527599b0..1c4d294053 100644
--- a/lib/chef/provider/service/insserv.rb
+++ b/lib/chef/provider/service/insserv.rb
@@ -24,7 +24,7 @@ class Chef
class Service
class Insserv < Chef::Provider::Service::Init
- provides :service, platform_family: %w(debian rhel fedora suse) do |node|
+ provides :service, platform_family: %w{debian rhel fedora suse} do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:insserv)
end
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index f93cd36348..9cc4258b70 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -28,7 +28,7 @@ class Chef
# @api private
attr_accessor :current_run_levels
- provides :service, platform_family: %w(rhel fedora suse) do |node|
+ provides :service, platform_family: %w{rhel fedora suse} do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:redhat)
end
diff --git a/lib/chef/provider/user/aix.rb b/lib/chef/provider/user/aix.rb
index a575a41e54..83bd900f79 100644
--- a/lib/chef/provider/user/aix.rb
+++ b/lib/chef/provider/user/aix.rb
@@ -18,7 +18,7 @@ class Chef
class Provider
class User
class Aix < Chef::Provider::User::Useradd
- provides :user, platform: %w(aix)
+ provides :user, platform: %w{aix}
UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:shell, "-s"], [:uid, "-u"]]
diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb
index 37890bdc1e..60df7d55f8 100644
--- a/lib/chef/provider/user/pw.rb
+++ b/lib/chef/provider/user/pw.rb
@@ -22,7 +22,7 @@ class Chef
class Provider
class User
class Pw < Chef::Provider::User
- provides :user, platform: %w(freebsd)
+ provides :user, platform: %w{freebsd}
def load_current_resource
super
diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb
index d9108d4ca4..18f44523ff 100644
--- a/lib/chef/provider/user/solaris.rb
+++ b/lib/chef/provider/user/solaris.rb
@@ -24,7 +24,7 @@ class Chef
class Provider
class User
class Solaris < Chef::Provider::User::Useradd
- provides :user, platform: %w(omnios solaris2)
+ provides :user, platform: %w{omnios solaris2}
UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:shell, "-s"], [:uid, "-u"]]
attr_writer :password_file
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb
index b5659c8a25..6d3f53c6d5 100644
--- a/lib/chef/run_context.rb
+++ b/lib/chef/run_context.rb
@@ -600,7 +600,7 @@ ERROR_MESSAGE
#
class ChildRunContext < RunContext
extend Forwardable
- def_delegators :parent_run_context, *%w(
+ def_delegators :parent_run_context, *%w{
cancel_reboot
config
cookbook_collection
@@ -627,7 +627,7 @@ ERROR_MESSAGE
request_reboot
resolve_attribute
unreachable_cookbook?
- )
+ }
def initialize(parent_run_context)
@parent_run_context = parent_run_context
@@ -638,7 +638,7 @@ ERROR_MESSAGE
initialize_child_state
end
- CHILD_STATE = %w(
+ CHILD_STATE = %w{
audits
audits=
create_child
@@ -660,7 +660,7 @@ ERROR_MESSAGE
parent_run_context
resource_collection
resource_collection=
- ).map { |x| x.to_sym }
+ }.map { |x| x.to_sym }
# Verify that we didn't miss any methods
missing_methods = superclass.instance_methods(false) - instance_methods(false) - CHILD_STATE
diff --git a/lib/chef/tasks/chef_repo.rake b/lib/chef/tasks/chef_repo.rake
index 977f8eb67c..6dce0a5f70 100644
--- a/lib/chef/tasks/chef_repo.rake
+++ b/lib/chef/tasks/chef_repo.rake
@@ -172,23 +172,23 @@ namespace :databag do
end
def deprecation_notice
- %Q[*************************************************
+ %Q{*************************************************
NOTICE: Chef Repository Rake Tasks Are Deprecated
*************************************************
-]
+}
end
def deprecated_cookbook_upload
- %Q[
+ %Q{
The `upload_cookbook` and `upload_cookbooks` rake tasks are not
recommended. These tasks are replaced by other, better workflow
tools, such as `knife cookbook upload`, `knife upload`, or `berks`
-]
+}
end
def deprecated_data_bag_creation
- %Q[
+ %Q{
The `data_bags:create` and `data_bags:create_item` tasks are not
recommended. You should create data bag items as JSON files in the data_bags
directory, with a sub-directory for each bag, and use `knife upload` to
@@ -197,5 +197,5 @@ upload them. For example, if you have a data bags named `users`, with
./data_bags/users/finn.json
./data-bags/users/jake.json
-]
+}
end
diff --git a/lib/chef/version_constraint.rb b/lib/chef/version_constraint.rb
index f30512c3cf..ef0849a120 100644
--- a/lib/chef/version_constraint.rb
+++ b/lib/chef/version_constraint.rb
@@ -19,8 +19,8 @@ require "chef/version_class"
class Chef
class VersionConstraint
DEFAULT_CONSTRAINT = ">= 0.0.0"
- STANDARD_OPS = %w(< > <= >=)
- OPS = %w(< > = <= >= ~>)
+ STANDARD_OPS = %w{< > <= >=}
+ OPS = %w{< > = <= >= ~>}
PATTERN = /^(#{OPS.join('|')}) *([0-9].*)$/
VERSION_CLASS = Chef::Version
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb
index 8b888ddf6a..c9f17f9702 100644
--- a/spec/functional/resource/deploy_revision_spec.rb
+++ b/spec/functional/resource/deploy_revision_spec.rb
@@ -193,7 +193,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
it "restarts the application" do
expect(File).to exist(rel_path("current/restart.txt"))
- expect(actual_operations_order).to eq(%w[deploy_to_latest_rev])
+ expect(actual_operations_order).to eq(%w{deploy_to_latest_rev})
end
it "is marked as updated" do
@@ -214,7 +214,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:latest_rev)
it "restarts the application after rolling back" do
- expect(actual_operations_order).to eq(%w[deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again})
end
it "is marked updated" do
@@ -248,7 +248,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
it "restarts the application" do
expect(File).to exist(rel_path("current/restart.txt"))
- expect(actual_operations_order).to eq(%w[deploy_to_latest_rev])
+ expect(actual_operations_order).to eq(%w{deploy_to_latest_rev})
end
it "is marked as updated" do
@@ -265,7 +265,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:latest_rev)
it "does not restart the app" do
- expect(actual_operations_order).to eq(%w[deploy_to_latest_rev])
+ expect(actual_operations_order).to eq(%w{deploy_to_latest_rev})
end
it "is not marked updated" do
@@ -283,7 +283,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:latest_rev)
it "restarts the app" do
- expect(actual_operations_order).to eq(%w[deploy_to_latest_rev deploy_to_latest_rev_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_latest_rev deploy_to_latest_rev_again})
end
it "is marked updated" do
@@ -301,7 +301,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:latest_rev)
it "restarts the application after the new deploy" do
- expect(actual_operations_order).to eq(%w[deploy_to_previous_rev deploy_to_latest_rev])
+ expect(actual_operations_order).to eq(%w{deploy_to_previous_rev deploy_to_latest_rev})
end
it "is marked updated" do
@@ -324,7 +324,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:latest_rev)
it "restarts the application after rolling back" do
- expect(actual_operations_order).to eq(%w[deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_latest_rev deploy_to_previous_rev deploy_to_latest_rev_again})
end
it "is marked updated" do
@@ -349,7 +349,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:previous_rev)
it "restarts the application after rolling back" do
- expect(actual_operations_order).to eq(%w[deploy_to_previous_rev deploy_to_latest_rev deploy_to_latest_rev_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_previous_rev deploy_to_latest_rev deploy_to_latest_rev_again})
end
it "is marked updated" do
@@ -392,7 +392,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:previous_rev)
it "restarts the application after rolling back" do
- expect(actual_operations_order).to eq(%w[deploy_to_previous_rev deploy_to_latest_rev deploy_to_previous_rev_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_previous_rev deploy_to_latest_rev deploy_to_previous_rev_again})
end
it "is marked updated" do
@@ -437,7 +437,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:second_rev)
it "restarts the application after rolling back" do
- expect(actual_operations_order).to eq(%w[deploy_to_second_rev deploy_to_previous_rev deploy_to_previous_rev_again deploy_to_latest_rev deploy_to_latest_rev_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_second_rev deploy_to_previous_rev deploy_to_previous_rev_again deploy_to_latest_rev deploy_to_latest_rev_again})
end
it "is marked updated" do
@@ -474,7 +474,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
the_app_is_deployed_at_revision(:second_rev)
it "restarts the application after rolling back" do
- expect(actual_operations_order).to eq(%w[deploy_to_second_rev deploy_to_previous_rev deploy_to_second_rev_again deploy_to_latest_rev deploy_to_second_rev_again_again])
+ expect(actual_operations_order).to eq(%w{deploy_to_second_rev deploy_to_previous_rev deploy_to_second_rev_again deploy_to_latest_rev deploy_to_second_rev_again_again})
end
it "is marked updated" do
@@ -689,7 +689,7 @@ describe Chef::Resource::DeployRevision, :unix_only => true do
end
it "runs migrations in between the before_migrate and before_symlink steps" do
- expect(actual_operations_order).to eq(%w[before_migrate migration before_symlink before_restart after_restart])
+ expect(actual_operations_order).to eq(%w{before_migrate migration before_symlink before_restart after_restart})
end
end
diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index 5ab6a403da..9335aa8505 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -644,7 +644,7 @@ describe Chef::Provider::User::Useradd, metadata do
context "and has no password" do
# TODO: platform_family should be setup in spec_helper w/ tags
- if %w[suse opensuse].include?(OHAI_SYSTEM["platform_family"])
+ if %w{suse opensuse}.include?(OHAI_SYSTEM["platform_family"])
# suse gets this right:
it "errors out trying to unlock the user" do
expect(@error).to be_a(Mixlib::ShellOut::ShellCommandFailed)
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 0ca784d468..d08935d854 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -48,7 +48,7 @@ describe "chef-client" do
# cf. CHEF-4914
let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
- let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(" ") }
+ let(:critical_env_vars) { %w{PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH}.map {|o| "#{o}=#{ENV[o]}"} .join(" ") }
when_the_repository "has a cookbook with a no-op recipe" do
before { file "cookbooks/x/recipes/default.rb", "" }
diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb
index e8e8753731..5fa1d604db 100644
--- a/spec/integration/client/ipv6_spec.rb
+++ b/spec/integration/client/ipv6_spec.rb
@@ -76,7 +76,7 @@ END_CLIENT_RB
let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") }
- let(:chef_client_cmd) { %Q[ruby '#{chef_dir}/chef-client' --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn] }
+ let(:chef_client_cmd) { %Q{ruby '#{chef_dir}/chef-client' --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} }
after do
FileUtils.rm_rf(cache_path)
diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb
index b5c86d7a00..2795db0a7b 100644
--- a/spec/integration/knife/chef_repo_path_spec.rb
+++ b/spec/integration/knife/chef_repo_path_spec.rb
@@ -81,7 +81,7 @@ EOM
context "when all _paths are set to alternates" do
before :each do
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2")
end
Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
@@ -162,7 +162,7 @@ EOM
context "when all _paths except chef_repo_path are set to alternates" do
before :each do
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2")
end
end
@@ -218,7 +218,7 @@ EOM
context "when only chef_repo_path is set to its alternate" do
before :each do
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
@@ -275,7 +275,7 @@ EOM
context "when paths are set to point to both versions of each" do
before :each do
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = [
File.join(Chef::Config.chef_repo_path, "#{object_name}s"),
File.join(Chef::Config.chef_repo_path, "#{object_name}s2"),
@@ -511,7 +511,7 @@ EOM
context "when when chef_repo_path is set to both places and no other _path is set" do
before :each do
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.chef_repo_path = [
@@ -613,7 +613,7 @@ EOM
context "when cookbook_path is set and nothing else" do
before :each do
- %w(client data_bag environment node role user).each do |object_name|
+ %w{client data_bag environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
@@ -671,7 +671,7 @@ EOM
context "when cookbook_path is set to multiple places and nothing else is set" do
before :each do
- %w(client data_bag environment node role user).each do |object_name|
+ %w{client data_bag environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
@@ -774,7 +774,7 @@ EOM
context "when data_bag_path and chef_repo_path are set, and nothing else" do
before :each do
- %w(client cookbook environment node role user).each do |object_name|
+ %w{client cookbook environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.data_bag_path = File.join(Chef::Config.chef_repo_path, "data_bags")
@@ -834,7 +834,7 @@ EOM
include_context "default config options"
before :each do
- %w(client cookbook environment node role user).each do |object_name|
+ %w{client cookbook environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
@@ -871,7 +871,7 @@ EOM
when_the_repository "is empty" do
context "when the repository _paths point to places that do not exist" do
before :each do
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "nowhere", object_name)
end
Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "nowhere")
diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb
index 8348c601aa..a27d1d6b72 100644
--- a/spec/integration/knife/deps_spec.rb
+++ b/spec/integration/knife/deps_spec.rb
@@ -33,7 +33,7 @@ describe "knife deps", :workstation do
when_the_repository "has a role with a default run_list" do
before do
- file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "roles/starring.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} }
file "roles/minor.json", {}
file "cookbooks/quiche/metadata.rb", 'name "quiche"'
file "cookbooks/quiche/recipes/default.rb", ""
@@ -52,7 +52,7 @@ EOM
when_the_repository "has a role with an env_run_list" do
before do
- file "roles/starring.json", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
+ file "roles/starring.json", { "env_run_lists" => { "desert" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } }
file "roles/minor.json", {}
file "cookbooks/quiche/metadata.rb", 'name "quiche"'
file "cookbooks/quiche/recipes/default.rb", ""
@@ -91,7 +91,7 @@ EOM
file "cookbooks/quiche/recipes/default.rb", ""
file "cookbooks/soup/metadata.rb", 'name "soup"'
file "cookbooks/soup/recipes/chicken.rb", ""
- file "nodes/mort.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "nodes/mort.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} }
end
it "knife deps reports just the node" do
knife("deps /nodes/mort.json").should_succeed <<EOM
@@ -136,7 +136,7 @@ depends "kettle"'
end
when_the_repository "has a deep dependency tree" do
before do
- file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "roles/starring.json", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} }
file "roles/minor.json", {}
file "cookbooks/quiche/metadata.rb", 'name "quiche"'
file "cookbooks/quiche/recipes/default.rb", ""
@@ -376,7 +376,7 @@ EOM
when_the_chef_server "has a role with a default run_list" do
before do
- role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "starring", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} }
role "minor", {}
cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
@@ -393,7 +393,7 @@ EOM
when_the_chef_server "has a role with an env_run_list" do
before do
- role "starring", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
+ role "starring", { "env_run_lists" => { "desert" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} } }
role "minor", {}
cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
@@ -428,7 +428,7 @@ EOM
role "minor", {}
cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
- node "mort", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ node "mort", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} }
end
it "knife deps reports just the node" do
knife("deps --remote /nodes/mort.json").should_succeed <<EOM
@@ -471,7 +471,7 @@ depends "kettle"', "recipes" => { "default.rb" => "" } }
end
when_the_chef_server "has a deep dependency tree" do
before do
- role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "starring", { "run_list" => %w{role[minor] recipe[quiche] recipe[soup::chicken]} }
role "minor", {}
cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2d95ddcae9..e69d61a7b3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -51,7 +51,7 @@ require "chef/knife"
Dir["lib/chef/knife/**/*.rb"].
map {|f| f.gsub("lib/", "") }.
- map {|f| f.gsub(%r[\.rb$], "") }.
+ map {|f| f.gsub(%r{\.rb$}, "") }.
each {|f| require f }
require "chef/resource_resolver"
@@ -82,7 +82,7 @@ Dir["spec/support/**/*.rb"].
reject { |f| f =~ %r{^spec/support/platforms} }.
reject { |f| f =~ %r{^spec/support/pedant} }.
map { |f| f.gsub(%r{.rb$}, "") }.
- map { |f| f.gsub(%r[spec/], "")}.
+ map { |f| f.gsub(%r{spec/}, "")}.
each { |f| require f }
OHAI_SYSTEM = Ohai::System.new
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb
index a19c9b35e7..6d3e3d3f5e 100644
--- a/spec/support/shared/integration/integration_helper.rb
+++ b/spec/support/shared/integration/integration_helper.rb
@@ -113,7 +113,7 @@ module IntegrationSupport
raise "Can only create one directory per test" if @repository_dir
@repository_dir = Dir.mktmpdir("chef_repo")
Chef::Config.chef_repo_path = @repository_dir
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
end
@@ -121,7 +121,7 @@ module IntegrationSupport
after :each do
if @repository_dir
begin
- %w(client cookbook data_bag environment node role user).each do |object_name|
+ %w{client cookbook data_bag environment node role user}.each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
index 07fe1f772b..b4d640d046 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -108,7 +108,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
it "should set -m -d /homedir" do
- expect(provider.universal_options).to eq(%w[-d /wowaweea -m])
+ expect(provider.universal_options).to eq(%w{-d /wowaweea -m})
expect(provider.useradd_options).to eq([])
end
end
@@ -121,7 +121,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
it "should set -m -d /homedir" do
- expect(provider.universal_options).to eql(%w[-d /wowaweea -m])
+ expect(provider.universal_options).to eql(%w{-d /wowaweea -m})
expect(provider.useradd_options).to eq([])
end
end
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index 6ff9597b53..67ef77615e 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -51,7 +51,7 @@ describe Chef::Application::Client, "reconfigure" do
context "when given a named_run_list" do
before do
- ARGV.replace( %w[ --named-run-list arglebargle-example ] )
+ ARGV.replace( %w{ --named-run-list arglebargle-example } )
app.reconfigure
end
diff --git a/spec/unit/chef_fs/data_handler/group_handler_spec.rb b/spec/unit/chef_fs/data_handler/group_handler_spec.rb
index 7cbd0e4c22..230fb7bd36 100644
--- a/spec/unit/chef_fs/data_handler/group_handler_spec.rb
+++ b/spec/unit/chef_fs/data_handler/group_handler_spec.rb
@@ -36,16 +36,16 @@ describe Chef::ChefFS::DataHandler::GroupDataHandler do
let(:group) do
{ "name" => "worker_bees",
- "clients" => %w(honey sting),
- "users" => %w(fizz buzz),
- "actors" => %w(honey),
+ "clients" => %w{honey sting},
+ "users" => %w{fizz buzz},
+ "actors" => %w{honey},
}
end
let(:normalized) do
{ "actors" =>
- { "users" => %w(fizz buzz),
- "clients"=> %w(honey sting),
+ { "users" => %w{fizz buzz},
+ "clients"=> %w{honey sting},
"groups"=> [],
},
"groupname" => "workers",
diff --git a/spec/unit/chef_fs/parallelizer.rb b/spec/unit/chef_fs/parallelizer.rb
index 0d667098a8..8f6f9e71fc 100644
--- a/spec/unit/chef_fs/parallelizer.rb
+++ b/spec/unit/chef_fs/parallelizer.rb
@@ -45,7 +45,7 @@ describe Chef::ChefFS::Parallelizer do
expect(parallelize(1.upto(10), :ordered => false) do |i|
sleep 0.2
"x"
- end.to_a).to eq(%w(x x x x x x x x x x))
+ end.to_a).to eq(%w{x x x x x x x x x x})
expect(elapsed_time).to be < 0.5
end
@@ -117,7 +117,7 @@ describe Chef::ChefFS::Parallelizer do
expect(parallelize(1.upto(10), :ordered => true) do |i|
sleep 0.2
"x"
- end.to_a).to eq(%w(x x x x x x x x x x))
+ end.to_a).to eq(%w{x x x x x x x x x x})
expect(elapsed_time).to be < 0.5
end
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 8ac62cce2b..3b4d23da6e 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -38,7 +38,7 @@ describe Chef::Client do
end
it "runs ohai with only the minimum required plugins" do
- expected_filter = %w[fqdn machinename hostname platform platform_version os os_version]
+ expected_filter = %w{fqdn machinename hostname platform platform_version os os_version}
expect(ohai_system).to receive(:all_plugins).with(expected_filter)
client.run_ohai
end
diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb
index 417087d9a3..794940c39a 100644
--- a/spec/unit/config_fetcher_spec.rb
+++ b/spec/unit/config_fetcher_spec.rb
@@ -7,7 +7,7 @@ describe Chef::ConfigFetcher do
let(:http) { double("Chef::HTTP::Simple") }
let(:config_location_regex) { Regexp.escape(config_location) }
- let(:invalid_json_error_regex) { %r[Could not parse the provided JSON file \(#{config_location_regex}\)] }
+ let(:invalid_json_error_regex) { %r{Could not parse the provided JSON file \(#{config_location_regex}\)} }
let(:fetcher) { Chef::ConfigFetcher.new(config_location) }
diff --git a/spec/unit/cookbook/chefignore_spec.rb b/spec/unit/cookbook/chefignore_spec.rb
index 9d81981dcf..89ab53b26d 100644
--- a/spec/unit/cookbook/chefignore_spec.rb
+++ b/spec/unit/cookbook/chefignore_spec.rb
@@ -23,12 +23,12 @@ describe Chef::Cookbook::Chefignore do
end
it "loads the globs in the chefignore file" do
- expect(@chefignore.ignores).to match_array(%w[recipes/ignoreme.rb ignored])
+ expect(@chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored})
end
it "removes items from an array that match the ignores" do
- file_list = %w[ recipes/ignoreme.rb recipes/dontignoreme.rb ]
- expect(@chefignore.remove_ignores_from(file_list)).to eq(%w[recipes/dontignoreme.rb])
+ file_list = %w{ recipes/ignoreme.rb recipes/dontignoreme.rb }
+ expect(@chefignore.remove_ignores_from(file_list)).to eq(%w{recipes/dontignoreme.rb})
end
it "determines if a file is ignored" do
@@ -43,7 +43,7 @@ describe Chef::Cookbook::Chefignore do
end
it "loads the globs in the chefignore file" do
- expect(@chefignore.ignores).to match_array(%w[recipes/ignoreme.rb ignored vendor/bundle/*])
+ expect(@chefignore.ignores).to match_array(%w{recipes/ignoreme.rb ignored vendor/bundle/*})
end
end
end
diff --git a/spec/unit/cookbook/file_vendor_spec.rb b/spec/unit/cookbook/file_vendor_spec.rb
index 2420718dea..134e8d7e25 100644
--- a/spec/unit/cookbook/file_vendor_spec.rb
+++ b/spec/unit/cookbook/file_vendor_spec.rb
@@ -68,7 +68,7 @@ describe Chef::Cookbook::FileVendor do
context "when configured to load files from disk" do
- let(:cookbook_path) { %w[/var/chef/cookbooks /var/chef/other_cookbooks] }
+ let(:cookbook_path) { %w{/var/chef/cookbooks /var/chef/other_cookbooks} }
# A manifest is a Hash of the format defined by Chef::CookbookVersion#manifest
let(:manifest) { {:cookbook_name => "bob"} }
diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb
index 17803a8392..d8f7f7d293 100644
--- a/spec/unit/cookbook/synchronizer_spec.rb
+++ b/spec/unit/cookbook/synchronizer_spec.rb
@@ -123,7 +123,7 @@ describe Chef::CookbookSynchronizer do
end
it "lists the cookbook names" do
- expect(synchronizer.cookbook_names).to eq(%w[cookbook_a])
+ expect(synchronizer.cookbook_names).to eq(%w{cookbook_a})
end
it "lists the cookbook manifests" do
diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb
index 856dc00006..0e330b2130 100644
--- a/spec/unit/cookbook_version_spec.rb
+++ b/spec/unit/cookbook_version_spec.rb
@@ -285,7 +285,7 @@ describe Chef::CookbookVersion do
@cbv = Chef::CookbookVersion.new("version validation", "/tmp/blah")
end
it "should accept valid cookbook versions" do
- good_versions = %w(1.2 1.2.3 1000.80.50000 0.300.25)
+ good_versions = %w{1.2 1.2.3 1000.80.50000 0.300.25}
good_versions.each do |v|
@cbv.version = v
end
diff --git a/spec/unit/dsl/data_query_spec.rb b/spec/unit/dsl/data_query_spec.rb
index 34d4cfdba3..22cb3f2db6 100644
--- a/spec/unit/dsl/data_query_spec.rb
+++ b/spec/unit/dsl/data_query_spec.rb
@@ -37,7 +37,7 @@ describe Chef::DSL::DataQuery do
allow(Chef::DataBag).to receive(:load)
.with("bag_name")
.and_return("item_1" => "http://url_for/item_1", "item_2" => "http://url_for/item_2")
- expect( language.data_bag("bag_name").sort ).to eql %w(item_1 item_2)
+ expect( language.data_bag("bag_name").sort ).to eql %w{item_1 item_2}
end
end
diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb
index 0f3ee17872..04f54688de 100644
--- a/spec/unit/environment_spec.rb
+++ b/spec/unit/environment_spec.rb
@@ -317,7 +317,7 @@ describe Chef::Environment do
it "validates the name given in the params" do
expect(@environment.update_from_params(:name => "@$%^&*()")).to be_falsey
- expect(@environment.invalid_fields[:name]).to eq(%q|Option name's value @$%^&*() does not match regular expression /^[\-[:alnum:]_]+$/|)
+ expect(@environment.invalid_fields[:name]).to eq(%q{Option name's value @$%^&*() does not match regular expression /^[\-[:alnum:]_]+$/})
end
it "updates the description from parameters[:description]" do
diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb
index 95124b5e8f..b361b5e419 100644
--- a/spec/unit/key_spec.rb
+++ b/spec/unit/key_spec.rb
@@ -199,7 +199,7 @@ EOS
end
it "should include the actor value under the key relative to the actor_field_name passed" do
- expect(json).to include(%Q("#{new_key.actor_field_name}":"original_actor"))
+ expect(json).to include(%Q{"#{new_key.actor_field_name}":"original_actor"})
end
it "should include the name field when present" do
@@ -213,7 +213,7 @@ EOS
it "should include the public_key field when present" do
new_key.public_key "this_public_key"
- expect(new_key.to_json).to include(%q("public_key":"this_public_key"))
+ expect(new_key.to_json).to include(%q{"public_key":"this_public_key"})
end
it "should not include the public_key if not present" do
@@ -222,7 +222,7 @@ EOS
it "should include the private_key field when present" do
new_key.private_key "this_public_key"
- expect(new_key.to_json).to include(%q("private_key":"this_public_key"))
+ expect(new_key.to_json).to include(%q{"private_key":"this_public_key"})
end
it "should not include the private_key if not present" do
@@ -231,7 +231,7 @@ EOS
it "should include the expiration_date field when present" do
new_key.expiration_date "2020-12-24T21:00:00Z"
- expect(new_key.to_json).to include(%Q("expiration_date":"2020-12-24T21:00:00Z"))
+ expect(new_key.to_json).to include(%Q{"expiration_date":"2020-12-24T21:00:00Z"})
end
it "should not include the expiration_date if not present" do
@@ -240,7 +240,7 @@ EOS
it "should include the create_key field when present" do
new_key.create_key true
- expect(new_key.to_json).to include(%q("create_key":true))
+ expect(new_key.to_json).to include(%q{"create_key":true})
end
it "should not include the create_key if not present" do
diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb
index 791b84b9c3..ee6b1a1ffa 100644
--- a/spec/unit/knife/bootstrap/client_builder_spec.rb
+++ b/spec/unit/knife/bootstrap/client_builder_spec.rb
@@ -161,11 +161,11 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
it "adds tags to the node when given" do
tag_receiver = []
- knife_config[:tags] = %w[foo bar]
+ knife_config[:tags] = %w{foo bar}
allow(node).to receive(:run_list).with([])
allow(node).to receive(:tags).and_return(tag_receiver)
client_builder.run
- expect(tag_receiver).to eq %w[foo bar]
+ expect(tag_receiver).to eq %w{foo bar}
end
it "builds a node when the run_list is a string" do
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index c64b2e49ea..0f9e6e3c39 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -426,7 +426,7 @@ describe Chef::Knife::Bootstrap do
context "when only policy_name is given" do
- let(:bootstrap_cli_options) { %w[ --policy-name my-app-server ] }
+ let(:bootstrap_cli_options) { %w{ --policy-name my-app-server } }
it "returns an error stating that policy_name and policy_group must be given together" do
expect { knife.validate_options! }.to raise_error(SystemExit)
@@ -437,7 +437,7 @@ describe Chef::Knife::Bootstrap do
context "when only policy_group is given" do
- let(:bootstrap_cli_options) { %w[ --policy-group staging ] }
+ let(:bootstrap_cli_options) { %w{ --policy-group staging } }
it "returns an error stating that policy_name and policy_group must be given together" do
expect { knife.validate_options! }.to raise_error(SystemExit)
@@ -448,7 +448,7 @@ describe Chef::Knife::Bootstrap do
context "when both policy_name and policy_group are given, but run list is also given" do
- let(:bootstrap_cli_options) { %w[ --policy-name my-app --policy-group staging --run-list cookbook ] }
+ let(:bootstrap_cli_options) { %w{ --policy-name my-app --policy-group staging --run-list cookbook } }
it "returns an error stating that policyfile and run_list are exclusive" do
expect { knife.validate_options! }.to raise_error(SystemExit)
@@ -459,7 +459,7 @@ describe Chef::Knife::Bootstrap do
context "when policy_name and policy_group are given with no conflicting options" do
- let(:bootstrap_cli_options) { %w[ --policy-name my-app --policy-group staging ] }
+ let(:bootstrap_cli_options) { %w{ --policy-name my-app --policy-group staging } }
it "passes options validation" do
expect { knife.validate_options! }.to_not raise_error
diff --git a/spec/unit/knife/core/gem_glob_loader_spec.rb b/spec/unit/knife/core/gem_glob_loader_spec.rb
index 671fabf695..de632f23c1 100644
--- a/spec/unit/knife/core/gem_glob_loader_spec.rb
+++ b/spec/unit/knife/core/gem_glob_loader_spec.rb
@@ -40,7 +40,7 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
it "finds files installed via rubygems" do
expect(loader.find_subcommands_via_rubygems).to include("chef/knife/node_create")
- loader.find_subcommands_via_rubygems.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])}
+ loader.find_subcommands_via_rubygems.each {|rel_path, abs_path| expect(abs_path).to match(%r{chef/knife/.+})}
end
it "finds files from latest version of installed gems" do
@@ -65,7 +65,7 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
it "finds files using a dirglob when rubygems is not available" do
expect(loader.find_subcommands_via_dirglob).to include("chef/knife/node_create")
- loader.find_subcommands_via_dirglob.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])}
+ loader.find_subcommands_via_dirglob.each {|rel_path, abs_path| expect(abs_path).to match(%r{chef/knife/.+})}
end
it "finds user-specific subcommands in the user's ~/.chef directory" do
diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb
index 2c1beb6ccb..e64faebf6b 100644
--- a/spec/unit/knife/core/node_editor_spec.rb
+++ b/spec/unit/knife/core/node_editor_spec.rb
@@ -29,7 +29,7 @@ describe Chef::Knife::NodeEditor do
"override" => { "alpha" => { "bravo" => "foxtrot", "delta" => "golf" } },
"policy_name" => nil,
"policy_group" => nil,
- "run_list" => %w(role[comedy] role[drama] recipe[mystery]),
+ "run_list" => %w{role[comedy] role[drama] recipe[mystery]},
}
end
@@ -45,8 +45,8 @@ describe Chef::Knife::NodeEditor do
it "returns a Hash with only the name, chef_environment, normal, " +
"policy_name, policy_group, and run_list properties" do
expected = node_data.select do |key,|
- %w[ name chef_environment normal
- policy_name policy_group run_list ].include?(key)
+ %w{ name chef_environment normal
+ policy_name policy_group run_list }.include?(key)
end
expect(subject.view).to eq(expected)
@@ -91,7 +91,7 @@ describe Chef::Knife::NodeEditor do
"normal" => { "alpha" => { "bravo" => "hotel2" }, "tags" => [ "xyz" ] },
"policy_name" => "mypolicy",
"policy_group" => "prod",
- "run_list" => %w(role[drama] recipe[mystery]),
+ "run_list" => %w{role[drama] recipe[mystery]},
)
end
@@ -123,7 +123,7 @@ describe Chef::Knife::NodeEditor do
"override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } },
"policy_name" => "mypolicy",
"policy_group" => "prod",
- "run_list" => %w(role[drama] recipe[mystery]),
+ "run_list" => %w{role[drama] recipe[mystery]},
)
end
@@ -159,7 +159,7 @@ describe Chef::Knife::NodeEditor do
"override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } },
"policy_name" => "mypolicy",
"policy_group" => "prod",
- "run_list" => %w(role[drama] recipe[mystery]),
+ "run_list" => %w{role[drama] recipe[mystery]},
)
end
@@ -173,7 +173,7 @@ describe Chef::Knife::NodeEditor do
end
it "returns an array of the changed property names" do
- expect(subject.updated?).to eql %w[ normal policy_name policy_group run_list ]
+ expect(subject.updated?).to eql %w{ normal policy_name policy_group run_list }
end
end
@@ -190,7 +190,7 @@ describe Chef::Knife::NodeEditor do
it 'returns an array of property names that doesn\'t include ' +
"the non-editable properties" do
- expect(subject.updated?).to eql %w[ normal policy_name policy_group run_list ]
+ expect(subject.updated?).to eql %w{ normal policy_name policy_group run_list }
end
end
end
diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb
index 427d3e4d1b..76f041bcb3 100644
--- a/spec/unit/knife/data_bag_show_spec.rb
+++ b/spec/unit/knife/data_bag_show_spec.rb
@@ -70,9 +70,9 @@ describe Chef::Knife::DataBagShow do
expect(knife.ui).to receive(:info).with("Encrypted data bag detected, decrypting with provided secret.")
expect(Chef::EncryptedDataBagItem).to receive(:load).with(bag_name, item_name, secret).and_return(enc_data_bag)
- expected = %q|baz: http://localhost:4000/data/bag_o_data/baz
+ expected = %q{baz: http://localhost:4000/data/bag_o_data/baz
id: id
-qux: http://localhost:4000/data/bag_o_data/qux|
+qux: http://localhost:4000/data/bag_o_data/qux}
knife.run
expect(stdout.string.strip).to eq(expected)
end
@@ -97,9 +97,9 @@ qux: http://localhost:4000/data/bag_o_data/qux|
expect(Chef::DataBagItem).to receive(:load).with(bag_name, item_name).and_return(data_bag)
expect(knife.ui).to receive(:info).with("Unencrypted data bag detected, ignoring any provided secret options.")
- expected = %q|baz: http://localhost:4000/data/bag_o_data/baz
+ expected = %q{baz: http://localhost:4000/data/bag_o_data/baz
id: id
-qux: http://localhost:4000/data/bag_o_data/qux|
+qux: http://localhost:4000/data/bag_o_data/qux}
knife.run
expect(stdout.string.strip).to eq(expected)
end
diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb
index 7106fdfc7b..da54ce87c3 100644
--- a/spec/unit/knife/node_bulk_delete_spec.rb
+++ b/spec/unit/knife/node_bulk_delete_spec.rb
@@ -44,7 +44,7 @@ describe Chef::Knife::NodeBulkDelete do
# I hate not having == defined for anything :(
actual = @knife.all_nodes
expect(actual.keys).to match_array(expected.keys)
- expect(actual.values.map {|n| n.name }).to match_array(%w[adam brent jacob])
+ expect(actual.values.map {|n| n.name }).to match_array(%w{adam brent jacob})
end
end
diff --git a/spec/unit/knife/tag_list_spec.rb b/spec/unit/knife/tag_list_spec.rb
index 97cd8e7efa..dceec9a5ea 100644
--- a/spec/unit/knife/tag_list_spec.rb
+++ b/spec/unit/knife/tag_list_spec.rb
@@ -14,7 +14,7 @@ describe Chef::Knife::TagList do
describe "run" do
it "can list tags on a node" do
- expected = %w(sadtag happytag)
+ expected = %w{sadtag happytag}
expect(@node.tags).to eq(expected)
expect(@knife).to receive(:output).with(expected)
@knife.run
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index 06892af905..a8b73212fe 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -311,7 +311,7 @@ describe Chef::Knife do
end
it "merges `listen` config to Chef::Config" do
- Chef::Knife.run(%w[test yourself --no-listen], Chef::Application::Knife.options)
+ Chef::Knife.run(%w{test yourself --no-listen}, Chef::Application::Knife.options)
expect(Chef::Config[:listen]).to be(false)
end
@@ -396,8 +396,8 @@ describe Chef::Knife do
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("403 Forbidden", response))
allow(knife).to receive(:username).and_return("sadpanda")
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: You authenticated successfully to http.+ as sadpanda but you are not authorized for this action])
- expect(stderr.string).to match(%r[Response: y u no administrator])
+ expect(stderr.string).to match(%r{ERROR: You authenticated successfully to http.+ as sadpanda but you are not authorized for this action})
+ expect(stderr.string).to match(%r{Response: y u no administrator})
end
it "formats 400s nicely" do
@@ -406,8 +406,8 @@ describe Chef::Knife do
allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "y u search wrong"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("400 Bad Request", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: The data in your request was invalid])
- expect(stderr.string).to match(%r[Response: y u search wrong])
+ expect(stderr.string).to match(%r{ERROR: The data in your request was invalid})
+ expect(stderr.string).to match(%r{Response: y u search wrong})
end
it "formats 404s nicely" do
@@ -416,8 +416,8 @@ describe Chef::Knife do
allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "nothing to see here"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("404 Not Found", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: The object you are looking for could not be found])
- expect(stderr.string).to match(%r[Response: nothing to see here])
+ expect(stderr.string).to match(%r{ERROR: The object you are looking for could not be found})
+ expect(stderr.string).to match(%r{Response: nothing to see here})
end
it "formats 406s (non-supported API version error) nicely" do
@@ -442,8 +442,8 @@ describe Chef::Knife do
allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sad trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("500 Internal Server Error", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: internal server error])
- expect(stderr.string).to match(%r[Response: sad trombone])
+ expect(stderr.string).to match(%r{ERROR: internal server error})
+ expect(stderr.string).to match(%r{Response: sad trombone})
end
it "formats 502s nicely" do
@@ -452,8 +452,8 @@ describe Chef::Knife do
allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sadder trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("502 Bad Gateway", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: bad gateway])
- expect(stderr.string).to match(%r[Response: sadder trombone])
+ expect(stderr.string).to match(%r{ERROR: bad gateway})
+ expect(stderr.string).to match(%r{Response: sadder trombone})
end
it "formats 503s nicely" do
@@ -462,8 +462,8 @@ describe Chef::Knife do
allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "saddest trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("503 Service Unavailable", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: Service temporarily unavailable])
- expect(stderr.string).to match(%r[Response: saddest trombone])
+ expect(stderr.string).to match(%r{ERROR: Service temporarily unavailable})
+ expect(stderr.string).to match(%r{Response: saddest trombone})
end
it "formats other HTTP errors nicely" do
@@ -472,24 +472,24 @@ describe Chef::Knife do
allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "nobugfixtillyoubuy"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("402 Payment Required", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: Payment Required])
- expect(stderr.string).to match(%r[Response: nobugfixtillyoubuy])
+ expect(stderr.string).to match(%r{ERROR: Payment Required})
+ expect(stderr.string).to match(%r{Response: nobugfixtillyoubuy})
end
it "formats NameError and NoMethodError nicely" do
allow(knife).to receive(:run).and_raise(NameError.new("Undefined constant FUUU"))
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: knife encountered an unexpected error])
- expect(stderr.string).to match(%r[This may be a bug in the 'knife' knife command or plugin])
- expect(stderr.string).to match(%r[Exception: NameError: Undefined constant FUUU])
+ expect(stderr.string).to match(%r{ERROR: knife encountered an unexpected error})
+ expect(stderr.string).to match(%r{This may be a bug in the 'knife' knife command or plugin})
+ expect(stderr.string).to match(%r{Exception: NameError: Undefined constant FUUU})
end
it "formats missing private key errors nicely" do
allow(knife).to receive(:run).and_raise(Chef::Exceptions::PrivateKeyMissing.new("key not there"))
allow(knife).to receive(:api_key).and_return("/home/root/.chef/no-key-here.pem")
knife.run_with_pretty_exceptions
- expect(stderr.string).to match(%r[ERROR: Your private key could not be loaded from /home/root/.chef/no-key-here.pem])
- expect(stderr.string).to match(%r[Check your configuration file and ensure that your private key is readable])
+ expect(stderr.string).to match(%r{ERROR: Your private key could not be loaded from /home/root/.chef/no-key-here.pem})
+ expect(stderr.string).to match(%r{Check your configuration file and ensure that your private key is readable})
end
it "formats connection refused errors nicely" do
@@ -498,8 +498,8 @@ describe Chef::Knife do
# Errno::ECONNREFUSED message differs by platform
# *nix = Errno::ECONNREFUSED: Connection refused
# win32: Errno::ECONNREFUSED: No connection could be made because the target machine actively refused it.
- expect(stderr.string).to match(%r[ERROR: Network Error: .* - y u no shut up])
- expect(stderr.string).to match(%r[Check your knife configuration and network settings])
+ expect(stderr.string).to match(%r{ERROR: Network Error: .* - y u no shut up})
+ expect(stderr.string).to match(%r{Check your knife configuration and network settings})
end
it "formats SSL errors nicely and suggests to use `knife ssl check` and `knife ssl fetch`" do
diff --git a/spec/unit/mixin/deep_merge_spec.rb b/spec/unit/mixin/deep_merge_spec.rb
index 1212ff2b53..a725fdecbc 100644
--- a/spec/unit/mixin/deep_merge_spec.rb
+++ b/spec/unit/mixin/deep_merge_spec.rb
@@ -304,25 +304,25 @@ describe Chef::Mixin::DeepMerge do
end
it "replaces arrays rather than merging them" do
- merge_ee_hash = {"top_level_a" => {"1_deep_a" => "1-a-merge-ee", "1_deep_b" => %w[A A A]}, "top_level_b" => "top-level-b-merge-ee"}
- merge_with_hash = {"top_level_a" => {"1_deep_b" => %w[B B B], "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" }
+ merge_ee_hash = {"top_level_a" => {"1_deep_a" => "1-a-merge-ee", "1_deep_b" => %w{A A A}}, "top_level_b" => "top-level-b-merge-ee"}
+ merge_with_hash = {"top_level_a" => {"1_deep_b" => %w{B B B}, "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" }
merged_result = @dm.hash_only_merge(merge_ee_hash, merge_with_hash)
expect(merged_result["top_level_b"]).to eq("top-level-b-merged-onto")
expect(merged_result["top_level_a"]["1_deep_a"]).to eq("1-a-merge-ee")
- expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w[B B B])
+ expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w{B B B})
end
it "replaces non-hash items with hashes when there's a conflict" do
merge_ee_hash = {"top_level_a" => "top-level-a-mergee", "top_level_b" => "top-level-b-merge-ee"}
- merge_with_hash = {"top_level_a" => {"1_deep_b" => %w[B B B], "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" }
+ merge_with_hash = {"top_level_a" => {"1_deep_b" => %w{B B B}, "1_deep_c" => "1-deep-c-merged-onto"}, "top_level_b" => "top-level-b-merged-onto" }
merged_result = @dm.hash_only_merge(merge_ee_hash, merge_with_hash)
expect(merged_result["top_level_a"]).to be_a(Hash)
expect(merged_result["top_level_a"]["1_deep_a"]).to be_nil
- expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w[B B B])
+ expect(merged_result["top_level_a"]["1_deep_b"]).to eq(%w{B B B})
end
it "does not mutate deeply-nested original hashes by default" do
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index dfa6f33122..1f962dfa3e 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -518,7 +518,7 @@ describe Chef::Node::Attribute do
describe "dup" do
it "array can be duped even if some elements can't" do
- @attributes.default[:foo] = %w[foo bar baz] + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ]
+ @attributes.default[:foo] = %w{foo bar baz} + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ]
@attributes.default[:foo].dup
end
end
diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb
index 07176beb76..097680b179 100644
--- a/spec/unit/node/immutable_collections_spec.rb
+++ b/spec/unit/node/immutable_collections_spec.rb
@@ -22,7 +22,7 @@ require "chef/node/immutable_collections"
describe Chef::Node::ImmutableMash do
before do
@data_in = {:top => {:second_level => "some value"},
- "top_level_2" => %w[array of values],
+ "top_level_2" => %w{array of values},
:top_level_3 => [{:hash_array => 1, :hash_array_b => 2}],
:top_level_4 => {:level2 => {:key => "value"}},
}
@@ -34,7 +34,7 @@ describe Chef::Node::ImmutableMash do
end
it "element references like a regular Mash" do
- expect(@immutable_mash[:top_level_2]).to eq(%w[array of values])
+ expect(@immutable_mash[:top_level_2]).to eq(%w{array of values})
end
it "converts Hash-like inputs into ImmutableMash's" do
@@ -112,7 +112,7 @@ end
describe Chef::Node::ImmutableArray do
before do
- @immutable_array = Chef::Node::ImmutableArray.new(%w[foo bar baz] + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ])
+ @immutable_array = Chef::Node::ImmutableArray.new(%w{foo bar baz} + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ])
immutable_mash = Chef::Node::ImmutableMash.new({:m => "m"})
@immutable_nested_array = Chef::Node::ImmutableArray.new(["level1",@immutable_array, immutable_mash])
end
diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb
index 409b5268ee..d994f463b7 100644
--- a/spec/unit/provider/package/rpm_spec.rb
+++ b/spec/unit/provider/package/rpm_spec.rb
@@ -287,7 +287,7 @@ describe Chef::Provider::Package::Rpm do
provider.process_resource_requirements
end
- %w(http HTTP https HTTPS ftp FTP file FILE).each do |scheme|
+ %w{http HTTP https HTTPS ftp FTP file FILE}.each do |scheme|
context "when the source URI uses protocol scheme '#{scheme}'" do
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index efbbdf6450..fc248122c9 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -2179,7 +2179,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
it "should set package_version if no existing package_name is found and new_package_name is available" do
@new_resource = Chef::Resource::Package.new(["cups = 1.2.4-11.18.el5_2.3", "emacs = 24.4"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
- allow(@yum_cache).to receive(:package_available?) { |pkg| %w(cups emacs).include?(pkg) ? true : false }
+ allow(@yum_cache).to receive(:package_available?) { |pkg| %w{cups emacs}.include?(pkg) ? true : false }
allow(@yum_cache).to receive(:candidate_version) do |pkg|
if pkg == "cups"
"1.2.4-11.18.el5_2.3"
diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb
index 0205df430c..1832445667 100644
--- a/spec/unit/provider/route_spec.rb
+++ b/spec/unit/provider/route_spec.rb
@@ -211,7 +211,7 @@ describe Chef::Provider::Route do
end
describe Chef::Provider::Route, "generate_config method" do
- %w[ centos redhat fedora ].each do |platform|
+ %w{ centos redhat fedora }.each do |platform|
it "should write a route file on #{platform} platform" do
@node.automatic_attrs[:platform] = platform
diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb
index 16befad5ca..cae2f96799 100644
--- a/spec/unit/provider_resolver_spec.rb
+++ b/spec/unit/provider_resolver_spec.rb
@@ -480,7 +480,7 @@ describe Chef::ProviderResolver do
end
end
- on_platform %w(freebsd netbsd), platform_version: "3.1.4" do
+ on_platform %w{freebsd netbsd}, platform_version: "3.1.4" do
it "returns a Freebsd provider if it finds the /usr/local/etc/rc.d initscript" do
stub_service_providers
stub_service_configs(:usr_local_etc_rcd)
@@ -648,7 +648,7 @@ describe Chef::ProviderResolver do
"suse" => {
"12.0" => {
},
- %w(11.1 11.2 11.3) => {
+ %w{11.1 11.2 11.3} => {
group: [ Chef::Resource::Group, Chef::Provider::Group::Suse ]
},
},
@@ -681,12 +681,12 @@ describe Chef::ProviderResolver do
package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ],
ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Redhat ],
- %w(amazon xcp xenserver ibm_powerkvm cloudlinux parallels) => {
+ %w{amazon xcp xenserver ibm_powerkvm cloudlinux parallels} => {
"3.1.4" => {
# service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
}
},
- %w(redhat centos scientific oracle) => {
+ %w{redhat centos scientific oracle} => {
"7.0" => {
},
"6.0" => {
@@ -705,7 +705,7 @@ describe Chef::ProviderResolver do
},
"darwin" => {
- %w(mac_os_x mac_os_x_server) => {
+ %w{mac_os_x mac_os_x_server} => {
group: [ Chef::Resource::Group, Chef::Provider::Group::Dscl ],
package: [ Chef::Resource::HomebrewPackage, Chef::Provider::Package::Homebrew ],
osx_profile: [ Chef::Resource::OsxProfile, Chef::Provider::OsxProfile],
@@ -732,7 +732,7 @@ describe Chef::ProviderResolver do
windows_service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ],
"windows" => {
- %w(mswin mingw32 windows) => {
+ %w{mswin mingw32 windows} => {
"10.9.2" => {
}
}
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb
index d247a1bb5e..6b96115cfc 100644
--- a/spec/unit/recipe_spec.rb
+++ b/spec/unit/recipe_spec.rb
@@ -367,7 +367,7 @@ describe Chef::Recipe do
it "gives a sane error message when using method_missing" do
expect do
recipe.no_such_resource("foo")
- end.to raise_error(NoMethodError, %q[No resource or method named `no_such_resource' for `Chef::Recipe "test"'])
+ end.to raise_error(NoMethodError, %q{No resource or method named `no_such_resource' for `Chef::Recipe "test"'})
end
it "gives a sane error message when using method_missing 'bare'" do
@@ -376,7 +376,7 @@ describe Chef::Recipe do
# Giving an argument will change this from NameError to NoMethodError
no_such_resource
end
- end.to raise_error(NameError, %q[No resource, method, or local variable named `no_such_resource' for `Chef::Recipe "test"'])
+ end.to raise_error(NameError, %q{No resource, method, or local variable named `no_such_resource' for `Chef::Recipe "test"'})
end
it "gives a sane error message when using build_resource" do
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 53d546d059..0994837622 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -417,7 +417,7 @@ describe Chef::Resource do
describe "is" do
it "should return the arguments passed with 'is'" do
zm = Chef::Resource::ZenMaster.new("coffee")
- expect(zm.is("one", "two", "three")).to eq(%w|one two three|)
+ expect(zm.is("one", "two", "three")).to eq(%w{one two three})
end
it "should allow arguments preceded by is to methods" do
diff --git a/spec/unit/rest_spec.rb b/spec/unit/rest_spec.rb
index ba5f837c07..8e6a3be79c 100644
--- a/spec/unit/rest_spec.rb
+++ b/spec/unit/rest_spec.rb
@@ -430,7 +430,7 @@ describe Chef::REST do
end
end
- %w[ HTTPFound HTTPMovedPermanently HTTPSeeOther HTTPUseProxy HTTPTemporaryRedirect HTTPMultipleChoice ].each do |resp_name|
+ %w{ HTTPFound HTTPMovedPermanently HTTPSeeOther HTTPUseProxy HTTPTemporaryRedirect HTTPMultipleChoice }.each do |resp_name|
describe "when encountering a #{resp_name} redirect" do
let(:http_response) do
resp_cls = Net.const_get(resp_name)
diff --git a/spec/unit/run_list/versioned_recipe_list_spec.rb b/spec/unit/run_list/versioned_recipe_list_spec.rb
index e1927f8310..a52c1818df 100644
--- a/spec/unit/run_list/versioned_recipe_list_spec.rb
+++ b/spec/unit/run_list/versioned_recipe_list_spec.rb
@@ -39,7 +39,7 @@ describe Chef::RunList::VersionedRecipeList do
describe "add_recipe" do
- let(:recipes) { %w[ apt god apache2 ] }
+ let(:recipes) { %w{ apt god apache2 } }
it "should append the recipe to the end of the list" do
list.add_recipe "rails"
@@ -130,20 +130,20 @@ describe Chef::RunList::VersionedRecipeList do
context "with bare cookbook names" do
- let(:recipes) { %w[ apache2 ] }
+ let(:recipes) { %w{ apache2 } }
it "gives $cookbook_name::default" do
- expect(fq_names).to eq( %w[ apache2::default ] )
+ expect(fq_names).to eq( %w{ apache2::default } )
end
end
context "with qualified recipe names but no versions" do
- let(:recipes) { %w[ mysql::server ] }
+ let(:recipes) { %w{ mysql::server } }
it "returns the qualified recipe names" do
- expect(fq_names).to eq( %w[ mysql::server ] )
+ expect(fq_names).to eq( %w{ mysql::server } )
end
end
diff --git a/spec/unit/version/platform_spec.rb b/spec/unit/version/platform_spec.rb
index 6c9720fe6d..5a6c9fde0e 100644
--- a/spec/unit/version/platform_spec.rb
+++ b/spec/unit/version/platform_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Version::Platform do
end
describe "when creating valid Versions" do
- good_versions = %w(1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003 1.2-STABLE 10.0-BETA3 9.1-RELEASE-p3)
+ good_versions = %w{1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003 1.2-STABLE 10.0-BETA3 9.1-RELEASE-p3}
good_versions.each do |v|
it "should accept '#{v}'" do
Chef::Version::Platform.new v
diff --git a/spec/unit/version_class_spec.rb b/spec/unit/version_class_spec.rb
index 2e70b7e00c..2e66931607 100644
--- a/spec/unit/version_class_spec.rb
+++ b/spec/unit/version_class_spec.rb
@@ -44,7 +44,7 @@ describe Chef::Version do
end
describe "when creating valid Versions" do
- good_versions = %w(1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003)
+ good_versions = %w{1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003}
good_versions.each do |v|
it "should accept '#{v}'" do
Chef::Version.new v
diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb
index 4b9f78be14..a67e4a2f60 100644
--- a/tasks/maintainers.rb
+++ b/tasks/maintainers.rb
@@ -121,14 +121,14 @@ begin
end
def prepare_teams(cmp)
- %w(text paths).each { |k| cmp.delete(k) }
+ %w{text paths}.each { |k| cmp.delete(k) }
if cmp.key?("team")
team = cmp.delete("team")
add_members(team, cmp.delete("lieutenant")) if cmp.key?("lieutenant")
add_members(team, cmp.delete("maintainers")) if cmp.key?("maintainers")
set_team_title(team, cmp.delete("title"))
else
- %w(maintainers lieutenant title).each { |k| cmp.delete(k) }
+ %w{maintainers lieutenant title}.each { |k| cmp.delete(k) }
end
cmp.each { |_k, v| prepare_teams(v) }
end