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

Pieter van de Bruggen pieter at puppetlabs.com
Tue May 10 08:06:22 UTC 2011


The following commit has been merged in the experimental branch:
commit a7173dc2054c4167c71a23fb70e3ca54d07c7447
Author: Pieter van de Bruggen <pieter at puppetlabs.com>
Date:   Mon Mar 21 15:00:17 2011 -0700

    (#6786) Fixing a number of failing tests.
    
    The initial merge of this branch hadn't actually been run against the full
    suite of specs; a number of specs began failing shortly afterward.
    
    Reviewed-By: Daniel Pittman

diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb
index e6d172c..7640989 100644
--- a/lib/puppet/application/indirection_base.rb
+++ b/lib/puppet/application/indirection_base.rb
@@ -2,7 +2,7 @@ require 'puppet/application/interface_base'
 require 'puppet/interface'
 
 class Puppet::Application::IndirectionBase < Puppet::Application::InterfaceBase
-  option("--from TERMINUS", "-f") do |arg|
+  option("--terminus TERMINUS") do |arg|
     @from = arg
   end
 
diff --git a/lib/puppet/application/interface_base.rb b/lib/puppet/application/interface_base.rb
index 88f97b6..1f18b08 100644
--- a/lib/puppet/application/interface_base.rb
+++ b/lib/puppet/application/interface_base.rb
@@ -71,7 +71,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application
 
     @type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym
 
-    unless @interface = Puppet::Interface.interface(@type)
+    unless @interface = Puppet::Interface.const_get(@type)
       raise "Could not find interface '#{@type}'"
     end
     @format ||= @interface.default_format
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index f9b2695..dfd75ef 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -42,20 +42,25 @@ class Puppet::Interface
     nil
   end
 
+  def self.const_get(name)
+    name = constantize(name)
+    super(name)
+  end
+
   def self.register_interface(name, instance)
-    const_set(name2const(name), instance)
+    const_set(constantize(name), instance)
   end
 
   def self.unload_interface(name)
-    remove_const(name2const(name)) rescue nil
+    remove_const(constantize(name)) rescue nil
   end
 
   def self.unify_name(name)
     name.to_s.downcase.to_sym
   end
 
-  def self.name2const(name)
-    name.to_s.capitalize
+  def self.constantize(name)
+    name.to_s.split(/\W|_/).map { |x| x.capitalize }.join
   end
 
   attr_accessor :default_format
diff --git a/spec/unit/interface/catalog_spec.rb b/spec/unit/interface/catalog_spec.rb
index 8eb0040..5748427 100644
--- a/spec/unit/interface/catalog_spec.rb
+++ b/spec/unit/interface/catalog_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/catalog'
 
-describe Puppet::Interface.interface(:catalog) do
+describe Puppet::Interface::Catalog do
   before do
-    @interface = Puppet::Interface.interface(:catalog)
+    @interface = Puppet::Interface::Catalog
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/certificate_request_spec.rb b/spec/unit/interface/certificate_request_spec.rb
index 8a613e5..fa9e819 100644
--- a/spec/unit/interface/certificate_request_spec.rb
+++ b/spec/unit/interface/certificate_request_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/certificate_request'
 
-describe Puppet::Interface.interface(:certificate_request) do
+describe Puppet::Interface::CertificateRequest do
   before do
-    @interface = Puppet::Interface.interface(:certificate_request)
+    @interface = Puppet::Interface::CertificateRequest
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/certificate_revocation_list_spec.rb b/spec/unit/interface/certificate_revocation_list_spec.rb
index 8ee341b..3fc981b 100644
--- a/spec/unit/interface/certificate_revocation_list_spec.rb
+++ b/spec/unit/interface/certificate_revocation_list_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/certificate_revocation_list'
 
-describe Puppet::Interface.interface(:certificate_revocation_list) do
+describe Puppet::Interface::CertificateRevocationList do
   before do
-    @interface = Puppet::Interface.interface(:certificate_revocation_list)
+    @interface = Puppet::Interface::CertificateRevocationList
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/certificate_spec.rb b/spec/unit/interface/certificate_spec.rb
index 47ddcb5..6b5f922 100644
--- a/spec/unit/interface/certificate_spec.rb
+++ b/spec/unit/interface/certificate_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/certificate'
 
-describe Puppet::Interface.interface(:certificate) do
+describe Puppet::Interface::Certificate do
   before do
-    @interface = Puppet::Interface.interface(:certificate)
+    @interface = Puppet::Interface::Certificate
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/config_spec.rb b/spec/unit/interface/config_spec.rb
index 79c65f2..683e8ab 100644
--- a/spec/unit/interface/config_spec.rb
+++ b/spec/unit/interface/config_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/config'
 
-describe Puppet::Interface.interface(:config) do
+describe Puppet::Interface::Config do
   before do
-    @interface = Puppet::Interface.interface(:config)
+    @interface = Puppet::Interface::Config
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/facts_spec.rb b/spec/unit/interface/facts_spec.rb
index 03d6410..c311b5d 100644
--- a/spec/unit/interface/facts_spec.rb
+++ b/spec/unit/interface/facts_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/facts'
 
-describe Puppet::Interface.interface(:facts) do
+describe Puppet::Interface::Facts do
   before do
-    @interface = Puppet::Interface.interface(:facts)
+    @interface = Puppet::Interface::Facts
   end
 
   it "should define an 'upload' fact" do
diff --git a/spec/unit/interface/file_spec.rb b/spec/unit/interface/file_spec.rb
index fc7accf..1d9e557 100644
--- a/spec/unit/interface/file_spec.rb
+++ b/spec/unit/interface/file_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/file'
 
-describe Puppet::Interface.interface(:file) do
+describe Puppet::Interface::File do
   before do
-    @interface = Puppet::Interface.interface(:file)
+    @interface = Puppet::Interface::File
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/key_spec.rb b/spec/unit/interface/key_spec.rb
index 93a7c93..9be0244 100644
--- a/spec/unit/interface/key_spec.rb
+++ b/spec/unit/interface/key_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/key'
 
-describe Puppet::Interface.interface(:key) do
+describe Puppet::Interface::Key do
   before do
-    @interface = Puppet::Interface.interface(:key)
+    @interface = Puppet::Interface::Key
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/node_spec.rb b/spec/unit/interface/node_spec.rb
index 6310930..cfb15e3 100644
--- a/spec/unit/interface/node_spec.rb
+++ b/spec/unit/interface/node_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/node'
 
-describe Puppet::Interface.interface(:node) do
+describe Puppet::Interface::Node do
   before do
-    @interface = Puppet::Interface.interface(:node)
+    @interface = Puppet::Interface::Node
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/report_spec.rb b/spec/unit/interface/report_spec.rb
index b5bee1a..932fc5c 100644
--- a/spec/unit/interface/report_spec.rb
+++ b/spec/unit/interface/report_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/report'
 
-describe Puppet::Interface.interface(:report) do
+describe Puppet::Interface::Report do
   before do
-    @interface = Puppet::Interface.interface(:report)
+    @interface = Puppet::Interface::Report
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/resource_spec.rb b/spec/unit/interface/resource_spec.rb
index cad45b6..b28b043 100644
--- a/spec/unit/interface/resource_spec.rb
+++ b/spec/unit/interface/resource_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/resource'
 
-describe Puppet::Interface.interface(:resource) do
+describe Puppet::Interface::Resource do
   before do
-    @interface = Puppet::Interface.interface(:resource)
+    @interface = Puppet::Interface::Resource
   end
 
   it "should be a subclass of 'Indirection'" do
diff --git a/spec/unit/interface/resource_type_spec.rb b/spec/unit/interface/resource_type_spec.rb
index 6c437c4..95b9ec7 100644
--- a/spec/unit/interface/resource_type_spec.rb
+++ b/spec/unit/interface/resource_type_spec.rb
@@ -3,9 +3,9 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
 require 'puppet/interface/resource_type'
 
-describe Puppet::Interface.interface(:resource_type) do
+describe Puppet::Interface::ResourceType do
   before do
-    @interface = Puppet::Interface.interface(:resource_type)
+    @interface = Puppet::Interface::ResourceType
   end
 
   it "should be a subclass of 'Indirection'" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list