diff options
author | Luke Kanies <luke@madstop.com> | 2008-01-19 11:29:57 -0800 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-01-19 11:29:57 -0800 |
commit | 1f15c80587529192321658a2e51fda33d481ced5 (patch) | |
tree | 903f9db27f8f55bf0e5bf6ef6f9f828168608019 /install.rb | |
parent | c751058722e10c6900f99f095d3be6e30c186a3e (diff) | |
parent | f335dc31f11f4bed80e91df041febdca6e33d3c2 (diff) | |
download | puppet-1f15c80587529192321658a2e51fda33d481ced5.tar.gz puppet-1f15c80587529192321658a2e51fda33d481ced5.tar.xz puppet-1f15c80587529192321658a2e51fda33d481ced5.zip |
Merge commit 'turnbull/ticket_198'
Diffstat (limited to 'install.rb')
-rwxr-xr-x | install.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/install.rb b/install.rb index 6c418119b..6dbb3e0e3 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,29 @@ def build_ri(files) end end +def build_man(bins) + return unless $haveman + begin + # Create binary man pages + rst2man = %x{which rst2man.py} + rst2man.chomp! + %x{bin/puppetdoc --reference configuration > ./puppet.conf.rst} + %x{#{rst2man} ./puppet.conf.rst ./man/man8/puppet.conf.8} + + bins.each do |bin| + b = bin.gsub( "bin/", "") + %x{#{bin} --help > ./#{b}.rst} + %x{#{rst2man} ./#{b}.rst ./man/man8/#{b}.8} + + # Delete temporary files + File.unlink("./#{b}.rst","./puppet.conf.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 +357,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) |