much-rails 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee8fc1ccf3484f2b015d6dc6f1911bcca2bddb9832809391dc48ef2aeac023bb
4
- data.tar.gz: a0a9b4ba294d780e3a4002545e967505f8f32e15bb231e3fbd1e9d594ed4f9b1
3
+ metadata.gz: 4e21c445f3eec6146fc636f67a3e98b4f40dde3c916c6f25f6bb02af8f6dfc38
4
+ data.tar.gz: ffcc8deab5152d91d1e433d5bfc174e359fa02a2d5e43b57c12f2b7dfed9fdab
5
5
  SHA512:
6
- metadata.gz: f47fe549b83381ec39c226cf52760d8b5ca2d386c66e3e4db3b37f22ce07d855dd665e499fe5db15e54e7263a5903f5759cbb2d9d60a175dffead64917388f79
7
- data.tar.gz: 3c50dc018ab3d5e0d6bf98cc8725b99314e9527d400890500c5ffbc8bf1e9ed2772da689b00bd7ef4b8fdf4d256927a71e338401da57ec53879019ad5a4ae5f2
6
+ metadata.gz: 3299e07aff0d7304b3cf84ca6df14e53e3dcdd0d63690ec9bed261217c04fdae8058e0314840b276a1e183a18b87e2ba47d930389c77eda82638f7637577437a
7
+ data.tar.gz: 5fe7641d69715ffe58daa889edf8635b3d0ae614d500e9205f44c4798aadd5d6c8c021d4a40f7c0afcc58db8c31ea10252a91e087fb7d8aa44f110fd883e1628
@@ -1,55 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "much-rails/mixin"
3
+ require "much-config"
4
4
 
5
- module MuchRails; end
6
-
7
- # MuchRails::Config is a mix-in to implement object DSL configuration.
8
- module MuchRails::Config
9
- include MuchRails::Mixin
10
-
11
- mixin_class_methods do
12
- def add_config(name = nil, method_name: nil)
13
- config_method_name, config_class_name, configure_method_name =
14
- much_rails_config_names(name, method_name)
15
-
16
- instance_eval(<<~RUBY, __FILE__, __LINE__ + 1)
17
- def #{config_method_name}
18
- @#{config_method_name} ||= self::#{config_class_name}.new
19
- end
20
-
21
- def #{configure_method_name}
22
- yield(#{config_method_name}) if block_given?
23
- end
24
- RUBY
25
- end
26
-
27
- def add_instance_config(name = nil, method_name: nil)
28
- config_method_name, config_class_name, configure_method_name =
29
- much_rails_config_names(name, method_name)
30
-
31
- instance_eval(<<~RUBY, __FILE__, __LINE__ + 1)
32
- define_method(:#{config_method_name}) do
33
- @#{config_method_name} ||= self.class::#{config_class_name}.new
34
- end
35
-
36
- define_method(:#{configure_method_name}) do |&block|
37
- block.call(#{config_method_name}) if block
38
- end
39
- RUBY
40
- end
41
-
42
- private
43
-
44
- def much_rails_config_names(name, method_name)
45
- name_prefix = name.nil? ? "" : "#{name.to_s.underscore}_"
46
- config_method_name = (method_name || "#{name_prefix}config").to_s
47
- config_class_name = "#{name_prefix.classify}Config"
48
-
49
- name_suffix = name.nil? ? "" : "_#{name.to_s.underscore}"
50
- configure_method_name = "configure#{name_suffix}"
51
-
52
- [config_method_name, config_class_name, configure_method_name]
53
- end
54
- end
5
+ module MuchRails
6
+ Config = MuchConfig
55
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuchRails
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
5
5
  end
data/much-rails.gemspec CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.required_ruby_version = "~> 2.5"
25
25
 
26
- gem.add_development_dependency("much-style-guide", ["~> 0.6.0"])
27
- gem.add_development_dependency("assert", ["~> 2.19.5"])
26
+ gem.add_development_dependency("much-style-guide", ["~> 0.6.6"])
27
+ gem.add_development_dependency("assert", ["~> 2.19.6"])
28
28
  gem.add_development_dependency("rails", ["> 5.0", "< 7.0"])
29
29
 
30
30
  gem.add_dependency("activerecord", ["> 5.0", "< 7.0"])
@@ -33,10 +33,11 @@ Gem::Specification.new do |gem|
33
33
  gem.add_dependency("dassets-erubi", ["~> 0.1.1"])
34
34
  gem.add_dependency("dassets-sass", ["~> 0.5.1"])
35
35
  gem.add_dependency("much-boolean", ["~> 0.2.1"])
36
+ gem.add_dependency("much-config", ["~> 0.1.0"])
36
37
  gem.add_dependency("much-decimal", ["~> 0.1.3"])
37
38
  gem.add_dependency("much-mixin", ["~> 0.2.4"])
38
39
  gem.add_dependency("much-not-given", ["~> 0.1.2"])
39
40
  gem.add_dependency("much-result", ["~> 0.1.3"])
40
41
  gem.add_dependency("much-slug", ["~> 0.1.2"])
41
- gem.add_dependency("oj", ["~> 3.10"])
42
+ gem.add_dependency("oj", ["~> 3.11"])
42
43
  end
@@ -48,7 +48,7 @@ module MuchRails::Assets
48
48
 
49
49
  should "configure the app's app/assets/css folder as a source" do
50
50
  source =
51
- subject.config.sources.detect do |source|
51
+ subject.config.sources.find do |source|
52
52
  source.path == FakeRails.root.join("app", "assets", "css").to_s
53
53
  end
54
54
 
@@ -63,7 +63,7 @@ module MuchRails::Assets
63
63
 
64
64
  should "configure the app's app/assets/img folder as a source" do
65
65
  source =
66
- subject.config.sources.detect do |source|
66
+ subject.config.sources.find do |source|
67
67
  source.path == FakeRails.root.join("app", "assets", "img").to_s
68
68
  end
69
69
 
@@ -74,7 +74,7 @@ module MuchRails::Assets
74
74
 
75
75
  should "configure the app's app/assets/js folder as a source" do
76
76
  source =
77
- subject.config.sources.detect do |source|
77
+ subject.config.sources.find do |source|
78
78
  source.path == FakeRails.root.join("app", "assets", "js").to_s
79
79
  end
80
80
 
@@ -87,7 +87,7 @@ module MuchRails::Assets
87
87
 
88
88
  should "configure the app's app/assets/vendor folder as a source" do
89
89
  source =
90
- subject.config.sources.detect do |source|
90
+ subject.config.sources.find do |source|
91
91
  source.path == FakeRails.root.join("app", "assets", "vendor").to_s
92
92
  end
93
93
 
@@ -10,59 +10,8 @@ module MuchRails::Config
10
10
 
11
11
  let(:unit_class){ MuchRails::Config }
12
12
 
13
- should "include MuchRails::Mixin" do
14
- assert_that(subject).includes(MuchRails::Mixin)
15
- end
16
- end
17
-
18
- class ReceiverTests < UnitTests
19
- desc "receiver"
20
- subject{ receiver_class }
21
-
22
- setup do
23
- class receiver_class::Config
24
- attr_accessor :value
25
- end
26
-
27
- class receiver_class::AnotherConfig
28
- include MuchRails::Config
29
-
30
- add_instance_config :sub, method_name: :sub
31
-
32
- attr_accessor :another_value
33
-
34
- class SubConfig
35
- attr_accessor :sub_value
36
- end
37
- end
38
- end
39
-
40
- let(:receiver_class) do
41
- Class.new do
42
- include MuchRails::Config
43
-
44
- add_config
45
- add_config :another
46
- end
47
- end
48
-
49
- should have_imeths :config, :another_config
50
-
51
- should "know its attributes" do
52
- assert_that(subject.config).is_instance_of(subject::Config)
53
- subject.configure{ |config| config.value = "VALUE 1" }
54
- assert_that(subject.config.value).equals("VALUE 1")
55
-
56
- assert_that(subject.another_config).is_instance_of(subject::AnotherConfig)
57
- subject.configure_another{ |config| config.another_value = "VALUE 2" }
58
- assert_that(subject.another_config.another_value).equals("VALUE 2")
59
-
60
- assert_that(subject.another_config.sub)
61
- .is_instance_of(subject::AnotherConfig::SubConfig)
62
- subject.another_config.configure_sub do |sub|
63
- sub.sub_value = "VALUE 3"
64
- end
65
- assert_that(subject.another_config.sub.sub_value).equals("VALUE 3")
13
+ should "be MuchConfig" do
14
+ assert_that(unit_class).is(MuchConfig)
66
15
  end
67
16
  end
68
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: much-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-11 00:00:00.000000000 Z
12
+ date: 2021-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: much-style-guide
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.6.0
20
+ version: 0.6.6
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.6.0
27
+ version: 0.6.6
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: assert
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 2.19.5
34
+ version: 2.19.6
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 2.19.5
41
+ version: 2.19.6
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rails
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -155,6 +155,20 @@ dependencies:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
157
  version: 0.2.1
158
+ - !ruby/object:Gem::Dependency
159
+ name: much-config
160
+ requirement: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: 0.1.0
165
+ type: :runtime
166
+ prerelease: false
167
+ version_requirements: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: 0.1.0
158
172
  - !ruby/object:Gem::Dependency
159
173
  name: much-decimal
160
174
  requirement: !ruby/object:Gem::Requirement
@@ -231,14 +245,14 @@ dependencies:
231
245
  requirements:
232
246
  - - "~>"
233
247
  - !ruby/object:Gem::Version
234
- version: '3.10'
248
+ version: '3.11'
235
249
  type: :runtime
236
250
  prerelease: false
237
251
  version_requirements: !ruby/object:Gem::Requirement
238
252
  requirements:
239
253
  - - "~>"
240
254
  - !ruby/object:Gem::Version
241
- version: '3.10'
255
+ version: '3.11'
242
256
  description: Rails utilities.
243
257
  email:
244
258
  - kelly@kellyredding.com
@@ -374,7 +388,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
374
388
  - !ruby/object:Gem::Version
375
389
  version: '0'
376
390
  requirements: []
377
- rubygems_version: 3.2.4
391
+ rubygems_version: 3.1.6
378
392
  signing_key:
379
393
  specification_version: 4
380
394
  summary: Rails utilities.