runger_config 2.6.1 → 2.7.0

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: a54d03412d6c18bcdba455116aaa8251ec3f0ff1ce5841f99d143c7d867987b8
4
- data.tar.gz: 6233d5fa61f04f78e65e3359954fcbdf37ed8a1d745593f1211a41a6978be61e
3
+ metadata.gz: 2321e79eb41ceb4f9cb880298a037bf6132b52f3b14ff8924563ddaa1ed871c0
4
+ data.tar.gz: 8c14454104fff26bf94c899cd09508e2984aecdeaff3a536041e8c69fb08d96f
5
5
  SHA512:
6
- metadata.gz: 60d514c4a4a36fff962ddc9b985af7d5d774f737bb5af1c2d4cea093547f70d251a8cb55833521acb27d95eed55f9f5da16c46b9fee33740cde61140d20b800a
7
- data.tar.gz: e4026522cd94304c3bfc0e5f07027da17b3e8d8d03d046f45f2af4b777ee2b67ac97217f2882cf6fc658c7e4aa3ee662b3cba59b456d4a16992c42bf52a3cfa0
6
+ metadata.gz: 3165821c9e090c4b4897790624ca082aa7558f8744fcc7ac762849ee02b1e9b65162992d748aca2462f18f911d5b7c8d051bb023018293115f51a0eab6fe7d1e
7
+ data.tar.gz: d283136c30a489dd9304ef6b51a869fab40e7c9cb64a3a9636ede9350cca402e248a89d6d007c83f7585593a9327fb19a232eb0e33a9a59389767a74fd4d9fa5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v2.7.0 (2023-11-19)
2
+
3
+ - Support name inference for nested classes
4
+
1
5
  ## v2.6.1 (2023-11-19)
2
6
 
3
7
  - Update GitHub links from palkan to davidrunger
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Cult Of Martians](http://cultofmartians.com/assets/badges/badge.svg)](https://cultofmartians.com/tasks/anyway-config-options-parse.html#task)
2
- [![Gem Version](https://badge.fury.io/rb/anyway_config.svg)](https://rubygems.org/gems/anyway_config) [![Build](https://github.com/palkan/anyway_config/workflows/Build/badge.svg)](https://github.com/palkan/anyway_config/actions)
3
- [![JRuby Build](https://github.com/palkan/anyway_config/workflows/JRuby%20Build/badge.svg)](https://github.com/palkan/anyway_config/actions)
4
- [![TruffleRuby Build](https://github.com/palkan/anyway_config/workflows/TruffleRuby%20Build/badge.svg)](https://github.com/palkan/anyway_config/actions)
2
+ [![Gem Version](https://badge.fury.io/rb/runger_config.svg)](https://rubygems.org/gems/runger_config) [![Build](https://github.com/davidrunger/runger_config/workflows/Build/badge.svg)](https://github.com/davidrunger/runger_config/actions)
3
+ [![JRuby Build](https://github.com/davidrunger/runger_config/workflows/JRuby%20Build/badge.svg)](https://github.com/davidrunger/runger_config/actions)
4
+ [![TruffleRuby Build](https://github.com/davidrunger/runger_config/workflows/TruffleRuby%20Build/badge.svg)](https://github.com/davidrunger/runger_config/actions)
5
5
 
6
6
  # Anyway Config
7
7
 
@@ -20,14 +20,14 @@ For application developers, Anyway Config could be useful to:
20
20
  - **Free code of ENV/credentials/secrets dependency** and use configuration classes instead—your code should not rely on configuration data sources.
21
21
 
22
22
  **NOTE:** this readme shows documentation for 2.x version.
23
- For version 1.x see the [1-4-stable branch](https://github.com/palkan/anyway_config/tree/1-4-stable).
23
+ For version 1.x see the [1-4-stable branch](https://github.com/davidrunger/runger_config/tree/1-4-stable).
24
24
 
25
- <a href="https://evilmartians.com/?utm_source=anyway_config">
25
+ <a href="https://evilmartians.com/?utm_source=runger_config">
26
26
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
27
27
 
28
28
  ## Links
29
29
 
30
- - [Anyway Config: Keep your Ruby configuration sane](https://evilmartians.com/chronicles/anyway-config-keep-your-ruby-configuration-sane?utm_source=anyway_config)
30
+ - [Anyway Config: Keep your Ruby configuration sane](https://evilmartians.com/chronicles/anyway-config-keep-your-ruby-configuration-sane?utm_source=runger_config)
31
31
 
32
32
  ## Table of contents
33
33
 
@@ -73,7 +73,7 @@ end
73
73
 
74
74
  Using Ruby classes to represent configuration allows you to add helper methods and computed parameters easily, makes the configuration **testable**.
75
75
 
76
- The `anyway_config` gem takes care of loading parameters from **different sources** (YAML, credentials/secrets, environment variables, etc.). Internally, we use a _pipeline pattern_ and provide the [Loaders API](#data-loaders) to manage and [extend](#custom-loaders) its functionality.
76
+ The `runger_config` gem takes care of loading parameters from **different sources** (YAML, credentials/secrets, environment variables, etc.). Internally, we use a _pipeline pattern_ and provide the [Loaders API](#data-loaders) to manage and [extend](#custom-loaders) its functionality.
77
77
 
78
78
  Check out the libraries using Anyway Config for more examples:
79
79
 
@@ -81,7 +81,7 @@ Check out the libraries using Anyway Config for more examples:
81
81
  - [AnyCable](https://github.com/anycable/anycable)
82
82
  - [Sniffer](https://github.com/aderyabin/sniffer)
83
83
  - [Blood Contracts](https://github.com/sclinede/blood_contracts)
84
- - [and others](https://github.com/palkan/anyway_config/network/dependents).
84
+ - [and others](https://github.com/davidrunger/runger_config/network/dependents).
85
85
 
86
86
  ## Installation
87
87
 
@@ -91,7 +91,7 @@ Adding to a gem:
91
91
  # my-cool-gem.gemspec
92
92
  Gem::Specification.new do |spec|
93
93
  # ...
94
- spec.add_dependency "anyway_config", ">= 2.0.0"
94
+ spec.add_dependency "runger_config", ">= 2.0.0"
95
95
  # ...
96
96
  end
97
97
  ```
@@ -100,7 +100,7 @@ Or adding to your project:
100
100
 
101
101
  ```ruby
102
102
  # Gemfile
103
- gem "anyway_config", "~> 2.0"
103
+ gem "runger_config", "~> 2.0"
104
104
  ```
105
105
 
106
106
  ### Supported Ruby versions
@@ -118,7 +118,7 @@ you can define a schema for your configuration, provide defaults, add validation
118
118
  Anyway Config provides a base class to inherit from with a few DSL methods:
119
119
 
120
120
  ```ruby
121
- require "anyway_config"
121
+ require "runger_config"
122
122
 
123
123
  module MyCoolGem
124
124
  class Config < Anyway::Config
@@ -372,7 +372,7 @@ development:
372
372
 
373
373
  ### Multi-env configuration
374
374
 
375
- _⚡️ This feature will be turned on by default in the future releases. You can turn it on now via `config.anyway_config.future.use :unwrap_known_environments`._
375
+ _⚡️ This feature will be turned on by default in the future releases. You can turn it on now via `config.runger_config.future.use :unwrap_known_environments`._
376
376
 
377
377
  If the YML does not have keys that are one of the "known" Rails environments (development, production, test)—the same configuration will be available in all environments, similar to non-Rails behavior:
378
378
 
@@ -385,7 +385,7 @@ port: 3002
385
385
  To extend the list of known environments, use the setting in the relevant part of your Rails code:
386
386
 
387
387
  ```ruby
388
- Rails.application.config.anyway_config.known_environments << "staging"
388
+ Rails.application.config.runger_config.known_environments << "staging"
389
389
  ```
390
390
 
391
391
  If your YML defines at least a single "environmental" top-level, you _have_ to separate all your settings per-environment. You can't mix and match:
@@ -400,7 +400,7 @@ port: 3002 # This value will not be loaded at all
400
400
  To provide default values you can use YAML anchors, but they do not deep-merge settings, so Anyway Config provides a way to define a special top-level key for default values like this:
401
401
 
402
402
  ```ruby
403
- config.anyway_config.default_environmental_key = "default"
403
+ config.runger_config.default_environmental_key = "default"
404
404
  ```
405
405
 
406
406
  After that, Anyway Config will start reading settings under the `"default"` key and then merge environmental settings into them.
@@ -419,17 +419,17 @@ staging:
419
419
 
420
420
  You can specify the lookup path for YAML files in one of the following ways:
421
421
 
422
- - By setting `config.anyway_config.default_config_path` to a target directory path:
422
+ - By setting `config.runger_config.default_config_path` to a target directory path:
423
423
 
424
424
  ```ruby
425
- config.anyway_config.default_config_path = "/etc/configs"
426
- config.anyway_config.default_config_path = Rails.root.join("etc", "configs")
425
+ config.runger_config.default_config_path = "/etc/configs"
426
+ config.runger_config.default_config_path = Rails.root.join("etc", "configs")
427
427
  ```
428
428
 
429
- - By setting `config.anyway_config.default_config_path` to a Proc, which accepts a config name and returns the path:
429
+ - By setting `config.runger_config.default_config_path` to a Proc, which accepts a config name and returns the path:
430
430
 
431
431
  ```ruby
432
- config.anyway_config.default_config_path = ->(name) { Rails.root.join("data", "configs", "#{name}.yml") }
432
+ config.runger_config.default_config_path = ->(name) { Rails.root.join("data", "configs", "#{name}.yml") }
433
433
  ```
434
434
 
435
435
  - By overriding a specific config YML file path via the `<NAME>_CONF` env variable, e.g., `MYCOOLGEM_CONF=path/to/cool.yml`
@@ -494,13 +494,13 @@ You can configure the configs folder path:
494
494
 
495
495
  ```ruby
496
496
  # The path must be relative to Rails root
497
- config.anyway_config.autoload_static_config_path = "path/to/configs"
497
+ config.runger_config.autoload_static_config_path = "path/to/configs"
498
498
  ```
499
499
 
500
500
  **NOTE:** Configs loaded from the `autoload_static_config_path` are **not reloaded in development**. We call them _static_. So, it makes sense to keep only configs necessary for initialization in this folder. Other configs, _dynamic_, could be stored in `app/configs`.
501
- Or you can store everything in `app/configs` by setting `config.anyway_config.autoload_static_config_path = "app/configs"`.
501
+ Or you can store everything in `app/configs` by setting `config.runger_config.autoload_static_config_path = "app/configs"`.
502
502
 
503
- **NOTE 2**: Since _static_ configs are loaded before initializers, it's not possible to use custom inflection Rules (usually defined in `config/initializers/inflections.rb`) to resolve constant names from files. If you rely on custom inflection rules (see, for example, [#81](https://github.com/palkan/anyway_config/issues/81)), we recommend configuration Rails inflector before initialization as well:
503
+ **NOTE 2**: Since _static_ configs are loaded before initializers, it's not possible to use custom inflection Rules (usually defined in `config/initializers/inflections.rb`) to resolve constant names from files. If you rely on custom inflection rules (see, for example, [#81](https://github.com/davidrunger/runger_config/issues/81)), we recommend configuration Rails inflector before initialization as well:
504
504
 
505
505
  ```ruby
506
506
  # config/application.rb
@@ -549,7 +549,7 @@ Would you like to generate a heroku.yml file? (Y/n) n
549
549
  You can also specify the `--app` option to put the newly created class into `app/configs` folder.
550
550
  Alternatively, you can call `rails g anyway:app_config name param1 param2 ...`.
551
551
 
552
- **NOTE:** The generated `ApplicationConfig` class uses a singleton pattern along with `delegate_missing_to` to re-use the same instance across the application. However, the delegation can lead to unexpected behaviour and break Anyway Config internals if you have attributes named as `Anyway::Config` class methods. See [#120](https://github.com/palkan/anyway_config/issues/120).
552
+ **NOTE:** The generated `ApplicationConfig` class uses a singleton pattern along with `delegate_missing_to` to re-use the same instance across the application. However, the delegation can lead to unexpected behaviour and break Anyway Config internals if you have attributes named as `Anyway::Config` class methods. See [#120](https://github.com/davidrunger/runger_config/issues/120).
553
553
 
554
554
  ### Loading Anyway Config before Rails
555
555
 
@@ -745,7 +745,7 @@ config at this location, too.
745
745
 
746
746
  Local configs are meant for using in development and only loaded if `Anyway::Settings.use_local_files` is `true` (which is true by default if `RACK_ENV` or `RAILS_ENV` env variable is equal to `"development"`).
747
747
 
748
- **NOTE:** in Rails apps you can use `Rails.application.configuration.anyway_config.use_local_files`.
748
+ **NOTE:** in Rails apps you can use `Rails.application.configuration.runger_config.use_local_files`.
749
749
 
750
750
  Don't forget to add `*.local.yml` (and `config/credentials/local.*`) to your `.gitignore`.
751
751
 
@@ -904,7 +904,7 @@ conf.to_source_trace["host"]
904
904
  #=> {type: :user, called_from: "/path/to/caller.rb:15"}
905
905
  ```
906
906
 
907
- You can disable tracing functionality by setting `Anyway::Settings.tracing_enabled = false` or `config.anyway_config.tracing_enabled = false` in Rails.
907
+ You can disable tracing functionality by setting `Anyway::Settings.tracing_enabled = false` or `config.runger_config.tracing_enabled = false` in Rails.
908
908
 
909
909
  ### Pretty print
910
910
 
@@ -1059,7 +1059,7 @@ To use them with Steep, add the following your `Steepfile`:
1059
1059
  ```ruby
1060
1060
  library "pathname"
1061
1061
  library "optparse"
1062
- library "anyway_config"
1062
+ library "runger_config"
1063
1063
  ```
1064
1064
 
1065
1065
  We also provide an API to generate a type signature for your config class:
@@ -1114,7 +1114,7 @@ Yeah, a lot of annotations 😞 Welcome to the type-safe world!
1114
1114
 
1115
1115
  ## Contributing
1116
1116
 
1117
- Bug reports and pull requests are welcome on GitHub at [https://github.com/palkan/anyway_config](https://github.com/palkan/anyway_config).
1117
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/davidrunger/runger_config](https://github.com/davidrunger/runger_config).
1118
1118
 
1119
1119
  ## License
1120
1120
 
data/lib/anyway/config.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/all"
3
4
  require "anyway/optparse_config"
4
5
  require "anyway/dynamic_config"
5
6
 
@@ -292,16 +293,12 @@ module Anyway # :nodoc:
292
293
  "via `config_name :my_config`"
293
294
  end
294
295
 
295
- # handle two cases:
296
- # - SomeModule::Config => "some_module"
297
- # - SomeConfig => "some"
298
- unless name =~ /^(\w+)(::)?Config$/
296
+ unless name.underscore.gsub("/", "_") =~ /(\w+)_config\z/
299
297
  raise "Couldn't infer config name, please, specify it explicitly " \
300
298
  "via `config_name :my_config`"
301
299
  end
302
300
 
303
- # TODO(v3.0): Replace downcase with underscore
304
- Regexp.last_match[1].tap(&:downcase!)
301
+ Regexp.last_match[1].delete_suffix("_config").tap(&:downcase!)
305
302
  end
306
303
 
307
304
  def validate_param_names!(names)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyway # :nodoc:
4
- VERSION = "2.6.1"
4
+ VERSION = "2.7.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runger_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.14.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 7.1.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 7.1.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: ammeter
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -169,16 +183,16 @@ files:
169
183
  - lib/generators/anyway/install/templates/application_config.rb.tt
170
184
  - sig/anyway_config.rbs
171
185
  - sig/manifest.yml
172
- homepage: http://github.com/davidrunger/anyway_config
186
+ homepage: http://github.com/davidrunger/runger_config
173
187
  licenses:
174
188
  - MIT
175
189
  metadata:
176
- bug_tracker_uri: http://github.com/davidrunger/anyway_config/issues
177
- changelog_uri: https://github.com/davidrunger/anyway_config/blob/master/CHANGELOG.md
178
- documentation_uri: http://github.com/davidrunger/anyway_config
190
+ bug_tracker_uri: http://github.com/davidrunger/runger_config/issues
191
+ changelog_uri: https://github.com/davidrunger/runger_config/blob/master/CHANGELOG.md
192
+ documentation_uri: http://github.com/davidrunger/runger_config
179
193
  funding_uri: https://github.com/sponsors/davidrunger
180
- homepage_uri: http://github.com/davidrunger/anyway_config
181
- source_code_uri: http://github.com/davidrunger/anyway_config
194
+ homepage_uri: http://github.com/davidrunger/runger_config
195
+ source_code_uri: http://github.com/davidrunger/runger_config
182
196
  rubygems_mfa_required: 'true'
183
197
  post_install_message:
184
198
  rdoc_options: []