tap 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History +9 -0
- data/README +1 -0
- data/bin/tap +7 -45
- data/cmd/manifest.rb +94 -0
- data/cmd/run.rb +1 -1
- data/lib/tap.rb +0 -5
- data/lib/tap/constants.rb +1 -1
- data/lib/tap/env.rb +195 -187
- data/lib/tap/exe.rb +63 -0
- data/lib/tap/file_task.rb +33 -8
- data/lib/tap/generator/base.rb +7 -28
- data/lib/tap/generator/generators/root/root_generator.rb +21 -15
- data/lib/tap/generator/generators/root/templates/Rakefile +1 -1
- data/lib/tap/generator/generators/root/templates/gemspec +2 -1
- data/lib/tap/patches/rake/testtask.rb +2 -0
- data/lib/tap/support/class_configuration.rb +5 -6
- data/lib/tap/support/configurable_class.rb +15 -18
- data/lib/tap/support/configuration.rb +8 -6
- data/lib/tap/support/declarations.rb +2 -2
- data/lib/tap/support/framework.rb +14 -2
- data/lib/tap/support/framework_class.rb +13 -32
- data/lib/tap/support/gems.rb +63 -0
- data/lib/tap/support/gems/rake.rb +90 -0
- data/lib/tap/support/instance_configuration.rb +8 -8
- data/lib/tap/support/lazy_attributes.rb +30 -0
- data/lib/tap/support/lazydoc.rb +65 -33
- data/lib/tap/support/manifest.rb +117 -54
- data/lib/tap/tasks/rake.rb +1 -0
- data/lib/tap/test/script_methods.rb +34 -71
- data/lib/tap/test/script_methods/script_test.rb +98 -0
- data/lib/tap/test/tap_methods.rb +1 -5
- data/lib/tap/workflow.rb +47 -34
- metadata +8 -2
data/lib/tap/test/tap_methods.rb
CHANGED
@@ -173,8 +173,6 @@ module Tap
|
|
173
173
|
assert_audit_records_equal(expected, actual, nesting)
|
174
174
|
end
|
175
175
|
|
176
|
-
private
|
177
|
-
|
178
176
|
def assert_audit_records_equal(expected, actual, nesting=[])
|
179
177
|
assert_equal ExpAudit, expected.class
|
180
178
|
assert_equal expected.length, actual.length, "unequal number of records"
|
@@ -192,9 +190,7 @@ module Tap
|
|
192
190
|
end
|
193
191
|
end
|
194
192
|
end
|
195
|
-
|
196
|
-
public
|
197
|
-
|
193
|
+
|
198
194
|
# The configurations used to initialize self.app
|
199
195
|
def app_config
|
200
196
|
{ :root => method_root,
|
data/lib/tap/workflow.rb
CHANGED
@@ -78,6 +78,27 @@ module Tap
|
|
78
78
|
#
|
79
79
|
class Workflow
|
80
80
|
include Support::Framework
|
81
|
+
|
82
|
+
class << self
|
83
|
+
protected
|
84
|
+
|
85
|
+
def define(name, klass=Tap::Task, &block)
|
86
|
+
instance_var = "@#{name}".to_sym
|
87
|
+
|
88
|
+
define_method(name) do |*args|
|
89
|
+
raise ArgumentError, "wrong number of arguments (#{args.length} for 1)" if args.length > 1
|
90
|
+
|
91
|
+
instance_name = args[0] || name
|
92
|
+
instance_variable_set(instance_var, {}) unless instance_variable_defined?(instance_var)
|
93
|
+
instance_variable_get(instance_var)[instance_name] ||= task(instance_name, klass, &block)
|
94
|
+
end
|
95
|
+
|
96
|
+
define_method("#{name}=") do |input|
|
97
|
+
input = {name => input} unless input.kind_of?(Hash)
|
98
|
+
instance_variable_set(instance_var, input)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
81
102
|
|
82
103
|
# The entry point for self.
|
83
104
|
attr_accessor :entry_point
|
@@ -103,25 +124,31 @@ module Tap
|
|
103
124
|
initialize_workflow
|
104
125
|
end
|
105
126
|
|
127
|
+
def initialize_workflow
|
128
|
+
@entry_point = {}
|
129
|
+
@exit_point = {}
|
130
|
+
workflow
|
131
|
+
end
|
132
|
+
|
106
133
|
# Returns an array of entry points, determined from entry_point.
|
107
134
|
def entry_points
|
108
|
-
case entry_point
|
109
|
-
when Hash then entry_point.values
|
110
|
-
when Support::Executable then [entry_point]
|
111
|
-
when Array then entry_point
|
112
|
-
|
113
|
-
|
135
|
+
case @entry_point
|
136
|
+
when Hash then @entry_point.values
|
137
|
+
when Support::Executable then [@entry_point]
|
138
|
+
when Array then @entry_point
|
139
|
+
when nil then []
|
140
|
+
else raise "unable to determine entry points from entry_point: #{@entry_point}"
|
114
141
|
end
|
115
142
|
end
|
116
143
|
|
117
144
|
# Returns an array of exit points, determined from exit_point.
|
118
145
|
def exit_points
|
119
|
-
case exit_point
|
120
|
-
when Hash then exit_point.values
|
121
|
-
when Support::Executable then [exit_point]
|
122
|
-
when Array then exit_point
|
123
|
-
|
124
|
-
|
146
|
+
case @exit_point
|
147
|
+
when Hash then @exit_point.values
|
148
|
+
when Support::Executable then [@exit_point]
|
149
|
+
when Array then @exit_point
|
150
|
+
when nil then []
|
151
|
+
else raise "unable to determine exit points from exit_point: #{@exit_point}"
|
125
152
|
end
|
126
153
|
end
|
127
154
|
|
@@ -149,36 +176,22 @@ module Tap
|
|
149
176
|
end
|
150
177
|
|
151
178
|
batch_function(:on_complete) {}
|
152
|
-
|
179
|
+
|
180
|
+
def task(name, klass=Tap::Task, &block)
|
181
|
+
configs = config[name] || {}
|
182
|
+
raise ArgumentError, "config '#{name}' is not a hash" unless configs.kind_of?(Hash)
|
183
|
+
klass.new(configs, name, &block)
|
184
|
+
end
|
185
|
+
|
153
186
|
# The workflow definition method. By default workflow
|
154
187
|
# simply calls the task_block. In subclasses, workflow
|
155
188
|
# should be overridden to provide the workflow definition.
|
156
189
|
def workflow
|
157
|
-
|
158
|
-
task_block.call(self)
|
159
|
-
end
|
160
|
-
|
161
|
-
class WorkflowError < Exception # :nodoc:
|
162
|
-
end
|
163
|
-
|
164
|
-
# Returns the name of the workflow joined to the input. This
|
165
|
-
# can be convenient when naming internal tasks, as they can
|
166
|
-
# be grouped based on the name of the workflow. Returns
|
167
|
-
# the name of the workflow if input == nil.
|
168
|
-
def name(input=nil)
|
169
|
-
input == nil ? @name : File.join(@name, input)
|
190
|
+
task_block.call(self) if task_block
|
170
191
|
end
|
171
192
|
|
172
193
|
protected
|
173
194
|
|
174
|
-
def initialize_workflow
|
175
|
-
@entry_point = {}
|
176
|
-
@exit_point = {}
|
177
|
-
|
178
|
-
workflow
|
179
|
-
raise WorkflowError.new("No entry points defined") if entry_points.empty?
|
180
|
-
end
|
181
|
-
|
182
195
|
# Hook to set a default task block. By default, nil.
|
183
196
|
def default_task_block
|
184
197
|
nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-21 00:00:00 -06:00
|
13
13
|
default_executable: tap
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- cmd/console.rb
|
34
34
|
- cmd/destroy.rb
|
35
35
|
- cmd/generate.rb
|
36
|
+
- cmd/manifest.rb
|
36
37
|
- cmd/run.rb
|
37
38
|
- doc/Tutorial
|
38
39
|
- doc/Class Reference
|
@@ -41,6 +42,7 @@ files:
|
|
41
42
|
- lib/tap/app.rb
|
42
43
|
- lib/tap/constants.rb
|
43
44
|
- lib/tap/env.rb
|
45
|
+
- lib/tap/exe.rb
|
44
46
|
- lib/tap/file_task.rb
|
45
47
|
- lib/tap/generator/base.rb
|
46
48
|
- lib/tap/generator/destroy.rb
|
@@ -89,7 +91,10 @@ files:
|
|
89
91
|
- lib/tap/support/executable_queue.rb
|
90
92
|
- lib/tap/support/framework.rb
|
91
93
|
- lib/tap/support/framework_class.rb
|
94
|
+
- lib/tap/support/gems/rake.rb
|
95
|
+
- lib/tap/support/gems.rb
|
92
96
|
- lib/tap/support/instance_configuration.rb
|
97
|
+
- lib/tap/support/lazy_attributes.rb
|
93
98
|
- lib/tap/support/lazydoc.rb
|
94
99
|
- lib/tap/support/manifest.rb
|
95
100
|
- lib/tap/support/run_error.rb
|
@@ -107,6 +112,7 @@ files:
|
|
107
112
|
- lib/tap/test/env_vars.rb
|
108
113
|
- lib/tap/test/file_methods.rb
|
109
114
|
- lib/tap/test/script_methods.rb
|
115
|
+
- lib/tap/test/script_methods/script_test.rb
|
110
116
|
- lib/tap/test/subset_methods.rb
|
111
117
|
- lib/tap/test/tap_methods.rb
|
112
118
|
- lib/tap/test.rb
|