summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/resource.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-04-30 16:05:43 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitd038a1d3ddffdf1366c78fe31118e9f15c1c6ed1 (patch)
tree6ff89deef467aa58b8b50ea06200b5d2f2dc97ac /lib/puppet/application/resource.rb
parent7656ba73ddfd883b36a01c81147ae69e80773bce (diff)
downloadpuppet-d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1.tar.gz
puppet-d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1.tar.xz
puppet-d038a1d3ddffdf1366c78fe31118e9f15c1c6ed1.zip
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 <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet/application/resource.rb')
-rw-r--r--lib/puppet/application/resource.rb8
1 files changed, 4 insertions, 4 deletions
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