Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
while a = ARGV.shift
case a
when /\A--no-harm\z/
@options['no-harm'] = true
when /\A--prefix=(.*)\z/
path = $1
path = File.expand_path(path) unless path[0,1] == '/'
@options['install-prefix'] = path
else
raise InstallError, "install: unknown option #{a}"
end
end
end
def print_usage( out )
out.puts 'Typical Installation Procedure:'
out.puts " $ ruby #{File.basename $0} config"
out.puts " $ ruby #{File.basename $0} setup"
out.puts " # ruby #{File.basename $0} install (may require root privilege)"
out.puts
out.puts 'Detailed Usage:'
out.puts " ruby #{File.basename $0} <global option>"
out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
fmt = " %-20s %s\n"
out.puts
out.puts 'Global options:'
out.printf fmt, '-q,--quiet', 'suppress message outputs'
out.printf fmt, ' --verbose', 'output messages verbosely'
out.printf fmt, '-h,--help', 'print this message'
out.printf fmt, '-v,--version', 'print version and quit'
out.printf fmt, ' --copyright', 'print copyright and quit'
out.puts
out.puts 'Tasks:'
TASKS.each do |name, desc|
out.printf " %-10s %s\n", name, desc
end
out.puts
out.puts 'Options for config:'
ConfigTable.each_definition do |name, (default, arg, desc, default2)|
out.printf " %-20s %s [%s]\n",
'--'+ name + (ConfigTable.bool_config?(name) ? '' : '='+arg),
desc,
default2 || default
end
out.printf " %-20s %s [%s]\n",
'--rbconfig=path', 'your rbconfig.rb to load', "running ruby's"
out.puts
out.puts 'Options for install:'
out.printf " %-20s %s [%s]\n",
'--no-harm', 'only display what to do if given', 'off'
out.printf " %-20s %s [%s]\n",
'--prefix', 'install path prefix', '$prefix'
out.puts
end
#
# config
#
def exec_config
super
@config.save
end
#
# show
#
def exec_show
ConfigTable.each_name do |k|
v = @config.get_raw(k)
if not v or v.empty?
v = '(not specified)'
end
printf "%-10s %s\n", k, v
end
end
end
### end toplevel.rb
if $0 == __FILE__
begin
ToplevelInstaller.invoke
rescue
raise if $DEBUG
$stderr.puts $!.message
$stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
exit 1
end
end