reap 6.0.2 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. data/CHANGES +6 -0
  2. data/COPYING +666 -395
  3. data/MANIFEST +139 -0
  4. data/NOTES +12 -0
  5. data/README +19 -163
  6. data/bin/reap-announce +7 -0
  7. data/bin/reap-check-load +8 -0
  8. data/bin/reap-check-syntax +7 -0
  9. data/bin/reap-clean +7 -0
  10. data/bin/reap-clobber +7 -0
  11. data/bin/reap-doc +7 -0
  12. data/bin/reap-doc-rdoc +7 -0
  13. data/bin/reap-doc-ri +7 -0
  14. data/bin/reap-init +69 -0
  15. data/bin/reap-inspect +7 -0
  16. data/bin/reap-install +8 -0
  17. data/bin/reap-install-gem +8 -0
  18. data/bin/reap-log +7 -0
  19. data/bin/reap-log-changes +8 -0
  20. data/bin/reap-log-notes +8 -0
  21. data/bin/reap-make +7 -0
  22. data/bin/reap-make-clean +7 -0
  23. data/bin/reap-make-distclean +7 -0
  24. data/bin/reap-make-extconf +7 -0
  25. data/bin/reap-make-static +8 -0
  26. data/bin/reap-package +8 -0
  27. data/bin/reap-package-gem +7 -0
  28. data/bin/reap-package-tgz +7 -0
  29. data/bin/reap-package-zip +7 -0
  30. data/bin/reap-prepare +7 -0
  31. data/bin/reap-publish +7 -0
  32. data/bin/reap-release +7 -0
  33. data/bin/reap-scaffold +8 -0
  34. data/bin/reap-scm-branch +7 -0
  35. data/bin/reap-scm-tag +7 -0
  36. data/bin/reap-spec +7 -0
  37. data/bin/reap-spec-doc +8 -0
  38. data/bin/reap-stamp +7 -0
  39. data/bin/reap-stats +7 -0
  40. data/bin/reap-test +7 -0
  41. data/bin/reap-test-cross +7 -0
  42. data/bin/reap-test-load +9 -0
  43. data/bin/reap-test-solo +7 -0
  44. data/bin/reap-uninstall +7 -0
  45. data/bin/reap-uninstall-gem +7 -0
  46. data/data/reap/base/CHANGES +19 -0
  47. data/data/reap/base/COPYING +674 -0
  48. data/data/reap/base/NOTES +12 -0
  49. data/data/reap/base/README +8 -0
  50. data/data/reap/build/rake/Rakefile +130 -0
  51. data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
  52. data/data/reap/build/rake-lite/install.rb +79 -0
  53. data/data/reap/build/tasks/task/rdoc +211 -0
  54. data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
  55. data/data/reap/build/tasks/task/test +38 -0
  56. data/data/reap/init/meta/project.yaml +21 -0
  57. data/demo/README +15 -0
  58. data/demo/lib/foo/foo.rb +7 -0
  59. data/demo/meta/VERSION +1 -0
  60. data/demo/meta/project.yaml +21 -0
  61. data/lib/reap/application.rb +80 -0
  62. data/lib/reap/default.yaml +77 -0
  63. data/lib/reap/extensions/array.rb +50 -0
  64. data/lib/reap/extensions/hash.rb +63 -0
  65. data/lib/reap/extensions/string.rb +31 -0
  66. data/lib/reap/extensions.rb +6 -0
  67. data/lib/reap/iobject.rb +264 -0
  68. data/lib/reap/manager/announce.rb +193 -0
  69. data/lib/reap/manager/check.rb +109 -0
  70. data/lib/reap/manager/clean.rb +58 -0
  71. data/lib/reap/manager/gem.rb +200 -0
  72. data/lib/reap/manager/html.rb +69 -0
  73. data/lib/reap/manager/log.rb +214 -0
  74. data/lib/reap/manager/make.rb +109 -0
  75. data/lib/reap/manager/pack.rb +232 -0
  76. data/lib/reap/manager/publish.rb +72 -0
  77. data/lib/reap/manager/rdoc.rb +194 -0
  78. data/lib/reap/manager/release.rb +78 -0
  79. data/lib/reap/manager/rubyforge.rb +44 -0
  80. data/lib/reap/manager/scaffold.rb +138 -0
  81. data/lib/reap/manager/scm.rb +66 -0
  82. data/lib/reap/manager/site.rb +27 -0
  83. data/lib/reap/manager/spec.rb +94 -0
  84. data/lib/reap/manager/stats.rb +145 -0
  85. data/lib/reap/manager/svn.rb +76 -0
  86. data/lib/reap/manager/test.rb +389 -0
  87. data/lib/reap/manager.rb +74 -0
  88. data/lib/reap/metadata.rb +603 -0
  89. data/lib/reap/project.rb +165 -0
  90. data/lib/reap/settings.rb +67 -0
  91. data/lib/reap/systems/rubyforge.rb +737 -0
  92. data/lib/reap/systems/subversion.rb +333 -0
  93. data/lib/reap/utilities/fileutils.rb +304 -0
  94. data/lib/reap/utilities/netutils.rb +221 -0
  95. data/lib/reap/utilities/setuputils.rb +124 -0
  96. data/lib/reap/utilities/shellutils.rb +175 -0
  97. data/log/Changelog.txt +107 -0
  98. data/log/FIXME.txt +25 -0
  99. data/log/TODO.txt +72 -0
  100. data/meta/VERSION +1 -0
  101. data/meta/description +4 -0
  102. data/meta/project.yaml +20 -0
  103. data/task/man +14 -0
  104. data/task/rdoc +20 -0
  105. data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
  106. metadata +225 -153
  107. data/ProjectInfo +0 -105
  108. data/bin/reap +0 -5
  109. data/bin/rubytest +0 -5
  110. data/data/reap/install.rb +0 -62
  111. data/data/reap/scaffold/standard/COPYING +0 -403
  112. data/data/reap/scaffold/standard/ChangeLog +0 -0
  113. data/data/reap/scaffold/standard/INSTALL +0 -14
  114. data/data/reap/scaffold/standard/ProjectInfo +0 -77
  115. data/data/reap/scaffold/standard/README +0 -3
  116. data/data/reap/scaffold/standard/Rakefile +0 -10
  117. data/data/reap/scaffold/standard/TODO +0 -0
  118. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  119. data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
  120. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  121. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
  122. data/data/reap/scaffold/subversion/trunk/README +0 -3
  123. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  124. data/data/reap/scaffold/subversion/trunk/TODO +0 -0
  125. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  126. data/forge/ProjectInfo +0 -38
  127. data/forge/ProjectInfo.rb +0 -76
  128. data/forge/TODO +0 -10
  129. data/forge/installer.rb +0 -250
  130. data/forge/reference/Rakefile +0 -124
  131. data/forge/reference/Rakefile.htm +0 -69
  132. data/forge/reference/aRakefile +0 -60
  133. data/forge/reference/compositepublisher.rb +0 -24
  134. data/forge/reference/ftptools.rb +0 -139
  135. data/forge/reference/installers/package.rb +0 -629
  136. data/forge/reference/license-each.rb +0 -85
  137. data/forge/reference/publisher.rb +0 -75
  138. data/forge/reference/rubyforge.rb +0 -247
  139. data/forge/reference/rubyforgepublisher.rb +0 -18
  140. data/forge/reference/sshpublisher.rb +0 -47
  141. data/forge/reference/suby-cvs.rb +0 -46
  142. data/forge/scaffold.rb +0 -126
  143. data/forge/unit_runner/README +0 -6
  144. data/forge/unit_runner/commentrunner.rb +0 -62
  145. data/forge/unit_runner/cunit.rb +0 -17
  146. data/forge/unit_runner/forkedrunner.rb +0 -91
  147. data/forge/unit_runner/sample.rb +0 -16
  148. data/lib/reap/bin/reap.rb +0 -230
  149. data/lib/reap/bin/rubytest.rb +0 -53
  150. data/lib/reap/class/announce.rb +0 -220
  151. data/lib/reap/class/doap.rb +0 -80
  152. data/lib/reap/class/extest.rb +0 -146
  153. data/lib/reap/class/filer.rb +0 -62
  154. data/lib/reap/class/manifest.rb +0 -68
  155. data/lib/reap/class/package.rb +0 -576
  156. data/lib/reap/class/publish.rb +0 -152
  157. data/lib/reap/class/rdoc.rb +0 -123
  158. data/lib/reap/class/test.rb +0 -264
  159. data/lib/reap/projectinfo.rb +0 -208
  160. data/lib/reap/rake.rb +0 -42
  161. data/lib/reap/reap.rb +0 -89
  162. data/lib/reap/tasks.rb +0 -756
  163. data/lib/reap/taskutils.rb +0 -122
  164. data/note/LATEST +0 -44
  165. data/note/doap.xml +0 -28
  166. data/note/history/Rakefile-0.1 +0 -308
  167. data/sample/ProjectInfo +0 -96
  168. data/sample/Rakefile +0 -9
  169. data/sample/Reapfile +0 -11
  170. data/sample/task/demo.rb +0 -15
  171. data/setup.rb +0 -1568
  172. data/web/ProjectInfo.html +0 -75
  173. data/web/images/grape.jpg +0 -0
  174. data/web/index.html +0 -312
@@ -1,3 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Setup and install.
1
4
  #
2
5
  # setup.rb
3
6
  #
@@ -6,52 +9,49 @@
6
9
  # This program is free software.
7
10
  # You can distribute/modify this program under the terms of
8
11
  # the GNU LGPL, Lesser General Public License version 2.1.
12
+
13
+ #
14
+ # Was hardcoded as 'InstalledFiles'
9
15
  #
10
16
 
11
- #############################
12
- # Forked from version 3.2.1 #
13
- # #
14
- # -trans #
15
- #############################
16
-
17
- # CHANGE No longer need to support 1.4.6 or 1.6 versions of Ruby.
18
-
19
- # unless Enumerable.method_defined?(:map) # Ruby 1.4.6
20
- # module Enumerable
21
- # alias map collect
22
- # end
23
- # end
24
-
25
- # unless File.respond_to?(:read) # Ruby 1.6
26
- # def File.read(fname)
27
- # open(fname) {|f|
28
- # return f.read
29
- # }
30
- # end
31
- # end
32
-
33
- # This is hack!
34
- # This is needed to install within an abitrary root dir.
35
- # B/c setup.rb has become spegetti code, I was forced to do this hack.
36
- # Setup.rb shuld be re-writ. I would use package.rb instead but
37
- # it lacks hooks and extension compilation. But we'll keep
38
- # an eye on that one for the future. -trans.
39
-
40
- $setup_install_root = nil
41
- ARGV.each{ |a|
42
- if md = /--root=(.*)/.match( a )
43
- $setup_install_root = md[1]
44
- end
45
- }
46
- if $setup_install_root
47
- ARGV.delete("--root=#{$setup_install_root}")
48
- $setup_install_root = File.expand_path($setup_install_root)
49
- puts "(root=#{$setup_install_root})"
17
+ INSTALLED_MANIFEST = '.installed'
18
+
19
+ #
20
+ # Was hardcoded as 'packages'.
21
+ #
22
+
23
+ PACKAGES_DIRECTORY = 'src'
24
+
25
+ #
26
+ # Locate and move to the root dir of the project/package.
27
+ # This is setup to put setup in a utilities subdir.
28
+ #
29
+ # TODO Make more robust.
30
+ #
31
+
32
+ ROOT_DIRECTORY = File.dirname(File.dirname(File.expand_path($0)))
33
+
34
+ Dir.chdir(ROOT_DIRECTORY)
35
+
36
+ #
37
+ # Deal with Ruby version issues.
38
+ #
39
+
40
+ unless Enumerable.method_defined?(:map) # Ruby 1.4.6
41
+ module Enumerable
42
+ alias map collect
43
+ end
50
44
  end
51
45
 
52
- # Windows?
46
+ unless File.respond_to?(:read) # Ruby 1.6
47
+ def File.read(fname)
48
+ open(fname) {|f|
49
+ return f.read
50
+ }
51
+ end
52
+ end
53
53
 
54
- unless Errno.const_defined?(:ENOTEMPTY)
54
+ unless Errno.const_defined?(:ENOTEMPTY) # Windows?
55
55
  module Errno
56
56
  class ENOTEMPTY
57
57
  # We do not raise this exception, implementation is not needed.
@@ -89,11 +89,17 @@ class ConfigTable
89
89
  attr_accessor :install_prefix
90
90
  attr_accessor :config_opt
91
91
 
92
- def verbose=(x) @verbose = x end
93
- def verbose?() @verbose end
92
+ attr_writer :verbose
94
93
 
95
- def no_harm=(x) @no_harm = x end
96
- def no_harm?() @no_harm end
94
+ def verbose?
95
+ @verbose
96
+ end
97
+
98
+ attr_writer :no_harm
99
+
100
+ def no_harm?
101
+ @no_harm
102
+ end
97
103
 
98
104
  def [](key)
99
105
  lookup(key).resolve(self)
@@ -137,7 +143,9 @@ class ConfigTable
137
143
  end
138
144
  end
139
145
 
140
- def savefile() '.config' end
146
+ def savefile
147
+ '.config'
148
+ end
141
149
 
142
150
  def load_savefile
143
151
  begin
@@ -160,126 +168,124 @@ class ConfigTable
160
168
  end
161
169
 
162
170
  def load_standard_entries
163
- #standard_entries(@rbconfig).each do |ent|
164
- standard_entries.each do |ent|
171
+ standard_entries(@rbconfig).each do |ent|
165
172
  add ent
166
173
  end
167
174
  end
168
175
 
169
- def standard_entries #(rbconfig)
170
- rbconfig = @rbconfig
176
+ def standard_entries(rbconfig)
177
+ c = rbconfig
171
178
 
172
- rubypath = File.join(rbconfig['bindir'], rbconfig['ruby_install_name'] + rbconfig['EXEEXT'])
179
+ rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
173
180
 
174
- major = rbconfig['MAJOR'].to_i
175
- minor = rbconfig['MINOR'].to_i
176
- teeny = rbconfig['TEENY'].to_i
181
+ major = c['MAJOR'].to_i
182
+ minor = c['MINOR'].to_i
183
+ teeny = c['TEENY'].to_i
177
184
  version = "#{major}.#{minor}"
178
185
 
179
- # CHANGE Do not need to support these old versions any more.
180
-
181
- # # ruby ver. >= 1.4.4?
182
- # newpath_p = ((major >= 2) or
183
- # ((major == 1) and
184
- # ((minor >= 5) or
185
- # ((minor == 4) and (teeny >= 4)))))
186
+ # ruby ver. >= 1.4.4?
187
+ newpath_p = ((major >= 2) or
188
+ ((major == 1) and
189
+ ((minor >= 5) or
190
+ ((minor == 4) and (teeny >= 4)))))
186
191
 
187
- #if c['rubylibdir']
192
+ if c['rubylibdir']
188
193
  # V > 1.6.3
189
-
190
- root = '/'
191
- prefix = rbconfig['prefix']
192
-
193
- libruby = "#{prefix}/lib/ruby"
194
- librubyver = rbconfig['rubylibdir']
195
- librubyverarch = rbconfig['archdir']
196
- siteruby = rbconfig['sitedir']
197
- siterubyver = rbconfig['sitelibdir']
198
- siterubyverarch = rbconfig['sitearchdir']
199
-
200
- bindir = paramize(rbconfig['bindir'])
201
- libdir = paramize(rbconfig['libdir'])
202
- datadir = paramize(rbconfig['datadir'])
203
- mandir = paramize(rbconfig['mandir'])
204
- sysconfdir = paramize(rbconfig['sysconfdir'])
205
- localstatedir = paramize(rbconfig['localstatedir'])
206
-
207
- # elsif newpath_p
208
- # # 1.4.4 <= V <= 1.6.3
209
- # libruby = "#{c['prefix']}/lib/ruby"
210
- # librubyver = "#{c['prefix']}/lib/ruby/#{version}"
211
- # librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
212
- # siteruby = c['sitedir']
213
- # siterubyver = "$siteruby/#{version}"
214
- # siterubyverarch = "$siterubyver/#{c['arch']}"
215
- # else
216
- # # V < 1.4.4
217
- # libruby = "#{c['prefix']}/lib/ruby"
218
- # librubyver = "#{c['prefix']}/lib/ruby/#{version}"
219
- # librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
220
- # siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
221
- # siterubyver = siteruby
222
- # siterubyverarch = "$siterubyver/#{c['arch']}"
223
- # end
224
-
194
+ libruby = "#{c['prefix']}/lib/ruby"
195
+ librubyver = c['rubylibdir']
196
+ librubyverarch = c['archdir']
197
+ siteruby = c['sitedir']
198
+ siterubyver = c['sitelibdir']
199
+ siterubyverarch = c['sitearchdir']
200
+ elsif newpath_p
201
+ # 1.4.4 <= V <= 1.6.3
202
+ libruby = "#{c['prefix']}/lib/ruby"
203
+ librubyver = "#{c['prefix']}/lib/ruby/#{version}"
204
+ librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
205
+ siteruby = c['sitedir']
206
+ siterubyver = "$siteruby/#{version}"
207
+ siterubyverarch = "$siterubyver/#{c['arch']}"
208
+ else
209
+ # V < 1.4.4
210
+ libruby = "#{c['prefix']}/lib/ruby"
211
+ librubyver = "#{c['prefix']}/lib/ruby/#{version}"
212
+ librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
213
+ siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
214
+ siterubyver = siteruby
215
+ siterubyverarch = "$siterubyver/#{c['arch']}"
216
+ end
225
217
  parameterize = lambda {|path|
226
- path.sub(/\A#{Regexp.quote(rbconfig['prefix'])}/, '$prefix')
218
+ path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
227
219
  }
228
220
 
229
- if arg = rbconfig['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
221
+ if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
230
222
  makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
231
223
  else
232
224
  makeprog = 'make'
233
225
  end
234
226
 
235
- installdir_lambda = lambda {|val, table|
236
- case val
237
- when 'std'
238
- table['rbdir'] = '$librubyver'
239
- table['sodir'] = '$librubyverarch'
240
- when 'site'
241
- table['rbdir'] = '$siterubyver'
242
- table['sodir'] = '$siterubyverarch'
243
- when 'home'
244
- setup_rb_error '$HOME was not set' unless ENV['HOME']
245
- table['prefix'] = ENV['HOME']
246
- table['rbdir'] = '$libdir/ruby'
247
- table['sodir'] = '$libdir/ruby'
248
- end
249
- }
250
-
251
227
  [
252
- ExecItem.new('installdirs', 'std/site/home', 'install under libruby, site_ruby or $HOME respectively', &installdir_lambda),
253
- PathItem.new('root', 'path', root, 'root destination directory'),
254
- PathItem.new('prefix', 'path', prefix, 'path prefix of target environment'),
255
- PathItem.new('bindir', 'path', bindir, 'the directory for commands'),
256
- PathItem.new('libdir', 'path', libdir, 'the directory for libraries'),
257
- PathItem.new('datadir', 'path', datadir, 'the directory for shared data'),
258
- PathItem.new('mandir', 'path', mandir, 'the directory for man pages'),
259
- PathItem.new('sysconfdir', 'path', sysconfdir, 'the directory for system configuration files'),
260
- PathItem.new('localstatedir', 'path', localstatedir, 'the directory for local state data'),
261
- PathItem.new('libruby', 'path', libruby, 'the directory for ruby libraries'),
262
- PathItem.new('librubyver', 'path', librubyver, 'the directory for standard ruby libraries'),
263
- PathItem.new('librubyverarch', 'path', librubyverarch, 'the directory for standard ruby extensions'),
264
- PathItem.new('siteruby', 'path', siteruby, 'the directory for version-independent aux ruby libraries'),
265
- PathItem.new('siterubyver', 'path', siterubyver, 'the directory for aux ruby libraries'),
266
- PathItem.new('siterubyverarch', 'path', siterubyverarch, 'the directory for aux ruby binaries'),
267
- PathItem.new('rbdir', 'path', '$siterubyver', 'the directory for ruby scripts'),
268
- PathItem.new('sodir', 'path', '$siterubyverarch', 'the directory for ruby extentions'),
269
- PathItem.new('rubypath', 'path', rubypath, 'the path to set to #! line'),
270
- ProgramItem.new('rubyprog', 'name', rubypath, 'the ruby program using for installation'),
271
- ProgramItem.new('makeprog', 'name', makeprog, 'the make program to compile ruby extentions'),
272
- SelectItem.new('shebang', 'all/ruby/never', 'ruby', 'shebang line (#!) editing mode'),
273
- BoolItem.new('without-ext', 'yes/no', 'no', 'does not compile/install ruby extentions')
228
+ ExecItem.new('installdirs', 'std/site/home',
229
+ 'std: install under libruby; site: install under site_ruby; home: install under $HOME')\
230
+ {|val, table|
231
+ case val
232
+ when 'std'
233
+ table['rbdir'] = '$librubyver'
234
+ table['sodir'] = '$librubyverarch'
235
+ when 'site'
236
+ table['rbdir'] = '$siterubyver'
237
+ table['sodir'] = '$siterubyverarch'
238
+ when 'home'
239
+ setup_rb_error '$HOME was not set' unless ENV['HOME']
240
+ table['prefix'] = ENV['HOME']
241
+ table['rbdir'] = '$libdir/ruby'
242
+ table['sodir'] = '$libdir/ruby'
243
+ end
244
+ },
245
+ PathItem.new('prefix', 'path', c['prefix'],
246
+ 'path prefix of target environment'),
247
+ PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
248
+ 'the directory for commands'),
249
+ PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
250
+ 'the directory for libraries'),
251
+ PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
252
+ 'the directory for shared data'),
253
+ PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
254
+ 'the directory for man pages'),
255
+ PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
256
+ 'the directory for system configuration files'),
257
+ PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
258
+ 'the directory for local state data'),
259
+ PathItem.new('libruby', 'path', libruby,
260
+ 'the directory for ruby libraries'),
261
+ PathItem.new('librubyver', 'path', librubyver,
262
+ 'the directory for standard ruby libraries'),
263
+ PathItem.new('librubyverarch', 'path', librubyverarch,
264
+ 'the directory for standard ruby extensions'),
265
+ PathItem.new('siteruby', 'path', siteruby,
266
+ 'the directory for version-independent aux ruby libraries'),
267
+ PathItem.new('siterubyver', 'path', siterubyver,
268
+ 'the directory for aux ruby libraries'),
269
+ PathItem.new('siterubyverarch', 'path', siterubyverarch,
270
+ 'the directory for aux ruby binaries'),
271
+ PathItem.new('rbdir', 'path', '$siterubyver',
272
+ 'the directory for ruby scripts'),
273
+ PathItem.new('sodir', 'path', '$siterubyverarch',
274
+ 'the directory for ruby extentions'),
275
+ PathItem.new('rubypath', 'path', rubypath,
276
+ 'the path to set to #! line'),
277
+ ProgramItem.new('rubyprog', 'name', rubypath,
278
+ 'the ruby program using for installation'),
279
+ ProgramItem.new('makeprog', 'name', makeprog,
280
+ 'the make program to compile ruby extentions'),
281
+ SelectItem.new('shebang', 'all/ruby/never', 'ruby',
282
+ 'shebang line (#!) editing mode'),
283
+ BoolItem.new('without-ext', 'yes/no', 'no',
284
+ 'does not compile/install ruby extentions')
274
285
  ]
275
286
  end
276
287
  private :standard_entries
277
288
 
278
- def paramize( path )
279
- path.sub(/\A#{Regexp.quote(@rbconfig['prefix'])}/, '$prefix')
280
- end
281
- private :paramize
282
-
283
289
  def load_multipackage_entries
284
290
  multipackage_entries().each do |ent|
285
291
  add ent
@@ -288,8 +294,10 @@ class ConfigTable
288
294
 
289
295
  def multipackage_entries
290
296
  [
291
- PackageSelectionItem.new('with', 'name,name...', '', 'ALL', 'package names that you want to install'),
292
- PackageSelectionItem.new('without', 'name,name...', '', 'NONE', 'package names that you do not want to install')
297
+ PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
298
+ 'package names that you want to install'),
299
+ PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
300
+ 'package names that you do not want to install')
293
301
  ]
294
302
  end
295
303
  private :multipackage_entries
@@ -354,8 +362,13 @@ class ConfigTable
354
362
  "--#{@name}=#{@template}"
355
363
  end
356
364
 
357
- def value? ; true ; end
358
- def value ; @value ; end
365
+ def value?
366
+ true
367
+ end
368
+
369
+ def value
370
+ @value
371
+ end
359
372
 
360
373
  def resolve(table)
361
374
  @value.gsub(%r<\$([^/]+)>) { table[$1] }
@@ -374,7 +387,9 @@ class ConfigTable
374
387
  end
375
388
 
376
389
  class BoolItem < Item
377
- def config_type() 'bool' end
390
+ def config_type
391
+ 'bool'
392
+ end
378
393
 
379
394
  def help_opt
380
395
  "--#{@name}"
@@ -394,9 +409,12 @@ class ConfigTable
394
409
  end
395
410
 
396
411
  class PathItem < Item
397
- def config_type() 'path' end
412
+ def config_type
413
+ 'path'
414
+ end
398
415
 
399
416
  private
417
+
400
418
  def check(path)
401
419
  setup_rb_error "config: --#{@name} requires argument" unless path
402
420
  path[0,1] == '$' ? path : File.expand_path(path)
@@ -404,7 +422,9 @@ class ConfigTable
404
422
  end
405
423
 
406
424
  class ProgramItem < Item
407
- def config_type() 'program' end
425
+ def config_type
426
+ 'program'
427
+ end
408
428
  end
409
429
 
410
430
  class SelectItem < Item
@@ -413,9 +433,12 @@ class ConfigTable
413
433
  @ok = selection.split('/')
414
434
  end
415
435
 
416
- def config_type() 'select' end
436
+ def config_type
437
+ 'select'
438
+ end
417
439
 
418
440
  private
441
+
419
442
  def check(val)
420
443
  unless @ok.include?(val.strip)
421
444
  setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
@@ -469,7 +492,7 @@ class ConfigTable
469
492
  private
470
493
 
471
494
  def check(val)
472
- unless File.dir?("packages/#{val}")
495
+ unless File.dir?("#{PACKAGES_DIRECTORY}/#{val}")
473
496
  setup_rb_error "config: no such package: #{val}"
474
497
  end
475
498
  val
@@ -542,9 +565,7 @@ end # class ConfigTable
542
565
  module FileOperations
543
566
 
544
567
  def mkdir_p(dirname, prefix = nil)
545
- dirname = File.join(prefix, File.expand_path(dirname)) if prefix
546
- dirname = File.join( $setup_install_root, dirname ) if $setup_install_root
547
-
568
+ dirname = prefix + File.expand_path(dirname) if prefix
548
569
  $stderr.puts "mkdir -p #{dirname}" if verbose?
549
570
  return if no_harm?
550
571
 
@@ -628,15 +649,11 @@ module FileOperations
628
649
  end
629
650
 
630
651
  def install(from, dest, mode, prefix = nil)
631
-
632
- realdest = prefix ? File.join(prefix, File.expand_path(dest)) : dest
633
- realdest = File.join($setup_install_root, File.expand_path(realdest)) if $setup_install_root
634
-
635
652
  $stderr.puts "install #{from} #{dest}" if verbose?
636
653
  return if no_harm?
637
654
 
655
+ realdest = prefix ? prefix + File.expand_path(dest) : dest
638
656
  realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
639
-
640
657
  str = File.binread(from)
641
658
  if diff?(str, realdest)
642
659
  verbose_off {
@@ -647,11 +664,7 @@ module FileOperations
647
664
  }
648
665
  File.chmod mode, realdest
649
666
 
650
- # Do not make InstalledFiles entry if to alternate root.
651
- # This prevents problem with root permissions on this file.
652
- return true unless $setup_install_root
653
-
654
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
667
+ File.open("#{objdir_root()}/#{INSTALLED_MANIFEST}", 'a') {|f|
655
668
  if prefix
656
669
  f.puts realdest.sub(prefix, '')
657
670
  else
@@ -715,14 +728,33 @@ module HookScriptAPI
715
728
  @config[key] = val
716
729
  end
717
730
 
731
+ #
718
732
  # srcdir/objdir (works only in the package directory)
733
+ #
719
734
 
720
- def curr_srcdir() "#{srcdir_root()}/#{relpath()}" end
721
- def curr_objdir() "#{objdir_root()}/#{relpath()}" end
722
- def srcfile(path) "#{curr_srcdir()}/#{path}" end
723
- def srcexist?(path) File.exist?(srcfile(path)) end
724
- def srcdirectory?(path) File.dir?(srcfile(path)) end
725
- def srcfile?(path) File.file?(srcfile(path)) end
735
+ def curr_srcdir
736
+ "#{srcdir_root()}/#{relpath()}"
737
+ end
738
+
739
+ def curr_objdir
740
+ "#{objdir_root()}/#{relpath()}"
741
+ end
742
+
743
+ def srcfile(path)
744
+ "#{curr_srcdir()}/#{path}"
745
+ end
746
+
747
+ def srcexist?(path)
748
+ File.exist?(srcfile(path))
749
+ end
750
+
751
+ def srcdirectory?(path)
752
+ File.dir?(srcfile(path))
753
+ end
754
+
755
+ def srcfile?(path)
756
+ File.file?(srcfile(path))
757
+ end
726
758
 
727
759
  def srcentries(path = '.')
728
760
  Dir.open("#{curr_srcdir()}/#{path}") {|d|
@@ -761,20 +793,22 @@ class ToplevelInstaller
761
793
  [ 'distclean',"does `make distclean' for each extention" ]
762
794
  ]
763
795
 
764
- def self.invoke
765
- config = ConfigTable.new(load_rbconfig)
796
+ def ToplevelInstaller.invoke
797
+ config = ConfigTable.new(load_rbconfig())
766
798
  config.load_standard_entries
767
799
  config.load_multipackage_entries if multipackage?
768
800
  config.fixup
769
801
  klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller)
770
- klass.new(File.dirname($0), config).invoke
802
+ #klass.new(File.dirname($0), config).invoke
803
+ klass.new(ROOT_DIRECTORY, config).invoke
771
804
  end
772
805
 
773
- def self.multipackage?
774
- File.dir?(File.dirname($0) + '/packages')
806
+ def ToplevelInstaller.multipackage?
807
+ #File.dir?(File.dirname($0) + '/#{PACKAGES_DIRECTORY}')
808
+ File.dir?(ROOT_DIRECTORY + "/#{PACKAGES_DIRECTORY}")
775
809
  end
776
810
 
777
- def self.load_rbconfig
811
+ def ToplevelInstaller.load_rbconfig
778
812
  if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
779
813
  ARGV.delete(arg)
780
814
  load File.expand_path(arg.split(/=/, 2)[1])
@@ -785,7 +819,6 @@ class ToplevelInstaller
785
819
  ::Config::CONFIG
786
820
  end
787
821
 
788
-
789
822
  def initialize(ardir_root, config)
790
823
  @ardir = File.expand_path(ardir_root)
791
824
  @config = config
@@ -837,9 +870,17 @@ class ToplevelInstaller
837
870
  # Hook Script API bases
838
871
  #
839
872
 
840
- def srcdir_root() @ardir end
841
- def objdir_root() '.' end
842
- def relpath() '.' end
873
+ def srcdir_root
874
+ @ardir
875
+ end
876
+
877
+ def objdir_root
878
+ '.'
879
+ end
880
+
881
+ def relpath
882
+ '.'
883
+ end
843
884
 
844
885
  #
845
886
  # Option Parsing
@@ -969,7 +1010,6 @@ class ToplevelInstaller
969
1010
  out.puts
970
1011
  out.puts 'Options for INSTALL:'
971
1012
  out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
972
- out.printf fmt, '--root=path', 'install root directory (effects all paths)', '/'
973
1013
  out.printf fmt, '--prefix=path', 'install path prefix', ''
974
1014
  out.puts
975
1015
  end
@@ -1018,7 +1058,7 @@ class ToplevelInstallerMulti < ToplevelInstaller
1018
1058
 
1019
1059
  def initialize(ardir_root, config)
1020
1060
  super
1021
- @packages = directories_of("#{@ardir}/packages")
1061
+ @packages = directories_of("#{@ardir}/#{PACKAGES_DIRECTORY}")
1022
1062
  raise 'no package exists' if @packages.empty?
1023
1063
  @root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
1024
1064
  end
@@ -1026,7 +1066,7 @@ class ToplevelInstallerMulti < ToplevelInstaller
1026
1066
  def run_metaconfigs
1027
1067
  @config.load_script "#{@ardir}/metaconfig", self
1028
1068
  @packages.each do |name|
1029
- @config.load_script "#{@ardir}/packages/#{name}/metaconfig"
1069
+ @config.load_script "#{@ardir}/#{PACKAGES_DIRECTORY}/#{name}/metaconfig"
1030
1070
  end
1031
1071
  end
1032
1072
 
@@ -1035,8 +1075,8 @@ class ToplevelInstallerMulti < ToplevelInstaller
1035
1075
  def packages=(list)
1036
1076
  raise 'package list is empty' if list.empty?
1037
1077
  list.each do |name|
1038
- raise "directory packages/#{name} does not exist"\
1039
- unless File.dir?("#{@ardir}/packages/#{name}")
1078
+ raise "directory #{PACKAGES_DIRECTORY}/#{name} does not exist"\
1079
+ unless File.dir?("#{@ardir}/#{PACKAGES_DIRECTORY}/#{name}")
1040
1080
  end
1041
1081
  @packages = list
1042
1082
  end
@@ -1045,8 +1085,8 @@ class ToplevelInstallerMulti < ToplevelInstaller
1045
1085
  @installers = {}
1046
1086
  @packages.each do |pack|
1047
1087
  @installers[pack] = Installer.new(@config,
1048
- "#{@ardir}/packages/#{pack}",
1049
- "packages/#{pack}")
1088
+ "#{@ardir}/#{PACKAGES_DIRECTORY}/#{pack}",
1089
+ "#{PACKAGES_DIRECTORY}/#{pack}")
1050
1090
  end
1051
1091
  with = extract_selection(config('with'))
1052
1092
  without = extract_selection(config('without'))
@@ -1119,11 +1159,11 @@ class ToplevelInstallerMulti < ToplevelInstaller
1119
1159
  #
1120
1160
 
1121
1161
  def each_selected_installers
1122
- Dir.mkdir 'packages' unless File.dir?('packages')
1162
+ Dir.mkdir PACKAGES_DIRECTORY unless File.dir?(PACKAGES_DIRECTORY)
1123
1163
  @selected.each do |pack|
1124
1164
  $stderr.puts "Processing the package `#{pack}' ..." if verbose?
1125
- Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
1126
- Dir.chdir "packages/#{pack}"
1165
+ Dir.mkdir "#{PACKAGES_DIRECTORY}/#{pack}" unless File.dir?("#{PACKAGES_DIRECTORY}/#{pack}")
1166
+ Dir.chdir "#{PACKAGES_DIRECTORY}/#{pack}"
1127
1167
  yield @installers[pack]
1128
1168
  Dir.chdir '../..'
1129
1169
  end
@@ -1164,15 +1204,24 @@ class Installer
1164
1204
  "#<#{self.class} #{File.basename(@srcdir)}>"
1165
1205
  end
1166
1206
 
1167
- def noop(rel) ; end
1207
+ def noop(rel)
1208
+ end
1168
1209
 
1169
1210
  #
1170
1211
  # Hook Script API base methods
1171
1212
  #
1172
1213
 
1173
- def srcdir_root() @srcdir end
1174
- def objdir_root() @objdir end
1175
- def relpath() @currdir end
1214
+ def srcdir_root
1215
+ @srcdir
1216
+ end
1217
+
1218
+ def objdir_root
1219
+ @objdir
1220
+ end
1221
+
1222
+ def relpath
1223
+ @currdir
1224
+ end
1176
1225
 
1177
1226
  #
1178
1227
  # Config Access
@@ -1320,7 +1369,7 @@ class Installer
1320
1369
  #
1321
1370
 
1322
1371
  def exec_install
1323
- rm_f 'InstalledFiles'
1372
+ rm_f "#{INSTALLED_MANIFEST}"
1324
1373
  exec_task_traverse 'install'
1325
1374
  end
1326
1375
 
@@ -1355,7 +1404,6 @@ class Installer
1355
1404
 
1356
1405
  def install_files(list, dest, mode)
1357
1406
  mkdir_p dest, @config.install_prefix
1358
- #mkdir_p dest, offset_dir
1359
1407
  list.each do |fname|
1360
1408
  install fname, dest, mode, @config.install_prefix
1361
1409
  end
@@ -1387,7 +1435,7 @@ class Installer
1387
1435
  end
1388
1436
 
1389
1437
  # picked up many entries from cvs-1.11.1/src/ignore.c
1390
- JUNK_FILES = %w(
1438
+ JUNK_FILES = %w(
1391
1439
  core RCSLOG tags TAGS .make.state
1392
1440
  .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
1393
1441
  *~ *.old *.bak *.BAK *.orig *.rej _$* *$
@@ -1457,7 +1505,7 @@ class Installer
1457
1505
  def exec_clean
1458
1506
  exec_task_traverse 'clean'
1459
1507
  rm_f @config.savefile
1460
- rm_f 'InstalledFiles'
1508
+ rm_f "#{INSTALLED_MANIFEST}"
1461
1509
  end
1462
1510
 
1463
1511
  alias clean_dir_bin noop
@@ -1478,7 +1526,7 @@ class Installer
1478
1526
  def exec_distclean
1479
1527
  exec_task_traverse 'distclean'
1480
1528
  rm_f @config.savefile
1481
- rm_f 'InstalledFiles'
1529
+ rm_f "#{INSTALLED_MANIFEST}"
1482
1530
  end
1483
1531
 
1484
1532
  alias distclean_dir_bin noop