diff options
author | Thom May <thom@chef.io> | 2016-01-14 14:08:03 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-01-14 14:08:03 +0000 |
commit | 51cfbdc4d16739caac4d946fadbe678444aafe34 (patch) | |
tree | 56dfd8f1cd9fd933de27268b32402e955a43ac2b /lib/chef/cookbook | |
parent | 05064423057d4cf46f4713b81b08829cf6d20af6 (diff) | |
download | chef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz |
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go
along with chef/chefstyle#5 . We should pick something and use it
consistently, and my opinion is that double quotes are the appropriate
thing.
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r-- | lib/chef/cookbook/chefignore.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook/cookbook_collection.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook/cookbook_version_loader.rb | 26 | ||||
-rw-r--r-- | lib/chef/cookbook/file_system_file_vendor.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 76 | ||||
-rw-r--r-- | lib/chef/cookbook/remote_file_vendor.rb | 6 | ||||
-rw-r--r-- | lib/chef/cookbook/synchronizer.rb | 14 | ||||
-rw-r--r-- | lib/chef/cookbook/syntax_check.rb | 16 |
8 files changed, 72 insertions, 72 deletions
diff --git a/lib/chef/cookbook/chefignore.rb b/lib/chef/cookbook/chefignore.rb index aa9345e64e..529e209084 100644 --- a/lib/chef/cookbook/chefignore.rb +++ b/lib/chef/cookbook/chefignore.rb @@ -61,7 +61,7 @@ class Chef if File.basename(path) =~ /chefignore/ path else - File.join(path, 'chefignore') + File.join(path, "chefignore") end end diff --git a/lib/chef/cookbook/cookbook_collection.rb b/lib/chef/cookbook/cookbook_collection.rb index 38784c22fa..3c43244dba 100644 --- a/lib/chef/cookbook/cookbook_collection.rb +++ b/lib/chef/cookbook/cookbook_collection.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'chef/mash' +require "chef/mash" class Chef # == Chef::CookbookCollection diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index 0341c394a8..370a77ecaf 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -1,8 +1,8 @@ -require 'chef/cookbook_version' -require 'chef/cookbook/chefignore' -require 'chef/cookbook/metadata' -require 'chef/util/path_helper' +require "chef/cookbook_version" +require "chef/cookbook/chefignore" +require "chef/cookbook/metadata" +require "chef/util/path_helper" class Chef class Cookbook @@ -78,10 +78,10 @@ class Chef # re-raise any exception that occurred when reading the metadata raise_metadata_error! - load_as(:attribute_filenames, 'attributes', '*.rb') - load_as(:definition_filenames, 'definitions', '*.rb') - load_as(:recipe_filenames, 'recipes', '*.rb') - load_recursively_as(:library_filenames, 'libraries', '*.rb') + load_as(:attribute_filenames, "attributes", "*.rb") + load_as(:definition_filenames, "definitions", "*.rb") + load_as(:recipe_filenames, "recipes", "*.rb") + load_recursively_as(:library_filenames, "libraries", "*.rb") load_recursively_as(:template_filenames, "templates", "*") load_recursively_as(:file_filenames, "files", "*") load_recursively_as(:resource_filenames, "resources", "*.rb") @@ -213,7 +213,7 @@ class Chef end def load_root_files - Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '*'), File::FNM_DOTMATCH).each do |file| + Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), "*"), File::FNM_DOTMATCH).each do |file| file = Chef::Util::PathHelper.cleanpath(file) next if File.directory?(file) next if File.basename(file) == UPLOADED_COOKBOOK_VERSION_FILE @@ -223,7 +223,7 @@ class Chef end def load_recursively_as(category, category_dir, glob) - file_spec = File.join(Chef::Util::PathHelper.escape_glob(cookbook_path, category_dir), '**', glob) + file_spec = File.join(Chef::Util::PathHelper.escape_glob(cookbook_path, category_dir), "**", glob) Dir.glob(file_spec, File::FNM_DOTMATCH).each do |file| file = Chef::Util::PathHelper.cleanpath(file) next if File.directory?(file) @@ -269,7 +269,7 @@ class Chef def apply_json_cookbook_version_metadata(file) begin data = Chef::JSONCompat.parse(IO.read(file)) - @metadata.from_hash(data['metadata']) + @metadata.from_hash(data["metadata"]) # the JSON cookbok metadata file is only used by chef-zero. # The Chef Server API currently does not enforce that the metadata # have a `name` field, but that will cause an error when attempting @@ -278,7 +278,7 @@ class Chef # # This behavior can be removed if/when Chef Server enforces that the # metadata contains a name key. - @metadata.name(data['cookbook_name']) unless data['metadata'].key?('name') + @metadata.name(data["cookbook_name"]) unless data["metadata"].key?("name") rescue Chef::Exceptions::JSON::ParseError Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in " + file) raise @@ -289,7 +289,7 @@ class Chef if uploaded_cookbook_version_file begin data = Chef::JSONCompat.parse(IO.read(uploaded_cookbook_version_file)) - @frozen = data['frozen?'] + @frozen = data["frozen?"] rescue Chef::Exceptions::JSON::ParseError Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in #{uploaded_cookbook_version_file}") raise diff --git a/lib/chef/cookbook/file_system_file_vendor.rb b/lib/chef/cookbook/file_system_file_vendor.rb index e351ec4702..227e873e4c 100644 --- a/lib/chef/cookbook/file_system_file_vendor.rb +++ b/lib/chef/cookbook/file_system_file_vendor.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'chef/cookbook/file_vendor' +require "chef/cookbook/file_vendor" class Chef class Cookbook diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 67d762f34b..530254eead 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -18,14 +18,14 @@ # limitations under the License. # -require 'chef/exceptions' -require 'chef/mash' -require 'chef/mixin/from_file' -require 'chef/mixin/params_validate' -require 'chef/log' -require 'chef/version_class' -require 'chef/version_constraint' -require 'chef/json_compat' +require "chef/exceptions" +require "chef/mash" +require "chef/mixin/from_file" +require "chef/mixin/params_validate" +require "chef/log" +require "chef/version_class" +require "chef/version_constraint" +require "chef/json_compat" class Chef class Cookbook @@ -35,28 +35,28 @@ class Chef # about Chef Cookbooks. class Metadata - NAME = 'name'.freeze - DESCRIPTION = 'description'.freeze - LONG_DESCRIPTION = 'long_description'.freeze - MAINTAINER = 'maintainer'.freeze - MAINTAINER_EMAIL = 'maintainer_email'.freeze - LICENSE = 'license'.freeze - PLATFORMS = 'platforms'.freeze - DEPENDENCIES = 'dependencies'.freeze - RECOMMENDATIONS = 'recommendations'.freeze - SUGGESTIONS = 'suggestions'.freeze - CONFLICTING = 'conflicting'.freeze - PROVIDING = 'providing'.freeze - REPLACING = 'replacing'.freeze - ATTRIBUTES = 'attributes'.freeze - GROUPINGS = 'groupings'.freeze - RECIPES = 'recipes'.freeze - VERSION = 'version'.freeze - SOURCE_URL = 'source_url'.freeze - ISSUES_URL = 'issues_url'.freeze - PRIVACY = 'privacy'.freeze - CHEF_VERSIONS = 'chef_versions'.freeze - OHAI_VERSIONS = 'ohai_versions'.freeze + NAME = "name".freeze + DESCRIPTION = "description".freeze + LONG_DESCRIPTION = "long_description".freeze + MAINTAINER = "maintainer".freeze + MAINTAINER_EMAIL = "maintainer_email".freeze + LICENSE = "license".freeze + PLATFORMS = "platforms".freeze + DEPENDENCIES = "dependencies".freeze + RECOMMENDATIONS = "recommendations".freeze + SUGGESTIONS = "suggestions".freeze + CONFLICTING = "conflicting".freeze + PROVIDING = "providing".freeze + REPLACING = "replacing".freeze + ATTRIBUTES = "attributes".freeze + GROUPINGS = "groupings".freeze + RECIPES = "recipes".freeze + VERSION = "version".freeze + SOURCE_URL = "source_url".freeze + ISSUES_URL = "issues_url".freeze + PRIVACY = "privacy".freeze + CHEF_VERSIONS = "chef_versions".freeze + OHAI_VERSIONS = "ohai_versions".freeze COMPARISON_FIELDS = [ :name, :description, :long_description, :maintainer, :maintainer_email, :license, :platforms, :dependencies, @@ -106,9 +106,9 @@ class Chef def initialize @name = nil - @description = '' - @long_description = '' - @license = 'All rights reserved' + @description = "" + @long_description = "" + @license = "All rights reserved" @maintainer = nil @maintainer_email = nil @@ -124,8 +124,8 @@ class Chef @groupings = Mash.new @recipes = Mash.new @version = Version.new("0.0.0") - @source_url = '' - @issues_url = '' + @source_url = "" + @issues_url = "" @privacy = false @chef_versions = [] @ohai_versions = [] @@ -404,7 +404,7 @@ class Chef # @param version_args [Array<String>] Version constraint in String form # @return [Array<Gem::Dependency>] Current chef_versions array def chef_version(*version_args) - @chef_versions << Gem::Dependency.new('chef', *version_args) unless version_args.empty? + @chef_versions << Gem::Dependency.new("chef", *version_args) unless version_args.empty? @chef_versions end @@ -415,7 +415,7 @@ class Chef # @param version_args [Array<String>] Version constraint in String form # @return [Array<Gem::Dependency>] Current ohai_versions array def ohai_version(*version_args) - @ohai_versions << Gem::Dependency.new('ohai', *version_args) unless version_args.empty? + @ohai_versions << Gem::Dependency.new("ohai", *version_args) unless version_args.empty? @ohai_versions end @@ -859,7 +859,7 @@ INVALID def handle_deprecated_constraints(specification) specification.inject(Mash.new) do |acc, (cb, constraints)| constraints = Array(constraints) - acc[cb] = (constraints.empty? || constraints.size > 1) ? [] : constraints.first.gsub(/>>/, '>').gsub(/<</, '<') + acc[cb] = (constraints.empty? || constraints.size > 1) ? [] : constraints.first.gsub(/>>/, ">").gsub(/<</, "<") acc end end diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb index b118c75f9e..eefc25c93b 100644 --- a/lib/chef/cookbook/remote_file_vendor.rb +++ b/lib/chef/cookbook/remote_file_vendor.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'chef/cookbook/file_vendor' +require "chef/cookbook/file_vendor" class Chef class Cookbook @@ -48,7 +48,7 @@ class Chef found_manifest_record = @manifest[segment].find {|manifest_record| manifest_record[:path] == filename } raise "No such file #{filename} in #{@cookbook_name}" unless found_manifest_record - cache_filename = File.join("cookbooks", @cookbook_name, found_manifest_record['path']) + cache_filename = File.join("cookbooks", @cookbook_name, found_manifest_record["path"]) # update valid_cache_entries so the upstream cache cleaner knows what # we've used. @@ -62,7 +62,7 @@ class Chef # If the checksums are different between on-disk (current) and on-server # (remote, per manifest), do the update. This will also execute if there # is no current checksum. - if current_checksum != found_manifest_record['checksum'] + if current_checksum != found_manifest_record["checksum"] raw_file = @rest.get(found_manifest_record[:url], true) Chef::Log.debug("Storing updated #{cache_filename} in the cache.") diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb index b499963653..9955bae6bb 100644 --- a/lib/chef/cookbook/synchronizer.rb +++ b/lib/chef/cookbook/synchronizer.rb @@ -1,7 +1,7 @@ -require 'chef/client' -require 'chef/util/threaded_job_queue' -require 'chef/server_api' -require 'singleton' +require "chef/client" +require "chef/util/threaded_job_queue" +require "chef/server_api" +require "singleton" class Chef @@ -245,14 +245,14 @@ class Chef # === Returns # Full path to the cached file as a String def sync_file(file) - cache_filename = File.join("cookbooks", file.cookbook.name, file.manifest_record['path']) + cache_filename = File.join("cookbooks", file.cookbook.name, file.manifest_record["path"]) mark_cached_file_valid(cache_filename) # If the checksums are different between on-disk (current) and on-server # (remote, per manifest), do the update. This will also execute if there # is no current checksum. - if !cached_copy_up_to_date?(cache_filename, file.manifest_record['checksum']) - download_file(file.manifest_record['url'], cache_filename) + if !cached_copy_up_to_date?(cache_filename, file.manifest_record["checksum"]) + download_file(file.manifest_record["url"], cache_filename) @events.updated_cookbook_file(file.cookbook.name, cache_filename) else Chef::Log.debug("Not storing #{cache_filename}, as the cache is up to date.") diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb index 96fc7e7b84..5528465f0c 100644 --- a/lib/chef/cookbook/syntax_check.rb +++ b/lib/chef/cookbook/syntax_check.rb @@ -16,12 +16,12 @@ # limitations under the License. # -require 'pathname' -require 'stringio' -require 'erubis' -require 'chef/mixin/shell_out' -require 'chef/mixin/checksum' -require 'chef/util/path_helper' +require "pathname" +require "stringio" +require "erubis" +require "chef/mixin/shell_out" +require "chef/mixin/checksum" +require "chef/util/path_helper" class Chef class Cookbook @@ -115,7 +115,7 @@ class Chef def ruby_files path = Chef::Util::PathHelper.escape_glob(cookbook_path) - files = Dir[File.join(path, '**', '*.rb')] + files = Dir[File.join(path, "**", "*.rb")] files = remove_ignored_files(files) files = remove_uninteresting_ruby_files(files) files @@ -133,7 +133,7 @@ class Chef end def template_files - remove_ignored_files Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '**/templates/**', '*.erb')] + remove_ignored_files Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), "**/templates/**", "*.erb")] end def untested_template_files |