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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61bfe9a27a2905f469bfd446a01e8291a33a5e66ac87761d18f83f2959a8237e
4
- data.tar.gz: 4812cfcdb1573f15a2e97ce4a23a204a28f2b76f6ef448b06f37dcadbf07c99d
3
+ metadata.gz: a224ef00f9af60ae0ba0763ccd95aa3fa1f96a0a2d1bc9065fd9901c9654334e
4
+ data.tar.gz: fe233997b912aa51af9345f21aecb7401e957d8f3a9e3a1791ed143c7c8ca6f7
5
5
  SHA512:
6
- metadata.gz: c5c230c614c28c9e423fa38bd2798e7730e450c19ee9c59702a8ca993103b10bb8f6559b6128d5fc233ea25aa13b857eed9e8954b078976ea16f2c3ff718d1a8
7
- data.tar.gz: 2b9136bcbde3a3fc9b9c1724d072353b4f0c39587c33671dbad76c8b56673082f6ef90b34b64cf1e0654e53c2ab201dbdd97ad54c004c2a62398e23f2b4f6f3b
6
+ metadata.gz: 9ea6242794f99d7cafe567d80a1ed8b1baa5ec25329e7bdacd9e246f7e0775d8347acaad5d570e904a6707fef9ffef2d593468c1e4c9ffc3c69cb1c452211bd6
7
+ data.tar.gz: 5b0af76af2347583a90091cc0717d2ecfe40a8c581032f438c7729a2ddbedadc0da867d5b3c87217df8b1185d4b82e717ae095c495b2cc5f56ea2f5c501787b7
@@ -6,21 +6,21 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.3)
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.1)
16
- rspec-support (~> 3.9.1)
17
- rspec-expectations (3.9.0)
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.2)
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.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: :string, name: nil, env: nil, remap: nil)
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.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-04-21 00:00:00.000000000 Z
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.2
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: []