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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/bin/release +27 -0
- data/lib/generators/runger/app_config/app_config_generator.rb +6 -10
- data/lib/generators/runger/config/config_generator.rb +44 -41
- data/lib/generators/runger/install/install_generator.rb +35 -37
- data/lib/runger/auto_cast.rb +3 -3
- data/lib/runger/config.rb +114 -94
- data/lib/runger/dynamic_config.rb +21 -23
- data/lib/runger/ejson_parser.rb +24 -24
- data/lib/runger/env.rb +50 -52
- data/lib/runger/ext/deep_dup.rb +33 -36
- data/lib/runger/ext/deep_freeze.rb +28 -32
- data/lib/runger/ext/flatten_names.rb +23 -27
- data/lib/runger/ext/hash.rb +26 -29
- data/lib/runger/ext/string_constantize.rb +12 -15
- data/lib/runger/loaders/base.rb +11 -15
- data/lib/runger/loaders/doppler.rb +38 -42
- data/lib/runger/loaders/ejson.rb +65 -63
- data/lib/runger/loaders/env.rb +6 -10
- data/lib/runger/loaders/yaml.rb +69 -66
- data/lib/runger/loaders.rb +69 -71
- data/lib/runger/option_parser_builder.rb +16 -18
- data/lib/runger/optparse_config.rb +11 -10
- data/lib/runger/rails/autoload.rb +24 -26
- data/lib/runger/rails/config.rb +13 -17
- data/lib/runger/rails/loaders/credentials.rb +53 -57
- data/lib/runger/rails/loaders/secrets.rb +21 -25
- data/lib/runger/rails/loaders/yaml.rb +1 -6
- data/lib/runger/rails/loaders.rb +3 -3
- data/lib/runger/rails/settings.rb +49 -49
- data/lib/runger/rails.rb +9 -11
- data/lib/runger/railtie.rb +3 -2
- data/lib/runger/rbs.rb +29 -29
- data/lib/runger/settings.rb +82 -84
- data/lib/runger/testing/helpers.rb +26 -28
- data/lib/runger/testing.rb +2 -2
- data/lib/runger/tracing.rb +143 -136
- data/lib/runger/type_casting.rb +16 -11
- data/lib/runger/utils/which.rb +10 -12
- data/lib/runger/version.rb +1 -1
- data/lib/runger.rb +1 -1
- data/lib/runger_config.rb +34 -27
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d7b6bb5cc8cd669711aff10814df1fcebc522e9284227c8badb4b08e45ada7c
|
4
|
+
data.tar.gz: 237b1530944cc34469d4b33e5f456f4b61078116294d7a2e3c41ad4703ce4b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82d00211c95f788f45accdef25e01b3f13ede5d6efdd407e067431ca43d16548c1ce0d422d5db6fc305684d32f8afddae2e5b481073b70f73bc44470301c479c
|
7
|
+
data.tar.gz: b8626650770d62b495352a9bcd71275a4b450da699227f7cf918dfea6f33339bdb9e87a952ff813405cf283f287c2f2746781dd688a805b8f368e9aa5764f026
|
data/CHANGELOG.md
CHANGED
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
|
3
|
+
require 'generators/runger/config/config_generator'
|
4
4
|
|
5
|
-
|
6
|
-
|
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
|
-
|
8
|
+
private
|
11
9
|
|
12
|
-
|
13
|
-
|
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
|
4
|
-
|
5
|
-
module Runger
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
4
|
-
|
5
|
-
module Runger
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
#{maybe_comment_indented.sub(/\s+$/, '')}
|
31
|
+
RUBY
|
32
|
+
end
|
33
|
+
end
|
34
|
+
# rubocop:enable Layout/HeredocIndentation
|
35
35
|
|
36
|
-
|
36
|
+
private
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
def static_config_root
|
39
|
+
options[:configs_path] || Runger::Settings.autoload_static_config_path || Runger::DEFAULT_CONFIGS_PATH
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
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
|
data/lib/runger/auto_cast.rb
CHANGED
@@ -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
|
26
|
+
Integer(val, 10)
|
27
27
|
when /\A\d*\.\d+\z/
|
28
|
-
val
|
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
|