reap 5.0.0 → 5.10.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/ANN +3 -0
  2. data/COPYING +11 -0
  3. data/ChangeLog +25 -0
  4. data/ProjectInfo +41 -66
  5. data/README +125 -0
  6. data/Rakefile +0 -10
  7. data/bin/reap +3 -4
  8. data/data/reap/scaffold/COPYING +11 -0
  9. data/data/reap/scaffold/{standard/ChangeLog → ChangeLog} +0 -0
  10. data/data/reap/scaffold/{standard/TODO → INSTALL} +0 -0
  11. data/data/reap/scaffold/{standard/ProjectInfo → ProjectInfo} +20 -20
  12. data/data/reap/scaffold/{subversion/trunk/ChangeLog → README} +0 -0
  13. data/data/reap/scaffold/Rakefile +146 -0
  14. data/data/reap/scaffold/{subversion/trunk/TODO → Todo} +0 -0
  15. data/{doc/note → data/reap/scaffold}/setup.rb +11 -18
  16. data/{doc/note/aRakefile → dev/Rakefile} +0 -0
  17. data/{doc/note → dev}/composite_task.rb +0 -0
  18. data/{doc/note → dev}/compositepublisher.rb +0 -0
  19. data/{doc/note → dev}/ftptools.rb +0 -0
  20. data/{doc/note → dev}/license-each.rb +0 -0
  21. data/{doc/note → dev}/publisher.rb +0 -0
  22. data/{doc/note → dev}/rubyforgepublisher.rb +0 -0
  23. data/{doc/note → dev}/sshpublisher.rb +0 -0
  24. data/{doc/note → dev}/suby-cvs.rb +0 -0
  25. data/{doc/note → dev}/template.rb +0 -0
  26. data/lib/reap/bin/reap.rb +67 -84
  27. data/{doc/note/interface/interface.rb → lib/reap/lint.rb} +0 -0
  28. data/lib/reap/projectinfo.rb +28 -206
  29. data/lib/reap/readymade.rb +21 -0
  30. data/lib/reap/task.rb +118 -184
  31. data/lib/reap/task/announce.rb +93 -181
  32. data/lib/reap/task/fileperm.rb +16 -46
  33. data/lib/reap/task/info.rb +7 -33
  34. data/lib/reap/task/install.rb +17 -52
  35. data/{task → lib/reap/task}/noop.rb +9 -4
  36. data/lib/reap/task/package.rb +102 -348
  37. data/lib/reap/task/publish.rb +29 -155
  38. data/lib/reap/task/rdoc.rb +40 -92
  39. data/lib/reap/task/scaffold.rb +98 -41
  40. data/lib/reap/task/test.rb +52 -147
  41. data/lib/reap/task/testext.rb +110 -0
  42. data/lib/reap/task/webpublish.rb +43 -0
  43. data/lib/reap/tasks.rb +13 -0
  44. data/lib/reap/test.rb +138 -0
  45. data/setup.rb +272 -287
  46. data/test/tc_reap.rb +1 -1
  47. data/web/ProjectInfo +57 -0
  48. data/web/images/appleboy.jpg +0 -0
  49. data/web/images/grape.jpg +0 -0
  50. data/web/index.html +124 -0
  51. data/web/rdoc/classes/Object.html +121 -0
  52. data/web/rdoc/classes/ProjectInfo.html +207 -0
  53. data/web/rdoc/classes/ProjectInfo.src/M000094.html +18 -0
  54. data/web/rdoc/classes/ProjectInfo.src/M000095.html +24 -0
  55. data/web/rdoc/classes/ProjectInfo.src/M000096.html +22 -0
  56. data/web/rdoc/classes/ProjectInfo.src/M000097.html +21 -0
  57. data/web/rdoc/classes/ProjectInfo.src/M000098.html +18 -0
  58. data/web/rdoc/classes/Reap.html +248 -0
  59. data/web/rdoc/classes/Reap.src/M000023.html +16 -0
  60. data/web/rdoc/classes/Reap.src/M000024.html +21 -0
  61. data/web/rdoc/classes/Reap.src/M000025.html +16 -0
  62. data/web/rdoc/classes/Reap.src/M000026.html +21 -0
  63. data/web/rdoc/classes/Reap/Announce.html +262 -0
  64. data/web/rdoc/classes/Reap/Announce.src/M000030.html +18 -0
  65. data/web/rdoc/classes/Reap/Announce.src/M000031.html +114 -0
  66. data/web/rdoc/classes/Reap/Announce.src/M000032.html +46 -0
  67. data/web/rdoc/classes/Reap/Info.html +176 -0
  68. data/web/rdoc/classes/Reap/Info.src/M000033.html +18 -0
  69. data/web/rdoc/classes/Reap/Info.src/M000034.html +17 -0
  70. data/web/rdoc/classes/Reap/Info.src/M000035.html +18 -0
  71. data/web/rdoc/classes/Reap/Install.html +193 -0
  72. data/web/rdoc/classes/Reap/Install.src/M000036.html +18 -0
  73. data/web/rdoc/classes/Reap/Install.src/M000037.html +20 -0
  74. data/web/rdoc/classes/Reap/Install.src/M000038.html +26 -0
  75. data/web/rdoc/classes/Reap/Noop.html +192 -0
  76. data/web/rdoc/classes/Reap/Noop.src/M000027.html +18 -0
  77. data/web/rdoc/classes/Reap/Noop.src/M000028.html +17 -0
  78. data/web/rdoc/classes/Reap/Noop.src/M000029.html +18 -0
  79. data/web/rdoc/classes/Reap/Package.html +310 -0
  80. data/web/rdoc/classes/Reap/Package.src/M000055.html +18 -0
  81. data/web/rdoc/classes/Reap/Package.src/M000056.html +68 -0
  82. data/web/rdoc/classes/Reap/Package.src/M000057.html +84 -0
  83. data/web/rdoc/classes/Reap/Package.src/M000058.html +61 -0
  84. data/web/rdoc/classes/Reap/Perm.html +236 -0
  85. data/web/rdoc/classes/Reap/Perm.src/M000078.html +18 -0
  86. data/web/rdoc/classes/Reap/Perm.src/M000079.html +21 -0
  87. data/web/rdoc/classes/Reap/Perm.src/M000080.html +42 -0
  88. data/web/rdoc/classes/Reap/Perm.src/M000081.html +26 -0
  89. data/web/rdoc/classes/Reap/Perm.src/M000082.html +18 -0
  90. data/web/rdoc/classes/Reap/Publish.html +213 -0
  91. data/web/rdoc/classes/Reap/Publish.src/M000070.html +18 -0
  92. data/web/rdoc/classes/Reap/Publish.src/M000071.html +22 -0
  93. data/web/rdoc/classes/Reap/Publish.src/M000072.html +37 -0
  94. data/web/rdoc/classes/Reap/RDoc.html +218 -0
  95. data/web/rdoc/classes/Reap/RDoc.src/M000059.html +18 -0
  96. data/web/rdoc/classes/Reap/RDoc.src/M000060.html +24 -0
  97. data/web/rdoc/classes/Reap/RDoc.src/M000061.html +70 -0
  98. data/web/rdoc/classes/Reap/Task.html +396 -0
  99. data/web/rdoc/classes/Reap/Task.src/M000039.html +18 -0
  100. data/web/rdoc/classes/Reap/Task.src/M000040.html +16 -0
  101. data/web/rdoc/classes/Reap/Task.src/M000041.html +16 -0
  102. data/web/rdoc/classes/Reap/Task.src/M000042.html +16 -0
  103. data/web/rdoc/classes/Reap/Task.src/M000043.html +16 -0
  104. data/web/rdoc/classes/Reap/Task.src/M000044.html +22 -0
  105. data/web/rdoc/classes/Reap/Task.src/M000045.html +16 -0
  106. data/web/rdoc/classes/Reap/Task.src/M000046.html +16 -0
  107. data/web/rdoc/classes/Reap/Task.src/M000047.html +16 -0
  108. data/web/rdoc/classes/Reap/Task.src/M000048.html +16 -0
  109. data/web/rdoc/classes/Reap/Task.src/M000049.html +16 -0
  110. data/web/rdoc/classes/Reap/Task.src/M000050.html +27 -0
  111. data/web/rdoc/classes/Reap/Task.src/M000051.html +19 -0
  112. data/web/rdoc/classes/Reap/Task.src/M000052.html +18 -0
  113. data/web/rdoc/classes/Reap/Task.src/M000053.html +18 -0
  114. data/web/rdoc/classes/Reap/Task.src/M000054.html +19 -0
  115. data/web/rdoc/classes/Reap/Test.html +253 -0
  116. data/web/rdoc/classes/Reap/Test.src/M000062.html +18 -0
  117. data/web/rdoc/classes/Reap/Test.src/M000063.html +26 -0
  118. data/web/rdoc/classes/Reap/Test.src/M000064.html +77 -0
  119. data/web/rdoc/classes/Reap/Test.src/M000065.html +27 -0
  120. data/web/rdoc/classes/Reap/Test.src/M000066.html +50 -0
  121. data/web/rdoc/classes/Reap/Test/TestResults.html +205 -0
  122. data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +21 -0
  123. data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +21 -0
  124. data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +23 -0
  125. data/web/rdoc/classes/Reap/TestExt.html +234 -0
  126. data/web/rdoc/classes/Reap/TestExt.src/M000073.html +18 -0
  127. data/web/rdoc/classes/Reap/TestExt.src/M000074.html +20 -0
  128. data/web/rdoc/classes/Reap/TestExt.src/M000075.html +49 -0
  129. data/web/rdoc/classes/Reap/TestExt.src/M000076.html +34 -0
  130. data/web/rdoc/classes/Reap/TestExt.src/M000077.html +27 -0
  131. data/web/rdoc/classes/Reap/WebPublish.html +213 -0
  132. data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +18 -0
  133. data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +21 -0
  134. data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +32 -0
  135. data/web/rdoc/classes/ReapCommand.html +425 -0
  136. data/web/rdoc/classes/ReapCommand.src/M000001.html +16 -0
  137. data/web/rdoc/classes/ReapCommand.src/M000003.html +16 -0
  138. data/web/rdoc/classes/ReapCommand.src/M000005.html +16 -0
  139. data/web/rdoc/classes/ReapCommand.src/M000007.html +16 -0
  140. data/web/rdoc/classes/ReapCommand.src/M000009.html +16 -0
  141. data/web/rdoc/classes/ReapCommand.src/M000011.html +16 -0
  142. data/web/rdoc/classes/ReapCommand.src/M000013.html +18 -0
  143. data/web/rdoc/classes/ReapCommand.src/M000014.html +19 -0
  144. data/web/rdoc/classes/ReapCommand.src/M000015.html +19 -0
  145. data/web/rdoc/classes/ReapCommand.src/M000016.html +24 -0
  146. data/web/rdoc/classes/ReapCommand.src/M000018.html +29 -0
  147. data/web/rdoc/classes/Scaffold.html +211 -0
  148. data/web/rdoc/classes/Scaffold.src/M000086.html +16 -0
  149. data/web/rdoc/classes/Scaffold.src/M000087.html +28 -0
  150. data/web/rdoc/classes/Scaffold.src/M000088.html +32 -0
  151. data/web/rdoc/classes/Scaffold.src/M000089.html +18 -0
  152. data/web/rdoc/classes/UnitTestKernel.html +176 -0
  153. data/web/rdoc/classes/UnitTestKernel.src/M000019.html +18 -0
  154. data/web/rdoc/classes/UnitTestKernel.src/M000020.html +18 -0
  155. data/web/rdoc/classes/UnitTestKernel.src/M000021.html +22 -0
  156. data/web/rdoc/classes/UnitTestKernel.src/M000022.html +22 -0
  157. data/web/rdoc/classes/UnitTesting.html +165 -0
  158. data/web/rdoc/classes/UnitTesting.src/M000090.html +34 -0
  159. data/web/rdoc/classes/UnitTesting.src/M000091.html +18 -0
  160. data/web/rdoc/classes/UnitTesting/Failure.html +156 -0
  161. data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +18 -0
  162. data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +21 -0
  163. data/web/rdoc/created.rid +1 -0
  164. data/web/rdoc/files/ANN.html +107 -0
  165. data/web/rdoc/files/COPYING.html +119 -0
  166. data/web/rdoc/files/ChangeLog.html +144 -0
  167. data/web/rdoc/files/ProjectInfo.html +190 -0
  168. data/web/rdoc/files/README.html +274 -0
  169. data/web/rdoc/files/Rakefile.html +101 -0
  170. data/web/rdoc/files/lib/reap/bin/reap_rb.html +129 -0
  171. data/web/rdoc/files/lib/reap/lint_rb.html +101 -0
  172. data/web/rdoc/files/lib/reap/projectinfo_rb.html +110 -0
  173. data/web/rdoc/files/lib/reap/readymade_rb.html +123 -0
  174. data/web/rdoc/files/lib/reap/task/announce_rb.html +114 -0
  175. data/web/rdoc/files/lib/reap/task/fileperm_rb.html +108 -0
  176. data/web/rdoc/files/lib/reap/task/info_rb.html +108 -0
  177. data/web/rdoc/files/lib/reap/task/install_rb.html +108 -0
  178. data/web/rdoc/files/lib/reap/task/noop_rb.html +108 -0
  179. data/web/rdoc/files/lib/reap/task/package_rb.html +109 -0
  180. data/web/rdoc/files/lib/reap/task/publish_rb.html +108 -0
  181. data/web/rdoc/files/lib/reap/task/rdoc_rb.html +108 -0
  182. data/web/rdoc/files/lib/reap/task/scaffold_rb.html +107 -0
  183. data/web/rdoc/files/lib/reap/task/test_rb.html +110 -0
  184. data/web/rdoc/files/lib/reap/task/testext_rb.html +109 -0
  185. data/web/rdoc/files/lib/reap/task/webpublish_rb.html +108 -0
  186. data/web/rdoc/files/lib/reap/task_rb.html +120 -0
  187. data/web/rdoc/files/lib/reap/tasks_rb.html +116 -0
  188. data/web/rdoc/files/lib/reap/test_rb.html +109 -0
  189. data/web/rdoc/fr_class_index.html +47 -0
  190. data/web/rdoc/fr_file_index.html +51 -0
  191. data/web/rdoc/fr_method_index.html +124 -0
  192. data/web/rdoc/index.html +24 -0
  193. data/web/rdoc/rdoc-style.css +208 -0
  194. metadata +257 -138
  195. data/bin/rubytest +0 -5
  196. data/data/reap/scaffold/standard/COPYING +0 -403
  197. data/data/reap/scaffold/standard/INSTALL +0 -14
  198. data/data/reap/scaffold/standard/README +0 -3
  199. data/data/reap/scaffold/standard/Rakefile +0 -10
  200. data/data/reap/scaffold/standard/setup.rb +0 -1568
  201. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  202. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  203. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -78
  204. data/data/reap/scaffold/subversion/trunk/README +0 -3
  205. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  206. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  207. data/data/reap/setup.rb +0 -1568
  208. data/doc/COPYING +0 -403
  209. data/doc/ChangeLog +0 -18
  210. data/doc/LATEST +0 -29
  211. data/doc/README +0 -182
  212. data/doc/doap.xml +0 -27
  213. data/doc/note/ProjectInfo.rb +0 -88
  214. data/doc/note/Rakefile.0 +0 -118
  215. data/doc/note/Rakefile.htm +0 -69
  216. data/doc/note/application.rb +0 -124
  217. data/doc/note/interface/rubyforge.rb +0 -247
  218. data/doc/note/intro.txt +0 -42
  219. data/doc/note/package.rb +0 -629
  220. data/doc/note/package.rb.0 +0 -394
  221. data/doc/note/scaffold.rb +0 -123
  222. data/lib/reap/app.rb +0 -74
  223. data/lib/reap/bin/rubylint.rb +0 -1
  224. data/lib/reap/bin/rubytest.rb +0 -45
  225. data/lib/reap/rake.rb +0 -12
  226. data/lib/reap/rakeadapter.rb +0 -50
  227. data/lib/reap/reap.rb +0 -32
  228. data/lib/reap/task/custom.rb +0 -12
  229. data/lib/reap/task/doap.rb +0 -85
  230. data/lib/reap/task/extest.rb +0 -161
  231. data/lib/reap/task/manifest.rb +0 -70
  232. data/lib/reap/task/release.rb +0 -512
  233. data/lib/reap/task/template.rb +0 -46
  234. data/lib/reap/vendor/http-access2.rb +0 -1590
  235. data/lib/reap/vendor/http-access2/cookie.rb +0 -538
  236. data/lib/reap/vendor/http-access2/http.rb +0 -542
@@ -0,0 +1,13 @@
1
+
2
+ require 'reap/task/fileperm'
3
+ require 'reap/task/test'
4
+ require 'reap/task/testext'
5
+ require 'reap/task/rdoc'
6
+ require 'reap/task/announce'
7
+ require 'reap/task/package'
8
+ require 'reap/task/publish'
9
+ require 'reap/task/info'
10
+ require 'reap/task/install'
11
+ #require 'reap/task/noop'
12
+ #require 'reap/webpublish'
13
+
@@ -0,0 +1,138 @@
1
+ require 'facet/kernel/sym_esc'
2
+ require 'yaml'
3
+
4
+ $test_mode = false
5
+ $test_failures = []
6
+
7
+
8
+ module UnitTestKernel
9
+
10
+ def assert_on!
11
+ $test_mode = true
12
+ end
13
+
14
+ def assert_off!
15
+ $test_mode = false
16
+ end
17
+
18
+ def assert!(&blk)
19
+ old = $test_mode
20
+ $test_mode = true
21
+ r = blk.call
22
+ $test_mode = old
23
+ return r
24
+ end
25
+
26
+ def no_assertion!(&blk)
27
+ old = $test_mode
28
+ $test_mode = false
29
+ r = blk.call
30
+ $test_mode = old
31
+ return r
32
+ end
33
+
34
+ end
35
+
36
+ class Object
37
+ include UnitTestKernel
38
+ end
39
+
40
+
41
+ module UnitTesting
42
+
43
+ class Failure
44
+
45
+ def to_yaml_properties
46
+ [ '@self', '@method', '@args', '@caller' ]
47
+ end
48
+
49
+ def initialize( slf, meth, args, callr )
50
+ @self = slf
51
+ @method = meth
52
+ @args = args
53
+ @caller = callr
54
+ end
55
+
56
+ end
57
+
58
+
59
+ TRANSPARENT_ASSERTIONS = %w{
60
+ == === eql? equal? kind_of? include?
61
+ member? empty? nil? has_key? key? respond_to?
62
+ between?
63
+ }
64
+
65
+ def self.advise_assertions
66
+
67
+ ObjectSpace.each_object(Module) do |m|
68
+
69
+ TRANSPARENT_ASSERTIONS.each do |meth|
70
+
71
+ nmeth = "assert_#{sym_esc(meth)}"
72
+
73
+ if m.method_defined?(meth)
74
+
75
+ m.class_eval <<-HERE
76
+ alias :#{nmeth} :#{meth}
77
+ def #{meth}(*args)
78
+ if $test_mode
79
+ r = nil
80
+ no_assertion! {
81
+ r = #{nmeth}(*args)
82
+ unless r
83
+ $test_failures << Failure.new( self, :"#{meth}", args, caller[2..-1] )
84
+ end
85
+ }
86
+ return r
87
+ else
88
+ return #{nmeth}(*args)
89
+ end
90
+ end
91
+ HERE
92
+
93
+ end #if
94
+
95
+ end #do
96
+
97
+ end #do
98
+
99
+ end #def
100
+
101
+ def self.report
102
+ y $test_failures
103
+ end
104
+
105
+ end
106
+
107
+ class Object
108
+ include UnitTestKernel
109
+ end
110
+
111
+ UnitTesting.advise_assertions
112
+
113
+
114
+ =begin testing
115
+
116
+ class X
117
+ def a
118
+ 1
119
+ end
120
+ end
121
+
122
+ class TestX < X
123
+
124
+ def test_a
125
+ assert! {
126
+ a == 1
127
+ a == 2
128
+ }
129
+ end
130
+
131
+ end
132
+
133
+ x = TestX.new
134
+ x.test_a
135
+
136
+ UnitTesting.report
137
+
138
+ =end
data/setup.rb CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  #
2
4
  # setup.rb
3
5
  #
@@ -8,50 +10,21 @@
8
10
  # the GNU LGPL, Lesser General Public License version 2.1.
9
11
  #
10
12
 
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})"
13
+ unless Enumerable.method_defined?(:map) # Ruby 1.4.6
14
+ module Enumerable
15
+ alias map collect
16
+ end
50
17
  end
51
18
 
52
- # Windows?
19
+ unless File.respond_to?(:read) # Ruby 1.6
20
+ def File.read(fname)
21
+ open(fname) {|f|
22
+ return f.read
23
+ }
24
+ end
25
+ end
53
26
 
54
- unless Errno.const_defined?(:ENOTEMPTY)
27
+ unless Errno.const_defined?(:ENOTEMPTY) # Windows?
55
28
  module Errno
56
29
  class ENOTEMPTY
57
30
  # We do not raise this exception, implementation is not needed.
@@ -84,16 +57,25 @@ class ConfigTable
84
57
  @config_opt = nil
85
58
  @verbose = true
86
59
  @no_harm = false
60
+ @libsrc_pattern = '*.rb'
87
61
  end
88
62
 
89
63
  attr_accessor :install_prefix
90
64
  attr_accessor :config_opt
91
65
 
92
- def verbose=(x) @verbose = x end
93
- def verbose?() @verbose end
66
+ attr_writer :verbose
67
+
68
+ def verbose?
69
+ @verbose
70
+ end
71
+
72
+ attr_writer :no_harm
73
+
74
+ def no_harm?
75
+ @no_harm
76
+ end
94
77
 
95
- def no_harm=(x) @no_harm = x end
96
- def no_harm?() @no_harm end
78
+ attr_accessor :libsrc_pattern
97
79
 
98
80
  def [](key)
99
81
  lookup(key).resolve(self)
@@ -137,7 +119,9 @@ class ConfigTable
137
119
  end
138
120
  end
139
121
 
140
- def savefile() '.config' end
122
+ def savefile
123
+ '.config'
124
+ end
141
125
 
142
126
  def load_savefile
143
127
  begin
@@ -160,126 +144,124 @@ class ConfigTable
160
144
  end
161
145
 
162
146
  def load_standard_entries
163
- #standard_entries(@rbconfig).each do |ent|
164
- standard_entries.each do |ent|
147
+ standard_entries(@rbconfig).each do |ent|
165
148
  add ent
166
149
  end
167
150
  end
168
151
 
169
- def standard_entries #(rbconfig)
170
- rbconfig = @rbconfig
152
+ def standard_entries(rbconfig)
153
+ c = rbconfig
171
154
 
172
- rubypath = File.join(rbconfig['bindir'], rbconfig['ruby_install_name'] + rbconfig['EXEEXT'])
155
+ rubypath = c['bindir'] + '/' + c['ruby_install_name']
173
156
 
174
- major = rbconfig['MAJOR'].to_i
175
- minor = rbconfig['MINOR'].to_i
176
- teeny = rbconfig['TEENY'].to_i
157
+ major = c['MAJOR'].to_i
158
+ minor = c['MINOR'].to_i
159
+ teeny = c['TEENY'].to_i
177
160
  version = "#{major}.#{minor}"
178
161
 
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)))))
162
+ # ruby ver. >= 1.4.4?
163
+ newpath_p = ((major >= 2) or
164
+ ((major == 1) and
165
+ ((minor >= 5) or
166
+ ((minor == 4) and (teeny >= 4)))))
186
167
 
187
- #if c['rubylibdir']
168
+ if c['rubylibdir']
188
169
  # 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
-
170
+ libruby = "#{c['prefix']}/lib/ruby"
171
+ librubyver = c['rubylibdir']
172
+ librubyverarch = c['archdir']
173
+ siteruby = c['sitedir']
174
+ siterubyver = c['sitelibdir']
175
+ siterubyverarch = c['sitearchdir']
176
+ elsif newpath_p
177
+ # 1.4.4 <= V <= 1.6.3
178
+ libruby = "#{c['prefix']}/lib/ruby"
179
+ librubyver = "#{c['prefix']}/lib/ruby/#{version}"
180
+ librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
181
+ siteruby = c['sitedir']
182
+ siterubyver = "$siteruby/#{version}"
183
+ siterubyverarch = "$siterubyver/#{c['arch']}"
184
+ else
185
+ # V < 1.4.4
186
+ libruby = "#{c['prefix']}/lib/ruby"
187
+ librubyver = "#{c['prefix']}/lib/ruby/#{version}"
188
+ librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
189
+ siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
190
+ siterubyver = siteruby
191
+ siterubyverarch = "$siterubyver/#{c['arch']}"
192
+ end
225
193
  parameterize = lambda {|path|
226
- path.sub(/\A#{Regexp.quote(rbconfig['prefix'])}/, '$prefix')
194
+ path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
227
195
  }
228
196
 
229
- if arg = rbconfig['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
197
+ if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
230
198
  makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
231
199
  else
232
200
  makeprog = 'make'
233
201
  end
234
202
 
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
203
  [
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')
204
+ ExecItem.new('installdirs', 'std/site/home',
205
+ 'std: install under libruby; site: install under site_ruby; home: install under $HOME')\
206
+ {|val, table|
207
+ case val
208
+ when 'std'
209
+ table['rbdir'] = '$librubyver'
210
+ table['sodir'] = '$librubyverarch'
211
+ when 'site'
212
+ table['rbdir'] = '$siterubyver'
213
+ table['sodir'] = '$siterubyverarch'
214
+ when 'home'
215
+ setup_rb_error '$HOME was not set' unless ENV['HOME']
216
+ table['prefix'] = ENV['HOME']
217
+ table['rbdir'] = '$libdir/ruby'
218
+ table['sodir'] = '$libdir/ruby'
219
+ end
220
+ },
221
+ PathItem.new('prefix', 'path', c['prefix'],
222
+ 'path prefix of target environment'),
223
+ PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
224
+ 'the directory for commands'),
225
+ PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
226
+ 'the directory for libraries'),
227
+ PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
228
+ 'the directory for shared data'),
229
+ PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
230
+ 'the directory for man pages'),
231
+ PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
232
+ 'the directory for system configuration files'),
233
+ PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
234
+ 'the directory for local state data'),
235
+ PathItem.new('libruby', 'path', libruby,
236
+ 'the directory for ruby libraries'),
237
+ PathItem.new('librubyver', 'path', librubyver,
238
+ 'the directory for standard ruby libraries'),
239
+ PathItem.new('librubyverarch', 'path', librubyverarch,
240
+ 'the directory for standard ruby extensions'),
241
+ PathItem.new('siteruby', 'path', siteruby,
242
+ 'the directory for version-independent aux ruby libraries'),
243
+ PathItem.new('siterubyver', 'path', siterubyver,
244
+ 'the directory for aux ruby libraries'),
245
+ PathItem.new('siterubyverarch', 'path', siterubyverarch,
246
+ 'the directory for aux ruby binaries'),
247
+ PathItem.new('rbdir', 'path', '$siterubyver',
248
+ 'the directory for ruby scripts'),
249
+ PathItem.new('sodir', 'path', '$siterubyverarch',
250
+ 'the directory for ruby extentions'),
251
+ PathItem.new('rubypath', 'path', rubypath,
252
+ 'the path to set to #! line'),
253
+ ProgramItem.new('rubyprog', 'name', rubypath,
254
+ 'the ruby program using for installation'),
255
+ ProgramItem.new('makeprog', 'name', makeprog,
256
+ 'the make program to compile ruby extentions'),
257
+ SelectItem.new('shebang', 'all/ruby/never', 'ruby',
258
+ 'shebang line (#!) editing mode'),
259
+ BoolItem.new('without-ext', 'yes/no', 'no',
260
+ 'does not compile/install ruby extentions')
274
261
  ]
275
262
  end
276
263
  private :standard_entries
277
264
 
278
- def paramize( path )
279
- path.sub(/\A#{Regexp.quote(@rbconfig['prefix'])}/, '$prefix')
280
- end
281
- private :paramize
282
-
283
265
  def load_multipackage_entries
284
266
  multipackage_entries().each do |ent|
285
267
  add ent
@@ -288,8 +270,10 @@ class ConfigTable
288
270
 
289
271
  def multipackage_entries
290
272
  [
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')
273
+ PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
274
+ 'package names that you want to install'),
275
+ PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
276
+ 'package names that you do not want to install')
293
277
  ]
294
278
  end
295
279
  private :multipackage_entries
@@ -354,8 +338,13 @@ class ConfigTable
354
338
  "--#{@name}=#{@template}"
355
339
  end
356
340
 
357
- def value? ; true ; end
358
- def value ; @value ; end
341
+ def value?
342
+ true
343
+ end
344
+
345
+ def value
346
+ @value
347
+ end
359
348
 
360
349
  def resolve(table)
361
350
  @value.gsub(%r<\$([^/]+)>) { table[$1] }
@@ -374,7 +363,9 @@ class ConfigTable
374
363
  end
375
364
 
376
365
  class BoolItem < Item
377
- def config_type() 'bool' end
366
+ def config_type
367
+ 'bool'
368
+ end
378
369
 
379
370
  def help_opt
380
371
  "--#{@name}"
@@ -384,19 +375,20 @@ class ConfigTable
384
375
 
385
376
  def check(val)
386
377
  return 'yes' unless val
387
- case val
388
- when /\Ay(es)?\z/i, /\At(rue)?\z/i then 'yes'
389
- when /\An(o)?\z/i, /\Af(alse)\z/i then 'no'
390
- else
378
+ unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
391
379
  setup_rb_error "config: --#{@name} accepts only yes/no for argument"
392
380
  end
381
+ (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
393
382
  end
394
383
  end
395
384
 
396
385
  class PathItem < Item
397
- def config_type() 'path' end
386
+ def config_type
387
+ 'path'
388
+ end
398
389
 
399
390
  private
391
+
400
392
  def check(path)
401
393
  setup_rb_error "config: --#{@name} requires argument" unless path
402
394
  path[0,1] == '$' ? path : File.expand_path(path)
@@ -404,7 +396,9 @@ class ConfigTable
404
396
  end
405
397
 
406
398
  class ProgramItem < Item
407
- def config_type() 'program' end
399
+ def config_type
400
+ 'program'
401
+ end
408
402
  end
409
403
 
410
404
  class SelectItem < Item
@@ -413,9 +407,12 @@ class ConfigTable
413
407
  @ok = selection.split('/')
414
408
  end
415
409
 
416
- def config_type() 'select' end
410
+ def config_type
411
+ 'select'
412
+ end
417
413
 
418
414
  private
415
+
419
416
  def check(val)
420
417
  unless @ok.include?(val.strip)
421
418
  setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
@@ -477,7 +474,7 @@ class ConfigTable
477
474
  end
478
475
 
479
476
  class MetaConfigEnvironment
480
- def initialize(config, installer)
477
+ def intiailize(config, installer)
481
478
  @config = config
482
479
  @installer = installer
483
480
  end
@@ -542,9 +539,7 @@ end # class ConfigTable
542
539
  module FileOperations
543
540
 
544
541
  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
-
542
+ dirname = prefix + File.expand_path(dirname) if prefix
548
543
  $stderr.puts "mkdir -p #{dirname}" if verbose?
549
544
  return if no_harm?
550
545
 
@@ -628,15 +623,11 @@ module FileOperations
628
623
  end
629
624
 
630
625
  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
626
  $stderr.puts "install #{from} #{dest}" if verbose?
636
627
  return if no_harm?
637
628
 
629
+ realdest = prefix ? prefix + File.expand_path(dest) : dest
638
630
  realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
639
-
640
631
  str = File.binread(from)
641
632
  if diff?(str, realdest)
642
633
  verbose_off {
@@ -647,10 +638,6 @@ module FileOperations
647
638
  }
648
639
  File.chmod mode, realdest
649
640
 
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
641
  File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
655
642
  if prefix
656
643
  f.puts realdest.sub(prefix, '')
@@ -675,7 +662,7 @@ module FileOperations
675
662
  def ruby(*args)
676
663
  command config('rubyprog'), *args
677
664
  end
678
-
665
+
679
666
  def make(task = nil)
680
667
  command(*[config('makeprog'), task].compact)
681
668
  end
@@ -715,14 +702,33 @@ module HookScriptAPI
715
702
  @config[key] = val
716
703
  end
717
704
 
705
+ #
718
706
  # srcdir/objdir (works only in the package directory)
707
+ #
719
708
 
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
709
+ def curr_srcdir
710
+ "#{srcdir_root()}/#{relpath()}"
711
+ end
712
+
713
+ def curr_objdir
714
+ "#{objdir_root()}/#{relpath()}"
715
+ end
716
+
717
+ def srcfile(path)
718
+ "#{curr_srcdir()}/#{path}"
719
+ end
720
+
721
+ def srcexist?(path)
722
+ File.exist?(srcfile(path))
723
+ end
724
+
725
+ def srcdirectory?(path)
726
+ File.dir?(srcfile(path))
727
+ end
728
+
729
+ def srcfile?(path)
730
+ File.file?(srcfile(path))
731
+ end
726
732
 
727
733
  def srcentries(path = '.')
728
734
  Dir.open("#{curr_srcdir()}/#{path}") {|d|
@@ -747,7 +753,7 @@ end
747
753
 
748
754
  class ToplevelInstaller
749
755
 
750
- Version = '3.4.1'
756
+ Version = '3.4.0'
751
757
  Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
752
758
 
753
759
  TASKS = [
@@ -761,8 +767,8 @@ class ToplevelInstaller
761
767
  [ 'distclean',"does `make distclean' for each extention" ]
762
768
  ]
763
769
 
764
- def self.invoke
765
- config = ConfigTable.new(load_rbconfig)
770
+ def ToplevelInstaller.invoke
771
+ config = ConfigTable.new(load_rbconfig())
766
772
  config.load_standard_entries
767
773
  config.load_multipackage_entries if multipackage?
768
774
  config.fixup
@@ -770,11 +776,11 @@ class ToplevelInstaller
770
776
  klass.new(File.dirname($0), config).invoke
771
777
  end
772
778
 
773
- def self.multipackage?
779
+ def ToplevelInstaller.multipackage?
774
780
  File.dir?(File.dirname($0) + '/packages')
775
781
  end
776
782
 
777
- def self.load_rbconfig
783
+ def ToplevelInstaller.load_rbconfig
778
784
  if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
779
785
  ARGV.delete(arg)
780
786
  load File.expand_path(arg.split(/=/, 2)[1])
@@ -785,7 +791,6 @@ class ToplevelInstaller
785
791
  ::Config::CONFIG
786
792
  end
787
793
 
788
-
789
794
  def initialize(ardir_root, config)
790
795
  @ardir = File.expand_path(ardir_root)
791
796
  @config = config
@@ -824,7 +829,7 @@ class ToplevelInstaller
824
829
  __send__ "exec_#{task}"
825
830
  end
826
831
  end
827
-
832
+
828
833
  def run_metaconfigs
829
834
  @config.load_script "#{@ardir}/metaconfig"
830
835
  end
@@ -837,9 +842,17 @@ class ToplevelInstaller
837
842
  # Hook Script API bases
838
843
  #
839
844
 
840
- def srcdir_root() @ardir end
841
- def objdir_root() '.' end
842
- def relpath() '.' end
845
+ def srcdir_root
846
+ @ardir
847
+ end
848
+
849
+ def objdir_root
850
+ '.'
851
+ end
852
+
853
+ def relpath
854
+ '.'
855
+ end
843
856
 
844
857
  #
845
858
  # Option Parsing
@@ -881,7 +894,6 @@ class ToplevelInstaller
881
894
 
882
895
  def parsearg_no_options
883
896
  unless ARGV.empty?
884
- task = caller(0).first.slice(%r<`parsearg_(\w+)'>, 1)
885
897
  setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}"
886
898
  end
887
899
  end
@@ -969,7 +981,6 @@ class ToplevelInstaller
969
981
  out.puts
970
982
  out.puts 'Options for INSTALL:'
971
983
  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
984
  out.printf fmt, '--prefix=path', 'install path prefix', ''
974
985
  out.puts
975
986
  end
@@ -1164,15 +1175,21 @@ class Installer
1164
1175
  "#<#{self.class} #{File.basename(@srcdir)}>"
1165
1176
  end
1166
1177
 
1167
- def noop(rel) ; end
1168
-
1169
1178
  #
1170
1179
  # Hook Script API base methods
1171
1180
  #
1172
1181
 
1173
- def srcdir_root() @srcdir end
1174
- def objdir_root() @objdir end
1175
- def relpath() @currdir end
1182
+ def srcdir_root
1183
+ @srcdir
1184
+ end
1185
+
1186
+ def objdir_root
1187
+ @objdir
1188
+ end
1189
+
1190
+ def relpath
1191
+ @currdir
1192
+ end
1176
1193
 
1177
1194
  #
1178
1195
  # Config Access
@@ -1205,21 +1222,29 @@ class Installer
1205
1222
  exec_task_traverse 'config'
1206
1223
  end
1207
1224
 
1208
- alias config_dir_bin noop
1209
- alias config_dir_lib noop
1225
+ def config_dir_bin(rel)
1226
+ end
1227
+
1228
+ def config_dir_lib(rel)
1229
+ end
1230
+
1231
+ def config_dir_man(rel)
1232
+ end
1210
1233
 
1211
1234
  def config_dir_ext(rel)
1212
1235
  extconf if extdir?(curr_srcdir())
1213
1236
  end
1214
1237
 
1215
- alias config_dir_data noop
1216
- alias config_dir_conf noop
1217
- alias config_dir_man noop
1218
-
1219
1238
  def extconf
1220
1239
  ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt
1221
1240
  end
1222
1241
 
1242
+ def config_dir_data(rel)
1243
+ end
1244
+
1245
+ def config_dir_conf(rel)
1246
+ end
1247
+
1223
1248
  #
1224
1249
  # TASK setup
1225
1250
  #
@@ -1230,89 +1255,43 @@ class Installer
1230
1255
 
1231
1256
  def setup_dir_bin(rel)
1232
1257
  files_of(curr_srcdir()).each do |fname|
1233
- update_shebang_line "#{curr_srcdir()}/#{fname}"
1258
+ adjust_shebang "#{curr_srcdir()}/#{fname}"
1234
1259
  end
1235
1260
  end
1236
1261
 
1237
- alias setup_dir_lib noop
1238
-
1239
- def setup_dir_ext(rel)
1240
- make if extdir?(curr_srcdir())
1241
- end
1242
-
1243
- alias setup_dir_data noop
1244
- alias setup_dir_conf noop
1245
- alias setup_dir_man noop
1246
-
1247
- def update_shebang_line(path)
1262
+ def adjust_shebang(path)
1248
1263
  return if no_harm?
1249
- return if config('shebang') == 'never'
1250
- old = Shebang.load(path)
1251
- if old
1252
- $stderr.puts "warning: #{path}: Shebang line includes too many args. It is not portable and your program may not work." if old.args.size > 1
1253
- new = new_shebang(old)
1254
- return if new.to_s == old.to_s
1255
- else
1256
- return unless config('shebang') == 'all'
1257
- new = Shebang.new(config('rubypath'))
1258
- end
1259
- $stderr.puts "updating shebang: #{File.basename(path)}" if verbose?
1260
- open_atomic_writer(path) {|output|
1261
- File.open(path, 'rb') {|f|
1262
- f.gets if old # discard
1263
- output.puts new.to_s
1264
- output.print f.read
1265
- }
1266
- }
1267
- end
1268
-
1269
- def new_shebang(old)
1270
- if /\Aruby/ =~ File.basename(old.cmd)
1271
- Shebang.new(config('rubypath'), old.args)
1272
- elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby'
1273
- Shebang.new(config('rubypath'), old.args[1..-1])
1274
- else
1275
- return old unless config('shebang') == 'all'
1276
- Shebang.new(config('rubypath'))
1277
- end
1278
- end
1279
-
1280
- def open_atomic_writer(path, &block)
1281
1264
  tmpfile = File.basename(path) + '.tmp'
1282
1265
  begin
1283
- File.open(tmpfile, 'wb', &block)
1284
- File.rename tmpfile, File.basename(path)
1266
+ File.open(path, 'rb') {|r|
1267
+ first = r.gets
1268
+ return unless File.basename(first.sub(/\A\#!/, '').split[0].to_s) == 'ruby'
1269
+ $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
1270
+ File.open(tmpfile, 'wb') {|w|
1271
+ w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
1272
+ w.write r.read
1273
+ }
1274
+ }
1275
+ move_file tmpfile, File.basename(path)
1285
1276
  ensure
1286
1277
  File.unlink tmpfile if File.exist?(tmpfile)
1287
1278
  end
1288
1279
  end
1289
1280
 
1290
- class Shebang
1291
- def Shebang.load(path)
1292
- line = nil
1293
- File.open(path) {|f|
1294
- line = f.gets
1295
- }
1296
- return nil unless /\A#!/ =~ line
1297
- parse(line)
1298
- end
1281
+ def setup_dir_lib(rel)
1282
+ end
1299
1283
 
1300
- def Shebang.parse(line)
1301
- cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
1302
- new(cmd, args)
1303
- end
1284
+ def setup_dir_man(rel)
1285
+ end
1304
1286
 
1305
- def initialize(cmd, args = [])
1306
- @cmd = cmd
1307
- @args = args
1308
- end
1287
+ def setup_dir_ext(rel)
1288
+ make if extdir?(curr_srcdir())
1289
+ end
1309
1290
 
1310
- attr_reader :cmd
1311
- attr_reader :args
1291
+ def setup_dir_data(rel)
1292
+ end
1312
1293
 
1313
- def to_s
1314
- "#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}")
1315
- end
1294
+ def setup_dir_conf(rel)
1316
1295
  end
1317
1296
 
1318
1297
  #
@@ -1329,7 +1308,7 @@ class Installer
1329
1308
  end
1330
1309
 
1331
1310
  def install_dir_lib(rel)
1332
- install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644
1311
+ install_files rubyscripts(), "#{config('rbdir')}/#{rel}", 0644
1333
1312
  end
1334
1313
 
1335
1314
  def install_dir_ext(rel)
@@ -1355,14 +1334,13 @@ class Installer
1355
1334
 
1356
1335
  def install_files(list, dest, mode)
1357
1336
  mkdir_p dest, @config.install_prefix
1358
- #mkdir_p dest, offset_dir
1359
1337
  list.each do |fname|
1360
1338
  install fname, dest, mode, @config.install_prefix
1361
1339
  end
1362
1340
  end
1363
1341
 
1364
- def libfiles
1365
- glob_reject(%w(*.y *.output), targetfiles())
1342
+ def rubyscripts
1343
+ glob_select(@config.libsrc_pattern, targetfiles())
1366
1344
  end
1367
1345
 
1368
1346
  def rubyextentions(dir)
@@ -1440,11 +1418,7 @@ class Installer
1440
1418
  return
1441
1419
  end
1442
1420
  $stderr.puts 'Running tests...' if verbose?
1443
- begin
1444
- require 'test/unit'
1445
- rescue LoadError
1446
- setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
1447
- end
1421
+ require 'test/unit'
1448
1422
  runner = Test::Unit::AutoRunner.new(true)
1449
1423
  runner.to_run << TESTDIR
1450
1424
  runner.run
@@ -1460,17 +1434,23 @@ class Installer
1460
1434
  rm_f 'InstalledFiles'
1461
1435
  end
1462
1436
 
1463
- alias clean_dir_bin noop
1464
- alias clean_dir_lib noop
1465
- alias clean_dir_data noop
1466
- alias clean_dir_conf noop
1467
- alias clean_dir_man noop
1437
+ def clean_dir_bin(rel)
1438
+ end
1439
+
1440
+ def clean_dir_lib(rel)
1441
+ end
1468
1442
 
1469
1443
  def clean_dir_ext(rel)
1470
1444
  return unless extdir?(curr_srcdir())
1471
1445
  make 'clean' if File.file?('Makefile')
1472
1446
  end
1473
1447
 
1448
+ def clean_dir_data(rel)
1449
+ end
1450
+
1451
+ def clean_dir_conf(rel)
1452
+ end
1453
+
1474
1454
  #
1475
1455
  # TASK distclean
1476
1456
  #
@@ -1481,26 +1461,31 @@ class Installer
1481
1461
  rm_f 'InstalledFiles'
1482
1462
  end
1483
1463
 
1484
- alias distclean_dir_bin noop
1485
- alias distclean_dir_lib noop
1464
+ def distclean_dir_bin(rel)
1465
+ end
1466
+
1467
+ def distclean_dir_lib(rel)
1468
+ end
1486
1469
 
1487
1470
  def distclean_dir_ext(rel)
1488
1471
  return unless extdir?(curr_srcdir())
1489
1472
  make 'distclean' if File.file?('Makefile')
1490
1473
  end
1491
1474
 
1492
- alias distclean_dir_data noop
1493
- alias distclean_dir_conf noop
1494
- alias distclean_dir_man noop
1475
+ def distclean_dir_data(rel)
1476
+ end
1477
+
1478
+ def distclean_dir_conf(rel)
1479
+ end
1495
1480
 
1496
1481
  #
1497
- # Traversing
1482
+ # lib
1498
1483
  #
1499
1484
 
1500
1485
  def exec_task_traverse(task)
1501
1486
  run_hook "pre-#{task}"
1502
1487
  FILETYPES.each do |type|
1503
- if type == 'ext' and config('without-ext') == 'yes'
1488
+ if config('without-ext') == 'yes' and type == 'ext'
1504
1489
  $stderr.puts 'skipping ext/* by user option' if verbose?
1505
1490
  next
1506
1491
  end