From ccf46bf3055b2a1c06499ec104f3d74c26643395 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 18 Jan 2016 09:07:13 -0800 Subject: another chefstyle catchup + pull master bunch of merges over the weekend need re-fixing again. seems like pointing at master of chefstyle is probably a good idea to start making people fix their code before merging. --- lib/chef/chef_fs/chef_fs_data_store.rb | 14 +++++++------- .../file_system/chef_server/cookbook_artifact_dir.rb | 4 ++-- .../file_system/chef_server/cookbook_artifacts_dir.rb | 10 +++++----- .../chef_repository_file_system_cookbook_artifact_dir.rb | 2 +- .../repository/chef_repository_file_system_root_dir.rb | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/chef') diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 37f30dde45..6b5bdc62a0 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 a3a3dfc6b9..df06f6d2e8 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) } -- cgit v1.2.1