runger_config 4.0.0 → 5.1.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/bin/release +27 -0
  4. data/lib/generators/runger/app_config/app_config_generator.rb +6 -10
  5. data/lib/generators/runger/config/config_generator.rb +44 -41
  6. data/lib/generators/runger/install/install_generator.rb +35 -37
  7. data/lib/runger/auto_cast.rb +3 -3
  8. data/lib/runger/config.rb +114 -94
  9. data/lib/runger/dynamic_config.rb +21 -23
  10. data/lib/runger/ejson_parser.rb +24 -24
  11. data/lib/runger/env.rb +50 -52
  12. data/lib/runger/ext/deep_dup.rb +33 -36
  13. data/lib/runger/ext/deep_freeze.rb +28 -32
  14. data/lib/runger/ext/flatten_names.rb +23 -27
  15. data/lib/runger/ext/hash.rb +26 -29
  16. data/lib/runger/ext/string_constantize.rb +12 -15
  17. data/lib/runger/loaders/base.rb +11 -15
  18. data/lib/runger/loaders/doppler.rb +38 -42
  19. data/lib/runger/loaders/ejson.rb +65 -63
  20. data/lib/runger/loaders/env.rb +6 -10
  21. data/lib/runger/loaders/yaml.rb +69 -66
  22. data/lib/runger/loaders.rb +69 -71
  23. data/lib/runger/option_parser_builder.rb +16 -18
  24. data/lib/runger/optparse_config.rb +11 -10
  25. data/lib/runger/rails/autoload.rb +24 -26
  26. data/lib/runger/rails/config.rb +13 -17
  27. data/lib/runger/rails/loaders/credentials.rb +53 -57
  28. data/lib/runger/rails/loaders/secrets.rb +21 -25
  29. data/lib/runger/rails/loaders/yaml.rb +1 -6
  30. data/lib/runger/rails/loaders.rb +3 -3
  31. data/lib/runger/rails/settings.rb +49 -49
  32. data/lib/runger/rails.rb +9 -11
  33. data/lib/runger/railtie.rb +3 -2
  34. data/lib/runger/rbs.rb +29 -29
  35. data/lib/runger/settings.rb +82 -84
  36. data/lib/runger/testing/helpers.rb +26 -28
  37. data/lib/runger/testing.rb +2 -2
  38. data/lib/runger/tracing.rb +143 -136
  39. data/lib/runger/type_casting.rb +16 -11
  40. data/lib/runger/utils/which.rb +10 -12
  41. data/lib/runger/version.rb +1 -1
  42. data/lib/runger.rb +1 -1
  43. data/lib/runger_config.rb +34 -27
  44. metadata +20 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b64cf53f84cf85e579523fa523e04afdd2c32dd75b219cf5a700df552368ded
4
- data.tar.gz: 59459b83f4aff3789c5289a1ed5c33b686dd5012a73eff0ae4627e5eb2e3a3a2
3
+ metadata.gz: 6d7b6bb5cc8cd669711aff10814df1fcebc522e9284227c8badb4b08e45ada7c
4
+ data.tar.gz: 237b1530944cc34469d4b33e5f456f4b61078116294d7a2e3c41ad4703ce4b0f
5
5
  SHA512:
6
- metadata.gz: f7b719cb241b1e1d5c4d7d12d1563179e38e68f7aa777142c4ae8d497d13542f1a07c3b17f9ac7c6c9b9117a5b2bb20cbaab5a8b46a07bbab239cda1f3b5703e
7
- data.tar.gz: 6f2156c5baecc455d4747a70351844c5161e9bb266743ed372dcde9634b6a6054524c354f85629863094e56b9311aa1e706b914ac405412008bb2980ac645bc8
6
+ metadata.gz: 82d00211c95f788f45accdef25e01b3f13ede5d6efdd407e067431ca43d16548c1ce0d422d5db6fc305684d32f8afddae2e5b481073b70f73bc44470301c479c
7
+ data.tar.gz: b8626650770d62b495352a9bcd71275a4b450da699227f7cf918dfea6f33339bdb9e87a952ff813405cf283f287c2f2746781dd688a805b8f368e9aa5764f026
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v5.1.0 (2024-06-15)
2
+
3
+ - Rename primary branch from `master` to `main`
4
+
5
+ ## v5.0.0 (2023-12-29)
6
+
7
+ - Don't use anonymous keyword rest arguments in block
8
+
1
9
  ## v4.0.0 (2023-11-19)
2
10
 
3
11
  - [BREAKING] Rename from Anyway Config to Runger Config
data/bin/release ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'release' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
12
+
13
+ bundle_binstub = File.expand_path('bundle', __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require 'rubygems'
25
+ require 'bundler/setup'
26
+
27
+ load Gem.bin_path('runger_release_assistant', 'release')
@@ -1,17 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "generators/runger/config/config_generator"
3
+ require 'generators/runger/config/config_generator'
4
4
 
5
- module Runger
6
- module Generators
7
- class AppConfigGenerator < ConfigGenerator
8
- source_root ConfigGenerator.source_root
5
+ class Runger::Generators::AppConfigGenerator < Runger::Generators::ConfigGenerator
6
+ source_root ::Runger::Generators::ConfigGenerator.source_root
9
7
 
10
- private
8
+ private
11
9
 
12
- def config_root
13
- "app/configs"
14
- end
15
- end
10
+ def config_root
11
+ 'app/configs'
16
12
  end
17
13
  end
@@ -1,46 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rails/generators"
4
-
5
- module Runger
6
- module Generators
7
- class ConfigGenerator < ::Rails::Generators::NamedBase
8
- source_root File.expand_path("templates", __dir__)
9
-
10
- class_option :yml, type: :boolean
11
- class_option :app, type: :boolean, default: false
12
- argument :parameters, type: :array, default: [], banner: "param1 param2"
13
-
14
- # check_class_collision suffix: "Config"
15
-
16
- def run_install_if_needed
17
- return if ::Rails.root.join(static_config_root, "application_config.rb").exist?
18
- generate "runger:install"
19
- end
20
-
21
- def create_config
22
- template "config.rb", File.join(config_root, class_path, "#{file_name}_config.rb")
23
- end
24
-
25
- def create_yml
26
- create_yml = options.fetch(:yml) { yes?("Would you like to generate a #{file_name}.yml file?") }
27
- return unless create_yml
28
- template "config.yml", File.join("config", "#{file_name}.yml")
29
- end
30
-
31
- private
32
-
33
- def static_config_root
34
- Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH
35
- end
36
-
37
- def config_root
38
- if options[:app]
39
- "app/configs"
40
- else
41
- static_config_root
42
- end
43
- end
3
+ require 'rails/generators'
4
+
5
+ module Runger::Generators ; end
6
+
7
+ class Runger::Generators::ConfigGenerator < Rails::Generators::NamedBase
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ class_option :yml, type: :boolean
11
+ class_option :app, type: :boolean, default: false
12
+ argument :parameters, type: :array, default: [], banner: 'param1 param2'
13
+
14
+ # check_class_collision suffix: "Config"
15
+
16
+ def run_install_if_needed
17
+ return if ::Rails.root.join(static_config_root, 'application_config.rb').exist?
18
+
19
+ generate('runger:install')
20
+ end
21
+
22
+ def create_config
23
+ template('config.rb', File.join(config_root, class_path, "#{file_name}_config.rb"))
24
+ end
25
+
26
+ def create_yml
27
+ create_yml =
28
+ options.fetch(:yml) {
29
+ yes?("Would you like to generate a #{file_name}.yml file?")
30
+ }
31
+ return unless create_yml
32
+
33
+ template('config.yml', File.join('config', "#{file_name}.yml"))
34
+ end
35
+
36
+ private
37
+
38
+ def static_config_root
39
+ Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH
40
+ end
41
+
42
+ def config_root
43
+ if options[:app]
44
+ 'app/configs'
45
+ else
46
+ static_config_root
44
47
  end
45
48
  end
46
49
  end
@@ -1,47 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rails/generators"
4
-
5
- module Runger
6
- module Generators
7
- class InstallGenerator < ::Rails::Generators::Base
8
- source_root File.expand_path("templates", __dir__)
9
-
10
- class_option :configs_path, type: :string
11
-
12
- def copy_application_config
13
- template "application_config.rb", File.join(static_config_root, "application_config.rb")
14
- end
15
-
16
- def add_local_files_to_gitignore
17
- if File.exist?(File.join(destination_root, ".gitignore"))
18
- append_to_file ".gitignore", "\n/config/*.local.yml\n/config/credentials/local.*\n"
19
- end
20
- end
21
-
22
- # rubocop:disable Layout/HeredocIndentation
23
- def add_setup_autoload_to_config
24
- maybe_comment_indented = default_configs_path? ? " # " : " "
25
- inject_into_file "config/application.rb", after: %r{< Rails::Application\n} do
26
- <<-RUBY
3
+ require 'rails/generators'
4
+
5
+ module Runger::Generators ; end
6
+
7
+ class Runger::Generators::InstallGenerator < Rails::Generators::Base
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ class_option :configs_path, type: :string
11
+
12
+ def copy_application_config
13
+ template('application_config.rb', File.join(static_config_root, 'application_config.rb'))
14
+ end
15
+
16
+ def add_local_files_to_gitignore
17
+ if File.exist?(File.join(destination_root, '.gitignore'))
18
+ append_to_file('.gitignore', "\n/config/*.local.yml\n/config/credentials/local.*\n")
19
+ end
20
+ end
21
+
22
+ # rubocop:disable Layout/HeredocIndentation
23
+ def add_setup_autoload_to_config
24
+ maybe_comment_indented = default_configs_path? ? ' # ' : ' '
25
+ inject_into_file('config/application.rb', after: %r{< Rails::Application\n}) do
26
+ <<-RUBY
27
27
  # Configure the path for configuration classes that should be used before initialization
28
28
  # NOTE: path should be relative to the project root (Rails.root)
29
29
  #{maybe_comment_indented}config.runger_config.autoload_static_config_path = "#{static_config_root}"
30
- #{maybe_comment_indented.sub(/\s+$/, "")}
31
- RUBY
32
- end
33
- end
34
- # rubocop:enable Layout/HeredocIndentation
30
+ #{maybe_comment_indented.sub(/\s+$/, '')}
31
+ RUBY
32
+ end
33
+ end
34
+ # rubocop:enable Layout/HeredocIndentation
35
35
 
36
- private
36
+ private
37
37
 
38
- def static_config_root
39
- options[:configs_path] || Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH
40
- end
38
+ def static_config_root
39
+ options[:configs_path] || Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH
40
+ end
41
41
 
42
- def default_configs_path?
43
- static_config_root == (Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH)
44
- end
45
- end
42
+ def default_configs_path?
43
+ static_config_root == (Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH)
46
44
  end
47
45
  end
@@ -23,11 +23,11 @@ module Runger
23
23
  when /\A(nil|null)\z/i
24
24
  nil
25
25
  when /\A\d+\z/
26
- val.to_i
26
+ Integer(val, 10)
27
27
  when /\A\d*\.\d+\z/
28
- val.to_f
28
+ Float(val)
29
29
  when /\A['"].*['"]\z/
30
- val.gsub(/(\A['"]|['"]\z)/, "")
30
+ val.gsub(/(\A['"]|['"]\z)/, '')
31
31
  else
32
32
  val
33
33
  end