Build the rdoc documentation.
# File install.rb, line 248
248: def build_rdoc(files)
249: return unless $haverdoc
250: begin
251: r = RDoc::RDoc.new
252: r.document(["--main", "MCollective", "--line-numbers"] + files)
253: rescue RDoc::RDocError => e
254: $stderr.puts e.message
255: rescue Exception => e
256: $stderr.puts "Couldn't build RDoc documentation\n#{e.message}"
257: end
258: end
(Not documented)
# File install.rb, line 65
65: def check_prereqs
66: PREREQS.each do |pre|
67: begin
68: require pre
69: rescue LoadError
70: puts "Could not load #{pre} Ruby library; cannot install"
71: exit(-1)
72: end
73: end
74: end
(Not documented)
# File install.rb, line 86
86: def do_bins(bins, target, strip = 's?bin/')
87: Dir.mkdir(target) unless File.directory? target
88: bins.each do |bf|
89: obf = bf.gsub(/#{strip}/, '')
90: install_binfile(bf, obf, target)
91: end
92: end
(Not documented)
# File install.rb, line 76
76: def do_configs(configs, target, strip = 'etc/')
77: Dir.mkdir(target) unless File.directory? target
78: configs.each do |cf|
79: ocf = File.join(target, cf.gsub(Regexp.new(strip), ''))
80: oc = File.dirname(ocf)
81: makedirs(oc, {:mode => 0755, :verbose => true})
82: install(cf, ocf, {:mode => 0644, :preserve => true, :verbose => true})
83: end
84: end
(Not documented)
# File install.rb, line 94
94: def do_libs(libs, target, strip = 'lib/')
95: libs.each do |lf|
96: olf = File.join(target, lf.sub(/^#{strip}/, ''))
97: op = File.dirname(olf)
98: if File.directory?(lf)
99: makedirs(olf, {:mode => 0755, :verbose => true})
100: else
101: makedirs(op, {:mode => 0755, :verbose => true})
102: install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
103: end
104: end
105: end
(Not documented)
# File install.rb, line 57
57: def glob(list)
58: g = list.map { |i| Dir.glob(i) }
59: g.flatten!
60: g.compact!
61: g.uniq!
62: g
63: end
Install file(s) from ./bin to RbConfig::CONFIG[‘bindir’]. Patch it on the way to insert a #! line; on a Unix install, the command is named as expected
# File install.rb, line 263
263: def install_binfile(from, op_file, target)
264: tmp_file = Tempfile.new('mcollective-binfile')
265:
266: if InstallOptions.ruby
267: ruby = InstallOptions.ruby
268: else
269: ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
270: end
271:
272: File.open(from) do |ip|
273: File.open(tmp_file.path, "w") do |op|
274: op.puts "#!#{ruby}"
275: contents = ip.readlines
276: contents.shift if contents[0] =~ /^#!/
277: op.write contents.join
278: end
279: end
280:
281: install(tmp_file.path, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true)
282: tmp_file.unlink
283: end
Prepare the file installation.
# File install.rb, line 110
110: def prepare_installation
111: InstallOptions.configs = true
112:
113: # Only try to do docs if we're sure they have rdoc
114: if $haverdoc
115: InstallOptions.rdoc = true
116: else
117: InstallOptions.rdoc = false
118: end
119:
120:
121: ARGV.options do |opts|
122: opts.banner = "Usage: #{File.basename($0)} [options]"
123: opts.separator ""
124: opts.on('--[no-]rdoc', 'Creation of RDoc output.', 'Default is create rdoc.') do |onrdoc|
125: InstallOptions.rdoc = onrdoc
126: end
127: opts.on('--[no-]configs', 'Installation of config files', 'Default is install configs.') do |onconfigs|
128: InstallOptions.configs = onconfigs
129: end
130: opts.on('--destdir[=OPTIONAL]', 'Installation prefix for all targets', 'Default essentially /') do |destdir|
131: InstallOptions.destdir = destdir
132: end
133: opts.on('--configdir[=OPTIONAL]', 'Installation directory for config files', 'Default /etc/mcollective') do |configdir|
134: InstallOptions.configdir = configdir
135: end
136: opts.on('--bindir[=OPTIONAL]', 'Installation directory for binaries', 'overrides RbConfig::CONFIG["bindir"]') do |bindir|
137: InstallOptions.bindir = bindir
138: end
139: opts.on('--sbindir[=OPTIONAL]', 'Installation directory for system binaries', 'overrides RbConfig::CONFIG["sbindir"]') do |sbindir|
140: InstallOptions.sbindir = sbindir
141: end
142: opts.on('--ruby[=OPTIONAL]', 'Ruby interpreter to use with installation', 'overrides ruby used to call install.rb') do |ruby|
143: InstallOptions.ruby = ruby
144: end
145: opts.on('--sitelibdir[=OPTIONAL]', 'Installation directory for libraries', 'overrides RbConfig::CONFIG["sitelibdir"]') do |sitelibdir|
146: InstallOptions.sitelibdir = sitelibdir
147: end
148: opts.on('--plugindir[=OPTIONAL]', 'Installation directory for plugins', 'Default /usr/libexec/mcollective') do |plugindir|
149: InstallOptions.plugindir = plugindir
150: end
151: opts.on('--quick', 'Performs a quick installation. Only the', 'installation is done.') do |quick|
152: InstallOptions.rdoc = false
153: InstallOptions.ri = false
154: InstallOptions.configs = true
155: end
156: opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |full|
157: InstallOptions.rdoc = true
158: InstallOptions.ri = true
159: InstallOptions.configs = true
160: end
161: opts.separator("")
162: opts.on_tail('--help', "Shows this help text.") do
163: $stderr.puts opts
164: exit
165: end
166:
167: opts.parse!
168: end
169:
170: version = [RbConfig::CONFIG["MAJOR"], RbConfig::CONFIG["MINOR"]].join(".")
171: libdir = File.join(RbConfig::CONFIG["libdir"], "ruby", version)
172:
173: # Mac OS X 10.5 and higher declare bindir
174: # /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
175: # which is not generally where people expect executables to be installed
176: # These settings are appropriate defaults for all OS X versions.
177: if RUBY_PLATFORM =~ /^universal-darwin[\d\.]+$/
178: RbConfig::CONFIG['bindir'] = "/usr/bin"
179: RbConfig::CONFIG['sbindir'] = "/usr/sbin"
180: end
181:
182: if InstallOptions.configdir
183: configdir = InstallOptions.configdir
184: else
185: configdir = "/etc/mcollective"
186: end
187:
188: if InstallOptions.bindir
189: bindir = InstallOptions.bindir
190: else
191: bindir = RbConfig::CONFIG['bindir']
192: end
193:
194: if InstallOptions.sbindir
195: sbindir = InstallOptions.sbindir
196: else
197: sbindir = RbConfig::CONFIG['sbindir']
198: end
199:
200: if InstallOptions.sitelibdir
201: sitelibdir = InstallOptions.sitelibdir
202: else
203: sitelibdir = RbConfig::CONFIG["sitelibdir"]
204: if sitelibdir.nil?
205: sitelibdir = $LOAD_PATH.find { |x| x =~ /site_ruby/ }
206: if sitelibdir.nil?
207: sitelibdir = File.join(libdir, "site_ruby")
208: elsif sitelibdir !~ Regexp.quote(version)
209: sitelibdir = File.join(sitelibdir, version)
210: end
211: end
212: end
213:
214: if InstallOptions.plugindir
215: plugindir = InstallOptions.plugindir
216: else
217: plugindir = "/usr/libexec/mcollective"
218: end
219:
220: if InstallOptions.destdir
221: destdir = InstallOptions.destdir
222: else
223: destdir = ''
224: end
225:
226: configdir = File.join(destdir, configdir)
227: bindir = File.join(destdir, bindir)
228: sbindir = File.join(destdir, sbindir)
229: sitelibdir = File.join(destdir, sitelibdir)
230: plugindir = File.join(destdir, plugindir)
231:
232: makedirs(configdir) if InstallOptions.configs
233: makedirs(bindir)
234: makedirs(sbindir)
235: makedirs(sitelibdir)
236: makedirs(plugindir)
237:
238: InstallOptions.sitelibdir = sitelibdir
239: InstallOptions.configdir = configdir
240: InstallOptions.bindir = bindir
241: InstallOptions.sbindir = sbindir
242: InstallOptions.plugindir = plugindir
243: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.