[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Luke Kanies luke at puppetlabs.com
Tue May 10 08:05:13 UTC 2011


The following commit has been merged in the experimental branch:
commit 368210e8a8a35cf2cae509b1d357337f9958cdff
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Tue Feb 22 17:38:04 2011 -0800

    Adding a simple "config" app
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/lib/puppet/application/config.rb b/lib/puppet/application/config.rb
new file mode 100644
index 0000000..90c5f53
--- /dev/null
+++ b/lib/puppet/application/config.rb
@@ -0,0 +1,4 @@
+require 'puppet/application/interface_base'
+
+class Puppet::Application::Config < Puppet::Application::InterfaceBase
+end
diff --git a/lib/puppet/interface/config.rb b/lib/puppet/interface/config.rb
new file mode 100644
index 0000000..501099a
--- /dev/null
+++ b/lib/puppet/interface/config.rb
@@ -0,0 +1,10 @@
+require 'puppet/interface'
+
+Puppet::Interface.new(:config) do
+  action(:print) do |*args|
+    if name
+      Puppet.settings[:configprint] = args.join(",")
+    end
+    Puppet.settings.print_config_options
+  end
+end
diff --git a/spec/unit/application/config_spec.rb b/spec/unit/application/config_spec.rb
new file mode 100644
index 0000000..3d894a8
--- /dev/null
+++ b/spec/unit/application/config_spec.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/application/config'
+
+describe Puppet::Application::Config do
+  it "should be a subclass of Puppet::Application::InterfaceBase" do
+    Puppet::Application::Config.superclass.should equal(Puppet::Application::InterfaceBase)
+  end
+end
diff --git a/spec/unit/interface/config_spec.rb b/spec/unit/interface/config_spec.rb
new file mode 100644
index 0000000..79c65f2
--- /dev/null
+++ b/spec/unit/interface/config_spec.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/config'
+
+describe Puppet::Interface.interface(:config) do
+  before do
+    @interface = Puppet::Interface.interface(:config)
+  end
+
+  it "should be a subclass of 'Indirection'" do
+    @interface.should be_instance_of(Puppet::Interface)
+  end
+
+  it "should use Settings#print_config_options when asked to print" do
+    Puppet.settings.stubs(:puts)
+    Puppet.settings.expects(:print_config_options)
+    @interface.print
+  end
+
+  it "should set 'configprint' to all desired values and call print_config_options when a specific value is provided" do
+    Puppet.settings.stubs(:puts)
+    Puppet.settings.expects(:print_config_options)
+    @interface.print("libdir", "ssldir")
+    Puppet.settings[:configprint].should == "libdir,ssldir"
+  end
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list