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
@@ -1,160 +0,0 @@
|
|
1
|
-
# TITLE:
|
2
|
-
#
|
3
|
-
# Multiglob
|
4
|
-
#
|
5
|
-
# SUMMARY:
|
6
|
-
#
|
7
|
-
# Dir extensions for globbing multiple locations at once.
|
8
|
-
#
|
9
|
-
# COPYING:
|
10
|
-
#
|
11
|
-
# Copyright (c) 2007 Psi T Corp.
|
12
|
-
#
|
13
|
-
# This file is part of the ProUtils' Ratch program.
|
14
|
-
#
|
15
|
-
# Ratch is free software: you can redistribute it and/or modify
|
16
|
-
# it under the terms of the GNU General Public License as published by
|
17
|
-
# the Free Software Foundation, either version 3 of the License, or
|
18
|
-
# (at your option) any later version.
|
19
|
-
#
|
20
|
-
# Ratch is distributed in the hope that it will be useful,
|
21
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23
|
-
# GNU General Public License for more details.
|
24
|
-
#
|
25
|
-
# You should have received a copy of the GNU General Public License
|
26
|
-
# along with Ratch. If not, see <http://www.gnu.org/licenses/>.
|
27
|
-
|
28
|
-
#
|
29
|
-
class Dir
|
30
|
-
|
31
|
-
# Like +glob+ but can take multiple patterns.
|
32
|
-
#
|
33
|
-
# Dir.multiglob( '*.rb', '*.py' )
|
34
|
-
#
|
35
|
-
# Rather then constants for options multiglob accepts a trailing options
|
36
|
-
# hash of symbol keys.
|
37
|
-
#
|
38
|
-
# :noescape File::FNM_NOESCAPE
|
39
|
-
# :casefold File::FNM_CASEFOLD
|
40
|
-
# :pathname File::FNM_PATHNAME
|
41
|
-
# :dotmatch File::FNM_DOTMATCH
|
42
|
-
# :strict File::FNM_PATHNAME && File::FNM_DOTMATCH
|
43
|
-
#
|
44
|
-
# It also has an option for recurse.
|
45
|
-
#
|
46
|
-
# :recurse Recurively include contents of directories.
|
47
|
-
#
|
48
|
-
# For example
|
49
|
-
#
|
50
|
-
# Dir.multiglob( '*', :recurse => true )
|
51
|
-
#
|
52
|
-
# would have the same result as
|
53
|
-
#
|
54
|
-
# Dir.multiglob('**/*')
|
55
|
-
#
|
56
|
-
# Multiglob also accepts '+' and '-' prefixes. Any entry that begins with a '-'
|
57
|
-
# is treated as an exclusion glob and will be removed from the final result.
|
58
|
-
# For example, to collect all files in the current directory, less ruby scripts:
|
59
|
-
#
|
60
|
-
# Dir.multiglob( '*', '-*.rb' )
|
61
|
-
#
|
62
|
-
# This is very useful in collecting files as specificed by a configuration
|
63
|
-
# parameter.
|
64
|
-
|
65
|
-
def self.multiglob( *patterns )
|
66
|
-
options = (Hash === patterns.last ? patterns.pop : {})
|
67
|
-
|
68
|
-
bitflags = 0
|
69
|
-
bitflags |= File::FNM_NOESCAPE if options[:noescape]
|
70
|
-
bitflags |= File::FNM_CASEFOLD if options[:casefold]
|
71
|
-
bitflags |= File::FNM_PATHNAME if options[:pathname] or options[:strict]
|
72
|
-
bitflags |= File::FNM_DOTMATCH if options[:dotmatch] or options[:strict]
|
73
|
-
|
74
|
-
patterns = [patterns].flatten.compact
|
75
|
-
|
76
|
-
patterns_include = patterns.select{ |f| f !~ /^[-]/ }
|
77
|
-
patterns_exclude = patterns.select{ |f| f =~ /^[-]/ }
|
78
|
-
|
79
|
-
patterns_include.collect!{ |f| f =~ /^[+]/ ? f[1..-1] : f }
|
80
|
-
patterns_exclude.collect!{ |f| f =~ /^[-]/ ? f[1..-1] : f }
|
81
|
-
|
82
|
-
if options[:recurse]
|
83
|
-
patterns_include += patterns_include.collect{ |f| File.join(f, '**', '*') }
|
84
|
-
patterns_exclude += patterns_exclude.collect{ |f| File.join(f, '**', '*') }
|
85
|
-
end
|
86
|
-
|
87
|
-
files = []
|
88
|
-
files += patterns_include.collect{ |pattern| Dir.glob(pattern, bitflags) }.flatten.uniq
|
89
|
-
files -= patterns_exclude.collect{ |pattern| Dir.glob(pattern, bitflags) }.flatten.uniq
|
90
|
-
|
91
|
-
return files
|
92
|
-
end
|
93
|
-
|
94
|
-
# The same as +multiglob+, but recusively includes directories.
|
95
|
-
#
|
96
|
-
# Dir.multiglob_r( 'folder' )
|
97
|
-
#
|
98
|
-
# is equivalent to
|
99
|
-
#
|
100
|
-
# Dir.multiglob( 'folder', :recurse=>true )
|
101
|
-
#
|
102
|
-
# The effect of which is
|
103
|
-
#
|
104
|
-
# Dir.multiglob( 'folder', 'folder/**/*' )
|
105
|
-
|
106
|
-
def self.multiglob_r( *patterns )
|
107
|
-
options = (Hash === patterns.last ? patterns.pop : {})
|
108
|
-
options[:recurse] = true
|
109
|
-
patterns << options
|
110
|
-
multiglob(*patterns)
|
111
|
-
end
|
112
|
-
|
113
|
-
# This is just like multiglob but handles a base pattern such that
|
114
|
-
# if the +patterns+ list starts with a '+' or '-' entry, then the base
|
115
|
-
# will be included in the result, otherwise it will be omitted.
|
116
|
-
#
|
117
|
-
# Dir.multiglob_with_default('*.yaml', '-*.rb') #=> [ 'foo.yaml' ]
|
118
|
-
# Dir.multiglob_with_default('*.yaml', '+*.rb') #=> [ 'foo.yaml', 'foo.rb' ]
|
119
|
-
# Dir.multiglob_with_default('*.yaml', '*.rb') #=> [ 'foo.rb' ]
|
120
|
-
#
|
121
|
-
# This is useful when a configuration option needs to supply a file list
|
122
|
-
# that may include files, exclude files or append files to a default list.
|
123
|
-
#
|
124
|
-
# TODO Deprecate this and replace with :default option on regular multiglob.
|
125
|
-
|
126
|
-
def self.multiglob_with_default(default, *patterns)
|
127
|
-
default = [default].flatten.compact
|
128
|
-
patterns = patterns.flatten.compact
|
129
|
-
|
130
|
-
if patterns.empty?
|
131
|
-
patterns = default
|
132
|
-
elsif patterns.first =~ /^[+-]/
|
133
|
-
patterns = default + patterns
|
134
|
-
end
|
135
|
-
|
136
|
-
multiglob(*patterns)
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
# _____ _
|
144
|
-
# |_ _|__ ___| |_
|
145
|
-
# | |/ _ \/ __| __|
|
146
|
-
# | | __/\__ \ |_
|
147
|
-
# |_|\___||___/\__|
|
148
|
-
#
|
149
|
-
|
150
|
-
# TODO Need to mock file system.
|
151
|
-
|
152
|
-
=begin #no test yet
|
153
|
-
|
154
|
-
require 'test/unit'
|
155
|
-
|
156
|
-
class TestDir < Test::Unit::TestCase
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
=end
|
data/lib/ratch/taskable.rb
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
# TITLE:
|
2
|
-
#
|
3
|
-
# Taskable
|
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
|
-
module Ratch
|
25
|
-
|
26
|
-
# = Taskable Mixin
|
27
|
-
#
|
28
|
-
module Taskable
|
29
|
-
|
30
|
-
# Reference task manager.
|
31
|
-
def task_manager
|
32
|
-
@task_manager ||= TaskManager.new(self)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Define a main task.
|
36
|
-
def main(name, &block)
|
37
|
-
name, deps, block = *parse_task_dependencies(name, &block)
|
38
|
-
task_manager.define_main(name, *deps, &block)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Define a task.
|
42
|
-
def task(name, &block)
|
43
|
-
name, deps, block = *parse_task_dependencies(name, &block)
|
44
|
-
task_manager.define_task(name, *deps, &block)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Run a task.
|
48
|
-
def run(name)
|
49
|
-
task_manager.call(name)
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
#
|
55
|
-
def parse_task_dependencies(name_deps, &block)
|
56
|
-
if Hash===name_deps
|
57
|
-
name = name_deps.keys[0]
|
58
|
-
deps = name_deps.values[0]
|
59
|
-
else
|
60
|
-
name = name_deps
|
61
|
-
deps = []
|
62
|
-
end
|
63
|
-
[name, deps, block]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# = TaskManager Class
|
68
|
-
#
|
69
|
-
class TaskManager
|
70
|
-
attr :main
|
71
|
-
attr :tasks
|
72
|
-
attr :runspace
|
73
|
-
|
74
|
-
def initialize(runspace)
|
75
|
-
@runspace = runspace
|
76
|
-
@main = nil
|
77
|
-
@tasks = {}
|
78
|
-
end
|
79
|
-
|
80
|
-
def define_main(name=nil, *depend, &block)
|
81
|
-
@main = Task.new(name, *depend, &block)
|
82
|
-
tasks[@main.name] = @main
|
83
|
-
end
|
84
|
-
|
85
|
-
def define_task(name, *depend, &block)
|
86
|
-
task = Task.new(name, *depend, &block)
|
87
|
-
tasks[task.name] = task
|
88
|
-
end
|
89
|
-
|
90
|
-
def call_main
|
91
|
-
return unless @main
|
92
|
-
call(@main.name)
|
93
|
-
end
|
94
|
-
|
95
|
-
# Call task.
|
96
|
-
def call(name)
|
97
|
-
plan(name).each{ |name| @tasks[name].call }
|
98
|
-
#action_call
|
99
|
-
end
|
100
|
-
|
101
|
-
# Prepare plan, checking for circular dependencies.
|
102
|
-
def plan(name, list=[])
|
103
|
-
if list.include?(name)
|
104
|
-
raise "Circular dependency #{name}."
|
105
|
-
end
|
106
|
-
if task = @tasks[name]
|
107
|
-
task.needs.each do |need|
|
108
|
-
need = need.to_s
|
109
|
-
next if list.include?(need)
|
110
|
-
#@tasks[need].plan(need, list)
|
111
|
-
plan(need, list)
|
112
|
-
end
|
113
|
-
list << task.name
|
114
|
-
else
|
115
|
-
if fname = runspace.batch?(name) # TODO THIS TIES TASKS INTO BATCH, BETTER WAY?
|
116
|
-
task = Task.new(name) do
|
117
|
-
runspace.batch(fname)
|
118
|
-
end
|
119
|
-
@tasks[name] = task
|
120
|
-
list << task.name
|
121
|
-
else
|
122
|
-
abort "no task -- #{name}"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
return list
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
# = Task class
|
131
|
-
#
|
132
|
-
class Task
|
133
|
-
|
134
|
-
attr :name
|
135
|
-
attr :needs
|
136
|
-
attr :action
|
137
|
-
|
138
|
-
#
|
139
|
-
def initialize(name, *needs, &action)
|
140
|
-
@name = name.to_s
|
141
|
-
@needs = needs
|
142
|
-
@action = action
|
143
|
-
end
|
144
|
-
|
145
|
-
#
|
146
|
-
def call
|
147
|
-
@action.call if @action
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
end #module Ratch
|
data/log/recent.rd
DELETED