[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.1rc1-141-gcdb2b90

Markus Roberts Markus at reality.com
Mon Aug 16 12:48:27 UTC 2010


The following commit has been merged in the upstream branch:
commit d38e52224f19b4fcedef722b2aab8fc94a59b481
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Thu Jul 22 14:33:58 2010 -0700

    [#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.

diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index 05b7d46..0a8fbc1 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 3c354cc..4338091 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

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list