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/lib/ratch/buildable.rb
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# Buildable
|
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
|
# = Buildable mixin
|
@@ -6,24 +29,24 @@ module Ratch
|
|
6
29
|
|
7
30
|
# Reference task manager.
|
8
31
|
def build_manager
|
9
|
-
@build_manager ||= BuildManager.new
|
32
|
+
@build_manager ||= BuildManager.new(self)
|
10
33
|
end
|
11
34
|
|
12
35
|
# Define a build target.
|
13
36
|
def file(name, &block)
|
14
37
|
name, deps, block = *parse_build_dependencies(name, &block)
|
15
|
-
|
38
|
+
build_manager.define_file(name, *deps, &block)
|
16
39
|
end
|
17
40
|
|
18
41
|
# Build a file.
|
19
42
|
def build(file)
|
20
|
-
|
43
|
+
build_manager.call(file)
|
21
44
|
end
|
22
45
|
|
23
46
|
private
|
24
47
|
|
25
48
|
#
|
26
|
-
def parse_build_dependencies
|
49
|
+
def parse_build_dependencies(name_deps, &block)
|
27
50
|
if Hash===name_deps
|
28
51
|
name = name_deps.keys[0]
|
29
52
|
deps = name_deps.values[0]
|
@@ -31,7 +54,7 @@ module Ratch
|
|
31
54
|
name = name_deps
|
32
55
|
deps = []
|
33
56
|
end
|
34
|
-
[name,
|
57
|
+
[name, deps, block]
|
35
58
|
end
|
36
59
|
end
|
37
60
|
|
@@ -40,33 +63,55 @@ module Ratch
|
|
40
63
|
class BuildManager
|
41
64
|
attr :builds
|
42
65
|
|
43
|
-
def initialize
|
44
|
-
@
|
66
|
+
def initialize(runspace)
|
67
|
+
@runspace = runspace
|
68
|
+
@builds = []
|
45
69
|
end
|
46
70
|
|
71
|
+
def force? ; @runspace.force? ; end
|
72
|
+
|
73
|
+
# Define a file build task.
|
47
74
|
def define_file(name, *depend, &block)
|
48
75
|
build = Build.new(name, *depend, &block)
|
49
|
-
builds
|
76
|
+
builds << build
|
50
77
|
end
|
51
78
|
|
52
|
-
#
|
53
|
-
def call(
|
54
|
-
|
55
|
-
#
|
79
|
+
# Call build.
|
80
|
+
def call(path)
|
81
|
+
# TODO How to handle more than one matching means of building?
|
82
|
+
#warn "More than one build definition matches #{path} using #{means.first}" if means.size > 1
|
83
|
+
if build = find(path)
|
84
|
+
if build.needed_for?(path) || force?
|
85
|
+
list, todo = *plan(build, path)
|
86
|
+
todo.each{|bld, pth| bld.call(pth) } #@builds[name].call }
|
87
|
+
build.call(path)
|
88
|
+
end
|
89
|
+
else
|
90
|
+
raise
|
91
|
+
end
|
56
92
|
end
|
57
93
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
94
|
+
def find(path)
|
95
|
+
builds.find{ |b| b.match?(path) }
|
96
|
+
end
|
97
|
+
|
98
|
+
# Prepare plan, checking for circular dependencies.
|
99
|
+
def plan(build, path, list=[], todo=[])
|
100
|
+
#if list.include?(build)
|
101
|
+
# raise "Circular build dependency #{build.name}."
|
102
|
+
#end
|
103
|
+
|
104
|
+
build.needed_paths.each do |npath|
|
105
|
+
next if list.include?(npath)
|
106
|
+
if nbuild = find(npath)
|
107
|
+
plan(nbuild, npath, list, todo)
|
108
|
+
todo << [nbuild, npath]
|
109
|
+
else
|
110
|
+
list << npath
|
111
|
+
end
|
67
112
|
end
|
68
|
-
|
69
|
-
return list
|
113
|
+
|
114
|
+
return list, todo
|
70
115
|
end
|
71
116
|
|
72
117
|
end
|
@@ -75,33 +120,63 @@ module Ratch
|
|
75
120
|
#
|
76
121
|
class Build
|
77
122
|
|
78
|
-
attr :
|
79
|
-
attr :
|
123
|
+
attr :match
|
124
|
+
attr :needs
|
80
125
|
attr :action
|
81
126
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
127
|
+
alias_method :name, :match
|
128
|
+
|
129
|
+
# Create a new build definition.
|
130
|
+
|
131
|
+
def initialize(match, *needs, &action)
|
132
|
+
@match = match
|
133
|
+
@needs = needs
|
86
134
|
@action = action
|
87
135
|
end
|
88
136
|
|
89
|
-
#
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
!File.exist?(file) || File.mtime(file) > mtime
|
97
|
-
end
|
98
|
-
else
|
99
|
-
needs = true
|
137
|
+
# Call this build process for the given path.
|
138
|
+
|
139
|
+
def call(path)
|
140
|
+
if File.exist?(path)
|
141
|
+
mtime = File.mtime(path)
|
142
|
+
dated = needs.find do |file|
|
143
|
+
!File.exist?(file) || File.mtime(file) > mtime
|
100
144
|
end
|
101
|
-
|
145
|
+
else
|
146
|
+
dated = true
|
147
|
+
end
|
148
|
+
action.call(path) if dated
|
149
|
+
end
|
150
|
+
|
151
|
+
# Does a file match this build definition?
|
152
|
+
|
153
|
+
def match?(path)
|
154
|
+
case match
|
155
|
+
when String
|
156
|
+
File.fnmatch(match, path)
|
157
|
+
when Regexp
|
158
|
+
match =~ path
|
159
|
+
else
|
160
|
+
false # ???
|
102
161
|
end
|
103
162
|
end
|
104
163
|
|
164
|
+
# Is this build needed to update/create path?
|
165
|
+
|
166
|
+
def needed_for?(path)
|
167
|
+
return true unless File.exist?(path)
|
168
|
+
mtimes = needed_paths.collect{|f| File.mtime(f)}
|
169
|
+
mtimes.max > File.mtime(path)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Glob expanded needs.
|
173
|
+
|
174
|
+
def needed_paths
|
175
|
+
#exact = needs.select{|n| File.fnmatch?(n,n)} +
|
176
|
+
exact = needs.select{|n| n !~ /[\[*?]/ }
|
177
|
+
globs = needs.collect{|n| Dir.glob(n)}.flatten
|
178
|
+
(exact + globs).uniq
|
179
|
+
end
|
180
|
+
|
105
181
|
end
|
106
182
|
end
|
107
|
-
|
data/lib/ratch/configutils.rb
CHANGED
@@ -1,11 +1,38 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# ConfigUtils
|
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
26
|
module ConfigUtils
|
5
27
|
|
6
|
-
DEFAULT_CONFIG_FILE = 'config'
|
28
|
+
#DEFAULT_CONFIG_FILE = '{config, config/general}'
|
7
29
|
|
30
|
+
# Load configuration data from a file. The file will
|
31
|
+
# be looked for in the current script directory then
|
32
|
+
# from the project root.
|
8
33
|
#
|
34
|
+
# Since they are YAML files, they can optionally
|
35
|
+
# end with '.yaml' or '.yml'.
|
9
36
|
|
10
37
|
def configuration(file=nil)
|
11
38
|
@configuration ||= {}
|
@@ -18,32 +45,35 @@ module Ratch
|
|
18
45
|
)
|
19
46
|
end
|
20
47
|
|
48
|
+
# If a +path+ is given it will first be looked for in the config directory of
|
49
|
+
# the utility directory. If not there, then it will be looked for in the project's trunk.
|
21
50
|
#
|
51
|
+
# If +path+ is not given then config.yaml or config/general.yaml will be used.
|
22
52
|
|
23
53
|
def config_file(path=nil)
|
24
|
-
path
|
25
|
-
|
26
|
-
|
54
|
+
if path
|
55
|
+
find = "{#{utility_directory}/config/,}#{path}{.yaml,.yml,}"
|
56
|
+
else
|
57
|
+
#path = DEFAULT_CONFIG_FILE
|
58
|
+
find = "{#{utility_directory}/config,#{utility_directory}/config/general}{.yaml,.yml,}"
|
59
|
+
end
|
60
|
+
file = Dir.glob(find).find{ |f| File.file?(f) }
|
27
61
|
return file
|
28
62
|
end
|
29
63
|
|
30
|
-
# Load configuration data from a file. THe file will
|
31
|
-
# be looked for in the current script directory then
|
32
|
-
# from the project root.
|
33
64
|
#
|
34
|
-
# Since they are YAML files, they can optionally
|
35
|
-
# end with '.yaml' or '.yml'.
|
36
65
|
|
37
66
|
def config_read(path)
|
38
|
-
find = "{#{utility_directory}/,}#{path}{.yaml,.yml,}"
|
39
|
-
if file = Dir.glob(find)[0]
|
40
|
-
|
67
|
+
#find = "{#{utility_directory}/,}#{path}{.yaml,.yml,}"
|
68
|
+
#if file = Dir.glob(find)[0]
|
69
|
+
if File.file?(path)
|
70
|
+
YAML::load(File.open(path)) || {} # The || {} is in case the file is empty.
|
41
71
|
else
|
42
72
|
raise LoadError, "Missing file -- #{path}"
|
43
73
|
end
|
44
74
|
end
|
45
75
|
|
46
|
-
# TODO Better name? Better definition? (Won't handle task subdirs
|
76
|
+
# TODO Better name? Better definition? (Won't handle task subdirs!).
|
47
77
|
|
48
78
|
def utility_directory
|
49
79
|
File.dirname($0)
|
data/lib/ratch/consoleutils.rb
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
# TITLE:
|
2
|
+
#
|
3
|
+
# ConsoleUtils
|
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
|
module ConsoleUtils
|
@@ -39,42 +62,74 @@ end
|
|
39
62
|
|
40
63
|
class Array
|
41
64
|
|
65
|
+
# Not empty?
|
66
|
+
|
67
|
+
def not_empty?
|
68
|
+
!empty?
|
69
|
+
end
|
70
|
+
|
42
71
|
# Convert an array into command line parameters.
|
43
72
|
# The array is accepted in the format of Ruby
|
44
73
|
# method arguments --ie. [arg1, arg2, ..., hash]
|
45
74
|
|
46
|
-
def
|
75
|
+
def to_console
|
47
76
|
flags = (Hash===last ? pop : {})
|
48
|
-
flags = flags.
|
77
|
+
flags = flags.to_console
|
78
|
+
flags + ' ' + join(" ")
|
79
|
+
end
|
80
|
+
alias_method :to_params, :to_console
|
81
|
+
|
82
|
+
# def to_console
|
83
|
+
# flags = (Hash===last ? pop : {})
|
84
|
+
# flags = flags.collect do |f,v|
|
85
|
+
# m = f.to_s.size == 1 ? '-' : '--'
|
86
|
+
# case v
|
87
|
+
# when Array
|
88
|
+
# v.collect{ |e| "#{m}#{f} '#{e}'" }.join(' ')
|
89
|
+
# when true
|
90
|
+
# "#{m}#{f}"
|
91
|
+
# when false, nil
|
92
|
+
# ''
|
93
|
+
# else
|
94
|
+
# "#{m}#{f} '#{v}'"
|
95
|
+
# end
|
96
|
+
# end
|
97
|
+
# return (flags + self).join(" ")
|
98
|
+
# end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
class Hash
|
104
|
+
|
105
|
+
# Convert an array into command line parameters.
|
106
|
+
# The array is accepted in the format of Ruby
|
107
|
+
# method arguments --ie. [arg1, arg2, ..., hash]
|
108
|
+
|
109
|
+
def to_console
|
110
|
+
flags = collect do |f,v|
|
49
111
|
m = f.to_s.size == 1 ? '-' : '--'
|
50
112
|
case v
|
51
113
|
when Array
|
52
|
-
v.collect{ |e| "#{m}#{f}
|
114
|
+
v.collect{ |e| "#{m}#{f}='#{e}'" }.join(' ')
|
53
115
|
when true
|
54
116
|
"#{m}#{f}"
|
55
117
|
when false, nil
|
56
118
|
''
|
57
119
|
else
|
58
|
-
"#{m}#{f}
|
120
|
+
"#{m}#{f}='#{v}'"
|
59
121
|
end
|
60
122
|
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
# Not empty?
|
65
|
-
|
66
|
-
def not_empty?
|
67
|
-
!empty?
|
123
|
+
flags.join(" ")
|
68
124
|
end
|
69
125
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
#
|
76
|
-
|
77
|
-
def command_vector(args_field=nil)
|
126
|
+
# Turn a hash into arguments.
|
127
|
+
#
|
128
|
+
# h = { :list => [1,2], :base => "HI" }
|
129
|
+
# h.argumentize #=> [ [], { :list => [1,2], :base => "HI" } ]
|
130
|
+
# h.argumentize(:list) #=> [ [1,2], { :base => "HI" } ]
|
131
|
+
#
|
132
|
+
def argumentize(args_field=nil)
|
78
133
|
config = dup
|
79
134
|
if args_field
|
80
135
|
args = [config.delete(args_field)].flatten.compact
|
@@ -85,4 +140,6 @@ class Hash
|
|
85
140
|
return args
|
86
141
|
end
|
87
142
|
|
143
|
+
alias_method :command_vector, :argumentize
|
144
|
+
|
88
145
|
end
|
data/lib/ratch/emailutils.rb
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
|
2
|
+
# TITLE:
|
3
|
+
#
|
4
|
+
# EmailUtils
|
5
|
+
#
|
6
|
+
# COPYING:
|
7
|
+
#
|
8
|
+
# Copyright (c) 2007 Psi T Corp.
|
9
|
+
#
|
10
|
+
# This file is part of the ProUtils' Ratch program.
|
11
|
+
#
|
12
|
+
# Ratch is free software: you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
14
|
+
# the Free Software Foundation, either version 3 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
#
|
17
|
+
# Ratch is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20
|
+
# GNU General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU General Public License
|
23
|
+
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
24
|
+
|
1
25
|
begin
|
2
26
|
require 'facets/net/smtp_tls'
|
3
27
|
rescue LoadError
|