summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:05:07 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:05:07 -0700
commit184132e07fc1461555cb4da842df15f32842a843 (patch)
tree67085c1100b28991ee3b5f4745d67777acf8d075 /lib/puppet/provider
parent9ee56f2e67be973da49b1d3f21de1bf87de35e6f (diff)
downloadpuppet-184132e07fc1461555cb4da842df15f32842a843.tar.gz
puppet-184132e07fc1461555cb4da842df15f32842a843.tar.xz
puppet-184132e07fc1461555cb4da842df15f32842a843.zip
Code smell: Use {} for % notation delimiters wherever practical
* * Replaced 16 occurances of %([qQrwWx])\((.*?)\) with %\1{\2} 3 Examples: The code: # %r(/) != /\// becomes: # %r{/} != /\// The code: ri = glob(%w(bin/*.rb sbin/* lib/**/*.rb)).reject { |e| e=~ /\.(bat|cmd)$/ } becomes: ri = glob(%w{bin/*.rb sbin/* lib/**/*.rb}).reject { |e| e=~ /\.(bat|cmd)$/ } The code: if !FileUtils.uptodate?("/var/cache/eix", %w(/usr/bin/eix /usr/portage/metadata/timestamp)) becomes: if !FileUtils.uptodate?("/var/cache/eix", %w{/usr/bin/eix /usr/portage/metadata/timestamp}) * Replaced 12 occurances of %([qQrwWx])\[(.*?)\] with %\1{\2} 3 Examples: The code: return send(command) if %w[get backup restore].include? command becomes: return send(command) if %w{get backup restore}.include? command The code: for iv in %w[indent space space_before object_nl array_nl check_circular allow_nan max_nesting] becomes: for iv in %w{indent space space_before object_nl array_nl check_circular allow_nan max_nesting} The code: @puppetd.command_line.stubs(:args).returns(%w[--logdest /my/file]) becomes: @puppetd.command_line.stubs(:args).returns(%w{--logdest /my/file}) * Replaced no occurances of %([qQrwWx])<(.*?)> with %\1{\2} * Replaced 19 occurances of %([qQrwWx])([^{\[(<])(.*?)\2 with %\1{\3} 3 Examples: The code: at.add_mapping(%r%^lib/puppet/(.*)\.rb$%) { |filename, m| becomes: at.add_mapping(%r{^lib/puppet/(.*)\.rb$}) { |filename, m| The code: at.add_mapping(%r%^spec/(unit|integration)/.*\.rb$%) { |filename, _| becomes: at.add_mapping(%r{^spec/(unit|integration)/.*\.rb$}) { |filename, _| The code: at.add_mapping(%r!^lib/puppet\.rb$!) { |filename, _| becomes: at.add_mapping(%r{^lib/puppet\.rb$}) { |filename, _|
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r--lib/puppet/provider/package/portage.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb
index ec0d1b7c4..5f3a5bd4c 100644
--- a/lib/puppet/provider/package/portage.rb
+++ b/lib/puppet/provider/package/portage.rb
@@ -20,7 +20,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
search_format = "<category> <name> [<installedversions:LASTVERSION>] [<bestversion:LASTVERSION>] <homepage> <description>\n"
begin
- if !FileUtils.uptodate?("/var/cache/eix", %w(/usr/bin/eix /usr/portage/metadata/timestamp))
+ if !FileUtils.uptodate?("/var/cache/eix", %w{/usr/bin/eix /usr/portage/metadata/timestamp})
update_eix
end
@@ -83,7 +83,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
search_value = package_name
begin
- if !FileUtils.uptodate?("/var/cache/eix", %w(/usr/bin/eix /usr/portage/metadata/timestamp))
+ if !FileUtils.uptodate?("/var/cache/eix", %w{/usr/bin/eix /usr/portage/metadata/timestamp})
update_eix
end