[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:14 UTC 2010
The following commit has been merged in the upstream branch:
commit 184132e07fc1461555cb4da842df15f32842a843
Author: Markus Roberts <Markus at reality.com>
Date: Fri Jul 9 18:05:07 2010 -0700
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, _|
diff --git a/autotest/puppet_rspec.rb b/autotest/puppet_rspec.rb
index 5569500..1504d45 100644
--- a/autotest/puppet_rspec.rb
+++ b/autotest/puppet_rspec.rb
@@ -5,40 +5,40 @@ Autotest.add_hook :initialize do |at|
at.clear_mappings
# the libraries under lib/puppet
- at.add_mapping(%r%^lib/puppet/(.*)\.rb$%) { |filename, m|
+ at.add_mapping(%r{^lib/puppet/(.*)\.rb$}) { |filename, m|
at.files_matching %r!spec/(unit|integration)/#{m[1]}.rb!
}
# the actual spec files themselves
- at.add_mapping(%r%^spec/(unit|integration)/.*\.rb$%) { |filename, _|
+ at.add_mapping(%r{^spec/(unit|integration)/.*\.rb$}) { |filename, _|
filename
}
# force a complete re-run for all of these:
# main puppet lib
- at.add_mapping(%r!^lib/puppet\.rb$!) { |filename, _|
- at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ at.add_mapping(%r{^lib/puppet\.rb$}) { |filename, _|
+ at.files_matching %r{spec/(unit|integration)/.*\.rb}
}
# the spec_helper
- at.add_mapping(%r!^spec/spec_helper\.rb$!) { |filename, _|
- at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ at.add_mapping(%r{^spec/spec_helper\.rb$}) { |filename, _|
+ at.files_matching %r{spec/(unit|integration)/.*\.rb}
}
# the puppet test libraries
- at.add_mapping(%r!^test/lib/puppettest/.*!) { |filename, _|
- at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ at.add_mapping(%r{^test/lib/puppettest/.*}) { |filename, _|
+ at.files_matching %r{spec/(unit|integration)/.*\.rb}
}
# the puppet spec libraries
- at.add_mapping(%r!^spec/lib/spec.*!) { |filename, _|
- at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ at.add_mapping(%r{^spec/lib/spec.*}) { |filename, _|
+ at.files_matching %r{spec/(unit|integration)/.*\.rb}
}
# the monkey patches for rspec
- at.add_mapping(%r!^spec/lib/monkey_patches/.*!) { |filename, _|
- at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ at.add_mapping(%r{^spec/lib/monkey_patches/.*}) { |filename, _|
+ at.files_matching %r{spec/(unit|integration)/.*\.rb}
}
end
diff --git a/autotest/rspec.rb b/autotest/rspec.rb
index bf3d2d9..89978d8 100644
--- a/autotest/rspec.rb
+++ b/autotest/rspec.rb
@@ -3,14 +3,14 @@ require 'autotest'
Autotest.add_hook :initialize do |at|
at.clear_mappings
# watch out: Ruby bug (1.8.6):
- # %r(/) != /\//
- at.add_mapping(%r%^spec/.*\.rb$%) { |filename, _|
+ # %r{/} != /\//
+ at.add_mapping(%r{^spec/.*\.rb$}) { |filename, _|
filename
}
- at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
+ at.add_mapping(%r{^lib/(.*)\.rb$}) { |_, m|
["spec/#{m[1]}_spec.rb"]
}
- at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
+ at.add_mapping(%r{^spec/(spec_helper|shared/.*)\.rb$}) {
at.files_matching %r{^spec/.*_spec\.rb$}
}
end
diff --git a/autotest/watcher.rb b/autotest/watcher.rb
index 028d3fe..0beaca7 100644
--- a/autotest/watcher.rb
+++ b/autotest/watcher.rb
@@ -98,15 +98,15 @@ def run_suite
end
watch('spec/spec_helper.rb') { run_all_specs }
-watch(%r%^spec/(unit|integration)/.*\.rb$%) { |md| run_spec_files(md[0]) }
-watch(%r%^lib/puppet/(.*)\.rb$%) { |md|
+watch(%r{^spec/(unit|integration)/.*\.rb$}) { |md| run_spec_files(md[0]) }
+watch(%r{^lib/puppet/(.*)\.rb$}) { |md|
run_spec_files(file2specs(md[0]))
if t = file2test(md[0])
run_test_file(t)
end
}
-watch(%r!^spec/lib/spec.*!) { |md| run_all_specs }
-watch(%r!^spec/lib/monkey_patches/.*!) { |md| run_all_specs }
+watch(%r{^spec/lib/spec.*}) { |md| run_all_specs }
+watch(%r{^spec/lib/monkey_patches/.*}) { |md| run_all_specs }
watch(%r{test/.+\.rb}) { |md|
if md[0] =~ /\/lib\//
run_all_tests
diff --git a/install.rb b/install.rb
index 54a7146..18da2be 100755
--- a/install.rb
+++ b/install.rb
@@ -82,7 +82,7 @@ end
sbins = glob(%w{sbin/*})
bins = glob(%w{bin/*})
rdoc = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ }
-ri = glob(%w(bin/*.rb sbin/* lib/**/*.rb)).reject { |e| e=~ /\.(bat|cmd)$/ }
+ri = glob(%w{bin/*.rb sbin/* lib/**/*.rb}).reject { |e| e=~ /\.(bat|cmd)$/ }
man = glob(%w{man/man[0-9]/*})
libs = glob(%w{lib/**/*.rb lib/**/*.py})
tests = glob(%w{test/**/*.rb})
diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb
index 8f9e917..842e172 100644
--- a/lib/puppet/application/filebucket.rb
+++ b/lib/puppet/application/filebucket.rb
@@ -15,7 +15,7 @@ class Puppet::Application::Filebucket < Puppet::Application
def run_command
@args = command_line.args
command = args.shift
- return send(command) if %w[get backup restore].include? command
+ return send(command) if %w{get backup restore}.include? command
help
end
diff --git a/lib/puppet/external/pson/pure/generator.rb b/lib/puppet/external/pson/pure/generator.rb
index 44aa526..6656ed1 100644
--- a/lib/puppet/external/pson/pure/generator.rb
+++ b/lib/puppet/external/pson/pure/generator.rb
@@ -212,7 +212,7 @@ module PSON
# passed to the configure method.
def to_h
result = {}
- for iv in %w[indent space space_before object_nl array_nl check_circular allow_nan max_nesting]
+ for iv in %w{indent space space_before object_nl array_nl check_circular allow_nan max_nesting}
result[iv.intern] = instance_variable_get("@#{iv}")
end
result
diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb
index ec0d1b7..5f3a5bd 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
diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index b6aceb5..d430089 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -294,7 +294,7 @@ module Puppet
newproperty(:failovermethod, :parent => Puppet::IniProperty) do
desc "Either 'roundrobin' or 'priority'.\n#{ABSENT_DOC}"
newvalue(:absent) { self.should = :absent }
- newvalue(%r(roundrobin|priority)) { }
+ newvalue(%r{roundrobin|priority}) { }
end
newproperty(:keepalive, :parent => Puppet::IniProperty) do
diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb
index 074b378..30d8edb 100755
--- a/spec/unit/application/agent_spec.rb
+++ b/spec/unit/application/agent_spec.rb
@@ -155,7 +155,7 @@ describe Puppet::Application::Agent do
end
it "should parse the log destination from the command line" do
- @puppetd.command_line.stubs(:args).returns(%w[--logdest /my/file])
+ @puppetd.command_line.stubs(:args).returns(%w{--logdest /my/file})
Puppet::Util::Log.expects(:newdestination).with("/my/file")
diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb
index 419f63d..f3c3b35 100644
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@ -102,7 +102,7 @@ describe Puppet::Application::Master do
end
it "should parse the log destination from ARGV" do
- @master.command_line.stubs(:args).returns(%w[--logdest /my/file])
+ @master.command_line.stubs(:args).returns(%w{--logdest /my/file})
Puppet::Util::Log.expects(:newdestination).with("/my/file")
diff --git a/spec/unit/indirector/node/ldap_spec.rb b/spec/unit/indirector/node/ldap_spec.rb
index 6f53b6c..aef623f 100755
--- a/spec/unit/indirector/node/ldap_spec.rb
+++ b/spec/unit/indirector/node/ldap_spec.rb
@@ -170,7 +170,7 @@ describe Puppet::Node::Ldap do
end
it "should add any classes from ldap" do
- @result[:classes] = %w[a b c d]
+ @result[:classes] = %w{a b c d}
@node.expects(:classes=).with(%w{a b c d})
@searcher.find(@request)
end
diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb
index 47a7684..d583d49 100755
--- a/spec/unit/parser/lexer_spec.rb
+++ b/spec/unit/parser/lexer_spec.rb
@@ -407,15 +407,15 @@ end
describe Puppet::Parser::Lexer,"when lexing strings" do
{
- %q['single quoted string')] => [[:STRING,'single quoted string']],
- %q["double quoted string"] => [[:STRING,'double quoted string']],
- %q['single quoted string with an escaped "\\'"'] => [[:STRING,'single quoted string with an escaped "\'"']],
- %q["string with an escaped '\\"'"] => [[:STRING,"string with an escaped '\"'"]],
- %q["string with an escaped '\\$'"] => [[:STRING,"string with an escaped '$'"]],
- %q["string with $v (but no braces)"] => [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' (but no braces)']],
+ %q{'single quoted string')} => [[:STRING,'single quoted string']],
+ %q{"double quoted string"} => [[:STRING,'double quoted string']],
+ %q{'single quoted string with an escaped "\\'"'} => [[:STRING,'single quoted string with an escaped "\'"']],
+ %q{"string with an escaped '\\"'"} => [[:STRING,"string with an escaped '\"'"]],
+ %q{"string with an escaped '\\$'"} => [[:STRING,"string with an escaped '$'"]],
+ %q{"string with $v (but no braces)"} => [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' (but no braces)']],
%q["string with ${v} in braces"] => [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' in braces']],
%q["string with ${qualified::var} in braces"] => [[:DQPRE,"string with "],[:VARIABLE,'qualified::var'],[:DQPOST,' in braces']],
- %q["string with $v and $v (but no braces)"] => [[:DQPRE,"string with "],[:VARIABLE,"v"],[:DQMID," and "],[:VARIABLE,"v"],[:DQPOST," (but no braces)"]],
+ %q{"string with $v and $v (but no braces)"} => [[:DQPRE,"string with "],[:VARIABLE,"v"],[:DQMID," and "],[:VARIABLE,"v"],[:DQPOST," (but no braces)"]],
%q["string with ${v} and ${v} in braces"] => [[:DQPRE,"string with "],[:VARIABLE,"v"],[:DQMID," and "],[:VARIABLE,"v"],[:DQPOST," in braces"]],
%q["string with ${'a nested single quoted string'} inside it."] => [[:DQPRE,"string with "],[:STRING,'a nested single quoted string'],[:DQPOST,' inside it.']],
%q["string with ${['an array ',$v2]} in it."] => [[:DQPRE,"string with "],:LBRACK,[:STRING,"an array "],:COMMA,[:VARIABLE,"v2"],:RBRACK,[:DQPOST," in it."]],
diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb
index 31b2d1b..bb2d073 100644
--- a/spec/unit/util/command_line_spec.rb
+++ b/spec/unit/util/command_line_spec.rb
@@ -12,42 +12,42 @@ describe Puppet::Util::CommandLine do
end
it "should pull off the first argument if it looks like a subcommand" do
- command_line = Puppet::Util::CommandLine.new("puppet", %w( client --help whatever.pp ), @tty )
+ command_line = Puppet::Util::CommandLine.new("puppet", %w{ client --help whatever.pp }, @tty )
command_line.subcommand_name.should == "client"
- command_line.args.should == %w( --help whatever.pp )
+ command_line.args.should == %w{ --help whatever.pp }
end
it "should use 'apply' if the first argument looks like a .pp file" do
- command_line = Puppet::Util::CommandLine.new("puppet", %w( whatever.pp ), @tty )
+ command_line = Puppet::Util::CommandLine.new("puppet", %w{ whatever.pp }, @tty )
command_line.subcommand_name.should == "apply"
- command_line.args.should == %w( whatever.pp )
+ command_line.args.should == %w{ whatever.pp }
end
it "should use 'apply' if the first argument looks like a .rb file" do
- command_line = Puppet::Util::CommandLine.new("puppet", %w( whatever.rb ), @tty )
+ command_line = Puppet::Util::CommandLine.new("puppet", %w{ whatever.rb }, @tty )
command_line.subcommand_name.should == "apply"
- command_line.args.should == %w( whatever.rb )
+ command_line.args.should == %w{ whatever.rb }
end
it "should use 'apply' if the first argument looks like a flag" do
- command_line = Puppet::Util::CommandLine.new("puppet", %w( --debug ), @tty )
+ command_line = Puppet::Util::CommandLine.new("puppet", %w{ --debug }, @tty )
command_line.subcommand_name.should == "apply"
- command_line.args.should == %w( --debug )
+ command_line.args.should == %w{ --debug }
end
it "should use 'apply' if the first argument is -" do
- command_line = Puppet::Util::CommandLine.new("puppet", %w( - ), @tty )
+ command_line = Puppet::Util::CommandLine.new("puppet", %w{ - }, @tty )
command_line.subcommand_name.should == "apply"
- command_line.args.should == %w( - )
+ command_line.args.should == %w{ - }
end
it "should return nil if the first argument is --help" do
- command_line = Puppet::Util::CommandLine.new("puppet", %w( --help ), @tty )
+ command_line = Puppet::Util::CommandLine.new("puppet", %w{ --help }, @tty )
command_line.subcommand_name.should == nil
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list