[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Markus Roberts Markus at reality.com
Wed Jul 14 10:37:24 UTC 2010


The following commit has been merged in the upstream branch:
commit c3e2353afb7fc2fb12efd1eb2bc5c342c792fb3b
Author: Markus Roberts <Markus at reality.com>
Date:   Fri Jul 9 18:06:56 2010 -0700

    Code smell: Use &&= for dependent initialization
    
    Replaced 6 occurances of
    
        ([$@]?\w+) += +(.*) +(if +\1|unless +\1.nil\?)$
    
    with
    
        \1 &&= \2
    
    3 Examples:
    
        The code:
            end
        becomes:
            end
        The code:
    
        becomes:
    
        The code:
            res
        becomes:
            res

diff --git a/lib/puppet/type/file/mode.rb b/lib/puppet/type/file/mode.rb
index 03cb63f..31209f4 100755
--- a/lib/puppet/type/file/mode.rb
+++ b/lib/puppet/type/file/mode.rb
@@ -99,7 +99,7 @@ module Puppet
 
             if stat = @resource.stat(false)
                 unless defined?(@fixed)
-                    @should = @should.collect { |s| self.dirmask(s) } if @should
+                    @should &&= @should.collect { |s| self.dirmask(s) }
                 end
                 return stat.mode & 007777
             else
diff --git a/lib/puppet/type/schedule.rb b/lib/puppet/type/schedule.rb
index f66b5b0..bcc62ce 100755
--- a/lib/puppet/type/schedule.rb
+++ b/lib/puppet/type/schedule.rb
@@ -331,7 +331,7 @@ module Puppet
         def match?(previous = nil, now = nil)
 
             # If we've got a value, then convert it to a Time instance
-            previous = Time.at(previous) if previous
+            previous &&= Time.at(previous)
 
             now ||= Time.now
 
diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb
index 614c8cc..a956241 100644
--- a/lib/puppet/util/rdoc/generators/puppet_generator.rb
+++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb
@@ -873,7 +873,7 @@ module Generators
 
         def find_symbol(symbol, method=nil)
             res = @context.parent.find_symbol(symbol, method)
-            res = res.viewer if res
+            res &&= res.viewer
             res
         end
 
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index 7c70dfa..80cab19 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -137,7 +137,7 @@ class Puppet::Util::Settings
     # Handle a command-line argument.
     def handlearg(opt, value = nil)
         @cache.clear
-        value = munge_value(value) if value
+        value &&= munge_value(value)
         str = opt.sub(/^--/,'')
 
         bool = true
@@ -658,7 +658,7 @@ if @config.include?(:run_mode)
 
     def uninterpolated_value(param, environment = nil)
         param = param.to_sym
-        environment = environment.to_sym if environment
+        environment &&= environment.to_sym
 
         # See if we can find it within our searchable list of values
         val = catch :foundval do
@@ -682,7 +682,7 @@ if @config.include?(:run_mode)
     # in which to search before the other configuration sections.
     def value(param, environment = nil)
         param = param.to_sym
-        environment = environment.to_sym if environment
+        environment &&= environment.to_sym
 
         # Short circuit to nil for undefined parameters.
         return nil unless @config.include?(param)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list