tubes 0.1.14 → 0.1.15
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/lib/tubes.rb +20 -11
- metadata +2 -2
data/lib/tubes.rb
CHANGED
@@ -74,12 +74,13 @@ class Tube
|
|
74
74
|
|
75
75
|
def invoke(klass, *args)
|
76
76
|
@invocations += 1
|
77
|
-
|
77
|
+
|
78
|
+
dir = File.join(@dir, "#{description(klass)}")
|
78
79
|
segment = klass.new dir, :order => @order, :parent => self
|
79
80
|
|
80
|
-
output_file = segment_cache
|
81
|
+
output_file = segment_cache segment
|
81
82
|
if output_file && File.exists?(output_file)
|
82
|
-
self.puts "Skipping: #{
|
83
|
+
self.puts "Skipping: #{@order}-#{@invocations}-#{segment.name}"
|
83
84
|
output = JSON.load(File.read(output_file))["data"]
|
84
85
|
|
85
86
|
if serial?
|
@@ -106,6 +107,14 @@ class Tube
|
|
106
107
|
end
|
107
108
|
|
108
109
|
|
110
|
+
def description(klass)
|
111
|
+
if @order.present?
|
112
|
+
"#{@order}-#{@invocations}-#{underscore(klass.name.split('::')[-1])}"
|
113
|
+
else
|
114
|
+
"#{@invocations}-#{underscore(klass.name.split('::')[-1])}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
109
118
|
def puts(string='')
|
110
119
|
@thread_lock.synchronize do
|
111
120
|
unlocked_puts(string)
|
@@ -185,7 +194,11 @@ class Tube
|
|
185
194
|
end
|
186
195
|
end
|
187
196
|
else
|
188
|
-
|
197
|
+
if options.present?
|
198
|
+
segment.send :run, *args, options
|
199
|
+
else
|
200
|
+
segment.send :run, *args
|
201
|
+
end
|
189
202
|
end
|
190
203
|
end
|
191
204
|
|
@@ -197,11 +210,7 @@ class Tube
|
|
197
210
|
elsif segment.method(:run).arity < 0
|
198
211
|
run_with_args(segment, args, options)
|
199
212
|
else
|
200
|
-
|
201
|
-
segment.send :run, options
|
202
|
-
else
|
203
|
-
segment.send :run
|
204
|
-
end
|
213
|
+
segment.send :run
|
205
214
|
end
|
206
215
|
|
207
216
|
if output_file
|
@@ -220,8 +229,8 @@ class Tube
|
|
220
229
|
end
|
221
230
|
|
222
231
|
|
223
|
-
def segment_cache(
|
224
|
-
File.join(
|
232
|
+
def segment_cache(segment)
|
233
|
+
File.join(@dir, "#{description(segment.class)}.json") if segment.dir
|
225
234
|
end
|
226
235
|
|
227
236
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tubes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple way to build a pipeline of tasks. These tasks can be configured
|
15
15
|
to run in serial, parallel or any combination thereof.
|