diddy 0.9.4 → 0.10.0

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/diddy.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "diddy"
7
- gem.version = '0.9.4'
7
+ gem.version = '0.10.0'
8
8
  gem.authors = ["Diederick Lawson", "Marcel de Graaf"]
9
9
  gem.email = ["diederick@altovista.nl", "mail@marceldegraaf.net"]
10
10
  gem.description = %q{Diddy script runner}
@@ -19,6 +19,10 @@ module Diddy
19
19
  # Start the run of an entire scenario.
20
20
  #
21
21
  def run_scenario(description)
22
+ unless @current_script
23
+ @current_script = Script.new("Unknown")
24
+ end
25
+
22
26
  @current_scenario = Scenario.new(description)
23
27
  @current_scenario.script = @current_script
24
28
 
@@ -59,6 +59,10 @@ module Diddy
59
59
  begin
60
60
  @resetted = {}
61
61
 
62
+ # also log
63
+ puts("Scenario: #{description}")
64
+ run_result.run_scenario("Scenario: #{description}")
65
+
62
66
  @steps.each do |step|
63
67
  run_step(step)
64
68
  end
@@ -129,6 +133,16 @@ module Diddy
129
133
  @shared_scope ||= SharedScope.new
130
134
  end
131
135
 
136
+ #
137
+ # Runs a given scenario
138
+ #
139
+ def self.run(run_result, scenario, options = {})
140
+ scenario.reset!
141
+ scenario.context = Context.new(options)
142
+ scenario.run_result = run_result
143
+ scenario.run
144
+ end
145
+
132
146
  class ScenarioAborted < Exception; end
133
147
  end
134
148
  end
data/lib/diddy/script.rb CHANGED
@@ -46,12 +46,6 @@ module Diddy
46
46
  # reset scenario
47
47
  scenario.reset!
48
48
 
49
- # print on screen
50
- puts("Scenario #{index + 1}: #{scenario.description}")
51
-
52
- # also log
53
- run_result.run_scenario("Scenario #{index + 1}: #{scenario.description}")
54
-
55
49
  # run all the steps within the scenario
56
50
  scenario.run_result = run_result
57
51
  scenario.context = context
@@ -93,8 +87,17 @@ module Diddy
93
87
  # Runs a given script
94
88
  #
95
89
  def self.run(run_result, description, options = {})
90
+ script = nil
91
+
96
92
  # find script
97
- script = scripts.find { |script| script.description == description }
93
+ if description.is_a?(String)
94
+ script = scripts.find { |script| script.description == description }
95
+
96
+ elsif description.is_a?(Diddy::Script)
97
+ script = description
98
+
99
+ end
100
+
98
101
  raise CannotFindScriptError.new("Cannot find script #{description}") unless script
99
102
 
100
103
  # output and run
@@ -105,10 +108,10 @@ module Diddy
105
108
  end
106
109
 
107
110
  # print to screen what we are doing
108
- puts(bold("Running #{description}#{vars}"))
111
+ puts(bold("Running #{script.description}#{vars}"))
109
112
 
110
113
  # also log to result logger
111
- run_result.run_script("Running #{description}#{vars}")
114
+ run_result.run_script("Running #{script.description}#{vars}")
112
115
 
113
116
  # apply the context and run result
114
117
  script.context = Context.new(options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-21 00:00:00.000000000 Z
13
+ date: 2013-10-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: term/ansicolor