lokap-composite 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lokap/composite.rb +25 -14
- data/lib/lokap/step.rb +22 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93f5b1365b9fb098e6eb272d7ca759b79924ef4818d49c1f20729411815c3092
|
4
|
+
data.tar.gz: 8188f6b5502593583bf0082d3e0cdd004c9e5cf402fe786013493663a9ee7232
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4335756e3442351868c7353516ca6b1a548684253e8914e338a2e82ad8f4fad2d270d4f0bcf89e2d17459d97edfc652fa43f726718dd3614247a111b4000bf25
|
7
|
+
data.tar.gz: cb7f345f6af6284665110a9685b945215fdd0b376699625507bcde02aa18f7b3bc933a8de8a1d68da29a4c8901099e3e0225e72a0ba717c8561ebc0b9b965f3f
|
data/lib/lokap/composite.rb
CHANGED
@@ -22,23 +22,35 @@ module Lokap
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def process
|
25
|
-
|
25
|
+
before_all
|
26
26
|
|
27
27
|
steps.each do |step|
|
28
|
-
|
28
|
+
before_each
|
29
|
+
|
30
|
+
step.before_step
|
29
31
|
step.perform
|
30
|
-
step.
|
32
|
+
step.after_step
|
33
|
+
|
34
|
+
after_each
|
31
35
|
end
|
32
36
|
|
33
|
-
|
37
|
+
after_all; self
|
38
|
+
end
|
39
|
+
|
40
|
+
def before_each
|
41
|
+
# noop
|
42
|
+
end
|
43
|
+
|
44
|
+
def after_each
|
45
|
+
# noop
|
34
46
|
end
|
35
47
|
|
36
|
-
def
|
37
|
-
messages << "
|
48
|
+
def before_all
|
49
|
+
messages << "#{self.class.name} Processing..."
|
38
50
|
end
|
39
51
|
|
40
|
-
def
|
41
|
-
messages << "
|
52
|
+
def after_all
|
53
|
+
messages << "#{self.class.name} Done."
|
42
54
|
end
|
43
55
|
end
|
44
56
|
|
@@ -53,16 +65,15 @@ module Lokap
|
|
53
65
|
end
|
54
66
|
|
55
67
|
def perform
|
56
|
-
raise AbstractMethodError,
|
57
|
-
"Child class must impelement abstract method: #{method_name}"
|
68
|
+
raise AbstractMethodError, "Child class must impelement method: #{method_name}"
|
58
69
|
end
|
59
70
|
|
60
|
-
def
|
61
|
-
composite.messages << "
|
71
|
+
def before_step
|
72
|
+
composite.messages << "→ #{self.class.name} Performing..."
|
62
73
|
end
|
63
74
|
|
64
|
-
def
|
65
|
-
composite.messages << "
|
75
|
+
def after_step
|
76
|
+
composite.messages << "→ #{self.class.name} Done."
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
data/lib/lokap/step.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class Composite::Step
|
2
|
+
class AbstractMethodError < StandardError; end
|
3
|
+
|
4
|
+
attr_accessor :composite, :options
|
5
|
+
|
6
|
+
def initialize(composite, options={})
|
7
|
+
@composite = composite
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def perform
|
12
|
+
raise AbstractMethodError, "Child class must impelement method: #{method_name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def before_step
|
16
|
+
composite.messages << "→ #{self.class.name} Performing..."
|
17
|
+
end
|
18
|
+
|
19
|
+
def after_step
|
20
|
+
composite.messages << "→ #{self.class.name} Done."
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lokap-composite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Bair
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
25
|
- lib/lokap/composite.rb
|
26
|
+
- lib/lokap/step.rb
|
26
27
|
homepage: https://github.com/adambair/lokap-composite
|
27
28
|
licenses:
|
28
29
|
- Nonstandard
|