runger_config 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -36
  3. data/README.md +83 -83
  4. data/lib/generators/{anyway → runger}/app_config/app_config_generator.rb +2 -2
  5. data/lib/generators/{anyway → runger}/config/config_generator.rb +3 -8
  6. data/lib/generators/{anyway → runger}/config/templates/config.rb.tt +0 -3
  7. data/lib/generators/{anyway → runger}/install/install_generator.rb +4 -4
  8. data/lib/generators/{anyway → runger}/install/templates/application_config.rb.tt +1 -1
  9. data/lib/{anyway → runger}/auto_cast.rb +1 -1
  10. data/lib/{anyway → runger}/config.rb +22 -22
  11. data/lib/{anyway → runger}/dynamic_config.rb +2 -2
  12. data/lib/{anyway → runger}/ejson_parser.rb +3 -3
  13. data/lib/{anyway → runger}/env.rb +3 -3
  14. data/lib/{anyway → runger}/ext/deep_dup.rb +1 -1
  15. data/lib/{anyway → runger}/ext/deep_freeze.rb +1 -1
  16. data/lib/{anyway → runger}/ext/flatten_names.rb +1 -1
  17. data/lib/{anyway → runger}/ext/hash.rb +1 -1
  18. data/lib/{anyway → runger}/ext/string_constantize.rb +1 -1
  19. data/lib/{anyway → runger}/loaders/base.rb +2 -2
  20. data/lib/{anyway → runger}/loaders/doppler.rb +2 -2
  21. data/lib/{anyway → runger}/loaders/ejson.rb +3 -3
  22. data/lib/{anyway → runger}/loaders/env.rb +2 -2
  23. data/lib/{anyway → runger}/loaders/yaml.rb +3 -3
  24. data/lib/{anyway → runger}/loaders.rb +6 -6
  25. data/lib/{anyway → runger}/option_parser_builder.rb +1 -1
  26. data/lib/{anyway → runger}/optparse_config.rb +6 -6
  27. data/lib/{anyway → runger}/rails/autoload.rb +5 -5
  28. data/lib/{anyway → runger}/rails/config.rb +3 -3
  29. data/lib/{anyway → runger}/rails/loaders/credentials.rb +2 -2
  30. data/lib/{anyway → runger}/rails/loaders/secrets.rb +3 -3
  31. data/lib/{anyway → runger}/rails/loaders/yaml.rb +2 -2
  32. data/lib/runger/rails/loaders.rb +5 -0
  33. data/lib/{anyway → runger}/rails/settings.rb +2 -2
  34. data/lib/runger/rails.rb +24 -0
  35. data/lib/{anyway → runger}/railtie.rb +7 -7
  36. data/lib/{anyway → runger}/rbs.rb +1 -1
  37. data/lib/{anyway → runger}/settings.rb +4 -4
  38. data/lib/{anyway → runger}/testing/helpers.rb +4 -4
  39. data/lib/{anyway → runger}/testing.rb +2 -2
  40. data/lib/{anyway → runger}/tracing.rb +4 -4
  41. data/lib/{anyway → runger}/type_casting.rb +4 -4
  42. data/lib/{anyway → runger}/utils/deep_merge.rb +2 -2
  43. data/lib/{anyway → runger}/utils/which.rb +1 -1
  44. data/lib/runger/version.rb +5 -0
  45. data/lib/{anyway.rb → runger.rb} +1 -1
  46. data/lib/runger_config.rb +49 -0
  47. data/sig/{anyway_config.rbs → runger_config.rbs} +1 -1
  48. metadata +51 -51
  49. data/lib/anyway/rails/loaders.rb +0 -5
  50. data/lib/anyway/rails.rb +0 -24
  51. data/lib/anyway/version.rb +0 -5
  52. data/lib/anyway_config.rb +0 -49
  53. /data/lib/generators/{anyway → runger}/app_config/USAGE +0 -0
  54. /data/lib/generators/{anyway → runger}/config/USAGE +0 -0
  55. /data/lib/generators/{anyway → runger}/config/templates/config.yml.tt +0 -0
  56. /data/lib/generators/{anyway → runger}/install/USAGE +0 -0
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/all"
4
- require "anyway/optparse_config"
5
- require "anyway/dynamic_config"
4
+ require "runger/optparse_config"
5
+ require "runger/dynamic_config"
6
6
 
7
- module Anyway # :nodoc:
8
- using Anyway::Ext::DeepDup
9
- using Anyway::Ext::DeepFreeze
10
- using Anyway::Ext::Hash
11
- using Anyway::Ext::FlattenNames
7
+ module Runger # :nodoc:
8
+ using Runger::Ext::DeepDup
9
+ using Runger::Ext::DeepFreeze
10
+ using Runger::Ext::Hash
11
+ using Runger::Ext::FlattenNames
12
12
 
13
13
  using(Module.new do
14
14
  refine Object do
@@ -111,7 +111,7 @@ module Anyway # :nodoc:
111
111
  def defaults
112
112
  return @defaults if instance_variable_defined?(:@defaults)
113
113
 
114
- @defaults = if superclass < Anyway::Config
114
+ @defaults = if superclass < Runger::Config
115
115
  superclass.defaults.deep_dup
116
116
  else
117
117
  new_empty_config
@@ -121,7 +121,7 @@ module Anyway # :nodoc:
121
121
  def config_attributes
122
122
  return @config_attributes if instance_variable_defined?(:@config_attributes)
123
123
 
124
- @config_attributes = if superclass < Anyway::Config
124
+ @config_attributes = if superclass < Runger::Config
125
125
  superclass.config_attributes.dup
126
126
  else
127
127
  []
@@ -141,7 +141,7 @@ module Anyway # :nodoc:
141
141
  def required_attributes
142
142
  return @required_attributes if instance_variable_defined?(:@required_attributes)
143
143
 
144
- @required_attributes = if superclass < Anyway::Config
144
+ @required_attributes = if superclass < Runger::Config
145
145
  superclass.required_attributes.dup
146
146
  else
147
147
  []
@@ -161,7 +161,7 @@ module Anyway # :nodoc:
161
161
  def load_callbacks
162
162
  return @load_callbacks if instance_variable_defined?(:@load_callbacks)
163
163
 
164
- @load_callbacks = if superclass <= Anyway::Config
164
+ @load_callbacks = if superclass <= Runger::Config
165
165
  superclass.load_callbacks.dup
166
166
  else
167
167
  []
@@ -192,7 +192,7 @@ module Anyway # :nodoc:
192
192
 
193
193
  return @env_prefix if instance_variable_defined?(:@env_prefix)
194
194
 
195
- @env_prefix = if superclass < Anyway::Config && superclass.explicit_config_name?
195
+ @env_prefix = if superclass < Runger::Config && superclass.explicit_config_name?
196
196
  superclass.env_prefix
197
197
  else
198
198
  config_name.upcase
@@ -204,7 +204,7 @@ module Anyway # :nodoc:
204
204
 
205
205
  return @loader_options if instance_variable_defined?(:@loader_options)
206
206
 
207
- @loader_options = if superclass < Anyway::Config
207
+ @loader_options = if superclass < Runger::Config
208
208
  superclass.loader_options
209
209
  else
210
210
  {}
@@ -227,7 +227,7 @@ module Anyway # :nodoc:
227
227
  def coercion_mapping
228
228
  return @coercion_mapping if instance_variable_defined?(:@coercion_mapping)
229
229
 
230
- @coercion_mapping = if superclass < Anyway::Config
230
+ @coercion_mapping = if superclass < Runger::Config
231
231
  superclass.coercion_mapping.deep_dup
232
232
  else
233
233
  {}
@@ -241,7 +241,7 @@ module Anyway # :nodoc:
241
241
  if coercion_mapping.empty?
242
242
  fallback_type_caster
243
243
  else
244
- ::Anyway::TypeCaster.new(coercion_mapping, fallback: fallback_type_caster)
244
+ ::Runger::TypeCaster.new(coercion_mapping, fallback: fallback_type_caster)
245
245
  end
246
246
  end
247
247
 
@@ -250,15 +250,15 @@ module Anyway # :nodoc:
250
250
 
251
251
  return @fallback_type_caster if instance_variable_defined?(:@fallback_type_caster)
252
252
 
253
- @fallback_type_caster = if superclass < Anyway::Config
253
+ @fallback_type_caster = if superclass < Runger::Config
254
254
  superclass.fallback_type_caster.deep_dup
255
255
  else
256
- ::Anyway::AutoCast
256
+ ::Runger::AutoCast
257
257
  end
258
258
  end
259
259
 
260
260
  def disable_auto_cast!
261
- @fallback_type_caster = ::Anyway::NoCast
261
+ @fallback_type_caster = ::Runger::NoCast
262
262
  end
263
263
 
264
264
  private
@@ -317,10 +317,10 @@ module Anyway # :nodoc:
317
317
  #
318
318
  # Example:
319
319
  #
320
- # my_config = Anyway::Config.new()
320
+ # my_config = Runger::Config.new()
321
321
  #
322
322
  # # provide some values explicitly
323
- # my_config = Anyway::Config.new({some: :value})
323
+ # my_config = Runger::Config.new({some: :value})
324
324
  #
325
325
  def initialize(overrides = nil)
326
326
  @config_name = self.class.config_name
@@ -386,7 +386,7 @@ module Anyway # :nodoc:
386
386
  end
387
387
 
388
388
  def load_from_sources(base_config, **)
389
- Anyway.loaders.each do |(_id, loader)|
389
+ Runger.loaders.each do |(_id, loader)|
390
390
  Utils.deep_merge!(base_config, loader.call(**))
391
391
  end
392
392
  base_config
@@ -406,7 +406,7 @@ module Anyway # :nodoc:
406
406
  end
407
407
 
408
408
  def resolve_config_path(name, env_prefix)
409
- Anyway.env.fetch(env_prefix).delete("conf") || Settings.default_config_path.call(name)
409
+ Runger.env.fetch(env_prefix).delete("conf") || Settings.default_config_path.call(name)
410
410
  end
411
411
 
412
412
  def deconstruct_keys(keys) = values.deconstruct_keys(keys)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  # Adds ability to generate anonymous (class-less) config dynamicly
5
5
  # (like Rails.application.config_for but using more data sources).
6
6
  module DynamicConfig
@@ -9,7 +9,7 @@ module Anyway
9
9
  #
10
10
  # Example:
11
11
  #
12
- # my_config = Anyway::Config.for(:my_app)
12
+ # my_config = Runger::Config.for(:my_app)
13
13
  # # will load data from config/my_app.yml, secrets.my_app, ENV["MY_APP_*"]
14
14
  #
15
15
  def for(name, auto_cast: true, **options)
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "open3"
4
- require "anyway/ext/hash"
4
+ require "runger/ext/hash"
5
5
 
6
- using Anyway::Ext::Hash
6
+ using Runger::Ext::Hash
7
7
 
8
- module Anyway
8
+ module Runger
9
9
  class EJSONParser
10
10
  attr_reader :bin_path
11
11
 
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  # Parses environment variables and provides
5
5
  # method-like access
6
6
  class Env
7
- using Anyway::Ext::DeepDup
8
- using Anyway::Ext::Hash
7
+ using Runger::Ext::DeepDup
8
+ using Runger::Ext::Hash
9
9
 
10
10
  class << self
11
11
  def from_hash(hash, prefix: nil, memo: {})
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Ext
5
5
  # Extend Object through refinements
6
6
  module DeepDup
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Ext
5
5
  # Add #deep_freeze to hashes and arrays
6
6
  module DeepFreeze
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Ext
5
5
  # Convert Hash with mixed array and hash values to an
6
6
  # array of paths.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Ext
5
5
  # Extend Hash through refinements
6
6
  module Hash
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Ext
5
5
  # Add simple safe_constantize method to String
6
6
  module StringConstantize
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Loaders
5
5
  class Base
6
6
  include Tracing
7
7
 
8
8
  class << self
9
- def call(local: Anyway::Settings.use_local_files, **)
9
+ def call(local: Runger::Settings.use_local_files, **)
10
10
  new(local:).call(**)
11
11
  end
12
12
  end
@@ -4,7 +4,7 @@ require "uri"
4
4
  require "net/http"
5
5
  require "json"
6
6
 
7
- module Anyway
7
+ module Runger
8
8
  module Loaders
9
9
  class Doppler < Base
10
10
  class RequestError < StandardError; end
@@ -23,7 +23,7 @@ module Anyway
23
23
  def call(env_prefix:, **_options)
24
24
  env_payload = parse_doppler_response(url: Doppler.download_url, token: Doppler.token)
25
25
 
26
- env = ::Anyway::Env.new(type_cast: ::Anyway::NoCast, env_container: env_payload)
26
+ env = ::Runger::Env.new(type_cast: ::Runger::NoCast, env_container: env_payload)
27
27
 
28
28
  env.fetch_with_trace(env_prefix).then do |(conf, trace)|
29
29
  Tracing.current_trace&.merge!(trace)
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "anyway/ejson_parser"
3
+ require "runger/ejson_parser"
4
4
 
5
- module Anyway
5
+ module Runger
6
6
  module Loaders
7
7
  class EJSON < Base
8
8
  class << self
@@ -11,7 +11,7 @@ module Anyway
11
11
 
12
12
  self.bin_path = "ejson"
13
13
 
14
- def call(name:, ejson_namespace: name, ejson_parser: Anyway::EJSONParser.new(EJSON.bin_path), **_options)
14
+ def call(name:, ejson_namespace: name, ejson_parser: Runger::EJSONParser.new(EJSON.bin_path), **_options)
15
15
  configs = []
16
16
 
17
17
  rel_config_paths.each do |rel_config_path|
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Loaders
5
5
  class Env < Base
6
6
  def call(env_prefix:, **_options)
7
- env = ::Anyway::Env.new(type_cast: ::Anyway::NoCast)
7
+ env = ::Runger::Env.new(type_cast: ::Runger::NoCast)
8
8
 
9
9
  env.fetch_with_trace(env_prefix).then do |(conf, trace)|
10
10
  Tracing.current_trace&.merge!(trace)
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pathname"
4
- require "anyway/ext/hash"
4
+ require "runger/ext/hash"
5
5
 
6
- using Anyway::Ext::Hash
6
+ using Runger::Ext::Hash
7
7
 
8
- module Anyway
8
+ module Runger
9
9
  module Loaders
10
10
  class YAML < Base
11
11
  def call(config_path:, **_options)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Loaders
5
5
  class Registry
6
6
  attr_reader :registry
@@ -70,8 +70,8 @@ module Anyway
70
70
  end
71
71
  end
72
72
 
73
- require "anyway/loaders/base"
74
- require "anyway/loaders/yaml"
75
- require "anyway/loaders/env"
76
- require "anyway/loaders/doppler"
77
- require "anyway/loaders/ejson"
73
+ require "runger/loaders/base"
74
+ require "runger/loaders/yaml"
75
+ require "runger/loaders/env"
76
+ require "runger/loaders/doppler"
77
+ require "runger/loaders/ejson"
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "optparse"
4
4
 
5
- module Anyway # :nodoc:
5
+ module Runger # :nodoc:
6
6
  # Initializes the OptionParser instance using the given configuration
7
7
  class OptionParserBuilder
8
8
  class << self
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "anyway/option_parser_builder"
3
+ require "runger/option_parser_builder"
4
4
 
5
- require "anyway/ext/deep_dup"
5
+ require "runger/ext/deep_dup"
6
6
 
7
- module Anyway
8
- using Anyway::Ext::DeepDup
7
+ module Runger
8
+ using Runger::Ext::DeepDup
9
9
 
10
10
  # Adds ability to use script options as the source
11
11
  # of configuration (via optparse)
@@ -50,7 +50,7 @@ module Anyway
50
50
  return @option_parser_extensions if instance_variable_defined?(:@option_parser_extensions)
51
51
 
52
52
  @option_parser_extensions =
53
- if superclass < Anyway::Config
53
+ if superclass < Runger::Config
54
54
  superclass.option_parser_extensions.dup
55
55
  else
56
56
  []
@@ -61,7 +61,7 @@ module Anyway
61
61
  return @option_parser_descriptors if instance_variable_defined?(:@option_parser_descriptors)
62
62
 
63
63
  @option_parser_descriptors =
64
- if superclass < Anyway::Config
64
+ if superclass < Runger::Config
65
65
  superclass.option_parser_descriptors.deep_dup
66
66
  else
67
67
  Hash.new { |h, k| h[k] = {} }
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # This module is used to detect a Rails application and activate the corresponding plugins
4
- # when Anyway Config is loaded before Rails (e.g., in config/puma.rb).
5
- module Anyway
4
+ # when Runger Config is loaded before Rails (e.g., in config/puma.rb).
5
+ module Runger
6
6
  module Rails
7
7
  class << self
8
8
  attr_reader :tracer, :name_method
@@ -15,17 +15,17 @@ module Anyway
15
15
  return if event.self.singleton_class?
16
16
 
17
17
  # We wait till `rails/application/configuration.rb` has been loaded, since we rely on it
18
- # See https://github.com/palkan/anyway_config/issues/134
18
+ # See https://github.com/palkan/runger_config/issues/134
19
19
  return unless name_method.bind_call(event.self) == "Rails::Application::Configuration"
20
20
 
21
21
  tracer.disable
22
22
 
23
23
  unless disable_postponed_load_warning
24
- warn "Anyway Config was loaded before Rails. Activating Anyway Config Rails plugins now.\n" \
24
+ warn "Runger Config was loaded before Rails. Activating Runger Config Rails plugins now.\n" \
25
25
  "NOTE: Already loaded configs were provisioned without Rails-specific sources."
26
26
  end
27
27
 
28
- require "anyway/rails"
28
+ require "runger/rails"
29
29
  end
30
30
  end
31
31
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "active_support/core_ext/hash/indifferent_access"
4
4
 
5
- module Anyway
5
+ module Runger
6
6
  module Rails
7
7
  # Enhance config to be more Railsy-like:
8
8
  # – accept hashes with indeferent access
@@ -19,5 +19,5 @@ module Anyway
19
19
  end
20
20
  end
21
21
 
22
- Anyway::Config.prepend Anyway::Rails::Config
23
- Anyway::Config.singleton_class.prepend Anyway::Rails::Config::ClassMethods
22
+ Runger::Config.prepend Runger::Rails::Config
23
+ Runger::Config.singleton_class.prepend Runger::Rails::Config::ClassMethods
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Rails
5
5
  module Loaders
6
- class Credentials < Anyway::Loaders::Base
6
+ class Credentials < Runger::Loaders::Base
7
7
  LOCAL_CONTENT_PATH = "config/credentials/local.yml.enc"
8
8
 
9
9
  def call(name:, **_options)
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Rails
5
5
  module Loaders
6
- class Secrets < Anyway::Loaders::Base
6
+ class Secrets < Runger::Loaders::Base
7
7
  def call(name:, **_options)
8
8
  return {} unless ::Rails.application.respond_to?(:secrets)
9
9
 
@@ -24,7 +24,7 @@ module Anyway
24
24
  def secrets
25
25
  @secrets ||= ::Rails.application.secrets.tap do |_|
26
26
  # Reset secrets state if the app hasn't been initialized
27
- # See https://github.com/palkan/anyway_config/issues/14
27
+ # See https://github.com/palkan/runger_config/issues/14
28
28
  next if ::Rails.application.initialized?
29
29
  ::Rails.application.remove_instance_variable(:@secrets)
30
30
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Rails
5
5
  module Loaders
6
- class YAML < Anyway::Loaders::YAML; end
6
+ class YAML < Runger::Loaders::YAML; end
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "runger/rails/loaders/yaml"
4
+ require "runger/rails/loaders/secrets"
5
+ require "runger/rails/loaders/credentials"
@@ -7,7 +7,7 @@ begin
7
7
  rescue LoadError
8
8
  end
9
9
 
10
- module Anyway
10
+ module Runger
11
11
  class Settings
12
12
  class << self
13
13
  attr_reader :autoload_static_config_path, :autoloader
@@ -28,7 +28,7 @@ module Anyway
28
28
  # See Rails 6 https://github.com/rails/rails/blob/8ab4fd12f18203b83d0f252db96d10731485ff6a/railties/lib/rails/autoloaders.rb#L10
29
29
  # and Rails 7 https://github.com/rails/rails/blob/5462fbd5de1900c1b1ce1c9dc11c1a2d8cdcd809/railties/lib/rails/autoloaders.rb#L15
30
30
  @autoloader = Zeitwerk::Loader.new.tap do |loader|
31
- loader.tag = "anyway.config"
31
+ loader.tag = "runger.config"
32
32
 
33
33
  if defined?(ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector)
34
34
  loader.inflector = ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runger
4
+ module Rails
5
+ end
6
+ end
7
+
8
+ require "runger/rails/settings"
9
+ require "runger/rails/config"
10
+ require "runger/rails/loaders"
11
+
12
+ # Configure Rails loaders
13
+ Runger.loaders.override :yml, Runger::Rails::Loaders::YAML
14
+
15
+ if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR >= 1
16
+ Runger.loaders.insert_after :yml, :credentials, Runger::Rails::Loaders::Credentials
17
+ else
18
+ Runger.loaders.insert_after :yml, :secrets, Runger::Rails::Loaders::Secrets
19
+ Runger.loaders.insert_after :secrets, :credentials, Runger::Rails::Loaders::Credentials
20
+ end
21
+
22
+ # Load Railties after configuring loaders.
23
+ # The application could be already initialized, and that would make `Runger.loaders` frozen
24
+ require "runger/railtie"
@@ -1,28 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway # :nodoc:
3
+ module Runger # :nodoc:
4
4
  DEFAULT_CONFIGS_PATH = "config/configs"
5
5
 
6
6
  class Railtie < ::Rails::Railtie # :nodoc:
7
7
  # Add settings to Rails config
8
- config.anyway_config = Anyway::Settings
8
+ config.runger_config = Runger::Settings
9
9
 
10
10
  config.before_configuration do
11
11
  next if ::Rails.application.initialized?
12
- config.anyway_config.autoload_static_config_path = DEFAULT_CONFIGS_PATH
12
+ config.runger_config.autoload_static_config_path = DEFAULT_CONFIGS_PATH
13
13
  end
14
14
 
15
15
  config.before_eager_load do
16
- Anyway::Settings.autoloader&.eager_load
16
+ Runger::Settings.autoloader&.eager_load
17
17
  end
18
18
 
19
19
  # Remove `autoload_static_config_path` from Rails `autoload_paths`
20
20
  # since we use our own autoloading mechanism
21
- initializer "anyway_config.cleanup_autoload" do
22
- Anyway::Settings.cleanup_autoload_paths
21
+ initializer "runger_config.cleanup_autoload" do
22
+ Runger::Settings.cleanup_autoload_paths
23
23
  end
24
24
 
25
25
  # Make sure loaders are not changed in runtime
26
- config.after_initialize { Anyway.loaders.freeze }
26
+ config.after_initialize { Runger.loaders.freeze }
27
27
  end
28
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module RBSGenerator
5
5
  TYPE_TO_CLASS = {
6
6
  string: "String",
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "pathname"
4
4
 
5
- module Anyway
5
+ module Runger
6
6
  # Use Settings name to not confuse with Config.
7
7
  #
8
8
  # Settings contain the library-wide configuration.
@@ -96,11 +96,11 @@ module Anyway
96
96
  end
97
97
  end
98
98
 
99
- # By default, use ANYWAY_ENV
100
- self.current_environment = ENV["ANYWAY_ENV"]
99
+ # By default, use RUNGER_ENV
100
+ self.current_environment = ENV["RUNGER_ENV"]
101
101
 
102
102
  # By default, use local files only in development (that's the purpose if the local files)
103
- self.use_local_files = (ENV["ANYWAY_ENV"] == "development" || ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development" || (defined?(Rails) && Rails.env.development?))
103
+ self.use_local_files = (ENV["RUNGER_ENV"] == "development" || ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development" || (defined?(Rails) && Rails.env.development?))
104
104
 
105
105
  # By default, consider configs are stored in the ./config folder
106
106
  self.default_config_path = ->(name) { "./config/#{name}.yml" }
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Anyway
3
+ module Runger
4
4
  module Testing
5
5
  module Helpers
6
6
  # Sets the ENV variables to the provided
7
7
  # values and restore outside the block
8
8
  #
9
- # Also resets Anyway.env before and after calling the block
9
+ # Also resets Runger.env before and after calling the block
10
10
  # to make sure that the values are not cached.
11
11
  #
12
12
  # NOTE: to remove the env value, pass `nil` as the value
@@ -20,7 +20,7 @@ module Anyway
20
20
  end
21
21
 
22
22
  # clear cached env values
23
- Anyway.env.clear
23
+ Runger.env.clear
24
24
  yield
25
25
  ensure
26
26
  was_values.each do |(key, val)|
@@ -29,7 +29,7 @@ module Anyway
29
29
  end
30
30
 
31
31
  # clear cache again
32
- Anyway.env.clear
32
+ Runger.env.clear
33
33
  end
34
34
  end
35
35
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "anyway/testing/helpers"
3
+ require "runger/testing/helpers"
4
4
 
5
5
  if defined?(RSpec::Core) && RSpec.respond_to?(:configure)
6
6
  RSpec.configure do |config|
7
7
  config.include(
8
- Anyway::Testing::Helpers,
8
+ Runger::Testing::Helpers,
9
9
  type: :config,
10
10
  file_path: %r{spec/configs}
11
11
  )