diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
commit | 686113531d23f30e9973d659c456ae33eb9cff1f (patch) | |
tree | f225de7251a8b49b8d183dd168bab0a0addbe23f /lib/chef/run_list | |
parent | d1cf34b059a16a81e0fc48de52ba29863bb41fe6 (diff) | |
download | chef-686113531d23f30e9973d659c456ae33eb9cff1f.tar.gz |
autofixing whitespace cops
4174 Style/SpaceInsideHashLiteralBraces
1860 Style/SpaceAroundOperators
1336 Style/SpaceInsideBlockBraces
1292 Style/AlignHash
997 Style/SpaceAfterComma
860 Style/SpaceAroundEqualsInParameterDefault
310 Style/EmptyLines
294 Style/IndentationConsistency
267 Style/TrailingWhitespace
238 Style/ExtraSpacing
212 Style/SpaceBeforeBlockBraces
166 Style/MultilineOperationIndentation
144 Style/TrailingBlankLines
120 Style/EmptyLineBetweenDefs
101 Style/IndentationWidth
82 Style/SpaceAroundBlockParameters
40 Style/EmptyLinesAroundMethodBody
29 Style/EmptyLinesAroundAccessModifier
1 Style/RescueEnsureAlignment
Diffstat (limited to 'lib/chef/run_list')
-rw-r--r-- | lib/chef/run_list/run_list_expansion.rb | 26 | ||||
-rw-r--r-- | lib/chef/run_list/run_list_item.rb | 3 | ||||
-rw-r--r-- | lib/chef/run_list/versioned_recipe_list.rb | 4 |
3 files changed, 14 insertions, 19 deletions
diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb index bac748096d..b895b53523 100644 --- a/lib/chef/run_list/run_list_expansion.rb +++ b/lib/chef/run_list/run_list_expansion.rb @@ -62,7 +62,7 @@ class Chef attr_reader :all_missing_roles attr_reader :role_errors - def initialize(environment, run_list_items, source=nil) + def initialize(environment, run_list_items, source = nil) @environment = environment @missing_roles_with_including_role = Array.new @@ -75,8 +75,8 @@ class Chef @recipes = Chef::RunList::VersionedRecipeList.new @applied_roles = {} - @run_list_trace = Hash.new {|h, key| h[key] = [] } - @better_run_list_trace = Hash.new {|h, key| h[key] = [] } + @run_list_trace = Hash.new { |h, key| h[key] = [] } + @better_run_list_trace = Hash.new { |h, key| h[key] = [] } @all_missing_roles = {} @role_errors = {} end @@ -140,7 +140,7 @@ class Chef end def errors - @missing_roles_with_including_role.map {|item| item.first } + @missing_roles_with_including_role.map { |item| item.first } end def to_json(*a) @@ -148,8 +148,8 @@ class Chef end def to_hash - seen_items = {:recipe => {}, :role => {}} - {:id => @environment, :run_list => convert_run_list_trace("top level", seen_items)} + seen_items = { :recipe => {}, :role => {} } + { :id => @environment, :run_list => convert_run_list_trace("top level", seen_items) } end private @@ -160,11 +160,10 @@ class Chef @applied_roles[role_name] = true end - def expand_run_list_items(items, included_by="top level") - + def expand_run_list_items(items, included_by = "top level") if entry = items.shift @run_list_trace[included_by.to_s] << entry.to_s - @better_run_list_trace[included_by.to_s] << entry + @better_run_list_trace[included_by.to_s] << entry case entry.type when :recipe @@ -186,19 +185,18 @@ class Chef seen_items[item.type][item.name] = true case item.type when :recipe - {:type => "recipe", :name => item.name, :version => item.version, :skipped => !!skipped} + { :type => "recipe", :name => item.name, :version => item.version, :skipped => !!skipped } when :role error = @role_errors[item.name] missing = @all_missing_roles[item.name] - {:type => :role, :name => item.name, :children => (missing || error || skipped) ? [] : convert_run_list_trace(item.to_s, seen_items), - :missing => missing, :error => error, :skipped => skipped} + { :type => :role, :name => item.name, :children => (missing || error || skipped) ? [] : convert_run_list_trace(item.to_s, seen_items), + :missing => missing, :error => error, :skipped => skipped } end end end end - # Expand a run list from disk. Suitable for chef-solo class RunListExpansionFromDisk < RunListExpansion @@ -234,5 +232,3 @@ class Chef end end - - diff --git a/lib/chef/run_list/run_list_item.rb b/lib/chef/run_list/run_list_item.rb index 3e689eddef..15e11b206e 100644 --- a/lib/chef/run_list/run_list_item.rb +++ b/lib/chef/run_list/run_list_item.rb @@ -25,7 +25,6 @@ class Chef attr_reader :name, :type, :version - def initialize(item) @version = nil case item @@ -89,7 +88,7 @@ class Chef end def assert_hash_is_valid_run_list_item!(item) - unless (item.key?("type")|| item.key?(:type)) && (item.key?("name") || item.key?(:name)) + unless (item.key?("type") || item.key?(:type)) && (item.key?("name") || item.key?(:name)) raise ArgumentError, "Initializing a #{self.class} from a hash requires that it have a 'type' and 'name' key" end end diff --git a/lib/chef/run_list/versioned_recipe_list.rb b/lib/chef/run_list/versioned_recipe_list.rb index 49622b8c43..7845568aaa 100644 --- a/lib/chef/run_list/versioned_recipe_list.rb +++ b/lib/chef/run_list/versioned_recipe_list.rb @@ -29,7 +29,7 @@ class Chef @versions = Hash.new end - def add_recipe(name, version=nil) + def add_recipe(name, version = nil) if version && @versions.has_key?(name) unless Chef::Version.new(@versions[name]) == Chef::Version.new(version) raise Chef::Exceptions::CookbookVersionConflict, "Run list requires #{name} at versions #{@versions[name]} and #{version}" @@ -40,7 +40,7 @@ class Chef end def with_versions - self.map {|recipe_name| {:name => recipe_name, :version => @versions[recipe_name]}} + self.map { |recipe_name| { :name => recipe_name, :version => @versions[recipe_name] } } end # Return an Array of Hashes, each of the form: |