subroutine-factory 0.1.5 → 0.1.6
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/lib/subroutine/factory/builder.rb +31 -13
- data/lib/subroutine/factory/config.rb +8 -1
- data/lib/subroutine/factory/version.rb +1 -1
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24d648affb53fc86b2f122467fd39622e4cb24ce
|
4
|
+
data.tar.gz: 1b240333481df189a3b021fcde9df9d7bef49394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d074064071df20e58c74bc13d311a8e00fb0efbd68d6b0e9adc06be52068c127e4244a5d8954c319e0da0e1a969a5022ba97e6916d3dc46b366710e26eab458
|
7
|
+
data.tar.gz: 6545d9a5c54172aa307b5b1fe2d6bad11901800d21d7cd926d1a534f4ab346aa160f0f01c1e0e744183cad906d2b3fbb68116223399d90078e1991e6f8409db5
|
@@ -14,44 +14,62 @@ module Subroutine
|
|
14
14
|
def execute!
|
15
15
|
args = @args.dup
|
16
16
|
|
17
|
-
Array(@options[:setups]).each{|block| block.call(args,
|
17
|
+
Array(@options[:setups]).each{|block| block.call(args, extras) }
|
18
18
|
|
19
19
|
args.push(inputs)
|
20
20
|
|
21
21
|
op = op_class.new(*args)
|
22
22
|
|
23
|
-
Array(@options[:befores]).each{|block| block.call(op,
|
23
|
+
Array(@options[:befores]).each{|block| block.call(op, extras) }
|
24
24
|
|
25
25
|
op.submit!
|
26
26
|
|
27
27
|
output = extract_output(op)
|
28
28
|
|
29
|
-
Array(@options[:afters]).each{|block| block.call(op, output,
|
29
|
+
Array(@options[:afters]).each{|block| block.call(op, output, extras) }
|
30
30
|
|
31
31
|
output
|
32
32
|
end
|
33
33
|
|
34
34
|
def inputs
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
@inputs ||= begin
|
36
|
+
out = {}
|
37
|
+
|
38
|
+
@options[:inputs].each_pair do |k,v|
|
39
|
+
if @overrides.has_key?(k)
|
40
|
+
out[k] = @overrides[k]
|
41
|
+
else
|
42
|
+
out[k] = invoke_input(v)
|
43
|
+
end
|
42
44
|
end
|
45
|
+
|
46
|
+
out
|
43
47
|
end
|
48
|
+
end
|
44
49
|
|
45
|
-
|
50
|
+
def extras
|
51
|
+
@extras ||= begin
|
52
|
+
out = {}
|
53
|
+
|
54
|
+
@options[:extras].each_pair do |k, v|
|
55
|
+
if @overrides.has_key?(k)
|
56
|
+
out[k] = @overrides[k]
|
57
|
+
elsif !v.nil?
|
58
|
+
out[k] = invoke_input(v)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
out
|
63
|
+
end
|
46
64
|
end
|
47
65
|
|
48
66
|
def invoke_input(input)
|
49
67
|
return input unless input.respond_to?(:call)
|
50
|
-
input.arity.zero? ? input.call : input.call(
|
68
|
+
input.arity.zero? ? input.call : input.call(extras)
|
51
69
|
end
|
52
70
|
|
53
71
|
def op_class
|
54
|
-
|
72
|
+
@options[:op].constantize
|
55
73
|
end
|
56
74
|
|
57
75
|
def extract_output(op)
|
@@ -61,6 +61,10 @@ module Subroutine
|
|
61
61
|
@options[:outputs] = names
|
62
62
|
end
|
63
63
|
|
64
|
+
def extra(name, value = nil)
|
65
|
+
@options[:extras][name.to_sym] = value
|
66
|
+
end
|
67
|
+
|
64
68
|
protected
|
65
69
|
|
66
70
|
def inherit_from(parent)
|
@@ -73,7 +77,7 @@ module Subroutine
|
|
73
77
|
op(@options[:op]) if @options[:op]
|
74
78
|
|
75
79
|
@options[:inputs] ||= {}
|
76
|
-
@options[:inputs].each_pair(
|
80
|
+
@options[:inputs].each_pair{|k,v| input(k, v) }
|
77
81
|
|
78
82
|
outputs(*@options[:outputs]) if @options[:outputs]
|
79
83
|
output(@options[:output]) if @options[:output]
|
@@ -86,6 +90,9 @@ module Subroutine
|
|
86
90
|
|
87
91
|
@options[:afters] = @options[:afters].dup if @options[:afters]
|
88
92
|
@options[:afters] ||= []
|
93
|
+
|
94
|
+
@options[:extras] ||= {}
|
95
|
+
@options[:extras].each_pair{|k,v| extra(k,v) }
|
89
96
|
end
|
90
97
|
|
91
98
|
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subroutine-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: subroutine
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest-reporters
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Test factories for ops using Subroutine Ops
|
@@ -101,8 +101,8 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
-
|
105
|
-
-
|
104
|
+
- .gitignore
|
105
|
+
- .travis.yml
|
106
106
|
- Gemfile
|
107
107
|
- LICENSE.txt
|
108
108
|
- README.md
|
@@ -126,17 +126,17 @@ require_paths:
|
|
126
126
|
- lib
|
127
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- -
|
134
|
+
- - '>='
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.0.14.1
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Test factories for ops using Subroutine Ops
|