diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-19 09:54:30 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-19 09:54:30 -0800 |
commit | 600f83f177370adbd916666190989054d6fae1f0 (patch) | |
tree | e0afae6096aa4cbd7a390c74364a4bcf1bbf7862 | |
parent | 5834290bd3ff6ddabe4ef527f1543fcfb01e50bc (diff) | |
parent | 5976d21c1d68403301b6ca4345aca07071c63812 (diff) | |
download | chef-600f83f177370adbd916666190989054d6fae1f0.tar.gz |
Merge pull request #4424 from chef/lcg/chefstyle-catchup2
another chefstyle catchup + pull master
8 files changed, 37 insertions, 38 deletions
@@ -1,9 +1,9 @@ source "https://rubygems.org" -gemspec :name => "chef" +gemspec name: "chef" -gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby" +gem "activesupport", "< 4.0.0", group: :compat_testing, platform: "ruby" -gem "chef-config", path: "chef-config" if File.exists?(__FILE__ + "../chef-config") +gem "chef-config", path: "chef-config" if File.exist?(__FILE__ + "../chef-config") group(:docgen) do gem "yard" @@ -23,32 +23,31 @@ group(:ruby_prof) do end group(:development, :test) do - gem "simplecov" gem "rack", "~> 1.5.1" # for testing new chefstyle rules # gem 'chefstyle', github: 'chef/chefstyle' - gem "chefstyle" + gem "chefstyle", github: "chef/chefstyle", branch: "master" - gem "ruby-shadow", :platforms => :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/) + gem "ruby-shadow", platforms: :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/) # For external tests -# gem 'chef-zero', github: 'chef/chef-zero' -# gem 'cheffish', github: 'chef/cheffish' -# gem 'chef-provisioning'#, github: 'chef/chef-provisioning' -# gem 'chef-provisioning-aws', github: 'chef/chef-provisioning-aws' -# gem 'test-kitchen' -# gem 'chefspec' -# gem 'chef-sugar' -# gem 'poise', github: 'poise/poise', branch: 'deeecb890a6a0bc2037dfb09ce0fd0a8931519aa' -# gem 'halite', github: 'poise/halite' -# gem 'foodcritic', github: 'acrmp/foodcritic', branch: 'v5.0.0' -# gem 'chef-rewind' + # gem 'chef-zero', github: 'chef/chef-zero' + # gem 'cheffish', github: 'chef/cheffish' + # gem 'chef-provisioning'#, github: 'chef/chef-provisioning' + # gem 'chef-provisioning-aws', github: 'chef/chef-provisioning-aws' + # gem 'test-kitchen' + # gem 'chefspec' + # gem 'chef-sugar' + # gem 'poise', github: 'poise/poise', branch: 'deeecb890a6a0bc2037dfb09ce0fd0a8931519aa' + # gem 'halite', github: 'poise/halite' + # gem 'foodcritic', github: 'acrmp/foodcritic', branch: 'v5.0.0' + # gem 'chef-rewind' end instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"] # If you want to load debugging tools into the bundle exec sandbox, # add these additional dependencies into chef/Gemfile.local -eval(IO.read(__FILE__ + ".local"), binding) if File.exists?(__FILE__ + ".local") +eval(IO.read(__FILE__ + ".local"), binding) if File.exist?(__FILE__ + ".local") diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index ab161c7fb2..634faaec7e 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -322,8 +322,8 @@ class Chef result.delete_if do |key,value| (value == [] && key != "recipes") end - result['metadata'] = result['metadata'].to_hash - result['metadata'].delete_if do |key,value| + 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)) || @@ -444,7 +444,7 @@ class Chef found_policy = false policies.children.each do |policy| # We want to delete just the ones that == POLICY - next unless policy.name.rpartition('-')[0] == path[1] + next unless policy.name.rpartition("-")[0] == path[1] policy.delete(false) found_policy = true end @@ -469,7 +469,7 @@ class Chef # LIST /policies elsif path == [ "policies" ] with_entry([ path[0] ]) do |policies| - policies.children.map { |policy| policy.name[0..-6].rpartition('-')[0] }.uniq + policies.children.map { |policy| policy.name[0..-6].rpartition("-")[0] }.uniq end # LIST /policies/POLICY/revisions @@ -481,7 +481,7 @@ class Chef # - b-2.0.0.json revisions = [] policies.children.each do |policy| - name, dash, revision = policy.name[0..-6].rpartition('-') + name, dash, revision = policy.name[0..-6].rpartition("-") revisions << revision if name == path[1] end raise ChefZero::DataStore::DataNotFoundError.new(path) if revisions.empty? @@ -503,7 +503,7 @@ class Chef with_entry(path) do |entry| begin if path[0] == "cookbook_artifacts" - entry.children.map { |child| child.name.rpartition('-')[0] }.uniq + entry.children.map { |child| child.name.rpartition("-")[0] }.uniq elsif chef_fs.versioned_cookbooks # /cookbooks/name-version -> /cookbooks/name entry.children.map { |child| split_name_version(child.name)[0] }.uniq @@ -725,7 +725,7 @@ class Chef # /policies/NAME-REVISION.json -> /policies/NAME/revisions/REVISION elsif path[0] == "policies" if path.length >= 2 - name, dash, revision = path[1][0..-6].rpartition('-') + name, dash, revision = path[1][0..-6].rpartition("-") path = [ "policies", name, "revisions", revision ] end diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb index ff3cde51a8..197e412810 100644 --- a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb +++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'chef/chef_fs/file_system/chef_server/cookbook_dir' +require "chef/chef_fs/file_system/chef_server/cookbook_dir" class Chef module ChefFS @@ -25,7 +25,7 @@ class Chef class CookbookArtifactDir < CookbookDir def initialize(name, parent, options = {}) super(name, parent) - @cookbook_name, dash, @version = name.rpartition('-') + @cookbook_name, dash, @version = name.rpartition("-") end def copy_from(other, options = {}) diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb index b001c28dc4..9dbd3fea4d 100644 --- a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb @@ -16,8 +16,8 @@ # limitations under the License. # -require 'chef/chef_fs/file_system/chef_server/cookbooks_dir' -require 'chef/chef_fs/file_system/chef_server/cookbook_artifact_dir' +require "chef/chef_fs/file_system/chef_server/cookbooks_dir" +require "chef/chef_fs/file_system/chef_server/cookbook_artifact_dir" class Chef module ChefFS @@ -43,7 +43,7 @@ class Chef @children ||= begin result = [] root.get_json("#{api_path}/?num_versions=all").each_pair do |cookbook_name, cookbooks| - cookbooks['versions'].each do |cookbook_version| + cookbooks["versions"].each do |cookbook_version| result << CookbookArtifactDir.new("#{cookbook_name}-#{cookbook_version['identifier']}", self) end end @@ -56,7 +56,7 @@ class Chef # to make this work. So instead, we make a temporary cookbook # symlinking back to real cookbook, and upload the proxy. def upload_cookbook(other, options) - cookbook_name, dash, identifier = other.name.rpartition('-') + cookbook_name, dash, identifier = other.name.rpartition("-") Dir.mktmpdir do |temp_cookbooks_path| proxy_cookbook_path = "#{temp_cookbooks_path}/#{cookbook_name}" @@ -93,7 +93,7 @@ class Chef end def can_have_child?(name, is_dir) - is_dir && name.include?('-') + is_dir && name.include?("-") end end end diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb index da9d74a1df..dbff973f17 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb @@ -26,7 +26,7 @@ class Chef # Override from parent def cookbook_version loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore) - cookbook_name, dash, identifier = name.rpartition('-') + cookbook_name, dash, identifier = name.rpartition("-") # KLUDGE: We shouldn't have to use instance_variable_set loader.instance_variable_set(:@cookbook_name, cookbook_name) loader.load_cookbooks 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 24017acc13..f16a499186 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 @@ -170,7 +170,7 @@ class Chef else dirs = paths.map { |path| ChefRepositoryFileSystemCookbooksDir.new(name, self, path) } end - when 'cookbook_artifacts' + when "cookbook_artifacts" dirs = paths.map { |path| ChefRepositoryFileSystemCookbookArtifactsDir.new(name, self, path) } when "policies" dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) } diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 57229b915a..86f1d9f4a4 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -1186,7 +1186,7 @@ EOM policy_group "x", { "policies" => { "x" => { "revision_id" => "1.0.0" }, - "blah" => { "revision_id" => "1.0.0" } + "blah" => { "revision_id" => "1.0.0" }, } } role "x", {} @@ -1273,7 +1273,7 @@ EOM file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.1" }, - "y" => { "revision_id" => "1.0.0" } + "y" => { "revision_id" => "1.0.0" }, } } file "roles/x.json", { "run_list" => [ "blah" ] } diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index 6ef40a1d98..afedf97459 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -1349,7 +1349,7 @@ EOM policy_group "x", { "policies" => { "x" => { "revision_id" => "1.0.0" }, - "blah" => { "revision_id" => "1.0.0" } + "blah" => { "revision_id" => "1.0.0" }, } } role "x", {} @@ -1403,7 +1403,7 @@ EOM policy_group "x", { "policies" => { "x" => { "revision_id" => "1.0.1" }, - "y" => { "revision_id" => "1.0.0" } + "y" => { "revision_id" => "1.0.0" }, } } role "x", { "run_list" => [ "blah" ] } |