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/mixin/securable.rb | |
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/mixin/securable.rb')
-rw-r--r-- | lib/chef/mixin/securable.rb | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/chef/mixin/securable.rb b/lib/chef/mixin/securable.rb index d83d009638..af3e10126b 100644 --- a/lib/chef/mixin/securable.rb +++ b/lib/chef/mixin/securable.rb @@ -20,7 +20,7 @@ class Chef module Mixin module Securable - def owner(arg=nil) + def owner(arg = nil) set_or_return( :owner, arg, @@ -30,7 +30,7 @@ class Chef alias :user :owner - def group(arg=nil) + def group(arg = nil) set_or_return( :group, arg, @@ -38,28 +38,27 @@ class Chef ) end - def mode(arg=nil) + def mode(arg = nil) set_or_return( :mode, arg, :callbacks => { "not in valid numeric range" => lambda { |m| if m.kind_of?(String) - m =~ /^0/ || m="0#{m}" + m =~ /^0/ || m = "0#{m}" end # Windows does not support the sticky or setuid bits if Chef::Platform.windows? - Integer(m)<=0777 && Integer(m)>=0 + Integer(m) <= 0777 && Integer(m) >= 0 else - Integer(m)<=07777 && Integer(m)>=0 + Integer(m) <= 07777 && Integer(m) >= 0 end } }, ) end - #==WindowsMacros # Defines methods for adding attributes to a chef resource to describe # Windows file security metadata. @@ -108,10 +107,9 @@ class Chef # * `:one_level_deep` (optional): Boolean # def rights_attribute(name) - # equivalent to something like: # def rights(permissions=nil, principals=nil, args_hash=nil) - define_method(name) do |permissions=nil, principals=nil, args_hash=nil| + define_method(name) do |permissions = nil, principals = nil, args_hash = nil| rights = self.instance_variable_get("@#{name}".to_sym) unless permissions.nil? input = { @@ -120,17 +118,17 @@ class Chef } input.merge!(args_hash) unless args_hash.nil? - validations = {:permissions => { :required => true }, - :principals => { :required => true, :kind_of => [String, Array] }, - :applies_to_children => { :equal_to => [ true, false, :containers_only, :objects_only ]}, - :applies_to_self => { :kind_of => [ TrueClass, FalseClass ] }, - :one_level_deep => { :kind_of => [ TrueClass, FalseClass ] }, + validations = { :permissions => { :required => true }, + :principals => { :required => true, :kind_of => [String, Array] }, + :applies_to_children => { :equal_to => [ true, false, :containers_only, :objects_only ] }, + :applies_to_self => { :kind_of => [ TrueClass, FalseClass ] }, + :one_level_deep => { :kind_of => [ TrueClass, FalseClass ] }, } validate(input, validations) [ permissions ].flatten.each do |permission| if permission.is_a?(Integer) - if permission < 0 || permission > 1<<32 + if permission < 0 || permission > 1 << 32 raise ArgumentError, "permissions flags must be positive and <= 32 bits (#{permission})" end elsif !([:full_control, :modify, :read_execute, :read, :write].include?(permission.to_sym)) @@ -169,8 +167,7 @@ class Chef # including class module WindowsSecurableAttributes - - def inherits(arg=nil) + def inherits(arg = nil) set_or_return( :inherits, arg, |