summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-03-21 15:00:17 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-03-21 15:00:17 -0700
commita7173dc2054c4167c71a23fb70e3ca54d07c7447 (patch)
treeec8b3beb8a236149676bf545d7a9fe45cd4c7a3d /lib
parentb187e071ac1b334878498d52ee6c18f8c0e6a5d9 (diff)
downloadpuppet-a7173dc2054c4167c71a23fb70e3ca54d07c7447.tar.gz
puppet-a7173dc2054c4167c71a23fb70e3ca54d07c7447.tar.xz
puppet-a7173dc2054c4167c71a23fb70e3ca54d07c7447.zip
(#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
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/application/indirection_base.rb2
-rw-r--r--lib/puppet/application/interface_base.rb2
-rw-r--r--lib/puppet/interface.rb13
3 files changed, 11 insertions, 6 deletions
diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb
index e6d172ced..764098925 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 88f97b69b..1f18b086c 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 f9b26950a..dfd75ef58 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