hierarchical_config 0.13 → 0.13.2

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: 63ac58b07f108d686879b6257643b289d9c2d702941b294d96cd64f2899dc241
4
- data.tar.gz: 23deffaef12f8c1c252f889c0ae62f53a580d711df76b0909d3d2047515d99ab
3
+ metadata.gz: '082a70f0459244fb67cda0dba88649260b67653ebb7da111e2f12c03ca1fc914'
4
+ data.tar.gz: d8ce915f3d8c6f442cf559ded686e2785c827a65598cec611cd67181f01c4742
5
5
  SHA512:
6
- metadata.gz: f7847a6250d05cd1a9f5af1666d1b0632664dc7a5b49c98c845c5e69892ba0a8988a3355d10418504aed9a427caf475832fca2922003164d58cfdca1ef36e6cf
7
- data.tar.gz: feeafb9fd68c08ef03c6ebf9d9900d3cfd8da773499cbedcf19b58306bbce09bef40fe931f86b37300a3487244d8fe1a34e6fef919fcf874bcbebe0ed37bb454
6
+ metadata.gz: f93a234df8d94e1ee23331866060713557e8dbde7378ca0dce3e4938638215198e2ed949a406bc1dbd5c9ef25c9bd515ec36ca50879682336afb717f405d400f
7
+ data.tar.gz: 449da19f03c6c1adacac64505c829903dee74847c6338549535ce3232838e021c1490a21bfb5bc8aaae9a03f1f7c4dd3346de348c7731803d4feae853f3b018c
@@ -0,0 +1,41 @@
1
+ name: release-please
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ release-please:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: GoogleCloudPlatform/release-please-action@v3
17
+ id: release
18
+ with:
19
+ release-type: ruby
20
+ package-name: hierarchical_config
21
+ bump-minor-pre-major: true
22
+ version-file: "lib/hierarchical_config/version.rb"
23
+ - uses: actions/checkout@v2
24
+ if: ${{ steps.release.outputs.release_created }}
25
+ - uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: 3.2.2
28
+ if: ${{ steps.release.outputs.release_created }}
29
+ - run: bundle install
30
+ if: ${{ steps.release.outputs.release_created }}
31
+ - name: publish gem
32
+ run: |
33
+ mkdir -p $HOME/.gem
34
+ touch $HOME/.gem/credentials
35
+ chmod 0600 $HOME/.gem/credentials
36
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
37
+ gem build *.gemspec
38
+ gem push *.gem
39
+ env:
40
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
41
+ if: ${{ steps.release.outputs.release_created }}
@@ -26,6 +26,9 @@ jobs:
26
26
  include:
27
27
  - gemfile: Gemfile
28
28
  not-only-test: true
29
+ - gemfile: Gemfile
30
+ ruby-version: 2.6
31
+ not-only-test: false
29
32
  - gemfile: Gemfile.2.4
30
33
  ruby-version: 2.5
31
34
  not-only-test: false
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.13.2"
3
+ }
data/.rubocop.yml CHANGED
@@ -25,7 +25,7 @@ Metrics/BlockLength:
25
25
  Metrics/ClassLength:
26
26
  Enabled: false
27
27
 
28
- Metrics/LineLength:
28
+ Layout/LineLength:
29
29
  Max: 120
30
30
 
31
31
  Metrics/MethodLength:
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## [0.13.2](https://github.com/timgaleckas/hierarchical_config/compare/v0.13.1...v0.13.2) (2023-08-09)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * allow for all upercase config keys and error on yaml keys that end with ? ([62d3d4b](https://github.com/timgaleckas/hierarchical_config/commit/62d3d4b4c863787dd5b54d601ce0fed01f73ce4f))
9
+
10
+ ## [0.13.1](https://github.com/timgaleckas/hierarchical_config/compare/v0.13.0...v0.13.1) (2023-08-09)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * allow for all upercase config keys and error on yaml keys that end with ? ([62d3d4b](https://github.com/timgaleckas/hierarchical_config/commit/62d3d4b4c863787dd5b54d601ce0fed01f73ce4f))
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hierarchical_config (0.13)
4
+ hierarchical_config (0.13.2)
5
5
  activesupport
6
6
  sorbet-runtime
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.0.4.2)
11
+ activesupport (7.0.6)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
@@ -20,12 +20,12 @@ GEM
20
20
  concurrent-ruby (1.2.2)
21
21
  debug_inspector (1.1.0)
22
22
  diff-lcs (1.5.0)
23
- i18n (1.12.0)
23
+ i18n (1.14.1)
24
24
  concurrent-ruby (~> 1.0)
25
25
  interception (0.5)
26
26
  json (2.6.3)
27
27
  method_source (1.0.0)
28
- minitest (5.17.0)
28
+ minitest (5.19.0)
29
29
  netrc (0.11.0)
30
30
  parallel (1.22.1)
31
31
  parser (3.2.1.0)
@@ -88,6 +88,7 @@ GEM
88
88
  sorbet-static (= 0.5.10689)
89
89
  sorbet-runtime (0.5.10689)
90
90
  sorbet-static (0.5.10689-universal-darwin-22)
91
+ sorbet-static (0.5.10689-x86_64-linux)
91
92
  sorbet-static-and-runtime (0.5.10689)
92
93
  sorbet (= 0.5.10689)
93
94
  sorbet-runtime (= 0.5.10689)
@@ -120,6 +121,7 @@ GEM
120
121
 
121
122
  PLATFORMS
122
123
  x86_64-darwin-22
124
+ x86_64-linux
123
125
 
124
126
  DEPENDENCIES
125
127
  bundler
@@ -1,5 +1,5 @@
1
1
  # typed: true
2
2
 
3
3
  module HierarchicalConfig
4
- VERSION = '0.13'.freeze
4
+ VERSION = '0.13.2'.freeze
5
5
  end
@@ -24,6 +24,36 @@ module HierarchicalConfig
24
24
  Hash[self.class.props.keys.map{|key| [key, item_to_hash(send(key))]}] # rubocop:disable Style/HashConversion
25
25
  end
26
26
 
27
+ sig do
28
+ type_parameters(:A, :B).
29
+ params(
30
+ blk: T.nilable(
31
+ T.proc.params(name: Symbol, value: T.untyped).
32
+ returns([T.type_parameter(:A), T.type_parameter(:B)]),
33
+ ),
34
+ ).
35
+ returns(
36
+ T.any(
37
+ T::Hash[T.type_parameter(:A), T.type_parameter(:B)],
38
+ T::Hash[Symbol, T.untyped],
39
+ ),
40
+ )
41
+ end
42
+ def to_h(&blk)
43
+ hash = self.class.props.keys.map{|key| [key, send(key)]}
44
+ if blk
45
+ # copied from https://github.com/marcandre/backports/blob/36572870cbdc0cda30e5bab81af8ba390a6cf7c7/lib/backports/2.6.0/hash/to_h.rb#L3C39-L3C39
46
+ # to implement to_h with block for ruby < 2.6.0
47
+ if {n: true}.to_h{[:ok, true]}[:n]
48
+ T.unsafe(hash).map(&blk).to_h
49
+ else
50
+ hash.to_h(&blk)
51
+ end
52
+ else
53
+ hash.to_h
54
+ end
55
+ end
56
+
27
57
  sig{params(key: T.any(String, Symbol)).returns(T.untyped)}
28
58
  def [](key)
29
59
  send(key)
@@ -71,7 +101,7 @@ module HierarchicalConfig
71
101
  def build_types(current_item, name, parent_class)
72
102
  case current_item
73
103
  when Hash
74
- new_type_name = ActiveSupport::Inflector.camelize(ActiveSupport::Inflector.underscore(name))
104
+ new_type_name = inflect_typename(name)
75
105
 
76
106
  return Hash if current_item.keys.to_a.any?{|k| k =~ /^[0-9]/ || k =~ /[- ]/}
77
107
 
@@ -115,7 +145,7 @@ module HierarchicalConfig
115
145
  when Hash
116
146
  return current_item.symbolize_keys if current_item.keys.to_a.any?{|k| k =~ /^[0-9]/ || k =~ /[- ]/}
117
147
 
118
- current_type = parent_class.const_get(ActiveSupport::Inflector.camelize(name))
148
+ current_type = parent_class.const_get(inflect_typename(name))
119
149
  current_type.new(Hash[current_item.map{|key, value| [key.to_sym, build_config(value, key, current_type)]}]) # rubocop:disable Style/HashConversion
120
150
  when Array
121
151
  current_item.each_with_index.map do |item, index|
@@ -247,5 +277,10 @@ module HierarchicalConfig
247
277
  end
248
278
  hash1
249
279
  end
280
+
281
+ sig{params(name: String).returns(String)}
282
+ def inflect_typename(name)
283
+ ActiveSupport::Inflector.camelize(name)
284
+ end
250
285
  end
251
286
  end
@@ -0,0 +1,14 @@
1
+ {
2
+ "packages": {
3
+ ".": {
4
+ "changelog-path": "CHANGELOG.md",
5
+ "release-type": "ruby",
6
+ "bump-minor-pre-major": true,
7
+ "bump-patch-for-minor-pre-major": true,
8
+ "draft": false,
9
+ "prerelease": false,
10
+ "version-file": "lib/hierarchical_config/version.rb"
11
+ }
12
+ },
13
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
14
+ }
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hierarchical_config
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.13'
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - timgaleckas
8
8
  - tjbladez
9
9
  - jdfrens
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-02-28 00:00:00.000000000 Z
13
+ date: 2023-08-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -47,11 +47,14 @@ executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - ".github/workflows/release.yml"
50
51
  - ".github/workflows/ruby.yml"
51
52
  - ".gitignore"
53
+ - ".release-please-manifest.json"
52
54
  - ".rspec"
53
55
  - ".rubocop.yml"
54
56
  - ".ruby-version"
57
+ - CHANGELOG.md
55
58
  - CODE_OF_CONDUCT.md
56
59
  - Gemfile
57
60
  - Gemfile.2.4
@@ -65,6 +68,7 @@ files:
65
68
  - hierarchical_config.gemspec
66
69
  - lib/hierarchical_config.rb
67
70
  - lib/hierarchical_config/version.rb
71
+ - release-please-config.json
68
72
  - sorbet/config
69
73
  - sorbet/rbi/annotations/activesupport.rbi
70
74
  - sorbet/rbi/annotations/rainbow.rbi
@@ -116,7 +120,7 @@ licenses:
116
120
  - MIT
117
121
  metadata:
118
122
  rubygems_mfa_required: 'true'
119
- post_install_message:
123
+ post_install_message:
120
124
  rdoc_options: []
121
125
  require_paths:
122
126
  - lib
@@ -131,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
135
  - !ruby/object:Gem::Version
132
136
  version: '0'
133
137
  requirements: []
134
- rubygems_version: 3.3.26
135
- signing_key:
138
+ rubygems_version: 3.4.10
139
+ signing_key:
136
140
  specification_version: 4
137
141
  summary: Robust strategy for defining the configuration accross environments, machines,
138
142
  clusters