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
File without changes
|
File without changes
|
@@ -0,0 +1,293 @@
|
|
1
|
+
#!/usr/bin/env ratch
|
2
|
+
|
3
|
+
#
|
4
|
+
require 'facets/hash/rekey'
|
5
|
+
require 'facets/string/tabs'
|
6
|
+
require 'facets/progressbar'
|
7
|
+
|
8
|
+
require 'test/unit/ui/testrunnermediator' #require 'test/unit'
|
9
|
+
::Test::Unit.run = true # Don't autorun tests!
|
10
|
+
|
11
|
+
main :isotestsolid do
|
12
|
+
run_isotests
|
13
|
+
end
|
14
|
+
|
15
|
+
# Run unit-tests. Each test is run in a separate interpretor
|
16
|
+
# to prevent script clash. This makes for a more robust test
|
17
|
+
# facility and prevents potential conflicts between test scripts.
|
18
|
+
#
|
19
|
+
# tests Test files (eg. test/tc_**/*.rb) [test/**/*]
|
20
|
+
# libs Directories to include in load path.
|
21
|
+
# ('./lib' is always included)
|
22
|
+
# live Deactive use of local libs and test against install.
|
23
|
+
# reqs List of files to require prior to running tests.
|
24
|
+
# extract Extract embedded tests first? [false]
|
25
|
+
#
|
26
|
+
# To isolate tests this tool marshals test results across a
|
27
|
+
# stdout->stdin shell pipe. This prevents interfence of one
|
28
|
+
# script's tests on another. But consequently it is not always
|
29
|
+
# possible to send debug info to stdout in the tests themselves
|
30
|
+
# (eg. #p and #puts).
|
31
|
+
|
32
|
+
def run_isotests
|
33
|
+
info = configuration['test']
|
34
|
+
|
35
|
+
tests = info['files'] || 'test/unit/**/test_*.rb'
|
36
|
+
libs = info['libpath']
|
37
|
+
reqs = info['require']
|
38
|
+
live = info['live']
|
39
|
+
#extract = info['extract']
|
40
|
+
|
41
|
+
tests = [ tests ].flatten
|
42
|
+
libs = [ libs ].flatten
|
43
|
+
|
44
|
+
#files = [ @files ].flatten
|
45
|
+
#extract_tests if extract
|
46
|
+
|
47
|
+
results = TestResults.new #(style)
|
48
|
+
|
49
|
+
# get test files
|
50
|
+
test_libs = libs.join(':')
|
51
|
+
test_files = Dir.multiglob( *tests )
|
52
|
+
if test_files.empty?
|
53
|
+
puts "Tests [NONE]"
|
54
|
+
return
|
55
|
+
end
|
56
|
+
|
57
|
+
# run tests
|
58
|
+
|
59
|
+
if trace?
|
60
|
+
pbar = nil
|
61
|
+
size = test_files.collect{|f| f.size}.max + 5
|
62
|
+
dots = '.' * size
|
63
|
+
else
|
64
|
+
pbar = Console::ProgressBar.new( 'Testing', test_files.size )
|
65
|
+
pbar.inc
|
66
|
+
end
|
67
|
+
|
68
|
+
test_files.each do |test_file|
|
69
|
+
pbar.inc if pbar
|
70
|
+
if ! File.file?(test_file)
|
71
|
+
next #r = nil
|
72
|
+
else
|
73
|
+
unless pbar
|
74
|
+
print test_file + dots[test_file.size..-1]
|
75
|
+
$stdout.flush
|
76
|
+
end
|
77
|
+
r = fork_test( test_file, :libs=>libs, :reqs=>reqs, :live=>live )
|
78
|
+
unless pbar
|
79
|
+
puts r.passed? ? "[PASS]" : "[FAIL]"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
results << r
|
83
|
+
end
|
84
|
+
|
85
|
+
pbar.finish if pbar
|
86
|
+
|
87
|
+
# display results
|
88
|
+
puts results
|
89
|
+
|
90
|
+
fails, errrs = results.failure_count, results.error_count
|
91
|
+
#CHECKLIST << :test if fails > 0
|
92
|
+
#CHECKLIST << :test if errrs > 0
|
93
|
+
return (fails + errrs > 0)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Run a test in a separate process.
|
97
|
+
#
|
98
|
+
# Currently send program output to null device.
|
99
|
+
# Could send to a logger in future version.
|
100
|
+
#
|
101
|
+
# Key parameters are libs, reqs, live.
|
102
|
+
|
103
|
+
def fork_test( file, keys )
|
104
|
+
keys = keys.rekey(:to_s)
|
105
|
+
|
106
|
+
libs = keys['lib'] || []
|
107
|
+
reqs = keys['req'] || []
|
108
|
+
live = keys['live']
|
109
|
+
|
110
|
+
src = ''
|
111
|
+
|
112
|
+
unless live
|
113
|
+
l = File.join( Dir.pwd, 'lib' )
|
114
|
+
if File.directory?( l )
|
115
|
+
src << %{$:.unshift('#{l}')\n}
|
116
|
+
end
|
117
|
+
libs.each { |r| src << %{$:.unshift('#{r}')\n} }
|
118
|
+
end
|
119
|
+
|
120
|
+
src << %{
|
121
|
+
#require 'test/unit'
|
122
|
+
require 'test/unit/collector'
|
123
|
+
require 'test/unit/collector/objectspace'
|
124
|
+
require 'test/unit/ui/testrunnermediator'
|
125
|
+
}
|
126
|
+
|
127
|
+
reqs.each do |fix|
|
128
|
+
src << %Q{
|
129
|
+
require '#{fix}'
|
130
|
+
}
|
131
|
+
end
|
132
|
+
|
133
|
+
src << %{
|
134
|
+
def warn(*null); end # silence warnings
|
135
|
+
|
136
|
+
output = STDOUT.dup
|
137
|
+
STDOUT.reopen( PLATFORM =~ /mswin/ ? "NUL" : "/dev/null" )
|
138
|
+
|
139
|
+
load('#{file}')
|
140
|
+
tests = Test::Unit::Collector::ObjectSpace.new.collect
|
141
|
+
runner = Test::Unit::UI::TestRunnerMediator.new( tests )
|
142
|
+
result = runner.run_suite
|
143
|
+
|
144
|
+
begin
|
145
|
+
marshalled = Marshal.dump(result)
|
146
|
+
rescue TypeError => e
|
147
|
+
$stderr << "MARSHAL ERROR\n"
|
148
|
+
$stderr << "TEST: #{file}\n"
|
149
|
+
$stderr << "DATA:" << result.inspect
|
150
|
+
exit -1
|
151
|
+
end
|
152
|
+
output << marshalled
|
153
|
+
|
154
|
+
STDOUT.reopen(output)
|
155
|
+
output.close
|
156
|
+
}
|
157
|
+
|
158
|
+
result = IO.popen("ruby","w+") do |ruby|
|
159
|
+
ruby.puts src
|
160
|
+
ruby.close_write
|
161
|
+
ruby.read
|
162
|
+
end
|
163
|
+
|
164
|
+
begin
|
165
|
+
marsh = Marshal.load(result)
|
166
|
+
rescue ArgumentError
|
167
|
+
$stderr << "\nCannot load marshalled test data.\n"
|
168
|
+
$stderr << result << "\n"
|
169
|
+
exit -1
|
170
|
+
end
|
171
|
+
|
172
|
+
return marsh
|
173
|
+
end
|
174
|
+
|
175
|
+
#
|
176
|
+
# Support class for collecting test results.
|
177
|
+
#
|
178
|
+
|
179
|
+
class TestResults
|
180
|
+
attr_reader :assertion_count,
|
181
|
+
:run_count,
|
182
|
+
:failure_count,
|
183
|
+
:error_count
|
184
|
+
|
185
|
+
attr_accessor :style
|
186
|
+
|
187
|
+
def initialize( style=nil )
|
188
|
+
@style = style
|
189
|
+
|
190
|
+
@results = []
|
191
|
+
|
192
|
+
@assertion_count = 0
|
193
|
+
@run_count = 0
|
194
|
+
@failure_count = 0
|
195
|
+
@error_count = 0
|
196
|
+
end
|
197
|
+
|
198
|
+
# Add a result to the results collection.
|
199
|
+
|
200
|
+
def <<( result )
|
201
|
+
@results << result
|
202
|
+
|
203
|
+
@assertion_count += result.assertion_count
|
204
|
+
@run_count += result.run_count
|
205
|
+
@failure_count += result.failure_count
|
206
|
+
@error_count += result.error_count
|
207
|
+
end
|
208
|
+
|
209
|
+
#
|
210
|
+
|
211
|
+
def errors
|
212
|
+
errors = []
|
213
|
+
@results.each do |r|
|
214
|
+
unless r.passed?
|
215
|
+
errors << r.instance_variable_get('@errors')
|
216
|
+
end
|
217
|
+
end
|
218
|
+
errors.reject! { |e| e == [] }
|
219
|
+
errors
|
220
|
+
end
|
221
|
+
|
222
|
+
#
|
223
|
+
|
224
|
+
def failures
|
225
|
+
failures = []
|
226
|
+
@results.each do |r|
|
227
|
+
unless r.passed?
|
228
|
+
failures << r.instance_variable_get('@failures')
|
229
|
+
end
|
230
|
+
end
|
231
|
+
failures.reject! { |e| e == [] }
|
232
|
+
failures
|
233
|
+
end
|
234
|
+
|
235
|
+
# Output format for test results.
|
236
|
+
|
237
|
+
def to_s
|
238
|
+
return @results.to_s if style == 'pease'
|
239
|
+
|
240
|
+
s = []
|
241
|
+
# Display failures
|
242
|
+
unless failures.empty?
|
243
|
+
s << ''
|
244
|
+
s << "FAILURES:"
|
245
|
+
failures.reverse.each do |fails|
|
246
|
+
fails.reverse.each do |failure|
|
247
|
+
#puts
|
248
|
+
s << %{ - test : #{failure.test_name}}
|
249
|
+
s << %{ location : #{failure.location}}
|
250
|
+
if failure.message.index("\n")
|
251
|
+
s << %{ message : >}
|
252
|
+
s << failure.message.tabto(6)
|
253
|
+
else
|
254
|
+
s << %{ message : #{failure.message}}
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
# Display errors
|
261
|
+
unless errors.empty?
|
262
|
+
s << ''
|
263
|
+
s << "ERRORS:"
|
264
|
+
errors.reverse.each do |errs|
|
265
|
+
errs.reverse.each do |err|
|
266
|
+
s << ''
|
267
|
+
s << %{ - test : #{err.test_name}}
|
268
|
+
s << %{ message : #{err.exception.message}}
|
269
|
+
s << %{ backtrace :}
|
270
|
+
err.exception.backtrace[0...-1].each { |bt| s << %Q{ - #{bt}} }
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
# Display final results
|
276
|
+
s << ''
|
277
|
+
s << "Summary:"
|
278
|
+
s << " Tests : #{@run_count}"
|
279
|
+
s << " Assertions : #{@assertion_count}"
|
280
|
+
s << " Failures : #{@failure_count}"
|
281
|
+
s << " Errors : #{@error_count}"
|
282
|
+
s << ''
|
283
|
+
s << ''
|
284
|
+
|
285
|
+
return s.join("\n")
|
286
|
+
end
|
287
|
+
|
288
|
+
# Delegate missing call to the results array.
|
289
|
+
|
290
|
+
def method_missing(*a,&b)
|
291
|
+
@results.send(*a,&b)
|
292
|
+
end
|
293
|
+
end
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ratch
|
2
|
+
|
3
|
+
main :syntax do
|
4
|
+
scripts = "lib/**/*.rb"
|
5
|
+
libpath = [ 'lib/methods', 'lib/core', 'lib/more' ].join(':')
|
6
|
+
|
7
|
+
checklist = []
|
8
|
+
cnt = 0
|
9
|
+
scripts = multiglob(*scripts) #- multiglob_r(ignore)
|
10
|
+
scripts.each do |s|
|
11
|
+
next unless File.file?(s)
|
12
|
+
#if not system "ruby -c -Ibin:lib:test #{s} &> /dev/null" then
|
13
|
+
if r = system "ruby -I#{libpath} #{s} > /dev/null"
|
14
|
+
puts "#{s} [PASS]" #if verbose?
|
15
|
+
else
|
16
|
+
puts "Load Issue: #{s}"
|
17
|
+
checklist << :load
|
18
|
+
cnt += 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if cnt == 0
|
23
|
+
puts "Load dependencies check out."
|
24
|
+
else
|
25
|
+
puts "#{cnt} Load Failures:\n "
|
26
|
+
puts checklist.join("\n ")
|
27
|
+
end
|
28
|
+
end
|
File without changes
|
File without changes
|
@@ -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
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ratch
|
2
|
+
|
3
|
+
main :syntax do
|
4
|
+
scripts = "lib/**/*.rb"
|
5
|
+
libpath = [ 'lib/methods', 'lib/core', 'lib/more' ].join(':')
|
6
|
+
|
7
|
+
checklist = []
|
8
|
+
cnt = 0
|
9
|
+
scripts = multiglob(*scripts) #- multiglob_r(ignore)
|
10
|
+
scripts.each do |s|
|
11
|
+
next unless File.file?(s)
|
12
|
+
#if not system "ruby -c -Ibin:lib:test #{s} &> /dev/null" then
|
13
|
+
r = system "ruby -c -I#{libpath} #{s} > /dev/null"
|
14
|
+
if r
|
15
|
+
puts "#{s} [PASS]" #if verbose?
|
16
|
+
else
|
17
|
+
puts "Syntax Error: #{s}"
|
18
|
+
checklist << :syntax
|
19
|
+
cnt += 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
if cnt == 0
|
24
|
+
puts "Syntax checks out."
|
25
|
+
else
|
26
|
+
puts "#{cnt} Syntax Failures:\n "
|
27
|
+
puts checklist.join("\n ")
|
28
|
+
end
|
29
|
+
end
|