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/demo/task/stats
ADDED
data/demo/task/task
ADDED
data/demo/{util → task}/tryme
RENAMED
File without changes
|
data/lib/ratch/argvutils.rb
CHANGED
@@ -1,40 +1,64 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# ArgvUtils
|
4
|
+
#
|
5
|
+
# COPYING:
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007 Psi T Corp.
|
8
|
+
#
|
9
|
+
# This file is part of the ProUtils' Ratch program.
|
10
|
+
#
|
11
|
+
# Ratch is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 3 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
#
|
16
|
+
# Ratch is distributed in the hope that it will be useful,
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
# GNU General Public License for more details.
|
20
|
+
#
|
21
|
+
# You should have received a copy of the GNU General Public License
|
22
|
+
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
1
23
|
|
2
24
|
module Ratch
|
3
25
|
|
4
|
-
# No fuss access to ARGV. This shows up as #
|
26
|
+
# No fuss access to ARGV. This shows up as #commandline in the ratch api.
|
5
27
|
#
|
6
28
|
# Ratch uses '=' for parameterized flags b/c this make parsing stupid simple
|
7
|
-
# and that's a good thing!!!
|
29
|
+
# and that's a good thing!!! However you can use value! if need be.
|
8
30
|
|
9
31
|
module ArgvUtils
|
10
32
|
|
11
|
-
def
|
12
|
-
@
|
33
|
+
def commandline
|
34
|
+
@commandline ||= (ARGV.dup).extend(Ext)
|
13
35
|
end
|
36
|
+
alias_method :argument_vector, :commandline
|
14
37
|
|
15
38
|
module Ext
|
16
39
|
|
17
|
-
def flags
|
18
|
-
@flags ||= collect{ |e| e =~ /^-/ && e !~ /=/ }
|
19
|
-
end
|
20
|
-
|
21
40
|
def arguments
|
22
|
-
@arguments ||=
|
41
|
+
@arguments ||= select{ |e| e !~ /^-/ && e !~ /=/ }
|
23
42
|
end
|
24
43
|
|
25
|
-
def
|
26
|
-
@
|
44
|
+
def options
|
45
|
+
@options ||= (
|
27
46
|
pms = {}
|
28
|
-
|
47
|
+
select{ |e| e =~ /=/ }.each do |e|
|
29
48
|
pms.store(*split('='))
|
30
49
|
end
|
31
50
|
pms
|
32
51
|
)
|
33
52
|
end
|
34
53
|
|
35
|
-
|
54
|
+
def flags
|
55
|
+
@flags ||= select{ |e| e =~ /^-/ || e !~ /=/ }
|
56
|
+
end
|
57
|
+
|
58
|
+
# Have specific flag?
|
59
|
+
|
36
60
|
def flag?(flag)
|
37
|
-
include?(flag)
|
61
|
+
flags.include?(flag)
|
38
62
|
end
|
39
63
|
|
40
64
|
# You can use this if you want to use parameterized
|
@@ -51,6 +75,25 @@ module Ratch
|
|
51
75
|
fetch(index(flag)+1)
|
52
76
|
end
|
53
77
|
|
78
|
+
#
|
79
|
+
def value!(flag)
|
80
|
+
@values ||= {}
|
81
|
+
@values[flag] ||= (
|
82
|
+
delete(index(flag))
|
83
|
+
delete(index(flag))
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
# #
|
88
|
+
# def [](x)
|
89
|
+
# case x
|
90
|
+
# when Integer
|
91
|
+
# super(x)
|
92
|
+
# else
|
93
|
+
# value(x.to_s)
|
94
|
+
# end
|
95
|
+
# end
|
96
|
+
|
54
97
|
end
|
55
98
|
end
|
56
99
|
end
|
data/lib/ratch/batch.rb
CHANGED
@@ -1,19 +1,61 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# BatchFile
|
4
|
+
#
|
5
|
+
# COPYING:
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007 Psi T Corp.
|
8
|
+
#
|
9
|
+
# This file is part of the ProUtils' Ratch program.
|
10
|
+
#
|
11
|
+
# Ratch is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 3 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
#
|
16
|
+
# Ratch is distributed in the hope that it will be useful,
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
# GNU General Public License for more details.
|
20
|
+
#
|
21
|
+
# You should have received a copy of the GNU General Public License
|
22
|
+
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
|
1
24
|
#require 'shellwords'
|
25
|
+
require 'yaml'
|
2
26
|
require 'rbconfig' # replace with facets/rbsystem in future ?
|
3
|
-
require '
|
27
|
+
#require 'facets/hash/merge' # for reverse_merge
|
28
|
+
|
29
|
+
require 'ratch/options'
|
30
|
+
|
31
|
+
require 'ratch/consoleutils'
|
32
|
+
require 'ratch/configutils'
|
33
|
+
require 'ratch/emailutils'
|
34
|
+
require 'ratch/fileutils'
|
35
|
+
require 'ratch/argvutils'
|
36
|
+
|
37
|
+
require 'ratch/taskable'
|
38
|
+
require 'ratch/buildable'
|
4
39
|
require 'ratch/batchable'
|
5
40
|
|
41
|
+
|
6
42
|
module Ratch
|
7
43
|
|
8
|
-
#
|
9
|
-
# ratch script.
|
44
|
+
# BatchScript module defines the DSL available to a ratch script.
|
10
45
|
|
11
|
-
|
46
|
+
module BatchScript #< Module
|
12
47
|
|
13
|
-
include
|
48
|
+
include GeneralOptions
|
14
49
|
|
50
|
+
include ConsoleUtils
|
51
|
+
include ArgvUtils
|
52
|
+
include FileUtils
|
53
|
+
include ConfigUtils
|
54
|
+
include EmailUtils
|
55
|
+
|
56
|
+
include Buildable
|
57
|
+
include Taskable
|
15
58
|
include Batchable
|
16
|
-
include OpenBatchable
|
17
59
|
|
18
60
|
# Quick start, equivalent to calling new.run(file).
|
19
61
|
|
@@ -23,27 +65,37 @@ module Ratch
|
|
23
65
|
|
24
66
|
# New Batch File
|
25
67
|
|
26
|
-
def initialize(file)
|
27
|
-
|
28
|
-
|
29
|
-
end
|
68
|
+
#def initialize(file)
|
69
|
+
# abort "missing batch file -- #{file}" unless File.file?(file)
|
70
|
+
# @file = file
|
71
|
+
#end
|
30
72
|
|
31
73
|
# TODO What todo about arguments?
|
32
74
|
|
33
|
-
def call(arguments=nil)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
|
75
|
+
#def call(arguments=nil)
|
76
|
+
# script = File.read($0 = @file)
|
77
|
+
#puts script
|
78
|
+
#p $0
|
79
|
+
#puts
|
80
|
+
# eval(script, binding, $0) #instance_eval(script)
|
81
|
+
# #@main.call if @main
|
82
|
+
# task_manager.call_main
|
83
|
+
# #run(:main) if task_manager.main
|
84
|
+
# end
|
40
85
|
|
41
86
|
end
|
42
87
|
|
43
88
|
end
|
44
89
|
|
45
|
-
# Load
|
90
|
+
# Load BatchScript into to main runspace.
|
91
|
+
#
|
92
|
+
# TODO: Should this be in all Object space (ie. no class << self)?
|
93
|
+
class << self
|
94
|
+
include Ratch::BatchScript
|
95
|
+
end
|
96
|
+
|
97
|
+
$batch_binding = binding
|
46
98
|
|
47
|
-
|
48
|
-
|
49
|
-
|
99
|
+
END {
|
100
|
+
task_manager.call_main
|
101
|
+
}
|
data/lib/ratch/batchable.rb
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# Batchable
|
4
|
+
#
|
5
|
+
# COPYING:
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007 Psi T Corp.
|
8
|
+
#
|
9
|
+
# This file is part of the ProUtils' Ratch program.
|
10
|
+
#
|
11
|
+
# Ratch is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 3 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
#
|
16
|
+
# Ratch is distributed in the hope that it will be useful,
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
# GNU General Public License for more details.
|
20
|
+
#
|
21
|
+
# You should have received a copy of the GNU General Public License
|
22
|
+
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
|
1
24
|
module Ratch
|
2
25
|
|
3
26
|
class BatchManager
|
@@ -6,7 +29,8 @@ module Ratch
|
|
6
29
|
attr :cache
|
7
30
|
|
8
31
|
# New BatchManager.
|
9
|
-
def initialize
|
32
|
+
def initialize(runspace)
|
33
|
+
@runspace = runspace
|
10
34
|
@cache = {}
|
11
35
|
end
|
12
36
|
|
@@ -15,14 +39,16 @@ module Ratch
|
|
15
39
|
@cache[batchfile] ||= run(batchfile, arguments)
|
16
40
|
end
|
17
41
|
|
18
|
-
#
|
42
|
+
# Run a batch file.
|
43
|
+
# TODO: How to handle arguments?
|
44
|
+
|
19
45
|
def run(batchfile, arguments=nil)
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
#
|
24
|
-
|
25
|
-
|
46
|
+
# # TODO probably should raise error instead
|
47
|
+
# abort "missing batch file -- #{batchfile}" unless File.file?(batchfile)
|
48
|
+
|
49
|
+
#BatchFile.new(batchfile).call # Old way with batch execution context object.
|
50
|
+
script = File.read($0 = batchfile)
|
51
|
+
eval(script, $batch_binding, $0)
|
26
52
|
end
|
27
53
|
|
28
54
|
#
|
@@ -38,7 +64,7 @@ module Ratch
|
|
38
64
|
|
39
65
|
# Reference batch manager.
|
40
66
|
def batch_manager
|
41
|
-
@batch_manager ||= BatchManager.new
|
67
|
+
@batch_manager ||= BatchManager.new(self)
|
42
68
|
end
|
43
69
|
|
44
70
|
# Batch run, ie. run and cache.
|
@@ -71,17 +97,20 @@ module Ratch
|
|
71
97
|
end
|
72
98
|
end
|
73
99
|
|
100
|
+
# Is a file a local batch file?
|
101
|
+
|
102
|
+
def batch?(path)
|
103
|
+
b = File.dirname($0) + "/#{path}"
|
104
|
+
b.chomp!('!')
|
105
|
+
b if FileTest.file?(b) && FileTest.executable?(b)
|
106
|
+
end
|
107
|
+
|
74
108
|
# Abort running.
|
75
109
|
#def abort(msg=nil)
|
76
110
|
# puts msg if msg
|
77
111
|
# exit 0
|
78
112
|
#end
|
79
113
|
|
80
|
-
end
|
81
|
-
|
82
|
-
#
|
83
|
-
module OpenBatchable
|
84
|
-
|
85
114
|
# If method is missing try to run an external task
|
86
115
|
# or binary by that name. If it is a binary, arguments
|
87
116
|
# translate into commandline parameters. For example:
|
@@ -107,14 +136,14 @@ module Ratch
|
|
107
136
|
|
108
137
|
name = sym.to_s
|
109
138
|
|
110
|
-
|
111
|
-
done =
|
112
|
-
cache =
|
113
|
-
bin = bin?(name) if (!
|
114
|
-
none =
|
115
|
-
#
|
139
|
+
bat = batch?(name)
|
140
|
+
done = bat && done?(bat)
|
141
|
+
cache = bat && !done && name[1,-1] != '!'
|
142
|
+
bin = bin?(name) if (!bat || done)
|
143
|
+
none = bat && done && !bin
|
144
|
+
#bat = name if bin
|
116
145
|
|
117
|
-
return super unless
|
146
|
+
return super unless bat || bin
|
118
147
|
|
119
148
|
return if none # nothing to do
|
120
149
|
|
@@ -123,13 +152,14 @@ module Ratch
|
|
123
152
|
if bin
|
124
153
|
cmd = "#{File.basename(bin)} #{params}"
|
125
154
|
res = sh(cmd)
|
126
|
-
elsif
|
127
|
-
cmd = "./#{
|
155
|
+
elsif bat
|
156
|
+
cmd = "./#{bat} #{params}"
|
128
157
|
puts "--> #{cache ? '' : 'not-'}cached execution: #{cmd}" if trace?
|
129
|
-
res =
|
158
|
+
res = batch(bat, args)
|
130
159
|
if cache
|
131
|
-
#@batch_catch[
|
132
|
-
|
160
|
+
#@batch_catch[bat] ||= (system(cmd); true)
|
161
|
+
#batch_cache[bat] ||= res
|
162
|
+
batch_manager.cache ||= res
|
133
163
|
end
|
134
164
|
end
|
135
165
|
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# BatchFile
|
4
|
+
#
|
5
|
+
# COPYING:
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007 Psi T Corp.
|
8
|
+
#
|
9
|
+
# This file is part of the ProUtils' Ratch program.
|
10
|
+
#
|
11
|
+
# Ratch is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 3 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
#
|
16
|
+
# Ratch is distributed in the hope that it will be useful,
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
# GNU General Public License for more details.
|
20
|
+
#
|
21
|
+
# You should have received a copy of the GNU General Public License
|
22
|
+
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
23
|
+
|
24
|
+
#require 'shellwords'
|
25
|
+
require 'yaml'
|
26
|
+
require 'rbconfig' # replace with facets/rbsystem in future ?
|
27
|
+
#require 'facets/hash/merge' # for reverse_merge
|
28
|
+
|
29
|
+
require 'ratch/options'
|
30
|
+
|
31
|
+
require 'ratch/consoleutils'
|
32
|
+
require 'ratch/configutils'
|
33
|
+
require 'ratch/emailutils'
|
34
|
+
require 'ratch/fileutils'
|
35
|
+
require 'ratch/argvutils'
|
36
|
+
|
37
|
+
require 'ratch/taskable'
|
38
|
+
require 'ratch/buildable'
|
39
|
+
require 'ratch/batchable'
|
40
|
+
|
41
|
+
|
42
|
+
module Ratch
|
43
|
+
|
44
|
+
# Batch File class, is used as an executionm context for a
|
45
|
+
# ratch script.
|
46
|
+
|
47
|
+
class BatchFile < Module
|
48
|
+
|
49
|
+
include GeneralOptions
|
50
|
+
|
51
|
+
include ConsoleUtils
|
52
|
+
include ArgvUtils
|
53
|
+
include FileUtils
|
54
|
+
include ConfigUtils
|
55
|
+
include EmailUtils
|
56
|
+
|
57
|
+
include Buildable
|
58
|
+
include Taskable
|
59
|
+
include Batchable
|
60
|
+
|
61
|
+
# Quick start, equivalent to calling new.run(file).
|
62
|
+
|
63
|
+
#def self.start(file)
|
64
|
+
# new(file).call
|
65
|
+
#end
|
66
|
+
|
67
|
+
# New Batch File
|
68
|
+
|
69
|
+
def initialize(file)
|
70
|
+
abort "missing batch file -- #{file}" unless File.file?(file)
|
71
|
+
@file = file
|
72
|
+
end
|
73
|
+
|
74
|
+
# TODO What todo about arguments?
|
75
|
+
|
76
|
+
def call(arguments=nil)
|
77
|
+
script = File.read($0 = @file)
|
78
|
+
puts script
|
79
|
+
p $0
|
80
|
+
puts
|
81
|
+
eval(script, binding, $0) #instance_eval(script)
|
82
|
+
#@main.call if @main
|
83
|
+
task_manager.call_main
|
84
|
+
#run(:main) if task_manager.main
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
# Load TaskUtils directly into to main runspace.
|
92
|
+
|
93
|
+
#class << self
|
94
|
+
# include TaskUtils
|
95
|
+
#end
|