laborantin 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/bin/labor +29 -8
  3. data/lib/laborantin.rb +1 -1
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
 
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = 'laborantin'
6
- s.version = '0.0.13'
6
+ s.version = '0.0.14'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = "A measurement batch facilitator"
9
9
 
data/bin/labor CHANGED
@@ -242,25 +242,46 @@ end
242
242
  # Replay
243
243
 
244
244
  Command.new('replay', 'scan existing runs, keep their raw results but rebuild all the products') do |c|
245
+ c.options[:scenarii] = []
246
+ c.options[:environments] = []
247
+ c.options[:methods] = []
248
+ c.options[:filter] = ''
245
249
  c.opts do |o|
250
+ o.on('-m', '--methods=OPTIONAL', 'list of methods to call, else all the products will, you can provide non products methods as well, so beware the typo', Array) {|val| c.options[:methods] = val}
251
+ o.on('-s', '--scenarii=OPTIONAL', 'scenarii to build, comma separated', Array) {|val| c.options[:scenarii] = val}
252
+ o.on('-e', '--environments=OPTIONAL', 'environments to prepare, comma separated', Array) {|val| c.options[:environments] = val}
253
+ o.on('-p', '--parameters=OPTIONAL', 'filter parameters (ruby hash format)', String) {|val| c.options[:filter] = val}
246
254
  o.on_tail('-h', '--help', 'shows this help and exit') {puts o; exit}
247
255
  end
248
256
  c.execute do
249
- FileUtils.cd(args.first || '.')
250
- Find.find('environments', 'scenarii') do |f|
251
- require f if File.extname(f) == '.rb'
252
- end
253
257
 
258
+ FileUtils.cd(args.first || '.')
259
+ loaded_envs = c.options[:environments].map{|e| "#{e}.rb"}
260
+ loaded_scii = c.options[:scenarii].map{|e| "#{e}.rb"}
261
+ find_and_require('environments', loaded_envs)
262
+ find_and_require('scenarii', loaded_scii)
263
+
254
264
  envs = Laborantin::Environment.scan_resdir('results')
255
265
  envs.each{|env| env.loggers << Logger.new(STDOUT)}
256
266
 
257
- scs = envs.map{|env| env.populate }.flatten
267
+ params = eval @options[:filter] unless @options[:filter].empty?
268
+ params.each_key{|k| params[k] = [params[k]].flatten} if params
269
+ params ||= {}
258
270
 
259
- puts "Replaying everything"
271
+ scs = envs.map{|env| env.populate }.flatten
260
272
 
261
273
  scs.each do |sc|
262
- sc.environment.log "Replaying products #{sc.params.inspect}"
263
- sc.analyze!
274
+ to_filter = params.keys.find{|k| not params[k].include?(sc.params[k])}
275
+ unless to_filter
276
+ sc.environment.log "Replaying products #{sc.params.inspect}"
277
+ if c.options[:methods].empty?
278
+ sc.analyze!
279
+ else
280
+ c.options[:methods].each do |meth|
281
+ sc.send meth
282
+ end
283
+ end
284
+ end
264
285
  end
265
286
  end
266
287
  end
@@ -28,7 +28,7 @@ require File.join(File.dirname(__FILE__), 'laborantin', 'core', 'environment')
28
28
  require File.join(File.dirname(__FILE__), 'laborantin', 'core', 'monkey_patches')
29
29
 
30
30
  module Laborantin
31
- VERSION = '0.0.13'
31
+ VERSION = '0.0.14'
32
32
  AUTHORS = ['Lucas Di Cioccio']
33
33
  WEBSITE = 'http://dicioccio.fr'
34
34
  LICENSE = 'GNU GPL version 3'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laborantin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Di Cioccio Lucas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-17 00:00:00 +02:00
12
+ date: 2009-09-18 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15