[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Daniel Pittman
daniel at puppetlabs.com
Tue May 10 08:11:10 UTC 2011
The following commit has been merged in the experimental branch:
commit 0b97bd0df57dd6732db5f52fc7360f61e74dba2e
Author: Daniel Pittman <daniel at puppetlabs.com>
Date: Tue Apr 5 11:36:18 2011 -0700
(#6972) Clean up OptParse name extraction a little.
During testing, an obvious cleanup showed up for the name extraction here, so
we implement it. This extends the regexp to better extract the data we want
rather than hacking it up post-match and having to do extra validation to make
sure it actually worked.
Reviewed-By: Dan Bode <dan at puppetlabs.com>
diff --git a/lib/puppet/string/option.rb b/lib/puppet/string/option.rb
index f499e4b..be7bbb7 100644
--- a/lib/puppet/string/option.rb
+++ b/lib/puppet/string/option.rb
@@ -70,10 +70,10 @@ class Puppet::String::Option
end
def optparse_to_name(declaration)
- unless found = declaration.match(/^-+([^= ]+)/) or found.length != 1 then
+ unless found = declaration.match(/^-+(?:\[no-\])?([^ =]+)/) then
raise ArgumentError, "Can't find a name in the declaration #{declaration.inspect}"
end
- name = found.captures.first.sub('[no-]', '').tr('-', '_')
+ name = found.captures.first.tr('-', '_')
raise "#{name.inspect} is an invalid option name" unless name.to_s =~ /^[a-z]\w*$/
name.to_sym
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list