summaryrefslogtreecommitdiffstats
path: root/install.rb
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-03-22 15:00:19 +1100
committerJames Turnbull <james@lovedthanlost.net>2008-03-22 15:00:19 +1100
commite5b16b26fff6b8b358975d27d46a274407891a69 (patch)
treeb5a2f4774e29098fa66508471c013b6c4d1529f3 /install.rb
parent18320b8e3271f7d1d1702907be1ff420acfc8d2b (diff)
downloadpuppet-e5b16b26fff6b8b358975d27d46a274407891a69.tar.gz
puppet-e5b16b26fff6b8b358975d27d46a274407891a69.tar.xz
puppet-e5b16b26fff6b8b358975d27d46a274407891a69.zip
Ported #198 man page creation functionality to 0.24.x branch
Diffstat (limited to 'install.rb')
-rwxr-xr-xinstall.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/install.rb b/install.rb
index 6c418119b..c7472a111 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
@@ -112,6 +124,17 @@ def prepare_installation
InstallOptions.rdoc = false
InstallOptions.ri = false
end
+
+
+ if $haveman
+ InstallOptions.man = true
+ if RUBY_PLATFORM == "i386-mswin32"
+ InstallOptions.man = false
+ end
+ else
+ InstallOptions.man = false
+ end
+
InstallOptions.tests = true
ARGV.options do |opts|
@@ -123,6 +146,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
@@ -212,6 +238,30 @@ def build_ri(files)
end
end
+def build_man(bins)
+ return unless $haveman
+ begin
+ # Locate rst2man
+ rst2man = %x{which rst2man.py}
+ rst2man.chomp!
+ # Create puppet.conf.8 man page
+ %x{bin/puppetdoc --reference configuration > ./puppet.conf.rst}
+ %x{#{rst2man} ./puppet.conf.rst ./man/man8/puppet.conf.8}
+ File.unlink("./puppet.conf.rst")
+
+ # Create binary man pages
+ bins.each do |bin|
+ b = bin.gsub( "bin/", "")
+ %x{#{bin} --help > ./#{b}.rst}
+ %x{#{rst2man} ./#{b}.rst ./man/man8/#{b}.8}
+ File.unlink("./#{b}.rst")
+ end
+ rescue SystemCallError
+ $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 +359,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)