laborantin 0.0.14 → 0.0.21

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.
Files changed (46) hide show
  1. data/INFO +1 -0
  2. data/README +148 -4
  3. data/Rakefile +73 -27
  4. data/TODO +27 -6
  5. data/bin/labor +2 -404
  6. data/lib/laborantin.rb +13 -26
  7. data/lib/laborantin/core/analysis.rb +231 -0
  8. data/lib/laborantin/core/command.rb +234 -0
  9. data/lib/laborantin/core/completeable.rb +30 -0
  10. data/lib/laborantin/core/configurable.rb +28 -0
  11. data/lib/laborantin/core/datable.rb +13 -0
  12. data/lib/laborantin/core/describable.rb +11 -0
  13. data/lib/laborantin/core/environment.rb +90 -52
  14. data/lib/laborantin/core/hookable.rb +20 -0
  15. data/lib/laborantin/core/monkey_patches.rb +0 -1
  16. data/lib/laborantin/core/multi_name.rb +25 -0
  17. data/lib/laborantin/core/parameter.rb +5 -12
  18. data/lib/laborantin/core/parameter_hash.rb +6 -2
  19. data/lib/laborantin/core/scenario.rb +93 -70
  20. data/lib/laborantin/core/table.rb +84 -0
  21. data/lib/laborantin/extra/commands/git.rb +40 -0
  22. data/lib/laborantin/extra/commands/git/check.rb +25 -0
  23. data/lib/laborantin/extra/commands/git/run.rb +100 -0
  24. data/lib/laborantin/extra/vectorial_product.rb +31 -0
  25. data/lib/laborantin/runner.rb +247 -0
  26. data/lib/laborantin/runner/commands/analyze.rb +58 -0
  27. data/lib/laborantin/runner/commands/cleanup.rb +40 -0
  28. data/lib/laborantin/runner/commands/complete.rb +111 -0
  29. data/lib/laborantin/runner/commands/config.rb +169 -0
  30. data/lib/laborantin/runner/commands/create.rb +61 -0
  31. data/lib/laborantin/runner/commands/describe.rb +215 -0
  32. data/lib/laborantin/runner/commands/find.rb +82 -0
  33. data/lib/laborantin/runner/commands/load_classes.rb +75 -0
  34. data/lib/laborantin/runner/commands/load_results.rb +143 -0
  35. data/lib/laborantin/runner/commands/note.rb +35 -0
  36. data/lib/laborantin/runner/commands/replay.rb +89 -0
  37. data/lib/laborantin/runner/commands/rm.rb +107 -0
  38. data/lib/laborantin/runner/commands/run.rb +131 -0
  39. data/lib/laborantin/runner/commands/scan.rb +77 -0
  40. metadata +45 -13
  41. data/bin/files/README.erb +0 -29
  42. data/bin/files/TODO.erb +0 -2
  43. data/bin/files/config/ftp.yaml.erb +0 -6
  44. data/bin/files/config/xmpp.yaml.erb +0 -7
  45. data/bin/files/environments/environment.rb.erb +0 -10
  46. data/bin/files/scenarii/scenario.rb.erb +0 -13
@@ -0,0 +1,131 @@
1
+ #runner/commands/run.rb
2
+
3
+ =begin
4
+
5
+ This file is part of Laborantin.
6
+
7
+ Laborantin is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ Laborantin is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with Laborantin. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ Copyright (c) 2009, Lucas Di Cioccio
21
+
22
+ =end
23
+
24
+ require 'laborantin'
25
+ require 'logger'
26
+ require 'fileutils'
27
+
28
+ module Laborantin
29
+ module Commands
30
+ class Run < Command
31
+ describe 'Runs all set of scenarios and environments'
32
+
33
+ option(:scenarii) do
34
+ describe "comma separated list of scenarios to describe"
35
+ short "-s"
36
+ long "--scenarii=OPTIONAL"
37
+ type Array
38
+ default []
39
+ complete do |cmd|
40
+ completion_propositions_iterating_on(cmd, Laborantin::Scenario.all.map(&:cli_name))
41
+ end
42
+ end
43
+
44
+ option(:environments) do
45
+ describe "comma separated list of environments to describe"
46
+ short "-e"
47
+ long "--envs=OPTIONAL"
48
+ type Array
49
+ default []
50
+ complete do |cmd|
51
+ completion_propositions_iterating_on(cmd, Laborantin::Environment.all.map(&:cli_name))
52
+ end
53
+ end
54
+
55
+ option(:parameters) do
56
+ describe "filter for parameters (a hash as Ruby syntax code)"
57
+ short '-p'
58
+ long '--parameters=OPTIONAL'
59
+ type String
60
+ default ''
61
+ end
62
+
63
+ option(:analyze) do
64
+ describe "set this flag to analyze as you run"
65
+ short '-a'
66
+ long '--analyze'
67
+ default false
68
+ end
69
+
70
+ option(:continue) do
71
+ describe "run in continue mode, that is, skip parameter configurations that matches a scenario among the results"
72
+ short '-c'
73
+ long '--continue-mode'
74
+ default false
75
+ end
76
+
77
+ execute do
78
+ # Parameters parsing
79
+ params = eval(opts[:parameters]) unless opts[:parameters].empty?
80
+ params.each_key{|k| params[k] = [params[k]].flatten} if params
81
+
82
+ classes = Laborantin::Commands::LoadClasses.new.run([],opts)
83
+ results = if opts[:continue]
84
+ Laborantin::Commands::LoadResults.new.run([],opts)
85
+ else
86
+ {:scii => []}
87
+ end
88
+
89
+ # Actual run of experiments
90
+ classes[:envs].each do |eklass|
91
+ env = eklass.new(self)
92
+ if env.valid?
93
+ begin
94
+ env.prepare!
95
+ env.log "Running matching scenarii", :info #TODO: this is weird
96
+ env.state = :run
97
+ classes[:scii].each do |sklass|
98
+ sklass.parameters.merge!(params) if params
99
+ env.log sklass.parameters.inspect
100
+ sklass.parameters.each_config do |cfg|
101
+ sc = results[:scii].find do |s|
102
+ (s.params == cfg) and
103
+ (s.class == sklass) and
104
+ (s.environment.class == eklass)
105
+ end
106
+ if sc
107
+ puts "skipping #{cfg} found in #{sc.rundir}"
108
+ next
109
+ end
110
+
111
+ sc = sklass.new(env, cfg)
112
+ sc.prepare!
113
+ sc.perform!
114
+ sc.analyze! if opts[:analyze]
115
+ end
116
+ end
117
+ env.teardown!
118
+ env.state = :success
119
+ env.log "Scenarii performed", :info
120
+ rescue Exception => err
121
+ env.log err.to_s, :warn
122
+ env.state = :error
123
+ raise err
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+
@@ -0,0 +1,77 @@
1
+ #runner/commands/scan.rb
2
+
3
+ =begin
4
+
5
+ This file is part of Laborantin.
6
+
7
+ Laborantin is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ Laborantin is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with Laborantin. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ Copyright (c) 2009, Lucas Di Cioccio
21
+
22
+ =end
23
+
24
+ require 'laborantin'
25
+ require 'fileutils'
26
+
27
+ module Laborantin
28
+ module Commands
29
+ class Scan < Command
30
+ describe "Prints a Summary of the various scenarios/environments performed"
31
+
32
+ option(:scenarii) do
33
+ describe "comma separated list of scenarios to describe"
34
+ short "-s"
35
+ long "--scenarii=OPTIONAL"
36
+ type Array
37
+ default []
38
+ complete do |cmd|
39
+ completion_propositions_iterating_on(cmd, Laborantin::Scenario.all.map(&:cli_name))
40
+ end
41
+ end
42
+
43
+ option(:environments) do
44
+ describe "comma separated list of environments to describe"
45
+ short "-e"
46
+ long "--envs=OPTIONAL"
47
+ type Array
48
+ default []
49
+ complete do |cmd|
50
+ completion_propositions_iterating_on(cmd, Laborantin::Environment.all.map(&:cli_name))
51
+ end
52
+ end
53
+
54
+ option(:parameters) do
55
+ describe "filter for parameters (a hash as Ruby syntax code)"
56
+ short '-p'
57
+ long '--parameters=OPTIONAL'
58
+ type String
59
+ default ''
60
+ end
61
+
62
+ execute do
63
+ results = Laborantin::Commands::LoadResults.new.run([], opts)
64
+ puts "Laborantin's summary:"
65
+ Laborantin::Environment.all.each do |envklass|
66
+ env_tot = results[:envs].select{|e| e.is_a? envklass}.size #XXX instead of .count
67
+ puts "#{envklass.cli_name} => #{env_tot}"
68
+ Laborantin::Scenario.all.each do |scklass|
69
+ sc_tot = results[:scii].select{|s| s.is_a? scklass and s.environment.is_a? envklass}.size #see above
70
+ puts "\t#{scklass.cli_name} => #{sc_tot}"
71
+ end
72
+ end
73
+
74
+ end #execute
75
+ end
76
+ end
77
+ end
metadata CHANGED
@@ -1,15 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laborantin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 21
9
+ version: 0.0.21
5
10
  platform: ruby
6
11
  authors:
7
- - Di Cioccio Lucas
12
+ - Lucas Di Cioccio
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-09-18 00:00:00 +02:00
17
+ date: 2011-05-09 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -27,21 +32,44 @@ files:
27
32
  - gpl-3.0.txt
28
33
  - Rakefile
29
34
  - TODO
35
+ - INFO
30
36
  - bin/labor
31
- - bin/files/README.erb
32
- - bin/files/TODO.erb
33
- - bin/files/config/ftp.yaml.erb
34
- - bin/files/config/xmpp.yaml.erb
35
- - bin/files/environments/environment.rb.erb
36
- - bin/files/scenarii/scenario.rb.erb
37
37
  - lib/laborantin.rb
38
38
  - lib/laborantin/core/environment.rb
39
39
  - lib/laborantin/core/parameter.rb
40
40
  - lib/laborantin/core/parameter_hash.rb
41
41
  - lib/laborantin/core/scenario.rb
42
42
  - lib/laborantin/core/monkey_patches.rb
43
+ - lib/laborantin/core/analysis.rb
44
+ - lib/laborantin/core/command.rb
45
+ - lib/laborantin/core/datable.rb
46
+ - lib/laborantin/core/completeable.rb
47
+ - lib/laborantin/core/describable.rb
48
+ - lib/laborantin/core/hookable.rb
49
+ - lib/laborantin/core/configurable.rb
50
+ - lib/laborantin/core/multi_name.rb
51
+ - lib/laborantin/core/table.rb
52
+ - lib/laborantin/runner.rb
53
+ - lib/laborantin/runner/commands/complete.rb
54
+ - lib/laborantin/runner/commands/create.rb
55
+ - lib/laborantin/runner/commands/describe.rb
56
+ - lib/laborantin/runner/commands/run.rb
57
+ - lib/laborantin/runner/commands/analyze.rb
58
+ - lib/laborantin/runner/commands/load_classes.rb
59
+ - lib/laborantin/runner/commands/load_results.rb
60
+ - lib/laborantin/runner/commands/replay.rb
61
+ - lib/laborantin/runner/commands/find.rb
62
+ - lib/laborantin/runner/commands/scan.rb
63
+ - lib/laborantin/runner/commands/note.rb
64
+ - lib/laborantin/runner/commands/cleanup.rb
65
+ - lib/laborantin/runner/commands/rm.rb
66
+ - lib/laborantin/runner/commands/config.rb
67
+ - lib/laborantin/extra/commands/git.rb
68
+ - lib/laborantin/extra/commands/git/check.rb
69
+ - lib/laborantin/extra/commands/git/run.rb
70
+ - lib/laborantin/extra/vectorial_product.rb
43
71
  has_rdoc: true
44
- homepage: http://rubyforge.org/projects/laborantin
72
+ homepage: http://dicioccio.fr/laborantin
45
73
  licenses: []
46
74
 
47
75
  post_install_message:
@@ -50,21 +78,25 @@ rdoc_options: []
50
78
  require_paths:
51
79
  - lib
52
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
53
82
  requirements:
54
83
  - - ">="
55
84
  - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
56
87
  version: "0"
57
- version:
58
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
59
90
  requirements:
60
91
  - - ">="
61
92
  - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
62
95
  version: "0"
63
- version:
64
96
  requirements: []
65
97
 
66
98
  rubyforge_project: laborantin
67
- rubygems_version: 1.3.3
99
+ rubygems_version: 1.3.7
68
100
  signing_key:
69
101
  specification_version: 3
70
102
  summary: A measurement batch facilitator
@@ -1,29 +0,0 @@
1
- The "<%= File.dirname __FILE__ %>" directory has been created by Laborantin <%= Laborantin::VERSION %>.
2
- It is important to understand the hierarchy of Laborantin's directory
3
- before moving any file.
4
-
5
- Laborantin has created several files:
6
-
7
- <%= File.dirname __FILE__ %>/
8
- |-- README # This file.
9
- |-- TODO # A file where you should track what is left.
10
- |-- config # Configuration for Laborantin's command.
11
- | |-- ftp.yaml # Account config for FTP exports.
12
- | `-- xmpp.yaml # Account config for XMPP Logging.
13
- |-- environments # Your measurement environments.
14
- |-- results # The results of the various run.
15
- |-- scenarii # Your scenarii.
16
- `-- scripts # A dir to place your additional scripts.
17
-
18
- In addition to this, it has created one environnment ruby file per
19
- -e argument as well as one scenario ruby file per -s argument.
20
-
21
- When executing a laborantin run command, Laborantin will scan the current
22
- directory for environments and scenarii.
23
-
24
- See <%= Laborantin::WEBSITE %> for further information.
25
-
26
- Laborantin has been written by:
27
- - <%= Laborantin::AUTHORS.join("\n- ") %>
28
-
29
- Laborantin is licensend under the <%= Laborantin::LICENSE %>.
@@ -1,2 +0,0 @@
1
- Store in <%= __FILE__ %> file what remains to do.
2
-
@@ -1,6 +0,0 @@
1
- ---
2
- :pass: secret
3
- :host: example.foo
4
- :port: 22
5
- :nick: bar
6
- :enable: false
@@ -1,7 +0,0 @@
1
- ---
2
- :pass: secret
3
- :nick: foobar@example.bar
4
- :receivers:
5
- - bidule@truc.chose
6
- - machin@carabistouille.bof
7
- :enable: false
@@ -1,10 +0,0 @@
1
- # environments/<%= e %>.rb
2
-
3
- class <%= e.camelize %> < Laborantin::Environment
4
-
5
- describe "Place your description here"
6
- #verify :instance_meth1, ...
7
- #setup :instance_meth2, ...
8
- #teardown :instance_meth3, ...
9
-
10
- end
@@ -1,13 +0,0 @@
1
- # scenarii/<%= s %>.rb
2
-
3
- class <%= s.camelize %> < Laborantin::Scenario
4
- describe "put your decription here"
5
- # parameter(:param_name) do
6
- # values 1, 2, 3, 4, ...
7
- # describe "put your parameter description here"
8
- # end
9
- #
10
- # setup :instance_meth1, ...
11
- # teardown :instance_meth2, ...
12
- # produces :instance_meth3, ...
13
- end