snfoil-context 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snfoil/context/version.rb +1 -1
- data/lib/snfoil/context.rb +10 -10
- data/{snfoil-policy.gemspec → snfoil-context.gemspec} +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 192d032e33ddaa32cb1ead86d97947a03eaee657af7c26a44effe1c47eeefe7a
|
4
|
+
data.tar.gz: e181f4ac51ccc95c0e50377b3186679b5f313824f4a650f7dbe80efb69e4f68b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41bbbdce248d49d94e646a2d446ff99ce9fa195dc235024cd85030d8f4664c2f0ddb4b1b42ba906df50ce71d330425bc5d582a8783be10603f9dc94745b10871
|
7
|
+
data.tar.gz: d0cbddc6b61b6bccae81d5a6b2db8930cada0f9f9729595aa1203252440f93b0d8e3fc9ea630dd2790eba7e69d17242390e76766d6e5b36dc35ef87fc4c3c5c5
|
data/lib/snfoil/context.rb
CHANGED
@@ -38,11 +38,19 @@ module SnFoil
|
|
38
38
|
raise SnFoil::Context::Error, "action #{name} already defined for #{self.name}" if (@defined_actions ||= []).include?(name)
|
39
39
|
|
40
40
|
@defined_actions << name
|
41
|
-
|
41
|
+
define_workflow_hooks(name)
|
42
42
|
define_action_primary(name, with, block)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def run_action_group(group_name, **options)
|
47
|
+
hooks = self.class.instance_variable_get("@#{group_name}_hooks") || []
|
48
|
+
options = hooks.reduce(options) { |opts, hook| run_hook(hook, opts) }
|
49
|
+
options = send(group_name, **options) if respond_to?(group_name)
|
50
|
+
|
51
|
+
options
|
52
|
+
end
|
53
|
+
|
46
54
|
private
|
47
55
|
|
48
56
|
# rubocop:disable reason: These are builder/mapping methods that are just too complex to simplify without
|
@@ -66,7 +74,7 @@ module SnFoil
|
|
66
74
|
end
|
67
75
|
end
|
68
76
|
|
69
|
-
def
|
77
|
+
def define_workflow_hooks(name)
|
70
78
|
hook_builder('setup_%s', name)
|
71
79
|
hook_builder('before_%s', name)
|
72
80
|
hook_builder('after_%s_success', name)
|
@@ -98,13 +106,5 @@ module SnFoil
|
|
98
106
|
|
99
107
|
instance_exec options, &block
|
100
108
|
end
|
101
|
-
|
102
|
-
def run_action_group(group_name, **options)
|
103
|
-
options = self.class.instance_variable_get("@#{group_name}_hooks")
|
104
|
-
.reduce(options) { |opts, hook| run_hook(hook, opts) }
|
105
|
-
options = send(group_name, **options) if respond_to?(group_name)
|
106
|
-
|
107
|
-
options
|
108
|
-
end
|
109
109
|
end
|
110
110
|
end
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Matthew Howes']
|
9
9
|
spec.email = ['howeszy@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = ''
|
12
|
-
spec.description = ''
|
11
|
+
spec.summary = 'Setup simple pipelined workflows'
|
12
|
+
spec.description = 'An easy way to make extensible workflows and actions'
|
13
13
|
spec.homepage = 'https://github.com/limited-effort/snfoil-context'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = '>= 2.5.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snfoil-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Howes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.5'
|
111
|
-
description:
|
111
|
+
description: An easy way to make extensible workflows and actions
|
112
112
|
email:
|
113
113
|
- howeszy@gmail.com
|
114
114
|
executables: []
|
@@ -132,7 +132,7 @@ files:
|
|
132
132
|
- lib/snfoil/context/error.rb
|
133
133
|
- lib/snfoil/context/structure.rb
|
134
134
|
- lib/snfoil/context/version.rb
|
135
|
-
- snfoil-
|
135
|
+
- snfoil-context.gemspec
|
136
136
|
homepage: https://github.com/limited-effort/snfoil-context
|
137
137
|
licenses:
|
138
138
|
- MIT
|
@@ -158,5 +158,5 @@ requirements: []
|
|
158
158
|
rubygems_version: 3.1.6
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
|
-
summary:
|
161
|
+
summary: Setup simple pipelined workflows
|
162
162
|
test_files: []
|