From d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 30 Apr 2010 16:05:43 -0700 Subject: Refactor #3706 Reify eigenclasses of Applications The Puppet::Application DSL is complicated by the fact that it operates on eigenclasses of instances of Puppet::Application, rather than subclassing it. This patch reifies the eigenclasses as subclasses of Puppet::Application. Signed-off-by: Jesse Wolfe --- lib/puppet/application/resource.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/puppet/application/resource.rb') diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index 78aed95c5..52320e7a1 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -2,13 +2,13 @@ require 'puppet' require 'puppet/application' require 'facter' -Puppet::Application.new(:resource) do +class Puppet::Application::Resource < Puppet::Application should_not_parse_config attr_accessor :host, :extra_params - preinit do + def preinit @extra_params = [] @host = nil Facter.loadfacts @@ -37,7 +37,7 @@ Puppet::Application.new(:resource) do @extra_params << arg.to_sym end - command(:main) do + def main args = Puppet::Util::CommandLine.args type = args.shift or raise "You must specify the type to display" typeobj = Puppet::Type.type(type) or raise "Could not find type #{type}" @@ -109,7 +109,7 @@ Puppet::Application.new(:resource) do end end - setup do + def setup Puppet::Util::Log.newdestination(:console) # Now parse the config -- cgit