From 51cfbdc4d16739caac4d946fadbe678444aafe34 Mon Sep 17 00:00:00 2001 From: Thom May Date: Thu, 14 Jan 2016 14:08:03 +0000 Subject: 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. --- lib/chef/cookbook/chefignore.rb | 2 +- lib/chef/cookbook/cookbook_collection.rb | 2 +- lib/chef/cookbook/cookbook_version_loader.rb | 26 +++++----- lib/chef/cookbook/file_system_file_vendor.rb | 2 +- lib/chef/cookbook/metadata.rb | 76 ++++++++++++++-------------- lib/chef/cookbook/remote_file_vendor.rb | 6 +-- lib/chef/cookbook/synchronizer.rb | 14 ++--- lib/chef/cookbook/syntax_check.rb | 16 +++--- 8 files changed, 72 insertions(+), 72 deletions(-) (limited to 'lib/chef/cookbook') 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] Version constraint in String form # @return [Array] 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] Version constraint in String form # @return [Array] 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(/< 1) ? [] : constraints.first.gsub(/>>/, ">").gsub(/<