gem_config 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +7 -5
- data/README.md +18 -1
- data/gem_config.gemspec +4 -4
- data/lib/gem_config.rb +1 -2
- data/lib/gem_config/configuration.rb +5 -3
- data/lib/gem_config/version.rb +1 -1
- metadata +17 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f62a384b505365800d4894e7dc402e2ecd8ba46a9ae99deb242afdaede4b04d9
|
4
|
+
data.tar.gz: c2cbbfa9d4a6f5c8244f0aa4cf632036afb39909591f3e1f473916d5636a96ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1c0e9b0064bb6acb2aa4b2f27fb6199880dab09c361d821333fc1f7470013ce9e2cb3d29f220511784d859a344f142d4abecb8f774b18a876789720a666a86
|
7
|
+
data.tar.gz: fd016fb10444f535f1bf8caeab2477b7911c3e7b006f82ffd529c6608000fc60528d5836c6fac55f5289eadae726d3ba2b3422ba1e17748bd535e123b3a3d688
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/gem_config.png)](http://badge.fury.io/rb/gem_config)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/krautcomputing/gem_config.png)](http://travis-ci.org/krautcomputing/gem_config)
|
5
|
-
[![Dependency Status](https://gemnasium.com/krautcomputing/gem_config.png)](https://gemnasium.com/krautcomputing/gem_config)
|
6
5
|
[![Code Climate](https://codeclimate.com/github/krautcomputing/gem_config.png)](https://codeclimate.com/github/krautcomputing/gem_config)
|
7
6
|
|
8
7
|
A nifty way to make your gem configurable.
|
@@ -42,6 +41,20 @@ Access the configuration values in the gem's code like this:
|
|
42
41
|
Awesomeness.configuration.api_key # Whatever the user set
|
43
42
|
```
|
44
43
|
|
44
|
+
To execute something after the gem is configured:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
module Awesomeness
|
48
|
+
include GemConfig::Base
|
49
|
+
|
50
|
+
# ...
|
51
|
+
|
52
|
+
after_configuration_change do
|
53
|
+
# configure some other gem you're using, perhaps
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
45
58
|
### As a gem user
|
46
59
|
|
47
60
|
Include and configure a gem like this:
|
@@ -71,3 +84,7 @@ Of course configuration values are checked against the allowed `classes` and `va
|
|
71
84
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
72
85
|
4. Push to the branch (`git push origin my-new-feature`)
|
73
86
|
5. Create new Pull Request
|
87
|
+
|
88
|
+
## Support
|
89
|
+
|
90
|
+
If you like this project, consider [buying me a coffee](https://www.buymeacoffee.com/279lcDtbF)! :)
|
data/gem_config.gemspec
CHANGED
@@ -7,11 +7,11 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = 'gem_config'
|
8
8
|
gem.version = GemConfig::VERSION
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.
|
10
|
+
gem.author = 'Manuel Meurer'
|
11
11
|
gem.email = 'manuel@krautcomputing.com'
|
12
12
|
gem.summary = 'A nifty way to make your gem configurable.'
|
13
13
|
gem.description = 'A nifty way to make your gem configurable.'
|
14
|
-
gem.homepage = '
|
14
|
+
gem.homepage = 'http://krautcomputing.github.io/gem_config'
|
15
15
|
gem.license = 'MIT'
|
16
16
|
|
17
17
|
gem.files = `git ls-files`.split($/)
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.test_files = gem.files.grep(%r(^(test|spec|features)/))
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
|
-
gem.add_development_dependency 'rake'
|
23
|
-
gem.add_development_dependency 'rspec', '~> 3.0
|
22
|
+
gem.add_development_dependency 'rake'
|
23
|
+
gem.add_development_dependency 'rspec', '~> 3.0'
|
24
24
|
gem.add_development_dependency 'guard-rspec', '~> 4.2'
|
25
25
|
end
|
data/lib/gem_config.rb
CHANGED
@@ -43,13 +43,15 @@ module GemConfig
|
|
43
43
|
self.rules.check(key, value)
|
44
44
|
instance_variable_set "@#{key}", value
|
45
45
|
call_after_configuration_change
|
46
|
+
value
|
46
47
|
end
|
47
48
|
|
48
49
|
def get(key)
|
49
|
-
|
50
|
+
case
|
51
|
+
when instance_variable_defined?("@#{key}")
|
50
52
|
instance_variable_get "@#{key}"
|
51
|
-
|
52
|
-
self.rules[key.to_sym][:default]
|
53
|
+
when self.rules[key.to_sym].key?(:default)
|
54
|
+
set key, self.rules[key.to_sym][:default]
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
data/lib/gem_config/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.0
|
33
|
+
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.0
|
40
|
+
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: guard-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '4.2'
|
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: '4.2'
|
55
55
|
description: A nifty way to make your gem configurable.
|
@@ -58,7 +58,7 @@ executables: []
|
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
|
-
- .travis.yml
|
61
|
+
- ".travis.yml"
|
62
62
|
- Gemfile
|
63
63
|
- Guardfile
|
64
64
|
- LICENSE.txt
|
@@ -74,7 +74,7 @@ files:
|
|
74
74
|
- spec/gem_config/configuration_spec.rb
|
75
75
|
- spec/gem_config/rules_spec.rb
|
76
76
|
- spec/spec_helper.rb
|
77
|
-
homepage:
|
77
|
+
homepage: http://krautcomputing.github.io/gem_config
|
78
78
|
licenses:
|
79
79
|
- MIT
|
80
80
|
metadata: {}
|
@@ -84,17 +84,16 @@ require_paths:
|
|
84
84
|
- lib
|
85
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
|
97
|
-
rubygems_version: 2.2.2
|
96
|
+
rubygems_version: 3.0.4
|
98
97
|
signing_key:
|
99
98
|
specification_version: 4
|
100
99
|
summary: A nifty way to make your gem configurable.
|