tubes 0.1.20 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/tubes.rb +15 -7
  2. metadata +2 -2
@@ -5,8 +5,8 @@ class Tube
5
5
  attr :dir
6
6
  attr :ended_at
7
7
  attr :exception
8
+ attr :invocations
8
9
  attr :name
9
- attr :order
10
10
  attr :input
11
11
  attr :output
12
12
  attr :started_at
@@ -29,7 +29,7 @@ class Tube
29
29
  @stats = @parent ? @parent.stats : {}
30
30
 
31
31
  @name = underscore self.class.name.split('::')[-1]
32
- @order = options.delete(:order) || ''
32
+ @order = options.delete(:order)
33
33
 
34
34
  @input = options.delete(:input)
35
35
  @output = serial? ? nil : []
@@ -82,7 +82,7 @@ class Tube
82
82
 
83
83
  output_file = segment_cache segment
84
84
  if output_file && File.exists?(output_file)
85
- self.puts "Skipping: #{@order}-#{@invocations}-#{segment.name}"
85
+ segment.puts "\033[0;35mSkipping\033[0m"
86
86
  output = YAML.load(File.read(output_file))[:data]
87
87
 
88
88
  if serial?
@@ -94,7 +94,7 @@ class Tube
94
94
  end
95
95
  end
96
96
  else
97
- self.puts "Running: #{segment.name}"
97
+ segment.puts "\033[0;32mRunning\033[0m"
98
98
 
99
99
  if serial?
100
100
  dispatch(segment, output_file, *args)
@@ -127,10 +127,18 @@ class Tube
127
127
 
128
128
 
129
129
  def unlocked_puts(string='')
130
- if self.class == Tube
131
- Kernel.puts "\033[32m[#{@order}]\033[0m #{string}"
130
+ if self.class == Tube || @parent.nil? # If @parent is missing, it is in the top level block.
131
+ if @order
132
+ Kernel.puts "\033[32m[#{@order}][#{@invocations}]\033[0m #{string}"
133
+ else
134
+ Kernel.puts "\033[33m[#{@invocations}]\033[0m #{string}"
135
+ end
132
136
  else
133
- Kernel.puts "\033[32m[#{@order}]\033[0m\033[36m[#{@name}]\033[0m #{string}"
137
+ if @order
138
+ Kernel.puts "\033[32m[#{@order}][#{@name}][#{@parent.invocations}]\033[0m #{string}"
139
+ else
140
+ Kernel.puts "\033[32m[#{@name}][#{@parent.invocations}]\033[0m #{string}"
141
+ end
134
142
  end
135
143
 
136
144
  STDOUT.flush
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.20
4
+ version: 0.2.1
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-12-26 00:00:00.000000000 Z
12
+ date: 2013-01-08 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.