ultra_marathon 0.0.3 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/ultra_marathon/abstract_runner.rb +3 -4
- data/lib/ultra_marathon/sub_runner.rb +3 -3
- data/lib/ultra_marathon/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d4509883d5029d7c4a4a1dae968fce358849c10
|
4
|
+
data.tar.gz: 10319093704148baaa01957b3d0016a1dcb14fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48e6c87b833a453bc4933847a612678a8e7f239d2f5642ef393a4ebdf05e1d0e330c0d57966ea27f2f6dbe0ac2041196e548d1ade29412e0a586ad81e5863c59
|
7
|
+
data.tar.gz: 4fab0f2cc7c61bc3f615459babc953c6fba3b9878ca6734a28efd791874d21eb7b0fe2ccf54c723476a7a78843a227b5288174175605efb6002f29ed58a67979
|
data/README.md
CHANGED
@@ -89,8 +89,8 @@ The basic flow of execution is as follows:
|
|
89
89
|
|
90
90
|
- `before_run`
|
91
91
|
- (`run!`)
|
92
|
+
- `on_error`
|
92
93
|
- `after_run`
|
93
|
-
- `after_all`
|
94
94
|
- (`reset`)
|
95
95
|
- `on_reset`
|
96
96
|
|
@@ -127,8 +127,8 @@ Callbacks can, additionally, take a hash of options. Currently `:if` and
|
|
127
127
|
|
128
128
|
```ruby
|
129
129
|
class MercurialRunner < UltraMarathon::AbstractRunner
|
130
|
-
|
131
|
-
|
130
|
+
after_run :celebrate, :if => :success?
|
131
|
+
after_run :cry, unless: ->{ success? }
|
132
132
|
|
133
133
|
run do
|
134
134
|
raise 'hell' if rand(2) % 2 == 0
|
@@ -10,9 +10,9 @@ module UltraMarathon
|
|
10
10
|
include Instrumentation
|
11
11
|
include Callbacks
|
12
12
|
attr_accessor :success
|
13
|
-
callbacks :before_run, :after_run, :
|
13
|
+
callbacks :before_run, :after_run, :on_error, :on_reset
|
14
14
|
|
15
|
-
|
15
|
+
after_run :write_log
|
16
16
|
on_error lambda { self.success = false }
|
17
17
|
on_error lambda { |error| logger.error(error) }
|
18
18
|
|
@@ -26,11 +26,10 @@ module UltraMarathon
|
|
26
26
|
invoke_before_run_callbacks
|
27
27
|
instrument { run_unrun_sub_runners }
|
28
28
|
self.success = failed_sub_runners.empty?
|
29
|
-
invoke_after_run_callbacks
|
30
29
|
rescue StandardError => error
|
31
30
|
invoke_on_error_callbacks(error)
|
32
31
|
ensure
|
33
|
-
|
32
|
+
invoke_after_run_callbacks
|
34
33
|
end
|
35
34
|
self
|
36
35
|
end
|
@@ -10,8 +10,8 @@ module UltraMarathon
|
|
10
10
|
attr_accessor :run_block, :success
|
11
11
|
attr_reader :sub_context, :options, :name
|
12
12
|
|
13
|
-
callbacks :before_run, :after_run, :
|
14
|
-
|
13
|
+
callbacks :before_run, :after_run, :on_error, :on_reset
|
14
|
+
after_run :log_header_and_sub_context
|
15
15
|
|
16
16
|
on_error lambda { self.success = false }
|
17
17
|
on_error lambda { |error| logger.error error }
|
@@ -33,7 +33,7 @@ module UltraMarathon
|
|
33
33
|
rescue StandardError => error
|
34
34
|
invoke_on_error_callbacks(error)
|
35
35
|
ensure
|
36
|
-
|
36
|
+
invoke_after_run_callbacks
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|