summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorRein Henrichs <reinh@reinh.com>2010-03-30 15:08:52 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitbe0ecf84edf051df84792067f6d873a70642872f (patch)
treec303cfaaec27278163fc649c29155a76dfc94562 /lib/puppet
parent7a327775c14fc5fed3998918e9c69af939380617 (diff)
downloadpuppet-be0ecf84edf051df84792067f6d873a70642872f.tar.gz
puppet-be0ecf84edf051df84792067f6d873a70642872f.tar.xz
puppet-be0ecf84edf051df84792067f6d873a70642872f.zip
Initial puppet single executable
- puppet executable delegates to available applications and provides basic usage information - Puppet::Application.applications accessor added for access by main executable - Ugly hack to make RDoc::usage work
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/application.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index 2882c8191..0b8e3d9d4 100644
--- a/lib/puppet/application.rb
+++ b/lib/puppet/application.rb
@@ -89,7 +89,11 @@ require 'optparse'
class Puppet::Application
include Puppet::Util
+ SBINDIR = File.expand_path(File.dirname(__FILE__)) + '/../../sbin'
+
@@applications = {}
+ def self.applications; @@applications end
+
class << self
include Puppet::Util
end
@@ -173,7 +177,7 @@ class Puppet::Application
def initialize(name, banner = nil, &block)
@opt_parser = OptionParser.new(banner)
- name = symbolize(name)
+ @name = symbolize(name)
init_default
@@ -181,7 +185,7 @@ class Puppet::Application
instance_eval(&block) if block_given?
- @@applications[name] = self
+ @@applications[@name] = self
end
# initialize default application behaviour
@@ -292,6 +296,12 @@ class Puppet::Application
def help
if Puppet.features.usage?
+ # RH:FIXME: My goodness, this is ugly.
+ ::RDoc.const_set("PuppetSourceFile", @name)
+ def (::RDoc).caller
+ file = `grep -l 'Puppet::Application\\[:#{::RDoc::PuppetSourceFile}\\]' #{SBINDIR}/*`.chomp
+ super << "#{file}:0"
+ end
::RDoc::usage && exit
else
puts "No help available unless you have RDoc::usage installed"