rbbt-util 5.17.17 → 5.17.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93a138cf7e724b74445c53a3afb9e728df0ea293
4
- data.tar.gz: ea7ad0564a6777c5eb64c57e42d8c8aded6c735e
3
+ metadata.gz: df2f1977b609e8ee620bf7f2a5318664c7ed7cbf
4
+ data.tar.gz: f8107c1ea077494713357cfe4b37289fcb1103ba
5
5
  SHA512:
6
- metadata.gz: 9e5684971fae54cb83485755097b298c56b74dd2d6244b73e6f1212276fdb9060cd3512e09038053adcd7f08707092c4441c78298aa2d48c249cf06d745805fb
7
- data.tar.gz: 6a7bffb98760080be7550e299c209bbad81b6ea43007400b097141e2b12f428336fbb5f703dc4de345f615584171ccfdb9a82ce4c6a9cf0cf80f76573c9442ff
6
+ metadata.gz: 5dfbc75b5b4cb08522333f438d0a40a240c29a17d3ebd37139a67d4dc7a5b236d6424b09eeb7a533d9e6f1fda1e133cca9db102de06d56ed9d9667a1c5be3855
7
+ data.tar.gz: 98a1e891119afbf2a454efd0e5ebc690be36f6deadb474c8ed9b3294f866522f3c568fe1571624015ca6653e29dffb229fef6d4074dc7d5a7ab702f06fadd1c5
data/bin/rbbt CHANGED
@@ -36,6 +36,7 @@ $ rbbt <command> <subcommand> ... -a --arg1 --arg2='value' --arg3 'another-value
36
36
 
37
37
 
38
38
  --log* #{Log.color :yellow, "Log level from 0 (debug) 6 (errors)"}
39
+ --log_file* #{Log.color :yellow, "Divert all Rbbt logs from STDERR to the file"}
39
40
  --dev* #{Log.color :yellow, "Find development libraries in the directory specified"}
40
41
  -cd--command_dir* #{Log.color :yellow, "Directory from where to load command scripts"}
41
42
  --profile #{Log.color :yellow, "Profile execution"}
@@ -50,6 +51,9 @@ EOF
50
51
 
51
52
  locate = options.delete :locate_file
52
53
 
54
+ if options[:log_file]
55
+ Log.logfile(options[:log_file])
56
+ end
53
57
  if options[:log]
54
58
  Log.severity = options[:log].to_i
55
59
  else
@@ -512,7 +512,8 @@ module TSV
512
512
  obj_options = obj.respond_to?(:options) ? obj.options : {}
513
513
  dumper = TSV::Dumper.new obj_options.merge(options)
514
514
  dumper.init
515
- traverse(obj, obj_options.merge(:into => dumper), &block)
515
+ _options = options.merge(obj_options).merge(:into => dumper)
516
+ traverse(obj, _options, &block)
516
517
  return dumper
517
518
  end
518
519
 
data/lib/rbbt/util/log.rb CHANGED
@@ -88,8 +88,19 @@ module Log
88
88
  end
89
89
  end
90
90
 
91
- def self.logfile
92
- @logfile = nil
91
+ def self.logfile(file=nil)
92
+ if file.nil?
93
+ @logfile
94
+ else
95
+ case file
96
+ when String
97
+ @logfile = File.open(file, :mode => 'a')
98
+ when IO, File
99
+ @logfile = file
100
+ else
101
+ raise "Unkown logfile format: #{file.inspect}"
102
+ end
103
+ end
93
104
  end
94
105
 
95
106
  WHITE, DARK, GREEN, YELLOW, RED = Color::SOLARIZED.values_at :base0, :base00, :green, :yellow, :magenta
@@ -124,36 +124,33 @@ class Step
124
124
 
125
125
  def run_dependencies
126
126
  @seen ||= []
127
+ seen_paths ||= Set.new
128
+
127
129
  dependencies.uniq.each do |dependency|
128
- next if seen.collect{|d| d.path}.include?(dependency.path)
129
- dependency.seen = seen
130
- @seen.concat dependency.rec_dependencies.collect{|d| d }
130
+ dependency_path = dependency.path
131
+ next if seen_paths.include? dependency_path
132
+ @seen.concat dependency.rec_dependencies
133
+ seen_paths.union(dependency.rec_dependencies.collect{|d| d.path})
131
134
  @seen << dependency
132
- @seen.uniq!
135
+ seen_paths << dependency_path
133
136
  end
134
137
 
138
+ @seen.uniq!
139
+ @seen.delete self
140
+
135
141
  return if @seen.empty?
136
142
 
143
+ log :dependencies, "#{Log.color :magenta, "Dependencies"} #{Log.color :yellow, task.name.to_s || ""}"
144
+ dupping = []
137
145
  @seen.each do |dependency|
138
- next if dependency == self
139
- if dependency.streaming? and not dependency.running?
140
- dependency.clean
141
- else
142
- dependency.clean if dependency.error? or dependency.aborted? or dependency.status.nil? or
143
- (dependency.done? and dependency.dirty?) or
144
- not (dependency.done? or dependency.running?)
145
- end
146
+ next if (dependency.done? and not dependency.dirty?) or (dependency.streaming? and dependency.running?)
147
+ dependency.clean
148
+ dupping << dependency unless dependencies.include? dependency
146
149
  end
147
150
 
148
- @seen.each do |dependency|
149
- next if dependency == self
150
- next unless dependencies.include? dependency
151
- dependency.dup_inputs
152
- end
151
+ dupping.each{|dep| dep.dup_inputs}
153
152
 
154
- log :dependencies, "#{Log.color :magenta, "Dependencies"} #{Log.color :yellow, task.name.to_s || ""}"
155
153
  @seen.each do |dependency|
156
- next if dependency == self
157
154
  next unless dependencies.include? dependency
158
155
  Log.info "#{Log.color :cyan, "dependency"} #{Log.color :yellow, task.name.to_s || ""} => #{Log.color :yellow, dependency.task_name.to_s || ""} -- #{Log.color :blue, dependency.path}"
159
156
  begin
@@ -66,8 +66,11 @@ class Step
66
66
  end
67
67
 
68
68
  def path
69
- @path = Misc.sanitize_filename(Path.setup(@path.call)) if Proc === @path
70
- @path
69
+ if Proc === @path
70
+ @path = Path.setup(Misc.sanitize_filename(@path.call))
71
+ else
72
+ @path
73
+ end
71
74
  end
72
75
 
73
76
  class << self
@@ -182,6 +185,27 @@ class Step
182
185
  self
183
186
  end
184
187
 
188
+ #def rec_dependencies
189
+
190
+ # # A step result with no info_file means that it was manually
191
+ # # placed. In that case, do not consider its dependencies
192
+ # return [] if Open.exists?(self.path.to_s) and not Open.exists? self.info_file
193
+
194
+ # return [] if dependencies.nil? or dependencies.empty?
195
+
196
+ # new_dependencies = []
197
+ # dependencies.each{|step|
198
+ # new_dependencies.concat step.rec_dependencies
199
+ # new_dependencies << step
200
+ # }
201
+ # new_dependencies.uniq!
202
+
203
+ # dependencies = self.dependencies ? self.dependencies + new_dependencies : new_dependencies
204
+ # dependencies.flatten!
205
+ # dependencies.uniq!
206
+ # dependencies
207
+ #end
208
+
185
209
  def rec_dependencies
186
210
 
187
211
  # A step result with no info_file means that it was manually
@@ -189,14 +213,13 @@ class Step
189
213
  return [] if Open.exists?(self.path.to_s) and not Open.exists? self.info_file
190
214
 
191
215
  return [] if dependencies.nil? or dependencies.empty?
192
- new_dependencies = dependencies.collect{|step|
193
- step.rec_dependencies
194
- }.flatten.uniq.compact
195
-
196
- dependencies = self.dependencies ? self.dependencies + new_dependencies : new_dependencies
197
- dependencies.flatten!
198
- dependencies.uniq!
199
- dependencies
216
+
217
+ new_dependencies = []
218
+ dependencies.each{|step|
219
+ new_dependencies.concat step.rec_dependencies
220
+ new_dependencies << step
221
+ }
222
+ new_dependencies.uniq
200
223
  end
201
224
 
202
225
  def recursive_clean
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.17.17
4
+ version: 5.17.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake