ratch 0.2.2 → 0.2.3
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/COPYING +674 -0
- data/README +5 -5
- data/bin/lt +11 -11
- data/bin/ratch +3 -2
- data/demo/README +1 -0
- data/demo/WILMA +1 -0
- data/demo/doc/rdoc/created.rid +1 -1
- data/demo/doc/rdoc/files/README.html +1 -1
- data/demo/doc/rdoc/files/lib/foo/foo_rb.html +1 -1
- data/demo/doc/rdoc/index.html +3 -3
- data/demo/p.rb +9 -0
- data/demo/r.rb +6 -0
- data/demo/t.rb +3 -0
- data/demo/task/config.yaml +2 -0
- data/demo/{util → task}/one +0 -0
- data/demo/task/rdoc +88 -0
- data/demo/task/rdoc-old +182 -0
- data/demo/task/simplebuild +15 -0
- data/demo/task/stats +6 -0
- data/demo/task/task +6 -0
- data/demo/{util → task}/tryme +0 -0
- data/lib/ratch/argvutils.rb +57 -14
- data/lib/ratch/batch.rb +73 -21
- data/lib/ratch/batchable.rb +56 -26
- data/lib/ratch/batchfile.rb +95 -0
- data/lib/ratch/buildable.rb +117 -42
- data/lib/ratch/configutils.rb +43 -13
- data/lib/ratch/consoleutils.rb +76 -19
- data/lib/ratch/emailutils.rb +24 -0
- data/lib/ratch/facets/multiglob.rb +160 -0
- data/lib/ratch/fileutils.rb +40 -8
- data/lib/ratch/options.rb +43 -4
- data/lib/ratch/taskable.rb +48 -12
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/announce +0 -0
- data/lib/ratch/toolset/ruby/crosstest +305 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/extest +0 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/install +0 -0
- data/lib/ratch/toolset/ruby/isotest +293 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/load +0 -0
- data/lib/ratch/toolset/ruby/loadtest +28 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/notes +0 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/publish +0 -0
- data/lib/ratch/toolset/ruby/rdoc +88 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/setup +0 -0
- data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/stats +0 -0
- data/lib/ratch/toolset/ruby/syntax +29 -0
- data/lib/ratch/toolset/ruby/test +26 -0
- data/lib/ratch/uploadutils.rb +25 -4
- data/log/history.rd +10 -0
- data/log/recent.rd +8 -0
- data/log/todo.rd +2 -0
- data/man/ratch.man +73 -0
- data/meta/MANIFEST +45 -31
- data/meta/{RATCH-0.2.2.roll → ratch-0.2.3.roll} +3 -3
- data/task/clobber/package +10 -0
- data/task/config.yaml +4 -0
- data/task/man +14 -0
- data/task/publish +1 -1
- data/task/rdoc +6 -0
- metadata +64 -40
- data/LICENSE +0 -344
- data/data/ratch/rubyproject/rdoc +0 -42
- data/demo/util/conf/rdoc +0 -4
- data/demo/util/rdoc +0 -39
- data/dev/install +0 -89
- data/dev/install.0 +0 -49
- data/dev/install.1 +0 -63
- data/dev/ludo +0 -25
- data/dev/oldtaskable.rb +0 -573
- data/dev/taskable-simple.rb +0 -42
- data/dev/taskable.rb +0 -120
- data/lib/ratch/t.rb +0 -0
- data/lib/ratch/taskutils.rb +0 -41
data/README
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Ratch is a Ruby-based Batch file system. It provides a Ruby-based DSL
|
6
6
|
for creating utility/task scripts. It is similar in function to build tools,
|
7
7
|
like Make, Ant, Maven, Rake, et al. But unlike these it stears clear
|
8
|
-
of monolithic
|
8
|
+
of monolithic design and instead more closely follows the "UNIX-way".
|
9
9
|
|
10
10
|
|
11
11
|
== Installation
|
@@ -26,12 +26,12 @@ For Windows users the last line will be:
|
|
26
26
|
== Usage
|
27
27
|
|
28
28
|
Basic usage simply entails writing a script that utilizes Ratch's syntax.
|
29
|
+
See lib/ratch/toolset/ruby for examples.
|
29
30
|
|
30
31
|
|
31
|
-
==
|
32
|
+
== Copying
|
32
33
|
|
33
|
-
Copyright (c) 2007
|
34
|
-
|
35
|
-
GPL 3 ???
|
34
|
+
Copyright (c) 2007 T. Sawyer (Psi T. Corp)
|
36
35
|
|
36
|
+
Ratch is distributed under the terms of the GPLv3.
|
37
37
|
|
data/bin/lt
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
# scan task scripts for descriptions
|
4
4
|
|
5
|
-
def script_desc(
|
5
|
+
def script_desc(dir)
|
6
6
|
help = {}
|
7
|
-
files = Dir.glob(
|
7
|
+
files = Dir.glob(File.join(dir,'**/*'))
|
8
8
|
files.each do |fname|
|
9
|
-
next if FileTest.directory?(
|
10
|
-
next unless FileTest.executable?(
|
9
|
+
next if FileTest.directory?(fname)
|
10
|
+
next unless FileTest.executable?(fname)
|
11
11
|
desc = ''
|
12
12
|
File.open(fname) do |f|
|
13
13
|
line = ''
|
@@ -23,25 +23,25 @@ def script_desc( dir )
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
help[
|
26
|
+
help[fname] = desc
|
27
27
|
end
|
28
28
|
help
|
29
29
|
end
|
30
30
|
|
31
|
-
def show(
|
32
|
-
tasks = script_desc(
|
31
|
+
def show(dir)
|
32
|
+
tasks = script_desc(dir)
|
33
33
|
max = tasks.keys.max{ |a,b| a.size <=> b.size }.size
|
34
34
|
if dir == ''
|
35
35
|
max += 4 + 2
|
36
36
|
else
|
37
37
|
max += dir.size + 2
|
38
38
|
end
|
39
|
+
tasks = tasks.sort_by{|k,v| k }
|
39
40
|
tasks.each do |name, sum|
|
40
|
-
#sum = Sake.help_summary( type )
|
41
41
|
if dir == ''
|
42
|
-
cmd = "
|
42
|
+
cmd = "ratch #{name}"
|
43
43
|
else
|
44
|
-
cmd =
|
44
|
+
cmd = name
|
45
45
|
end
|
46
46
|
puts "%-#{max}s # %s" % [cmd, sum]
|
47
47
|
end
|
@@ -49,7 +49,7 @@ end
|
|
49
49
|
|
50
50
|
dir = ARGV[0] || '.'
|
51
51
|
|
52
|
-
if File.directory?(
|
52
|
+
if File.directory?(dir)
|
53
53
|
show( dir )
|
54
54
|
else
|
55
55
|
puts "#{dir} is not a directory"
|
data/bin/ratch
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
#require 'shellwords'
|
4
4
|
require 'rbconfig' # replace with facets/rbsystem in future ?
|
5
|
+
#require 'ratch/batchfile'
|
5
6
|
require 'ratch/batch'
|
6
7
|
|
7
8
|
module Ratch
|
@@ -48,7 +49,7 @@ module Ratch
|
|
48
49
|
|
49
50
|
end
|
50
51
|
|
51
|
-
|
52
|
+
load($0 = ARGV.shift)
|
52
53
|
|
53
|
-
Ratch::RatchCommand.start(ARGV.shift)
|
54
|
+
#Ratch::RatchCommand.start(ARGV.shift)
|
54
55
|
|
data/demo/README
CHANGED
data/demo/WILMA
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Here
|
data/demo/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Sun,
|
1
|
+
Sun, 11 Nov 2007 10:50:18 -0500
|
data/demo/doc/rdoc/index.html
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
<!--
|
7
7
|
|
8
|
-
|
8
|
+
RDoc Documentation
|
9
9
|
|
10
10
|
-->
|
11
11
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
12
|
<head>
|
13
|
-
<title>
|
13
|
+
<title>RDoc Documentation</title>
|
14
14
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
15
|
</head>
|
16
16
|
<frameset rows="20%, 80%">
|
@@ -19,6 +19,6 @@
|
|
19
19
|
<frame src="fr_class_index.html" name="Classes" />
|
20
20
|
<frame src="fr_method_index.html" name="Methods" />
|
21
21
|
</frameset>
|
22
|
-
<frame src="files/
|
22
|
+
<frame src="files/lib/foo/foo_rb.html" name="docwin" />
|
23
23
|
</frameset>
|
24
24
|
</html>
|
data/demo/p.rb
ADDED
data/demo/r.rb
ADDED
data/demo/t.rb
ADDED
data/demo/{util → task}/one
RENAMED
File without changes
|
data/demo/task/rdoc
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/env ratch
|
2
|
+
|
3
|
+
# generate rdocs
|
4
|
+
#
|
5
|
+
# Generate Rdoc documentation. Settings are
|
6
|
+
# the same as the rdoc command's options.
|
7
|
+
|
8
|
+
main :rdoc do
|
9
|
+
config, output, input = *rdoc_configuration
|
10
|
+
|
11
|
+
file output => input do
|
12
|
+
rdoc_target(config)
|
13
|
+
end
|
14
|
+
|
15
|
+
file 'README' do
|
16
|
+
puts "OH YEH README"
|
17
|
+
end
|
18
|
+
|
19
|
+
build output
|
20
|
+
end
|
21
|
+
|
22
|
+
# Document target.
|
23
|
+
|
24
|
+
def rdoc_target(config)
|
25
|
+
output = config['op']
|
26
|
+
input = config.delete('include')
|
27
|
+
|
28
|
+
# Check for 'doc' directory.
|
29
|
+
# (Helps to ensure we're in the right place.)
|
30
|
+
#dir!(File.dirname(site))
|
31
|
+
|
32
|
+
# Remove old rdocs.
|
33
|
+
rm_r(output) if exist?(output) and safe?(output)
|
34
|
+
|
35
|
+
#input = input.collect{ |i| glob(i) }.flatten
|
36
|
+
vector = [input, config]
|
37
|
+
rdoc(vector.to_console)
|
38
|
+
|
39
|
+
insert_ads(output)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Collect RDocs configuration.
|
43
|
+
|
44
|
+
def rdoc_configuration
|
45
|
+
config = configuration['rdoc'] || {}
|
46
|
+
|
47
|
+
config = {
|
48
|
+
'template' => 'html',
|
49
|
+
'op' => 'doc/rdoc',
|
50
|
+
'merge' => true,
|
51
|
+
'inline-source' => true,
|
52
|
+
'exclude' => [],
|
53
|
+
'include' => ['lib', '[A-Z]*']
|
54
|
+
}.merge(config)
|
55
|
+
|
56
|
+
if config['output']
|
57
|
+
config['op'] = config.delete('output')
|
58
|
+
end
|
59
|
+
|
60
|
+
output = config['op']
|
61
|
+
|
62
|
+
input = config['include'].collect do |i|
|
63
|
+
dir?(i) ? File.join(i,'**','*') : i
|
64
|
+
end
|
65
|
+
|
66
|
+
return config, output, input
|
67
|
+
end
|
68
|
+
|
69
|
+
# Insert an ad if available.
|
70
|
+
|
71
|
+
def insert_ads(site)
|
72
|
+
adfile = configuration['ad_file'] || 'meta/site_ad.html'
|
73
|
+
return unless adfile && File.file?(adfile)
|
74
|
+
adtext = File.read(adfile)
|
75
|
+
#puts
|
76
|
+
dirs = Dir.glob(File.join(site,'*/'))
|
77
|
+
dirs.each do |dir|
|
78
|
+
files = Dir.glob(File.join(dir, '**/*.html'))
|
79
|
+
files.each do |file|
|
80
|
+
html = file_read(file)
|
81
|
+
bodi = html.index('<body>')
|
82
|
+
html[bodi + 7] = "\n" + adtext
|
83
|
+
#print "Augmenting #{file}..."
|
84
|
+
file_write(file, html) unless dryrun?
|
85
|
+
#puts "[done]"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/demo/task/rdoc-old
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
#!/usr/bin/env ratch
|
2
|
+
|
3
|
+
# generate rdocs
|
4
|
+
#
|
5
|
+
# Geneate RDoc documentation. This uses the rdoc config entry.
|
6
|
+
# most entires are shodows of the argument the rdoc command
|
7
|
+
# takes. Three execptions -- you can use 'output' instead of
|
8
|
+
# 'op' if you prefer. You can sopecify 'chdir', from which
|
9
|
+
# rdoc will work relative. And you can specify 'groups'.
|
10
|
+
# Groups allow you to document groups of files separetely.
|
11
|
+
# Using groups, any file not part of a group will be document
|
12
|
+
# on it's own.
|
13
|
+
#
|
14
|
+
# Eg.
|
15
|
+
#
|
16
|
+
# rdoc:
|
17
|
+
# title : Foo Aop
|
18
|
+
# main : README
|
19
|
+
# output: doc/rdoc
|
20
|
+
# chdir : lib
|
21
|
+
#
|
22
|
+
# rdoc:
|
23
|
+
# doc/rdoc:
|
24
|
+
# title : Foo Aop
|
25
|
+
# main : README
|
26
|
+
# chdir : lib/core
|
27
|
+
# doc/rdoc/aop:
|
28
|
+
# title : Foo Aop
|
29
|
+
# main : README
|
30
|
+
# chdir : lib/core
|
31
|
+
#
|
32
|
+
#
|
33
|
+
# You can also specify more than one rdoc process by using
|
34
|
+
# an array of such entries.
|
35
|
+
|
36
|
+
# Load RDoc configuration.
|
37
|
+
rdoc_configs = configuration['rdoc']
|
38
|
+
rdoc_configs = [configs] unless Array===configs
|
39
|
+
|
40
|
+
targets = rdoc_configs.collect{ |config| config['output'] }
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
main :rdoc => targets do
|
45
|
+
puts "RDoc complete."
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
file configuration['rdoc'] do |config|
|
50
|
+
if config['groups']
|
51
|
+
rdoc_groups(config)
|
52
|
+
else
|
53
|
+
rdoc_target(config)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
|
60
|
+
rdoc_configs.each do |config|
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
file config['output'] do |config|
|
65
|
+
if config['groups']
|
66
|
+
rdoc_groups(config)
|
67
|
+
else
|
68
|
+
rdoc_target(config)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
# Docuement groups of targets.
|
75
|
+
|
76
|
+
def rdoc_groups(config)
|
77
|
+
site = config.delete('output') || config.delete('op') || 'doc/rdoc'
|
78
|
+
tdir = config['chdir']
|
79
|
+
|
80
|
+
groups = config.delete('groups')
|
81
|
+
groups = TrueClass===groups ? [] : groups
|
82
|
+
|
83
|
+
# the rest
|
84
|
+
rest = []
|
85
|
+
chdir(tdir){rest=glob('**/*').select{|f| File.file?(f)}}
|
86
|
+
rest = rest - groups.flatten
|
87
|
+
groups.concat(rest.collect{ |r| [r] })
|
88
|
+
|
89
|
+
title = config['title'].to_s
|
90
|
+
|
91
|
+
# rdoc each group
|
92
|
+
groups.each do |group|
|
93
|
+
gf1st = File.basename(group.first)
|
94
|
+
gname = gf1st.chomp(File.extname(gf1st))
|
95
|
+
gsite = File.join(site,gname) # *
|
96
|
+
gtitle = "#{title} #{gname.capitalize}".strip
|
97
|
+
|
98
|
+
gconfig = config.merge('title' => gtitle, 'op' => gsite, 'files' => group)
|
99
|
+
|
100
|
+
rdoc_target(gconfig)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Document target.
|
105
|
+
|
106
|
+
def rdoc_target(config)
|
107
|
+
config = {
|
108
|
+
'template' => 'html',
|
109
|
+
'merge' => true,
|
110
|
+
'inline-source' => true,
|
111
|
+
'files' => '**/*'
|
112
|
+
}.merge(config)
|
113
|
+
|
114
|
+
site = config.delete('output') || config.delete('op') || 'doc/rdoc'
|
115
|
+
tgdir = config.delete('chdir')
|
116
|
+
files = config.delete('files')
|
117
|
+
|
118
|
+
config['op'] = File.expand_path(site)
|
119
|
+
|
120
|
+
config['main'] = File.expand_path(config['main']) if config['main']
|
121
|
+
|
122
|
+
# Helps to ensure we're in the right place.
|
123
|
+
#dir!(File.dirname(site))
|
124
|
+
|
125
|
+
# Remove all old rdocs.
|
126
|
+
rm_r(site) if dir?(site) and safe?(site)
|
127
|
+
|
128
|
+
# Prepare command arguments.
|
129
|
+
vector = [files, config] #.flatten.compact
|
130
|
+
|
131
|
+
# Create Documentation.
|
132
|
+
cd(tgdir) do
|
133
|
+
rdoc(vector.to_console)
|
134
|
+
end
|
135
|
+
|
136
|
+
insert_ads(site)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Insert ads.
|
140
|
+
|
141
|
+
def insert_ads(site)
|
142
|
+
adfile = configuration['ad_file'] || 'meta/site_ad.html'
|
143
|
+
return unless adfile && File.file?(adfile)
|
144
|
+
adtext = File.read(adfile)
|
145
|
+
#puts
|
146
|
+
dirs = Dir.glob(File.join(site,'*/'))
|
147
|
+
dirs.each do |dir|
|
148
|
+
files = Dir.glob(File.join(dir, '**/*.html'))
|
149
|
+
files.each do |file|
|
150
|
+
html = file_read(file)
|
151
|
+
bodi = html.index('<body>')
|
152
|
+
html[bodi + 7] = "\n" + adtext
|
153
|
+
#print "Augmenting #{file}..."
|
154
|
+
file_write(file, html) unless dryrun?
|
155
|
+
#puts "[done]"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
|
161
|
+
class RDocGroup
|
162
|
+
|
163
|
+
attr_accessor :title
|
164
|
+
attr_accessor :main
|
165
|
+
|
166
|
+
def initialize(config, group)
|
167
|
+
populate(config)
|
168
|
+
@group = group
|
169
|
+
end
|
170
|
+
|
171
|
+
def name
|
172
|
+
@name ||= (
|
173
|
+
name = File.basename(group.first)
|
174
|
+
name.chomp(File.extname(name))
|
175
|
+
)
|
176
|
+
end
|
177
|
+
|
178
|
+
def output
|
179
|
+
site = config.delete('output') || config.delete('op') || 'doc/rdoc'
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|