ratch 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ratch +60 -47
- data/bin/ratch-find +21 -0
- data/demo/{README → XR} +0 -0
- data/demo/task/stats +0 -2
- data/doc/images/clipboard.jpg +0 -0
- data/doc/images/clipboard2.png +0 -0
- data/doc/images/milles-tn.jpg +0 -0
- data/doc/images/mints.png +0 -0
- data/doc/images/ratch2.png +0 -0
- data/doc/images/ruby-sm.png +0 -0
- data/doc/images/silver.gif +0 -0
- data/doc/images/toolbox.jpg +0 -0
- data/doc/index.html +181 -0
- data/doc/notes/original.rb +308 -0
- data/doc/rdoc/classes/Array.html +194 -0
- data/doc/rdoc/classes/Dir.html +317 -0
- data/doc/rdoc/classes/Hash.html +217 -0
- data/doc/rdoc/classes/Ratch.html +201 -0
- data/doc/rdoc/classes/Ratch/ArgvUtils.html +173 -0
- data/doc/rdoc/classes/Ratch/ArgvUtils/Ext.html +285 -0
- data/doc/rdoc/classes/Ratch/BatchFile.html +207 -0
- data/doc/rdoc/classes/Ratch/BatchManager.html +250 -0
- data/doc/rdoc/classes/Ratch/BatchScript.html +127 -0
- data/doc/rdoc/classes/Ratch/Batchable.html +373 -0
- data/doc/rdoc/classes/Ratch/Build.html +321 -0
- data/doc/rdoc/classes/Ratch/BuildManager.html +319 -0
- data/doc/rdoc/classes/Ratch/Buildable.html +202 -0
- data/doc/rdoc/classes/Ratch/ConfigUtils.html +281 -0
- data/doc/rdoc/classes/Ratch/ConsoleUtils.html +189 -0
- data/doc/rdoc/classes/Ratch/EmailUtils.html +209 -0
- data/doc/rdoc/classes/Ratch/FileUtils.html +674 -0
- data/doc/rdoc/classes/Ratch/GeneralOptions.html +430 -0
- data/doc/rdoc/classes/Ratch/Task.html +201 -0
- data/doc/rdoc/classes/Ratch/TaskManager.html +330 -0
- data/doc/rdoc/classes/Ratch/Taskable.html +231 -0
- data/doc/rdoc/classes/Ratch/UploadUtils.html +566 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +1003 -0
- data/{demo/doc → doc}/rdoc/files/README.html +36 -5
- data/doc/rdoc/files/lib/ratch/argvutils_rb.html +131 -0
- data/doc/rdoc/files/lib/ratch/batch_rb.html +155 -0
- data/doc/rdoc/files/lib/ratch/batchable_rb.html +131 -0
- data/doc/rdoc/files/lib/ratch/batchfile_rb.html +148 -0
- data/doc/rdoc/files/lib/ratch/buildable_rb.html +131 -0
- data/doc/rdoc/files/lib/ratch/consoleutils_rb.html +131 -0
- data/{demo/doc/rdoc/files/lib/foo/foo_rb.html → doc/rdoc/files/lib/ratch/emailutils_rb.html} +35 -41
- data/doc/rdoc/files/lib/ratch/facets/multiglob_rb.html +137 -0
- data/doc/rdoc/files/lib/ratch/fileutils_rb.html +139 -0
- data/doc/rdoc/files/lib/ratch/options_rb.html +131 -0
- data/doc/rdoc/files/lib/ratch/taskable_rb.html +131 -0
- data/doc/rdoc/files/lib/ratch/uploadutils_rb.html +150 -0
- data/doc/rdoc/fr_class_index.html +48 -0
- data/doc/rdoc/fr_file_index.html +41 -0
- data/doc/rdoc/fr_method_index.html +133 -0
- data/{demo/doc → doc}/rdoc/index.html +1 -1
- data/{demo/doc → doc}/rdoc/rdoc-style.css +0 -0
- data/doc/scrap/flexihead-flip.jpg +0 -0
- data/doc/scrap/flexihead.jpg +0 -0
- data/doc/scrap/head1.jpg +0 -0
- data/doc/scrap/ratch.jpg +0 -0
- data/doc/scrap/ratch1.png +0 -0
- data/doc/scrap/ratch2.jpg +0 -0
- data/doc/scrap/ratch3.png +0 -0
- data/doc/scrap/red-ratch.jpg +0 -0
- data/doc/scrap/redratchet.jpg +0 -0
- data/doc/scrap/ruby-kit/ruby.png +0 -0
- data/doc/scrap/scrap.red +256 -0
- data/doc/sitemap.yaml +10 -0
- data/doc/siteparts/index.red +100 -0
- data/doc/siteparts/layout.rhtml +56 -0
- data/doc/siteparts/tutorial.red +578 -0
- data/doc/style.css +112 -0
- data/doc/tutorial.html +722 -0
- data/lib/ratch/batch.rb +417 -30
- data/lib/ratch/{argvutils.rb → batch/argvutils.rb} +27 -19
- data/lib/ratch/batch/build.rb +95 -0
- data/lib/ratch/{consoleutils.rb → batch/consoleutils.rb} +0 -0
- data/lib/ratch/{emailutils.rb → batch/emailutils.rb} +0 -0
- data/lib/ratch/{fileutils.rb → batch/fileutils.rb} +32 -32
- data/lib/ratch/{options.rb → batch/options.rb} +0 -0
- data/lib/ratch/batch/task.rb +43 -0
- data/lib/ratch/manager.rb +34 -0
- data/lib/ratch/project/information.rb +257 -0
- data/lib/ratch/project/package.rb +82 -0
- data/lib/ratch/project/project.rb +531 -0
- data/lib/ratch/project/release.rb +112 -0
- data/lib/ratch/support/filetest.rb +29 -0
- data/lib/ratch/support/setuputils.rb +124 -0
- data/lib/ratch/support/signiture.rb +252 -0
- data/lib/ratch/support/stage.rb +292 -0
- data/lib/ratch/toolset/ruby/pack/gem +85 -0
- data/lib/ratch/toolset/ruby/pack/tgz +85 -0
- data/lib/ratch/toolset/ruby/{crosstest → test/crosstest} +0 -0
- data/lib/ratch/toolset/ruby/{extest → test/extest} +0 -0
- data/lib/ratch/toolset/ruby/{isotest → test/isotest} +0 -0
- data/lib/ratch/toolset/ruby/{load → test/load} +0 -0
- data/lib/ratch/toolset/ruby/{loadtest → test/loadtest} +0 -0
- data/lib/ratch/toolset/ruby/{syntax → test/syntax} +0 -0
- data/lib/ratch/toolset/ruby/{test → test/test} +0 -0
- data/log/{history.rd → history} +6 -0
- data/log/{todo.rd → todo} +0 -0
- data/meta/MANIFEST +52 -36
- data/meta/ROLLRC +2 -0
- data/meta/icli.yaml +16 -0
- data/meta/{ratch-0.2.3.roll → project.yaml} +1 -7
- data/task/release +12 -0
- data/{lib/ratch → work/old}/batchfile.rb +0 -0
- data/work/project-old.rb +67 -0
- data/work/scrap/install +89 -0
- data/work/scrap/install.0 +49 -0
- data/work/scrap/install.1 +63 -0
- data/work/scrap/ludo +25 -0
- data/work/scrap/oldtaskable.rb +573 -0
- data/work/scrap/ratch.man +39 -0
- data/work/scrap/taskable-simple.rb +42 -0
- data/work/scrap/taskable.rb +120 -0
- metadata +170 -72
- data/demo/doc/rdoc/created.rid +0 -1
- data/demo/doc/rdoc/fr_class_index.html +0 -26
- data/demo/doc/rdoc/fr_file_index.html +0 -28
- data/demo/doc/rdoc/fr_method_index.html +0 -27
- data/demo/task/config.yaml +0 -2
- data/lib/ratch/batchable.rb +0 -169
- data/lib/ratch/buildable.rb +0 -182
- data/lib/ratch/configutils.rb +0 -132
- data/lib/ratch/facets/multiglob.rb +0 -160
- data/lib/ratch/taskable.rb +0 -152
- data/log/recent.rd +0 -8
- data/task/config.yaml +0 -10
data/bin/ratch
CHANGED
@@ -1,55 +1,68 @@
|
|
1
1
|
#! /usr/bin/ruby1.8
|
2
2
|
|
3
|
-
|
4
|
-
require '
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.start(file)
|
15
|
-
new.run(file)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Run task.
|
19
|
-
|
20
|
-
def run(file)
|
21
|
-
if file
|
22
|
-
BatchFile.new(file).call
|
23
|
-
else
|
24
|
-
help
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Dispaly help.
|
29
|
-
|
30
|
-
def help
|
31
|
-
help = <<-END
|
32
|
-
USAGE:
|
33
|
-
|
34
|
-
ratch [options] <taskfile>
|
35
|
-
|
36
|
-
OPTIONS:
|
37
|
-
|
38
|
-
--dryrun --nohram
|
39
|
-
|
40
|
-
--trace
|
41
|
-
|
42
|
-
--debug
|
43
|
-
END
|
44
|
-
puts help.gsub(/^\s+/, '')
|
3
|
+
if ARGV[0] == '-s'
|
4
|
+
require 'ratch/manager'
|
5
|
+
manager = Ratch::Manager.new
|
6
|
+
file = ARGV[1]
|
7
|
+
if file
|
8
|
+
# run tool
|
9
|
+
if tool = manager.tool?(file)
|
10
|
+
require 'ratch/batch'
|
11
|
+
load(tool)
|
12
|
+
else
|
13
|
+
puts "no tool -- #{file}"
|
45
14
|
end
|
46
|
-
|
15
|
+
else
|
16
|
+
puts manager.toolset.join("\n")
|
47
17
|
end
|
18
|
+
elsif ARGV.empty?
|
19
|
+
# TODO read stdin for ratch script
|
48
20
|
|
49
|
-
|
21
|
+
else
|
22
|
+
require 'ratch/batch'
|
23
|
+
load($0 = ARGV.shift)
|
50
24
|
end
|
51
25
|
|
52
|
-
load($0 = ARGV.shift)
|
53
|
-
|
54
|
-
#Ratch::RatchCommand.start(ARGV.shift)
|
55
26
|
|
27
|
+
# module Ratch
|
28
|
+
#
|
29
|
+
# class RatchCommand
|
30
|
+
#
|
31
|
+
# # Quick start.
|
32
|
+
#
|
33
|
+
# def self.start(file)
|
34
|
+
# new.run(file)
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# # Run task.
|
38
|
+
#
|
39
|
+
# def run(file)
|
40
|
+
# if file
|
41
|
+
# BatchFile.new(file).call
|
42
|
+
# else
|
43
|
+
# help
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# # Dispaly help.
|
48
|
+
#
|
49
|
+
# def help
|
50
|
+
# help = <<-END
|
51
|
+
# USAGE:
|
52
|
+
#
|
53
|
+
# ratch [options] <taskfile>
|
54
|
+
#
|
55
|
+
# OPTIONS:
|
56
|
+
#
|
57
|
+
# --dryrun --nohram
|
58
|
+
#
|
59
|
+
# --trace
|
60
|
+
#
|
61
|
+
# --debug
|
62
|
+
# END
|
63
|
+
# puts help.gsub(/^\s+/, '')
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# end
|
data/bin/ratch-find
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
name = ARGV[0]
|
4
|
+
|
5
|
+
unless name
|
6
|
+
puts "file path required"
|
7
|
+
exit -1
|
8
|
+
end
|
9
|
+
|
10
|
+
matches = []
|
11
|
+
paths = ENV['ROLL_PATH'].split(/[:;]/)
|
12
|
+
paths.each do |path|
|
13
|
+
matches = Dir.glob(File.join(path,'{*,*/*,*/*/*,*/*/*/*}',name)) # searches up to four layers deep.
|
14
|
+
end
|
15
|
+
matches = matches.select{ |f| File.executable?(f) }
|
16
|
+
matches = matches.sort{ |a,b| File.mtime(b) <=> File.mtime(a) }
|
17
|
+
|
18
|
+
matches.each do |f|
|
19
|
+
puts "#{File.mtime(f)} #{f}"
|
20
|
+
end
|
21
|
+
|
data/demo/{README → XR}
RENAMED
File without changes
|
data/demo/task/stats
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/index.html
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Ratch</title>
|
4
|
+
<link href="style.css" rel="stylesheet" type="text/css"/>
|
5
|
+
<LINK REL="SHORTCUT ICON" HREF="images/ratch1.png"/>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
|
9
|
+
<div class="promenu">
|
10
|
+
ProUtils :: <a href="http://proutils.rubyforge.org/">Home</a> ·
|
11
|
+
<a href="http://rubyforge.org/news/?group_id=4438">News</a> ·
|
12
|
+
<a href="http://rubyforge.org/frs/?group_id=4438">Download</a> ·
|
13
|
+
<a href="http://rubyforge.org/mail/?group_id=4438">Mail</a> ·
|
14
|
+
<a href="http://rubyforge.org/forum/?group_id=4438">Forum</a> ·
|
15
|
+
<a href="http://rubyforge.org/scm/?group_id=4438">Source</a> ·
|
16
|
+
<a href="http://rubyforge.org/tracker/?group_id=4438">Ticket</a>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="container">
|
20
|
+
|
21
|
+
<div class="banner">
|
22
|
+
RATCH <img src="images/ruby-sm.png"/>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="menu">
|
26
|
+
<a href="index.html">Welcome</a>
|
27
|
+
<a href="tutorial.html">Tutorial</a>
|
28
|
+
<a href="rdoc/index.html">Library</a>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="ad">
|
32
|
+
<script type="text/javascript"><!--
|
33
|
+
google_ad_client = "pub-1126154564663472";
|
34
|
+
//RATCH 728x90, 11/8/07
|
35
|
+
google_ad_slot = "6500283279";
|
36
|
+
google_ad_width = 728;
|
37
|
+
google_ad_height = 90;
|
38
|
+
//--></script>
|
39
|
+
<script type="text/javascript"
|
40
|
+
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
41
|
+
</script>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div class="content">
|
45
|
+
<h1 class="top">Welcome</h1>
|
46
|
+
|
47
|
+
|
48
|
+
<p>Ratch is a Ruby-based build tool in the linage of Rake and Reap, but distinguishes
|
49
|
+
itself in it’s closer adherence to the <span class="caps">UNIX</span>-way in that Ratch “targets” are independent
|
50
|
+
scripts. In fact, the name “ratch” derives from the phrase
|
51
|
+
“<u>R</u>uby b<u>atch</u> file”.</p>
|
52
|
+
|
53
|
+
|
54
|
+
<p>Ratch is part of the ProUtils collection. In particular Ratch scripts might take
|
55
|
+
advantage of the <a href="http://proutils.rubyforge.org/box">Box</a> system and can easily be
|
56
|
+
copied and updated via <a href="http://proutils.rubyforge.org/mint">Mint</a>.</p>
|
57
|
+
|
58
|
+
|
59
|
+
<h1>News</h1>
|
60
|
+
|
61
|
+
|
62
|
+
<h3 class="date">2007-11-11</h3>
|
63
|
+
|
64
|
+
|
65
|
+
<h2>From Special to Main</h2>
|
66
|
+
|
67
|
+
|
68
|
+
<p>Ratch is really starting to come together. And I dare say that’s no small statement.
|
69
|
+
I started development many, many months ago with only a hunch that the basic
|
70
|
+
design would be effective—was it even possible to effectively bridge the gap
|
71
|
+
between the shell and script? We may never have found out. Implementation has been
|
72
|
+
challenge at times and more than once a little voice in the back of my head would
|
73
|
+
say “just use Rake”. But if I am anything, it is determined. I really believe
|
74
|
+
in the underlying design of this project—as hard as it might have been get “right”.</p>
|
75
|
+
|
76
|
+
|
77
|
+
<p>But “right” is where I may finally be. Granted I’m still worried about tricky
|
78
|
+
dependency loops, but that’s a rare bird and I have yet to see it happen in practice.
|
79
|
+
And, sure there’s areas of the code that could just use some general spit-and-shine.
|
80
|
+
But in practice, it’s really starting to look good.</p>
|
81
|
+
|
82
|
+
|
83
|
+
<p>For instance, this evening I transitioned from executing all ratch files in an
|
84
|
+
instance of a special runner class (a subclass of Module), to executing
|
85
|
+
in top-level ‘main’ space. This simplifies the start up code a fair bit and now allows
|
86
|
+
<code>load()</code> to work for ratch files just as it does for ruby files—where as before
|
87
|
+
I had to create a special #import method to load the ratch file into the special object.
|
88
|
+
The benefit of this change is that one no longer <em>has</em> to copy any of the pre-made tools
|
89
|
+
distributed with ratch. Instead one can just depend on them like normal code.
|
90
|
+
For instance, my projects tool/stats file looks like this:</p>
|
91
|
+
|
92
|
+
|
93
|
+
<pre>
|
94
|
+
#!/usr/bin/env ratch
|
95
|
+
# code stats
|
96
|
+
load('ratch/toolset/ruby/stats')
|
97
|
+
</pre>
|
98
|
+
|
99
|
+
<p>Of course if you want to make project specific modifications you can still grab a copy
|
100
|
+
and have at it.</p>
|
101
|
+
|
102
|
+
|
103
|
+
<h1>Installation</h1>
|
104
|
+
|
105
|
+
|
106
|
+
<p>Via RubyGems:</p>
|
107
|
+
|
108
|
+
|
109
|
+
<pre><code>$ gem install ratch</code></pre>
|
110
|
+
|
111
|
+
|
112
|
+
<p>With the source code:</p>
|
113
|
+
|
114
|
+
|
115
|
+
<pre><code>$ tar -xzf ratch-x.y.z.tar.gz
|
116
|
+
$ cd ratch-x.y.z
|
117
|
+
$ sudo task/setup</code></pre>
|
118
|
+
|
119
|
+
|
120
|
+
<p>Microsoft Windows users, you’ll have to use ‘<code>ruby task/setup</code>’ instead.</p>
|
121
|
+
|
122
|
+
|
123
|
+
<h1>Development</h1>
|
124
|
+
|
125
|
+
|
126
|
+
<p>Ratch is part of the <a href="http://protuils.rubyforge.org">ProUtils</a> project.</p>
|
127
|
+
|
128
|
+
|
129
|
+
<h2>Anonymous Subversion Access</h2>
|
130
|
+
|
131
|
+
|
132
|
+
<p>This project’s <span class="caps">SVN</span> repository can be checked out through anonymous access with the following command(s).</p>
|
133
|
+
|
134
|
+
|
135
|
+
<pre><code>svn checkout svn://rubyforge.org/var/svn/proutils/ratch
|
136
|
+
svn checkout http://proutils.rubyforge.org/svn/ratch</code></pre>
|
137
|
+
|
138
|
+
|
139
|
+
<h2>Developer Subversion Access via <span class="caps">SSH</span></h2>
|
140
|
+
|
141
|
+
|
142
|
+
<p>Only project developers can access the <span class="caps">SVN</span> tree via this method. <span class="caps">SSH</span> must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.</p>
|
143
|
+
|
144
|
+
|
145
|
+
<pre><code>svn checkout svn+ssh://developername@rubyforge.org/var/svn/proutils/ratch</code></pre>
|
146
|
+
|
147
|
+
|
148
|
+
<h1>Copying</h1>
|
149
|
+
|
150
|
+
|
151
|
+
<p>Ratch—Ruby-based Batch Files</p>
|
152
|
+
|
153
|
+
|
154
|
+
<p>Copyright © 2007 Ψ Τ Corporation</p>
|
155
|
+
|
156
|
+
|
157
|
+
<p>This program is free software: you can redistribute it and/or modify
|
158
|
+
it under the terms of the <span class="caps">GNU</span> General Public License as published by
|
159
|
+
the Free Software Foundation, either version 3 of the License, or
|
160
|
+
(at your option) any later version.</p>
|
161
|
+
|
162
|
+
|
163
|
+
<p>This program is distributed in the hope that it will be useful,
|
164
|
+
but <span class="caps">WITHOUT ANY WARRANTY</span>; without even the implied warranty of
|
165
|
+
<span class="caps">MERCHANTABILITY</span> or <span class="caps">FITNESS FOR A PARTICULAR PURPOSE</span>. See the
|
166
|
+
<span class="caps">GNU</span> General Public License for more details.</p>
|
167
|
+
|
168
|
+
|
169
|
+
<p>You should have received a copy of the <span class="caps">GNU</span> General Public License
|
170
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.</p>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div class="copyright">
|
174
|
+
Ratch, Copyright © 2007 <a href="http://psytower.info">Ψ Τ Corp.</a> <br/><br/>
|
175
|
+
Website design by <a href="http://psytower.info/transcode/">TransCrankItOut</a> using <a href="">Webrite</a>!
|
176
|
+
</div>
|
177
|
+
|
178
|
+
</div>
|
179
|
+
|
180
|
+
</body>
|
181
|
+
</html>
|
@@ -0,0 +1,308 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
PKG_TITLE = 'WhiteCloth'
|
4
|
+
PKG_NAME = 'whitecloth'
|
5
|
+
PKG_VERSION = '1'
|
6
|
+
PKG_AUTHOR = 'Thomas Sawyer'
|
7
|
+
PKG_EMAIL = 'transami@runbox.com'
|
8
|
+
PKG_SUMMARY = 'WhiteCloth is an implementation of ArtML'
|
9
|
+
PKG_DESCRIPTION = 'WhiteCloth is a Ruby implementation of ArtML'
|
10
|
+
|
11
|
+
# site info
|
12
|
+
# remark out if you don't need
|
13
|
+
PKG_HOMEPAGE = 'http://whitecloth.rubyforge.org'
|
14
|
+
PKG_RUBYFORGE_PROJECT = 'whitecloth'
|
15
|
+
PKG_RUBYFORGE_PASS = nil
|
16
|
+
|
17
|
+
# all package files
|
18
|
+
PKG_FILES = [ 'lib/**/*', 'test/**/*', 'samples/**/*', 'doc/**/*', '[A-Z]*', 'Rakefile' ]
|
19
|
+
|
20
|
+
# rdoc
|
21
|
+
RDOC_TITLE = PKG_TITLE
|
22
|
+
RDOC_DIR = 'doc'
|
23
|
+
RDOC_TEMPLATE = 'kilmer'
|
24
|
+
RDOC_OPTIONS = ''
|
25
|
+
RDOC_INCLUDE = [ 'VERSION', 'README', 'CHANGELOG', 'TODO', 'COPYING', 'lib/**/*.rb', 'bin/**/*.rb' ]
|
26
|
+
RDOC_EXCLUDE = []
|
27
|
+
|
28
|
+
# include in distribution
|
29
|
+
PKG_DIST_DIRS = [ 'bin', 'lib', 'test', 'samples' ]
|
30
|
+
PKG_DIST_FILES = [ 'README', 'TODO', 'CHANGELOG', 'VERSION', 'LICENSE', 'Rakefile' ]
|
31
|
+
|
32
|
+
# tests
|
33
|
+
PKG_TEST_DIR = 'test'
|
34
|
+
PKG_TEST_FILES = [ 'test/*_test.rb', 'test/**/*_test.rb' ]
|
35
|
+
|
36
|
+
=begin
|
37
|
+
# library files for manual install
|
38
|
+
PKG_LIB_DIR = 'lib'
|
39
|
+
PKG_LIB_MKDIRS = '**/*/'
|
40
|
+
PKG_LIB_FILES = [ '**/*.rb', '**/*.yaml' ]
|
41
|
+
PKG_LIB_DEPRECATE = []
|
42
|
+
|
43
|
+
# binary files for manual install
|
44
|
+
PKG_BIN_DIR = 'bin'
|
45
|
+
PKG_BIN_FILES = '**/*'
|
46
|
+
PKG_BIN_DEPRECATE = []
|
47
|
+
=end
|
48
|
+
|
49
|
+
#***************************************************************************
|
50
|
+
# The PackMule Rakefile v0.1
|
51
|
+
# PackMule can run tests, build packages and gems, manually install,
|
52
|
+
# generate rdocs, and publish them. CVS support might be added later.
|
53
|
+
#
|
54
|
+
# In general, layout your project directory as follows:
|
55
|
+
# - lib/
|
56
|
+
# - lib/#{lib_name}/ if you need a lib dir
|
57
|
+
# - bin/
|
58
|
+
# - test/
|
59
|
+
# - demo/ -or- examples/ -or- samples/
|
60
|
+
# - doc/ -and;or- rdoc/
|
61
|
+
# The test dir can have subdirs, but tests should be named
|
62
|
+
# like '#{name}_test.rb' or 'test_#{name}.rb'.
|
63
|
+
#
|
64
|
+
# Then use the Rake.yaml config file designed for this form.
|
65
|
+
# To get a blank config for this form type:
|
66
|
+
# > rake form
|
67
|
+
# This will send the form to stdout. There may be a line like
|
68
|
+
# "(in ...)" at the beginning, just remove it or remark it.
|
69
|
+
#***************************************************************************
|
70
|
+
|
71
|
+
require 'rake'
|
72
|
+
require 'rubygems'
|
73
|
+
require 'rake/testtask'
|
74
|
+
require 'rake/rdoctask'
|
75
|
+
require 'rake/packagetask'
|
76
|
+
require 'rake/gempackagetask'
|
77
|
+
require 'rake/contrib/rubyforgepublisher'
|
78
|
+
|
79
|
+
#################################################
|
80
|
+
# load config from Rake.yaml and make constants #
|
81
|
+
#################################################
|
82
|
+
#YAML::load( File.open('Rake.yaml') ).each{|c,v| self.class.const_set(c,v)}
|
83
|
+
|
84
|
+
|
85
|
+
##
|
86
|
+
# = Default Task
|
87
|
+
##
|
88
|
+
|
89
|
+
desc "Default Task (test)"
|
90
|
+
task :default => [ :test ]
|
91
|
+
|
92
|
+
|
93
|
+
##
|
94
|
+
# = Run Unit Tests
|
95
|
+
##
|
96
|
+
|
97
|
+
Rake::TestTask.new("test") { |t|
|
98
|
+
#t.desc "Run all tests"
|
99
|
+
t.libs << PKG_TEST_DIR
|
100
|
+
PKG_TEST_FILES.each { |pat| t.pattern = pat }
|
101
|
+
t.verbose = true
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
##
|
106
|
+
# = Genereate RDoc Documentation
|
107
|
+
##
|
108
|
+
|
109
|
+
Rake::RDocTask.new { |rdoc|
|
110
|
+
rdoc.rdoc_dir = RDOC_DIR
|
111
|
+
rdoc.template = RDOC_TEMPLATE
|
112
|
+
rdoc.title = RDOC_TITLE
|
113
|
+
rdoc.options << '--line-numbers --inline-source ' + RDOC_OPTIONS
|
114
|
+
rdoc.rdoc_files.include(*RDOC_INCLUDE)
|
115
|
+
rdoc.rdoc_files.exclude(*RDOC_EXCLUDE)
|
116
|
+
rdoc.rdoc_files.delete_if { |f| ! File.exist?(f) }
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
##
|
121
|
+
# = Publish Documentation
|
122
|
+
##
|
123
|
+
|
124
|
+
# Publish documentation
|
125
|
+
#desc "Publish the API documentation"
|
126
|
+
#task :pdoc => [:rdoc] do
|
127
|
+
# Rake::SshDirPublisher.new("david@hunter.5th.dk", "sites/rubyonrails.org/ar", "doc").upload
|
128
|
+
#end
|
129
|
+
|
130
|
+
if PKG_RUBYFORGE_PROJECT
|
131
|
+
desc "Publish to RubyForge"
|
132
|
+
task :rubyforge do
|
133
|
+
Rake::RubyForgePublisher.new(PKG_RUBYFORGE_PROJECT, PKG_RUBYFORGE_PASS).upload
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
##
|
139
|
+
# = Create Compressed Packages
|
140
|
+
##
|
141
|
+
|
142
|
+
dist_dirs = PKG_DIST_DIRS
|
143
|
+
|
144
|
+
spec = Gem::Specification.new do |s|
|
145
|
+
s.name = PKG_NAME
|
146
|
+
s.version = PKG_VERSION
|
147
|
+
s.summary = PKG_SUMMARY
|
148
|
+
s.description = PKG_DESCRIPTION
|
149
|
+
|
150
|
+
s.files = PKG_DIST_FILES
|
151
|
+
dist_dirs.each do |dir|
|
152
|
+
s.files.concat Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "CVS" ) }
|
153
|
+
end
|
154
|
+
#s.files.delete "test/fixtures/fixture_database.sqlite"
|
155
|
+
s.require_path = 'lib'
|
156
|
+
s.autorequire = '#{PKG_NAME}'
|
157
|
+
s.has_rdoc = true
|
158
|
+
s.author = PKG_AUTHOR
|
159
|
+
s.email = PKG_EMAIL
|
160
|
+
s.homepage = PKG_HOMEPAGE if PKG_HOMEPAGE
|
161
|
+
s.rubyforge_project = PKG_RUBYFORGE_PROJECT if PKG_RUBYFORGE_PROJECT
|
162
|
+
end
|
163
|
+
|
164
|
+
Rake::GemPackageTask.new(spec) do |p|
|
165
|
+
p.gem_spec = spec
|
166
|
+
p.need_tar = true
|
167
|
+
p.need_zip = true
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
##
|
172
|
+
# = Line Count
|
173
|
+
##
|
174
|
+
|
175
|
+
desc "Line Count"
|
176
|
+
task :lines do
|
177
|
+
lines = 0
|
178
|
+
codelines = 0
|
179
|
+
Dir.foreach("lib/#{PKG_NAME}") { |file_name|
|
180
|
+
next unless file_name =~ /.*rb/
|
181
|
+
|
182
|
+
f = File.open("lib/#{PKG_NAME}/" + file_name)
|
183
|
+
|
184
|
+
while line = f.gets
|
185
|
+
lines += 1
|
186
|
+
next if line =~ /^\s*$/
|
187
|
+
next if line =~ /^\s*#/
|
188
|
+
codelines += 1
|
189
|
+
end
|
190
|
+
}
|
191
|
+
puts "Lines #{lines}, LOC #{codelines}"
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
=begin
|
196
|
+
##
|
197
|
+
# = Manual Install
|
198
|
+
##
|
199
|
+
|
200
|
+
desc "Manual Installation"
|
201
|
+
task :install do
|
202
|
+
|
203
|
+
# install
|
204
|
+
# this was adapted from active record's install.rb
|
205
|
+
# by way of rdoc's install.rb
|
206
|
+
# by way of Log4r's install.rb
|
207
|
+
# with some modifications from ruby-gems' install.rb ;)
|
208
|
+
|
209
|
+
require 'rbconfig'
|
210
|
+
require 'find'
|
211
|
+
require 'ftools'
|
212
|
+
require 'fileutils'
|
213
|
+
|
214
|
+
include Config
|
215
|
+
|
216
|
+
#$sitedir = CONFIG["sitelibdir"]
|
217
|
+
#unless $sitedir
|
218
|
+
# version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
|
219
|
+
# $libdir = File.join(CONFIG["libdir"], "ruby", version)
|
220
|
+
#
|
221
|
+
# $sitedir = $:.find {|x| x =~ /site_ruby/ }
|
222
|
+
# if !$sitedir
|
223
|
+
# $sitedir = File.join($libdir, "site_ruby")
|
224
|
+
# elsif $sitedir !~ Regexp.quote(version)
|
225
|
+
# $sitedir = File.join($sitedir, version)
|
226
|
+
# end
|
227
|
+
#end
|
228
|
+
|
229
|
+
$srcdir = CONFIG["srcdir"]
|
230
|
+
$version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
|
231
|
+
$libdir = File.join(CONFIG["libdir"], "ruby", $version)
|
232
|
+
$bindir = CONFIG['bindir']
|
233
|
+
$archdir = File.join($libdir, CONFIG["arch"])
|
234
|
+
$sitedir = CONFIG["sitelibdir"]
|
235
|
+
if !$sitedir
|
236
|
+
$sitedir = $:.find {|x| x =~ /site_ruby$/}
|
237
|
+
if !$sitedir
|
238
|
+
$sitedir = File.join($libdir, "site_ruby")
|
239
|
+
elsif $sitedir !~ Regexp.new(Regexp.quote($version))
|
240
|
+
$sitedir = File.join($site_libdir, $version)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# get current dir
|
245
|
+
current_dir = Dir.pwd
|
246
|
+
|
247
|
+
### install lib files
|
248
|
+
|
249
|
+
if FileTest.directory?(PKG_LIB_DIR)
|
250
|
+
|
251
|
+
# change dir to package lib dir
|
252
|
+
Dir.chdir(PKG_LIB_DIR)
|
253
|
+
|
254
|
+
# make lib dirs in ruby sitelibdir
|
255
|
+
makedirs = FileList[*PKG_LIB_MKDIRS].to_a
|
256
|
+
makedirs.each {|f| File::makedirs( File.join( $sitedir, *f.split(/\//) ) ) }
|
257
|
+
|
258
|
+
# deprecated files that should be removed
|
259
|
+
deprecated = FileList[*PKG_LIB_DEPRECATE].to_a
|
260
|
+
|
261
|
+
# files to install in library path
|
262
|
+
files = FileList[*PKG_LIB_FILES].to_a
|
263
|
+
|
264
|
+
# the actual gruntwork
|
265
|
+
File::safe_unlink *deprecated.collect{|f| File.join($sitedir, f.split(/\//))}
|
266
|
+
files.each do |f|
|
267
|
+
File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
|
268
|
+
end
|
269
|
+
|
270
|
+
# change dir back
|
271
|
+
Dir.chdir(current_dir)
|
272
|
+
|
273
|
+
end
|
274
|
+
|
275
|
+
### install bin files
|
276
|
+
|
277
|
+
if FileTest.directory?(PKG_BIN_DIR)
|
278
|
+
|
279
|
+
# change dir to package bin dir
|
280
|
+
Dir.chdir(PKG_BIN_DIR)
|
281
|
+
|
282
|
+
is_windows_platform = CONFIG["arch"] =~ /dos|win32/i
|
283
|
+
|
284
|
+
# files to install in bin path
|
285
|
+
files = FileList[*PKG_BIN_FILES].to_a
|
286
|
+
|
287
|
+
# deprecated files that should be removed
|
288
|
+
deprecated = FileList[*PKG_BIN_DEPRECATE].to_a
|
289
|
+
|
290
|
+
# the actual gruntwork
|
291
|
+
File::safe_unlink *deprecated.collect{|f| File.join($bindir, f.split(/\//))}
|
292
|
+
files.each do |f|
|
293
|
+
target = File.join($bindir, *f.split(/\//))
|
294
|
+
File::install(f, target, 0755, true)
|
295
|
+
if is_windows_platform
|
296
|
+
File.open("#{target}.cmd", "w") do |file|
|
297
|
+
file.puts "@ruby #{target} %1 %2 %3 %4 %5 %6 %7 %8 %9"
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
# change dir back
|
303
|
+
Dir.chdir(current_dir)
|
304
|
+
|
305
|
+
end
|
306
|
+
=end
|
307
|
+
|
308
|
+
end
|