reap 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ProjectInfo +102 -0
- data/data/reap/install.rb +62 -0
- data/forge/ProjectInfo +38 -0
- data/forge/ProjectInfo.rb +76 -0
- data/forge/TODO +10 -0
- data/forge/installer.rb +250 -0
- data/forge/reference/Rakefile +124 -0
- data/forge/reference/Rakefile.htm +69 -0
- data/forge/reference/aRakefile +60 -0
- data/forge/reference/compositepublisher.rb +24 -0
- data/forge/reference/ftptools.rb +139 -0
- data/forge/reference/installers/package.rb +629 -0
- data/forge/reference/installers/setup.rb +1558 -0
- data/forge/reference/license-each.rb +85 -0
- data/forge/reference/publisher.rb +75 -0
- data/forge/reference/rubyforge.rb +247 -0
- data/forge/reference/rubyforgepublisher.rb +18 -0
- data/forge/reference/sshpublisher.rb +47 -0
- data/forge/reference/suby-cvs.rb +46 -0
- data/forge/scaffold.rb +126 -0
- data/forge/unit_runner/README +6 -0
- data/forge/unit_runner/commentrunner.rb +62 -0
- data/forge/unit_runner/cunit.rb +17 -0
- data/forge/unit_runner/forkedrunner.rb +91 -0
- data/forge/unit_runner/sample.rb +16 -0
- data/lib/reap/class/extest.rb +2 -7
- data/lib/reap/class/manifest.rb +7 -11
- data/lib/reap/class/package.rb +120 -25
- data/lib/reap/class/rdoc.rb +1 -9
- data/lib/reap/class/test.rb +2 -7
- data/lib/reap/tasks.rb +51 -58
- data/note/LATEST +44 -0
- data/note/doap.xml +28 -0
- data/note/history/Rakefile-0.1 +308 -0
- data/web/ProjectInfo.html +80 -0
- data/web/images/grape.jpg +0 -0
- data/web/index.html +312 -0
- metadata +66 -27
- data/lib/reap/class/installer.rb +0 -178
data/web/index.html
ADDED
@@ -0,0 +1,312 @@
|
|
1
|
+
<html>
|
2
|
+
|
3
|
+
<head>
|
4
|
+
<title>Reap</title>
|
5
|
+
<style>
|
6
|
+
|
7
|
+
body { margin: 0; padding: 0; font-size: 10pt; font-size: 1em; }
|
8
|
+
|
9
|
+
p { font-family: sans-serif; text-align: justify;
|
10
|
+
font-size: 1em; line-height: 1.3em;
|
11
|
+
}
|
12
|
+
|
13
|
+
img { }
|
14
|
+
|
15
|
+
h2 { color: red; margin-top: 30px; }
|
16
|
+
|
17
|
+
td { margin: 0; padding: 0; vertical-align: top; }
|
18
|
+
|
19
|
+
b.p { color: white; }
|
20
|
+
b.b { color: black; }
|
21
|
+
b.r { color: red; }
|
22
|
+
|
23
|
+
pre { font-size: .9em; line-height: 1.2em;
|
24
|
+
margin: 0;
|
25
|
+
padding: 0; padding-bottom: 5px; padding-top: 15px;
|
26
|
+
background: #FFFBBF;
|
27
|
+
}
|
28
|
+
|
29
|
+
pre.white { background: white; }
|
30
|
+
|
31
|
+
span.m { font-family: monospace; }
|
32
|
+
|
33
|
+
div#title {
|
34
|
+
float: top;
|
35
|
+
background: black repeat-x;
|
36
|
+
border-bottom: 1px solid gray;
|
37
|
+
}
|
38
|
+
|
39
|
+
div#title table {}
|
40
|
+
|
41
|
+
td#meta { color: white; vertical-align: bottom;
|
42
|
+
font-size: 64pt; font-family: sans-serif; font-weight: bold; }
|
43
|
+
|
44
|
+
td#slogon {
|
45
|
+
width: 120px;
|
46
|
+
vertical-align: middle; text-align: left; font-family: monospace;
|
47
|
+
color: gray; font-size: 1.3em; padding-left: 10px; text-align: center;
|
48
|
+
white-space: nowrap;
|
49
|
+
}
|
50
|
+
|
51
|
+
div#menu { width: 100%; vertical-align: middle; padding-left: 30px;
|
52
|
+
font-family: sans-serif; font-size: .8em; line-height: 3em;
|
53
|
+
border-bottom: 1px solid black;
|
54
|
+
color: red; background: white; }
|
55
|
+
|
56
|
+
div#menu a { color: red; text-decoration: none; font-weight: bold; }
|
57
|
+
|
58
|
+
div#menu a:hover { color: pink; }
|
59
|
+
|
60
|
+
div#container { margin: 10px; padding: 10px; padding-top: 5px;
|
61
|
+
border: 0;
|
62
|
+
}
|
63
|
+
|
64
|
+
div#copy { font-size: 7pt; font-family: sans-serif; margin: 5px;
|
65
|
+
border-top: 1px solid #cccccc; color: gray;
|
66
|
+
}
|
67
|
+
|
68
|
+
div#eg { float: right; margin: 20px; margin-top: -110px;
|
69
|
+
padding: 0px; padding-top: 7px;
|
70
|
+
border: solid 1px lightgray;
|
71
|
+
text-align: center;
|
72
|
+
font-family: monospace; font-size: .8em;
|
73
|
+
color: green; background: #cccccc; }
|
74
|
+
|
75
|
+
iframe { width: 430px; height: 1000px; border: 0; border-left: solid 1px #DDDDDD;
|
76
|
+
margin: 0px; margin-top: 5px; padding-left: 5px;
|
77
|
+
background: #EEFFEE; }
|
78
|
+
|
79
|
+
</style>
|
80
|
+
</head>
|
81
|
+
|
82
|
+
<body>
|
83
|
+
|
84
|
+
<div id="title">
|
85
|
+
<table width="100%" border="0" style="padding: 0;">
|
86
|
+
<tr>
|
87
|
+
<td id="slogon">
|
88
|
+
<b class="p">w h e n</b> <br/>
|
89
|
+
<b class="p">y o u r</b> <br/>
|
90
|
+
<b class="r">r u b y</b> <br/>
|
91
|
+
<b class="p">r u n s</b> <br/>
|
92
|
+
<b class="p">o v e r</b>
|
93
|
+
</td>
|
94
|
+
<td id="meta">
|
95
|
+
RE<b class="r">A</b>P
|
96
|
+
</td>
|
97
|
+
</tr>
|
98
|
+
<tr>
|
99
|
+
</tr>
|
100
|
+
</table>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<div id="menu" colspan="2">
|
104
|
+
<a href="http://rubyforge.org/frs/?group_id=811">Download</a> ·
|
105
|
+
<a href="doc/api/index.html">Documentation</a> ·
|
106
|
+
<a href="http://rubyforge.org/projects/reap/">Development</a>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div id="eg">
|
110
|
+
<b>Example ProjectInfo File</b><br/>
|
111
|
+
<iframe src="ProjectInfo.html">Sorry, there are no iframes in your web world.</iframe>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div id="container">
|
115
|
+
|
116
|
+
<p>Reap is a set of integrated tasks designed to simplify the life of
|
117
|
+
Ruby application developers and project managers. The tasks
|
118
|
+
cover the range of common nneds, from setting up a standard
|
119
|
+
project structure to distributing and announcments.
|
120
|
+
Because of the commonality between the tasks, Reap utilizes a
|
121
|
+
central YAML-format configuration file to harvest project
|
122
|
+
information, significantly simplifying usage.</p>
|
123
|
+
|
124
|
+
<p>Custom task can also be easily created to suit specific
|
125
|
+
project requirements. In this respect Reap is much like
|
126
|
+
Rake. In fact Reap can be used as a replacement for Rake.
|
127
|
+
On the other hand Reap tasks can also be used via Rake
|
128
|
+
just as if they were another set of avaiable Rake tasks.</p>
|
129
|
+
|
130
|
+
|
131
|
+
<h2> Usage </h2>
|
132
|
+
|
133
|
+
<p>To use Reap, you simply need to install it and add a ProjectInfo
|
134
|
+
to your projects main directory. By default, Reap supports the standard
|
135
|
+
project layout as promoted by setup.rb.</p>
|
136
|
+
|
137
|
+
<p>Once you ProjectInfo file is filled out you can see what tasks are ready to run
|
138
|
+
simply by typing 'reap' into the command line. For example you might see
|
139
|
+
something like:</p>
|
140
|
+
|
141
|
+
<pre>
|
142
|
+
~/myproj$ reap
|
143
|
+
|
144
|
+
info Display ProjectInfo file.
|
145
|
+
testext Extract unit-tests from lib scripts.
|
146
|
+
test Run unit-tests (each in a separate process).
|
147
|
+
rdoc Generate API Documentation.
|
148
|
+
doap Generate DOAP project file.
|
149
|
+
publish Publish documents to the web.
|
150
|
+
perm Normalize ownership and permissions of files.
|
151
|
+
package Build distribution packages.
|
152
|
+
install Locally install package using built-in setup.rb.
|
153
|
+
release Release distribution files.
|
154
|
+
announce Email project announcement.
|
155
|
+
</pre>
|
156
|
+
|
157
|
+
<p>To get started, it easiest to use a pre-existing ProjectInfo file and modifying
|
158
|
+
it to fit your project. Besides copying another project's ProjectInfo file
|
159
|
+
you can ask Reap for an empty one.</p>
|
160
|
+
|
161
|
+
<pre>
|
162
|
+
~/myproj$ reap template
|
163
|
+
</pre>
|
164
|
+
|
165
|
+
<p>Each task section of the project information file can be used as a task name and
|
166
|
+
a YAML private type identifies the type of task it represents.
|
167
|
+
To find out what parameters each task accepts see Reap's RDoc API.</p>
|
168
|
+
|
169
|
+
<p>If you prefer using Rake for all your project tasks. Reap provides an
|
170
|
+
simple interface for doing so. Here's an example of a Rakefile.</p>
|
171
|
+
|
172
|
+
<pre>
|
173
|
+
require 'rake'
|
174
|
+
require 'reap/reap'
|
175
|
+
|
176
|
+
task_package 'pack' do |pkg|
|
177
|
+
pkg.distribute = [ 'gem' ]
|
178
|
+
pkg.dependencies = [ facets ]
|
179
|
+
end
|
180
|
+
</pre>
|
181
|
+
|
182
|
+
<p>In the above, all information is provided directly via the Ruby task code.
|
183
|
+
You can also use Rake while utilizing the ProjectInfo file, if you prefer.
|
184
|
+
In that case it is very simple. In your Rake file simple put:</p>
|
185
|
+
|
186
|
+
<pre>
|
187
|
+
require 'rake'
|
188
|
+
require 'reap/rake'
|
189
|
+
</pre>
|
190
|
+
|
191
|
+
<p>Then all the tasks defined in the ProjectInfo file will be available via Rake.
|
192
|
+
You can add additional Rake tasks, of course.</p>
|
193
|
+
|
194
|
+
<h2> Creating Tasks </h2>
|
195
|
+
|
196
|
+
<p>Building a Reap task is pretty easy too. In fact if you ever used Rake
|
197
|
+
you already have a good idea about how to do it.</p>
|
198
|
+
|
199
|
+
<p>The first thing you need to know is where to put the tasks code.
|
200
|
+
With Reap each task typically has it's own file.
|
201
|
+
To create a custom task particular to a project add a task/ directory
|
202
|
+
to your project and place your custom task file in it.</p>
|
203
|
+
|
204
|
+
<!--
|
205
|
+
<p>If you have custom tasks you'd like to use for all your projects
|
206
|
+
you can place them either in you home directory under ~/.config/reap/task/,
|
207
|
+
or you could make them universally available to all users in the
|
208
|
+
shared data directory, on Debian, /usr/share/reap/task/.</p>
|
209
|
+
-->
|
210
|
+
|
211
|
+
<p>Here's an "oh-so-simple" example:</p>
|
212
|
+
|
213
|
+
<pre>
|
214
|
+
module Tasks
|
215
|
+
|
216
|
+
def simple( name, data )
|
217
|
+
|
218
|
+
desc 'This is a custom reap task class.'
|
219
|
+
|
220
|
+
task name do
|
221
|
+
data.message ||= master.message
|
222
|
+
puts data.message + "\n\n" + data.signed
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
228
|
+
</pre>
|
229
|
+
|
230
|
+
<p>The corresponding settings in the ProjectInfo file will then be:</p>
|
231
|
+
|
232
|
+
<pre>
|
233
|
+
message: Hi, how are you?
|
234
|
+
|
235
|
+
simple: !!simple
|
236
|
+
signed: Your friend, Tom.
|
237
|
+
</pre>
|
238
|
+
|
239
|
+
<p>And to use it type:</p>
|
240
|
+
|
241
|
+
<pre>
|
242
|
+
% reap simple
|
243
|
+
</pre>
|
244
|
+
|
245
|
+
<p>Notice the reference to 'master'. This is an OpenCascade interface
|
246
|
+
(similar to OpenObject and OpenStruct) to the whole ProjectInfo dataset.</p>
|
247
|
+
|
248
|
+
<p>You might recognize the core methods of creating a task, 'desc' and 'task'.
|
249
|
+
These are used exactly as they are in Rake. We encapsulate them in a
|
250
|
+
task-definition method (eg. simple) so the task can be generated dyanmically
|
251
|
+
if such a section (!!simple) appears in the ProjectInfo file. Such
|
252
|
+
task-definition methods are recognized by reap b/c they are stored in the
|
253
|
+
special purpose Tasks module.</p>
|
254
|
+
|
255
|
+
<p>It's a good idea to take some time and learn all the standard
|
256
|
+
properties of a project's information file which you can draw on for
|
257
|
+
your own tasks. Looking at the RDoc API documentation will elucidate most these.
|
258
|
+
</p>
|
259
|
+
|
260
|
+
<p>The rest of building a task is a matter or writing the code to have it do
|
261
|
+
what you want it to, of course. If you develop any nice tasks, be sure to pass
|
262
|
+
them along!
|
263
|
+
</p>
|
264
|
+
|
265
|
+
|
266
|
+
<h2> Status </h2>
|
267
|
+
|
268
|
+
<p>Reap works fairly well at this point, although not all intended functionality is complete.
|
269
|
+
The primary tasks, like packaging, testing and rdocing are the most well developed.
|
270
|
+
Other tasks have some limitations. For instance, the publish task
|
271
|
+
is limited to uploading to RubyForge at the moment. And the announcment task can't
|
272
|
+
route email via TLS servers. But Reap is very usable and is used in a number of
|
273
|
+
projects including Facets and Nitro. Moreover, if you use it, contributions
|
274
|
+
to it's improvement are very welcome and will be sung many wonderous praises <span class="m">;)</span>
|
275
|
+
</p>
|
276
|
+
|
277
|
+
<p>IMPORTANT!!! Microsoft Windows support is weak at the moment. No doubt a few of
|
278
|
+
the built-in tasks will fail under Windoes. But fixing this issues is a high priority
|
279
|
+
for upcoming releases. So staty tuned --or heck, help out!</p>
|
280
|
+
|
281
|
+
|
282
|
+
<h2> Future </h2>
|
283
|
+
|
284
|
+
<p>The future of Reap looks very bright. Some of the plans for the future
|
285
|
+
include:</p>
|
286
|
+
|
287
|
+
<p>
|
288
|
+
1. Code audit to catch any overlooked bugs and potential gotchas.<br/>
|
289
|
+
2. Full Windows compatability, replacing most of the shell calls.<br/>
|
290
|
+
3. Switching from setup.rb to an improved package.rb install system.<br/>
|
291
|
+
4. SCM related tasks, starting with Darcs and later Subversion.<br/>
|
292
|
+
</p>
|
293
|
+
|
294
|
+
|
295
|
+
<h2> License </h2>
|
296
|
+
|
297
|
+
<p>Reap Copyright (c) 2004-2006 Thomas Sawyer, Ruby License</p>
|
298
|
+
|
299
|
+
<p>THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
300
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
301
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
302
|
+
PURPOSE.
|
303
|
+
</p>
|
304
|
+
|
305
|
+
<br/><br/>
|
306
|
+
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div id="copy">Copyright (c) 2006 Thomas Sawyer, All Rights Reserved.</div>
|
310
|
+
|
311
|
+
</body>
|
312
|
+
</html>
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: reap
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 6.0.
|
7
|
-
date: 2006-06-
|
6
|
+
version: 6.0.1
|
7
|
+
date: 2006-06-06 00:00:00 -04:00
|
8
8
|
summary: The Flexible Ruby Project Management Assistant
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -28,36 +28,27 @@ cert_chain:
|
|
28
28
|
authors:
|
29
29
|
- Thomas Sawyer
|
30
30
|
files:
|
31
|
-
- lib
|
32
|
-
- data
|
33
31
|
- bin
|
32
|
+
- note
|
33
|
+
- data
|
34
|
+
- forge
|
35
|
+
- lib
|
36
|
+
- web
|
37
|
+
- sample
|
34
38
|
- COPYING
|
39
|
+
- ProjectInfo
|
35
40
|
- README
|
36
41
|
- setup.rb
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
- lib/reap/class
|
44
|
-
- lib/reap/taskutils.rb
|
45
|
-
- lib/reap/tasks.rb
|
46
|
-
- lib/reap/bin/reap.rb
|
47
|
-
- lib/reap/bin/rubytest.rb
|
48
|
-
- lib/reap/class/rdoc.rb
|
49
|
-
- lib/reap/class/doap.rb
|
50
|
-
- lib/reap/class/installer.rb
|
51
|
-
- lib/reap/class/test.rb
|
52
|
-
- lib/reap/class/announce.rb
|
53
|
-
- lib/reap/class/extest.rb
|
54
|
-
- lib/reap/class/manifest.rb
|
55
|
-
- lib/reap/class/publish.rb
|
56
|
-
- lib/reap/class/package.rb
|
57
|
-
- lib/reap/class/filer.rb
|
42
|
+
- bin/rubytest
|
43
|
+
- bin/reap
|
44
|
+
- note/history
|
45
|
+
- note/doap.xml
|
46
|
+
- note/LATEST
|
47
|
+
- note/history/Rakefile-0.1
|
58
48
|
- data/reap
|
59
49
|
- data/reap/scaffold
|
60
50
|
- data/reap/setup.rb
|
51
|
+
- data/reap/install.rb
|
61
52
|
- data/reap/scaffold/subversion
|
62
53
|
- data/reap/scaffold/standard
|
63
54
|
- data/reap/scaffold/subversion/branches
|
@@ -94,8 +85,56 @@ files:
|
|
94
85
|
- data/reap/scaffold/standard/test
|
95
86
|
- data/reap/scaffold/standard/doc/note
|
96
87
|
- data/reap/scaffold/standard/doc/api
|
97
|
-
-
|
98
|
-
-
|
88
|
+
- forge/installer.rb
|
89
|
+
- forge/TODO
|
90
|
+
- forge/ProjectInfo.rb
|
91
|
+
- forge/scaffold.rb
|
92
|
+
- forge/unit_runner
|
93
|
+
- forge/ProjectInfo
|
94
|
+
- forge/reference
|
95
|
+
- forge/unit_runner/sample.rb
|
96
|
+
- forge/unit_runner/README
|
97
|
+
- forge/unit_runner/cunit.rb
|
98
|
+
- forge/unit_runner/commentrunner.rb
|
99
|
+
- forge/unit_runner/forkedrunner.rb
|
100
|
+
- forge/reference/rubyforgepublisher.rb
|
101
|
+
- forge/reference/sshpublisher.rb
|
102
|
+
- forge/reference/compositepublisher.rb
|
103
|
+
- forge/reference/rubyforge.rb
|
104
|
+
- forge/reference/ftptools.rb
|
105
|
+
- forge/reference/license-each.rb
|
106
|
+
- forge/reference/suby-cvs.rb
|
107
|
+
- forge/reference/publisher.rb
|
108
|
+
- forge/reference/Rakefile.htm
|
109
|
+
- forge/reference/aRakefile
|
110
|
+
- forge/reference/Rakefile
|
111
|
+
- forge/reference/installers
|
112
|
+
- forge/reference/installers/package.rb
|
113
|
+
- forge/reference/installers/setup.rb
|
114
|
+
- lib/reap
|
115
|
+
- lib/reap/projectinfo.rb
|
116
|
+
- lib/reap/rake.rb
|
117
|
+
- lib/reap/bin
|
118
|
+
- lib/reap/reap.rb
|
119
|
+
- lib/reap/class
|
120
|
+
- lib/reap/taskutils.rb
|
121
|
+
- lib/reap/tasks.rb
|
122
|
+
- lib/reap/bin/reap.rb
|
123
|
+
- lib/reap/bin/rubytest.rb
|
124
|
+
- lib/reap/class/rdoc.rb
|
125
|
+
- lib/reap/class/doap.rb
|
126
|
+
- lib/reap/class/test.rb
|
127
|
+
- lib/reap/class/announce.rb
|
128
|
+
- lib/reap/class/extest.rb
|
129
|
+
- lib/reap/class/manifest.rb
|
130
|
+
- lib/reap/class/publish.rb
|
131
|
+
- lib/reap/class/package.rb
|
132
|
+
- lib/reap/class/filer.rb
|
133
|
+
- web/doc
|
134
|
+
- web/index.html
|
135
|
+
- web/ProjectInfo.html
|
136
|
+
- web/images
|
137
|
+
- web/images/grape.jpg
|
99
138
|
- sample/task
|
100
139
|
- sample/Rakefile
|
101
140
|
- sample/Reapfile
|
data/lib/reap/class/installer.rb
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
module Reap
|
5
|
-
|
6
|
-
# = Installer
|
7
|
-
#
|
8
|
-
# The Installer class generates a specialized install.rb
|
9
|
-
# script specifically for your project. It currently
|
10
|
-
# does not support c/c++ ext/ compilation.
|
11
|
-
|
12
|
-
class Installer
|
13
|
-
|
14
|
-
include TaskUtils
|
15
|
-
|
16
|
-
def self.config(name)
|
17
|
-
# XXX use pathname
|
18
|
-
prefix = Regexp.quote(Config::CONFIG["prefix"])
|
19
|
-
exec_prefix = Regexp.quote(Config::CONFIG["exec_prefix"])
|
20
|
-
Config::CONFIG[name].gsub(/\A\/?(#{prefix}|#{exec_prefix})\/?/, '')
|
21
|
-
end
|
22
|
-
|
23
|
-
KINDS = [
|
24
|
-
:bin, :lib, :ext, :data, :conf, :doc
|
25
|
-
]
|
26
|
-
|
27
|
-
SITE_DIRS = {
|
28
|
-
:bin => config("bindir"),
|
29
|
-
:lib => config("sitelibdir"),
|
30
|
-
:ext => config("sitearchdir"),
|
31
|
-
:data => config("datadir"),
|
32
|
-
:conf => config("sysconfdir"),
|
33
|
-
:doc => File.join(config("datadir"), "doc"),
|
34
|
-
}
|
35
|
-
|
36
|
-
VEND_DIRS = {
|
37
|
-
:bin => config("bindir"),
|
38
|
-
:lib => config("rubylibdir"),
|
39
|
-
:ext => config("archdir"),
|
40
|
-
:data => config("datadir"),
|
41
|
-
:conf => config("sysconfdir"),
|
42
|
-
:doc => File.join(config("datadir"), "doc"),
|
43
|
-
}
|
44
|
-
|
45
|
-
MODES = {
|
46
|
-
:bin => 0755,
|
47
|
-
:lib => 0644,
|
48
|
-
:ext => 0755, # was: 0555,
|
49
|
-
:data => 0644,
|
50
|
-
:conf => 0644,
|
51
|
-
:doc => 0644,
|
52
|
-
}
|
53
|
-
|
54
|
-
attr_accessor :trunk, :template, :options
|
55
|
-
|
56
|
-
def initialize( ins )
|
57
|
-
super
|
58
|
-
@trunk = '.' unless @trunk
|
59
|
-
@spec = parse( @template )
|
60
|
-
@transfer = Hash.new { |h,k| h[k] = [] }
|
61
|
-
end
|
62
|
-
|
63
|
-
#--
|
64
|
-
# TODO use shellwords
|
65
|
-
#++
|
66
|
-
def parse( spec )
|
67
|
-
lines = spec.strip.split("\n")
|
68
|
-
lines.each { |line|
|
69
|
-
words = line.strip.split(/\s+/)
|
70
|
-
send( *words )
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
# substitute variables
|
75
|
-
def vsub( str )
|
76
|
-
return nil if str.nil?
|
77
|
-
str = str.gsub( '$version', @options[:version].to_s )
|
78
|
-
str = str.gsub( '$name', @options[:name].to_s )
|
79
|
-
str
|
80
|
-
end
|
81
|
-
|
82
|
-
# Return the installation directory.
|
83
|
-
def dir( kind, mode=:site )
|
84
|
-
case mode
|
85
|
-
when :site
|
86
|
-
SITE_DIRS[ kind ]
|
87
|
-
when :vendor
|
88
|
-
VEND_DIRS[ kind ]
|
89
|
-
else
|
90
|
-
raise ArgumentError, "unknown mode -- #{mode}"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Return installation prefix.
|
95
|
-
def prefix( kind )
|
96
|
-
Config::CONFIG["prefix"]
|
97
|
-
end
|
98
|
-
|
99
|
-
#--
|
100
|
-
# DSL methods for setting installation spec.
|
101
|
-
#++
|
102
|
-
|
103
|
-
# Setup a lib installation transfer.
|
104
|
-
def lib( from, glob, to )
|
105
|
-
to = '' if to == '.'
|
106
|
-
@transfer[:lib] << { :from=>vsub(from), :glob=>vsub(glob), :to=>vsub(to) }
|
107
|
-
end
|
108
|
-
|
109
|
-
# Setup a bin installation transfer.
|
110
|
-
def bin( from, glob, to )
|
111
|
-
to = '' if to == '.'
|
112
|
-
@transfer[:bin] << { :from=>vsub(from), :glob=>vsub(glob), :to=>vsub(to) }
|
113
|
-
end
|
114
|
-
|
115
|
-
# Compile script and write to install file (install.rb).
|
116
|
-
|
117
|
-
def compile_and_write
|
118
|
-
script = ""
|
119
|
-
script << "# INSTALL SCRIPT\n"
|
120
|
-
script << "# Generated by Reap\n"
|
121
|
-
script << "# #{Time.now}\n"
|
122
|
-
script << "\n"
|
123
|
-
script << compile
|
124
|
-
script << "\n"
|
125
|
-
script << "# END"
|
126
|
-
|
127
|
-
write( script )
|
128
|
-
end
|
129
|
-
|
130
|
-
alias_method :call, :compile_and_write
|
131
|
-
|
132
|
-
private
|
133
|
-
|
134
|
-
# Compile installation instructions.
|
135
|
-
|
136
|
-
def compile
|
137
|
-
mkdirp = []
|
138
|
-
script = ''
|
139
|
-
Dir.chdir( @trunk ) do
|
140
|
-
KINDS.each { |kind|
|
141
|
-
@transfer[kind].each { |trans|
|
142
|
-
next unless File.directory?( trans[:from] )
|
143
|
-
files = []
|
144
|
-
Dir.chdir( trans[:from] ) {
|
145
|
-
files = Dir.glob( trans[:glob] ).reject { |f| File.directory?( f ) }
|
146
|
-
}
|
147
|
-
files.each { |file|
|
148
|
-
f = File.join( trans[:from], file )
|
149
|
-
t = File.join( prefix(kind), dir(kind), trans[:to], file )
|
150
|
-
m = MODES[kind]
|
151
|
-
d = File.dirname(t)
|
152
|
-
unless mkdirp.include?(d)
|
153
|
-
script << "mkdir_p '%s'\n" % d
|
154
|
-
mkdirp << d
|
155
|
-
end
|
156
|
-
script << "install '%s', '%s', :mode=>%o\n" % [ f, t, m ]
|
157
|
-
}
|
158
|
-
}
|
159
|
-
}
|
160
|
-
end
|
161
|
-
script
|
162
|
-
end
|
163
|
-
|
164
|
-
def write( script )
|
165
|
-
install_file = File.join( @trunk, 'install.rb' )
|
166
|
-
if File.file?( install_file )
|
167
|
-
script_template = File.read( install_file )
|
168
|
-
script = script_template.gsub(/\# INSTALL SCRIPT.*\# END/, script)
|
169
|
-
end
|
170
|
-
File.open( install_file, 'w+' ) do |f|
|
171
|
-
f << script
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
end #module Reap
|