configature 0.3.3 → 0.3.4
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/Gemfile.lock +5 -5
- data/README.md +13 -0
- data/VERSION +1 -1
- data/lib/configature/namespace.rb +6 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a224ef00f9af60ae0ba0763ccd95aa3fa1f96a0a2d1bc9065fd9901c9654334e
|
4
|
+
data.tar.gz: fe233997b912aa51af9345f21aecb7401e957d8f3a9e3a1791ed143c7c8ca6f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ea6242794f99d7cafe567d80a1ed8b1baa5ec25329e7bdacd9e246f7e0775d8347acaad5d570e904a6707fef9ffef2d593468c1e4c9ffc3c69cb1c452211bd6
|
7
|
+
data.tar.gz: 5b0af76af2347583a90091cc0717d2ecfe40a8c581032f438c7729a2ddbedadc0da867d5b3c87217df8b1185d4b82e717ae095c495b2cc5f56ea2f5c501787b7
|
data/Gemfile.lock
CHANGED
@@ -6,21 +6,21 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
diff-lcs (1.
|
9
|
+
diff-lcs (1.4.4)
|
10
10
|
rake (13.0.1)
|
11
11
|
rspec (3.9.0)
|
12
12
|
rspec-core (~> 3.9.0)
|
13
13
|
rspec-expectations (~> 3.9.0)
|
14
14
|
rspec-mocks (~> 3.9.0)
|
15
|
-
rspec-core (3.9.
|
16
|
-
rspec-support (~> 3.9.
|
17
|
-
rspec-expectations (3.9.
|
15
|
+
rspec-core (3.9.2)
|
16
|
+
rspec-support (~> 3.9.3)
|
17
|
+
rspec-expectations (3.9.2)
|
18
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
19
19
|
rspec-support (~> 3.9.0)
|
20
20
|
rspec-mocks (3.9.1)
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
22
|
rspec-support (~> 3.9.0)
|
23
|
-
rspec-support (3.9.
|
23
|
+
rspec-support (3.9.3)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
ruby
|
data/README.md
CHANGED
@@ -90,6 +90,19 @@ relative to `Rails.root` if `Rails` is defined.
|
|
90
90
|
This value can be overridden with the environment variable `EXAMPLE_ARGUMENT`
|
91
91
|
or in a config file `config/example.yml` under the `argument:` key.
|
92
92
|
|
93
|
+
The location of the config file for a namespace can be overridden with
|
94
|
+
the `config_dir` directive:
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
class MyConfig < Configature::Config
|
98
|
+
namespace :example do
|
99
|
+
self.config_dir = File.expand_path('../conf', __dir__)
|
100
|
+
|
101
|
+
argument default: 'value'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
93
106
|
## Development
|
94
107
|
|
95
108
|
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
@@ -23,6 +23,7 @@ class Configature::Namespace
|
|
23
23
|
end
|
24
24
|
|
25
25
|
RECAST_AS = {
|
26
|
+
[ :array, Array ] => -> (v) { v.is_a?(Array) ? v : [ v ] },
|
26
27
|
[ :string, String ] => :to_s.to_proc,
|
27
28
|
[ :integer, Integer ] => :to_i.to_proc,
|
28
29
|
[ :float, Float ] => :to_f.to_proc,
|
@@ -35,16 +36,16 @@ class Configature::Namespace
|
|
35
36
|
[ k, v ]
|
36
37
|
end
|
37
38
|
end.to_h.freeze
|
38
|
-
|
39
|
+
|
39
40
|
# == Properties ===========================================================
|
40
41
|
|
41
42
|
attr_reader :name
|
42
43
|
attr_reader :env_name_prefix
|
43
44
|
attr_reader :namespaces
|
44
45
|
attr_reader :parameters
|
45
|
-
|
46
|
+
|
46
47
|
# == Class Methods ========================================================
|
47
|
-
|
48
|
+
|
48
49
|
# == Instance Methods =====================================================
|
49
50
|
|
50
51
|
def initialize(name = nil, env_name_prefix: '', env_suffix: '', extends: nil)
|
@@ -80,8 +81,9 @@ class Configature::Namespace
|
|
80
81
|
@env_default = default
|
81
82
|
end
|
82
83
|
|
83
|
-
def parameter(parameter_name, default: nil, as:
|
84
|
+
def parameter(parameter_name, default: nil, as: nil, name: nil, env: nil, remap: nil)
|
84
85
|
name ||= parameter_name
|
86
|
+
as ||= default.is_a?(Array) ? :array : :string
|
85
87
|
|
86
88
|
case (as)
|
87
89
|
when Class, Symbol
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Tadman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Assists in the creation of config files from example templates and can
|
14
14
|
identify when some customization is necessary.
|
@@ -48,7 +48,7 @@ metadata:
|
|
48
48
|
homepage_uri: https://postageapp.com/
|
49
49
|
source_code_uri: https://github.com/postageapp/configuature
|
50
50
|
changelog_uri: https://github.com/postageapp/configuature
|
51
|
-
post_install_message:
|
51
|
+
post_install_message:
|
52
52
|
rdoc_options: []
|
53
53
|
require_paths:
|
54
54
|
- lib
|
@@ -63,8 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.1.
|
67
|
-
signing_key:
|
66
|
+
rubygems_version: 3.1.4
|
67
|
+
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Configuration file auto-generator
|
70
70
|
test_files: []
|