summaryrefslogtreecommitdiffstats
path: root/install.rb
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-01-12 23:16:39 +1100
committerJames Turnbull <james@lovedthanlost.net>2008-01-12 23:16:39 +1100
commite5888af8848e5e54821a1a238c4b4af253160afa (patch)
tree6964177157ebedb26f1cff9094fcf831676b411e /install.rb
parentebe5cc0979b57517f81c84a4d3ee771c12c6a19f (diff)
downloadpuppet-e5888af8848e5e54821a1a238c4b4af253160afa.tar.gz
puppet-e5888af8848e5e54821a1a238c4b4af253160afa.tar.xz
puppet-e5888af8848e5e54821a1a238c4b4af253160afa.zip
Added support for man page creation - requires rst2man.py and writer - closed ticket #198
Diffstat (limited to 'install.rb')
-rwxr-xr-xinstall.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/install.rb b/install.rb
index 6c418119b..d9ec864bc 100755
--- a/install.rb
+++ b/install.rb
@@ -47,6 +47,18 @@ rescue LoadError
$haverdoc = false
end
+begin
+ if $haverdoc
+ rst2man = %x{which rst2man.py}
+ $haveman = true
+ else
+ $haveman = false
+ end
+rescue
+ puts "Missing rst2man; skipping man page creation"
+ $haveman = false
+end
+
PREREQS = %w{openssl facter xmlrpc/client xmlrpc/server cgi}
InstallOptions = OpenStruct.new
@@ -114,6 +126,15 @@ def prepare_installation
end
InstallOptions.tests = true
+ if $haveman
+ InstallOptions.man = true
+ if RUBY_PLATFORM == "i386-mswin32"
+ InstallOptions.man = false
+ end
+ else
+ InstallOptions.man = false
+ end
+
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.separator ""
@@ -123,6 +144,9 @@ def prepare_installation
opts.on('--[no-]ri', 'Prevents the creation of RI output.', 'Default off on mswin32.') do |onri|
InstallOptions.ri = onri
end
+ opts.on('--[no-]man', 'Presents the creation of man pages.', 'Default on.') do |onman|
+ InstallOptions.man = onman
+ end
opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default on.') do |ontest|
InstallOptions.tests = ontest
end
@@ -133,6 +157,7 @@ def prepare_installation
end
opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |full|
InstallOptions.rdoc = true
+ InstallOptions.man = true
InstallOptions.ri = true
InstallOptions.tests = true
end
@@ -212,6 +237,26 @@ def build_ri(files)
end
end
+def build_man(bins)
+ return unless $haveman
+ begin
+ # Create man pages
+ bins.each do |bin|
+ rst2man = %x{which rst2man.py}
+ rst2man.chomp!
+ b = bin.gsub( "bin/", "")
+ %x{#{bin} --help > ./#{b}.rst}
+ %x{#{rst2man} ./#{b}.rst ./man/man8/#{b}.8}
+
+ # Delete temporary files
+ File.unlink("./#{b}.rst")
+ end
+ rescue
+ $stderr.puts "Couldn't build man pages"
+ $stderr.puts "Continuing with install..."
+ end
+end
+
def run_tests(test_list)
begin
require 'test/unit/ui/console/testrunner'
@@ -309,6 +354,7 @@ prepare_installation
run_tests(tests) if InstallOptions.tests
#build_rdoc(rdoc) if InstallOptions.rdoc
#build_ri(ri) if InstallOptions.ri
+build_man(bins) if InstallOptions.man
do_bins(sbins, InstallOptions.sbin_dir)
do_bins(bins, InstallOptions.bin_dir)
do_libs(libs)