diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-07-22 14:33:58 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-25 22:24:45 -0700 |
commit | d38e52224f19b4fcedef722b2aab8fc94a59b481 (patch) | |
tree | 18cff77c9667e3e951090489cfe493d596677b25 | |
parent | 86b0882c8a772b2e84e8da0609ec911d085ac0fc (diff) | |
download | puppet-d38e52224f19b4fcedef722b2aab8fc94a59b481.tar.gz puppet-d38e52224f19b4fcedef722b2aab8fc94a59b481.tar.xz puppet-d38e52224f19b4fcedef722b2aab8fc94a59b481.zip |
[#4333] old optparse doesn't support default_argv=
optparse hasn't always had the concept of default_argv. Fortunately, we
don't really need it.
-rw-r--r-- | lib/puppet/application.rb | 3 | ||||
-rwxr-xr-x | spec/unit/application_spec.rb | 14 |
2 files changed, 3 insertions, 14 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index 05b7d466f..0a8fbc155 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -264,7 +264,6 @@ class Application self.send(fname, value) end end - @option_parser.default_argv = self.command_line.args @option_parser end @@ -337,7 +336,7 @@ class Application # scan command line argument begin - self.option_parser.parse! + self.option_parser.parse!(self.command_line.args) rescue OptionParser::ParseError => detail $stderr.puts detail $stderr.puts "Try 'puppet #{command_line.subcommand_name} --help'" diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 3c354cce9..433809172 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -194,7 +194,6 @@ describe Puppet::Application do it "should create a new option parser when needed" do option_parser = stub "option parser" option_parser.stubs(:on) - option_parser.stubs(:default_argv=) OptionParser.expects(:new).returns(option_parser).once @app.option_parser.should == option_parser @app.option_parser.should == option_parser @@ -203,7 +202,6 @@ describe Puppet::Application do it "should pass the banner to the option parser" do option_parser = stub "option parser" option_parser.stubs(:on) - option_parser.stubs(:default_argv=) @app.class.instance_eval do banner "banner" end @@ -213,15 +211,6 @@ describe Puppet::Application do @app.option_parser end - it "should set the optionparser's args to the command line args" do - option_parser = stub "option parser" - option_parser.stubs(:on) - option_parser.expects(:default_argv=).with(%w{ fake args }) - @app.command_line.stubs(:args).returns(%w{ fake args }) - OptionParser.expects(:new).returns(option_parser) - @app.option_parser - end - it "should get options from Puppet.settings.optparse_addargs" do Puppet.settings.expects(:optparse_addargs).returns([]) @@ -237,7 +226,8 @@ describe Puppet::Application do end it "should ask OptionParser to parse the command-line argument" do - @app.option_parser.expects(:parse!) + @app.command_line.stubs(:args).returns(%w{ fake args }) + @app.option_parser.expects(:parse!).with(%w{ fake args }) @app.parse_options end |