spicerack 0.20.2 → 0.20.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spicerack.rb +1 -0
- data/lib/spicerack/configurable/config_builder/double_configure.rb +1 -1
- data/lib/spicerack/input_model.rb +1 -1
- data/lib/spicerack/objects/attributes.rb +4 -0
- data/lib/spicerack/objects/output.rb +58 -0
- data/lib/spicerack/rspec/configurable/matchers/configuration/define_config_option.rb +2 -6
- data/lib/spicerack/spec_helper.rb +1 -0
- data/lib/spicerack/stateful_object.rb +9 -0
- data/lib/spicerack/version.rb +1 -1
- metadata +20 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 445f354d4e51daa0d30fd70e2d673480f3088c6b6bca5ffdec6ebb6e8943ae9f
|
4
|
+
data.tar.gz: 8ed71fe41cf8a7e878cac22d76f630bfdb3c299bfa1610ddd7d4890e8b9ec926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fbff23449a89a652361c62255cc5963f928cd5b5e6ee472862e3a1157f3efa5382de9d35b3cc9e5c182f27216035dc02dcee6709abdc7e55702d412ef064ccb
|
7
|
+
data.tar.gz: 863491ad5f298561b1ad7182c874d032f41af15575b1c0373132aeac1218c554631ce1a9b23a6f673b999a4c924c6fa55429115badc3fc99e1caf0ca03f182c8
|
data/lib/spicerack.rb
CHANGED
@@ -27,7 +27,7 @@ module Spicerack
|
|
27
27
|
|
28
28
|
puts <<~WARNING
|
29
29
|
#{self.class._configurable_module_name}.configure has been called more than once, which can lead to unexpected consequences.
|
30
|
-
For the most predictable behavior, configure should only be called once
|
30
|
+
For the most predictable behavior, configure should only be called once.
|
31
31
|
WARNING
|
32
32
|
end
|
33
33
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spicerack
|
4
|
+
module Objects
|
5
|
+
module Output
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
class_attribute :_outputs, instance_writer: false, default: []
|
10
|
+
|
11
|
+
delegate :_outputs, to: :class
|
12
|
+
|
13
|
+
after_validation do
|
14
|
+
next unless validated?
|
15
|
+
|
16
|
+
_outputs.each do |key|
|
17
|
+
public_send("#{key}=".to_sym, _defaults[key].value) if _defaults.key?(key) && public_send(key).nil?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class_methods do
|
23
|
+
def inherited(base)
|
24
|
+
base._outputs = _outputs.dup
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def output(output, default: nil, &block)
|
31
|
+
_outputs << output
|
32
|
+
define_attribute output
|
33
|
+
define_default output, static: default, &block
|
34
|
+
ensure_validation_before output
|
35
|
+
ensure_validation_before "#{output}=".to_sym
|
36
|
+
end
|
37
|
+
|
38
|
+
def ensure_validation_before(method)
|
39
|
+
around_method method do |*arguments|
|
40
|
+
raise Flow::State::Errors::NotValidated unless validated?
|
41
|
+
|
42
|
+
super(*arguments)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def outputs
|
48
|
+
return {} if _outputs.empty?
|
49
|
+
|
50
|
+
output_struct.new(*_outputs.map(&method(:public_send)))
|
51
|
+
end
|
52
|
+
|
53
|
+
def output_struct
|
54
|
+
Struct.new(*_outputs)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -21,8 +21,8 @@ module Spicerack
|
|
21
21
|
# it { is_expected.to define_config_option :bar, default: :baz }
|
22
22
|
# end
|
23
23
|
define :define_config_option do |option, default: nil|
|
24
|
-
description { "define config option #{option}" }
|
25
|
-
failure_message { "expected #{@obj} to define config option #{option} #{
|
24
|
+
description { "define config option #{option.inspect}" }
|
25
|
+
failure_message { "expected #{@obj} to define config option #{option.inspect} with default #{default.inspect}" }
|
26
26
|
|
27
27
|
match do |obj|
|
28
28
|
@obj = obj
|
@@ -35,10 +35,6 @@ module Spicerack
|
|
35
35
|
expect(obj.config.instance_variable_get(:@config)).to define_option option, default: default
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
def with_default(default)
|
40
|
-
"with default #{default}" unless default.nil?
|
41
|
-
end
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
data/lib/spicerack/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spicerack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-01-
|
14
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: around_the_world
|
@@ -19,70 +19,70 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.20.
|
22
|
+
version: 0.20.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.20.
|
29
|
+
version: 0.20.3
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: redis_hash
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - '='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.20.
|
36
|
+
version: 0.20.3
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - '='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.20.
|
43
|
+
version: 0.20.3
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: short_circu_it
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 0.20.
|
50
|
+
version: 0.20.3
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 0.20.
|
57
|
+
version: 0.20.3
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: technologic
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - '='
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.20.
|
64
|
+
version: 0.20.3
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - '='
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 0.20.
|
71
|
+
version: 0.20.3
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: tablesalt
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
76
|
- - '='
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 0.20.
|
78
|
+
version: 0.20.3
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - '='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.20.
|
85
|
+
version: 0.20.3
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: bundler
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,28 +207,28 @@ dependencies:
|
|
207
207
|
requirements:
|
208
208
|
- - '='
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: 0.20.
|
210
|
+
version: 0.20.3
|
211
211
|
type: :development
|
212
212
|
prerelease: false
|
213
213
|
version_requirements: !ruby/object:Gem::Requirement
|
214
214
|
requirements:
|
215
215
|
- - '='
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version: 0.20.
|
217
|
+
version: 0.20.3
|
218
218
|
- !ruby/object:Gem::Dependency
|
219
219
|
name: spicerack-styleguide
|
220
220
|
requirement: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
222
|
- - '='
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version: 0.20.
|
224
|
+
version: 0.20.3
|
225
225
|
type: :development
|
226
226
|
prerelease: false
|
227
227
|
version_requirements: !ruby/object:Gem::Requirement
|
228
228
|
requirements:
|
229
229
|
- - '='
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version: 0.20.
|
231
|
+
version: 0.20.3
|
232
232
|
- !ruby/object:Gem::Dependency
|
233
233
|
name: will_paginate
|
234
234
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,6 +307,7 @@ files:
|
|
307
307
|
- lib/spicerack/objects/attributes.rb
|
308
308
|
- lib/spicerack/objects/defaults.rb
|
309
309
|
- lib/spicerack/objects/options.rb
|
310
|
+
- lib/spicerack/objects/output.rb
|
310
311
|
- lib/spicerack/redis_model.rb
|
311
312
|
- lib/spicerack/root_object.rb
|
312
313
|
- lib/spicerack/rspec/configurable/dsl.rb
|
@@ -323,6 +324,7 @@ files:
|
|
323
324
|
- lib/spicerack/rspec/shared_examples/an_input_object_with_a_class_collection_attribute.rb
|
324
325
|
- lib/spicerack/rspec/shoulda_matcher_helper.rb
|
325
326
|
- lib/spicerack/spec_helper.rb
|
327
|
+
- lib/spicerack/stateful_object.rb
|
326
328
|
- lib/spicerack/version.rb
|
327
329
|
homepage: https://github.com/Freshly/spicerack
|
328
330
|
licenses:
|
@@ -347,7 +349,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
347
349
|
- !ruby/object:Gem::Version
|
348
350
|
version: '0'
|
349
351
|
requirements: []
|
350
|
-
|
352
|
+
rubyforge_project:
|
353
|
+
rubygems_version: 2.7.6
|
351
354
|
signing_key:
|
352
355
|
specification_version: 4
|
353
356
|
summary: A suite of utility gems for Ruby on Rails.
|