anyway_config 1.4.4 → 2.0.0.pre

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +187 -51
  3. data/lib/anyway.rb +22 -2
  4. data/lib/anyway/config.rb +116 -98
  5. data/lib/anyway/dynamic_config.rb +27 -0
  6. data/lib/anyway/env.rb +2 -5
  7. data/lib/anyway/ext/deep_dup.rb +4 -4
  8. data/lib/anyway/ext/deep_freeze.rb +5 -0
  9. data/lib/anyway/ext/jruby.rb +9 -4
  10. data/lib/anyway/ext/string_serialize.rb +1 -7
  11. data/{spec/dummy/config.ru → lib/anyway/loaders/env_loader.rb} +0 -0
  12. data/lib/anyway/loaders/secrets_loader.rb +0 -0
  13. data/lib/anyway/loaders/yaml_loader.rb +0 -0
  14. data/lib/anyway/option_parser_builder.rb +2 -2
  15. data/lib/anyway/optparse_config.rb +90 -0
  16. data/lib/anyway/rails/config.rb +76 -24
  17. data/lib/anyway/railtie.rb +11 -0
  18. data/lib/anyway/testing.rb +13 -0
  19. data/lib/anyway/testing/helpers.rb +36 -0
  20. data/lib/anyway/version.rb +1 -1
  21. metadata +46 -48
  22. data/.gem_release.yml +0 -3
  23. data/.gitignore +0 -40
  24. data/.rubocop.yml +0 -50
  25. data/.travis.yml +0 -30
  26. data/CHANGELOG.md +0 -112
  27. data/Gemfile +0 -21
  28. data/Rakefile +0 -23
  29. data/anyway_config.gemspec +0 -29
  30. data/config/cool.yml +0 -5
  31. data/gemfiles/jruby.gemfile +0 -7
  32. data/gemfiles/rails42.gemfile +0 -6
  33. data/gemfiles/rails5.gemfile +0 -6
  34. data/gemfiles/railsmaster.gemfile +0 -7
  35. data/spec/anyway.yml +0 -2
  36. data/spec/config_spec.rb +0 -337
  37. data/spec/config_spec_norails.rb +0 -86
  38. data/spec/dummy/config/application.rb +0 -13
  39. data/spec/dummy/config/boot.rb +0 -5
  40. data/spec/dummy/config/cool.yml +0 -5
  41. data/spec/dummy/config/cool_custom.yml +0 -2
  42. data/spec/dummy/config/database.yml +0 -25
  43. data/spec/dummy/config/environment.rb +0 -5
  44. data/spec/dummy/config/environments/test.rb +0 -2
  45. data/spec/dummy/config/routes.rb +0 -2
  46. data/spec/dummy/config/secrets.yml +0 -30
  47. data/spec/env_spec.rb +0 -50
  48. data/spec/ext/deep_dup_spec.rb +0 -38
  49. data/spec/ext/deep_freeze_spec.rb +0 -32
  50. data/spec/ext/hash_spec.rb +0 -39
  51. data/spec/ext/string_serialize_spec.rb +0 -32
  52. data/spec/spec_helper.rb +0 -31
  53. data/spec/spec_norails_helper.rb +0 -26
  54. data/spec/support/cool_config.rb +0 -10
  55. data/spec/support/print_warning_matcher.rb +0 -34
  56. data/spec/support/small_config.rb +0 -7
  57. data/spec/support/test_config.rb +0 -16
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyway_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 2.0.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-07 00:00:00.000000000 Z
11
+ date: 2019-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.5'
33
+ version: '3.8'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.5'
40
+ version: '3.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.60.0
47
+ version: 0.63.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.60.0
54
+ version: 0.63.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-md
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.2'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: simplecov
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: 0.3.8
83
+ - !ruby/object:Gem::Dependency
84
+ name: standard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.0.12
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.0.12
69
97
  description: "\n Configuration DSL for Ruby libraries and applications.\n Allows
70
98
  you to easily follow the twelve-factor application principles (https://12factor.net/config).\n
71
99
  \ "
@@ -75,57 +103,28 @@ executables: []
75
103
  extensions: []
76
104
  extra_rdoc_files: []
77
105
  files:
78
- - ".gem_release.yml"
79
- - ".gitignore"
80
- - ".rubocop.yml"
81
- - ".travis.yml"
82
- - CHANGELOG.md
83
- - Gemfile
84
106
  - LICENSE.txt
85
107
  - README.md
86
- - Rakefile
87
- - anyway_config.gemspec
88
- - config/cool.yml
89
- - gemfiles/jruby.gemfile
90
- - gemfiles/rails42.gemfile
91
- - gemfiles/rails5.gemfile
92
- - gemfiles/railsmaster.gemfile
93
108
  - lib/anyway.rb
94
109
  - lib/anyway/config.rb
110
+ - lib/anyway/dynamic_config.rb
95
111
  - lib/anyway/env.rb
96
112
  - lib/anyway/ext/deep_dup.rb
97
113
  - lib/anyway/ext/deep_freeze.rb
98
114
  - lib/anyway/ext/hash.rb
99
115
  - lib/anyway/ext/jruby.rb
100
116
  - lib/anyway/ext/string_serialize.rb
117
+ - lib/anyway/loaders/env_loader.rb
118
+ - lib/anyway/loaders/secrets_loader.rb
119
+ - lib/anyway/loaders/yaml_loader.rb
101
120
  - lib/anyway/option_parser_builder.rb
121
+ - lib/anyway/optparse_config.rb
102
122
  - lib/anyway/rails/config.rb
123
+ - lib/anyway/railtie.rb
124
+ - lib/anyway/testing.rb
125
+ - lib/anyway/testing/helpers.rb
103
126
  - lib/anyway/version.rb
104
127
  - lib/anyway_config.rb
105
- - spec/anyway.yml
106
- - spec/config_spec.rb
107
- - spec/config_spec_norails.rb
108
- - spec/dummy/config.ru
109
- - spec/dummy/config/application.rb
110
- - spec/dummy/config/boot.rb
111
- - spec/dummy/config/cool.yml
112
- - spec/dummy/config/cool_custom.yml
113
- - spec/dummy/config/database.yml
114
- - spec/dummy/config/environment.rb
115
- - spec/dummy/config/environments/test.rb
116
- - spec/dummy/config/routes.rb
117
- - spec/dummy/config/secrets.yml
118
- - spec/env_spec.rb
119
- - spec/ext/deep_dup_spec.rb
120
- - spec/ext/deep_freeze_spec.rb
121
- - spec/ext/hash_spec.rb
122
- - spec/ext/string_serialize_spec.rb
123
- - spec/spec_helper.rb
124
- - spec/spec_norails_helper.rb
125
- - spec/support/cool_config.rb
126
- - spec/support/print_warning_matcher.rb
127
- - spec/support/small_config.rb
128
- - spec/support/test_config.rb
129
128
  homepage: http://github.com/palkan/anyway_config
130
129
  licenses:
131
130
  - MIT
@@ -138,15 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
137
  requirements:
139
138
  - - ">="
140
139
  - !ruby/object:Gem::Version
141
- version: '2.3'
140
+ version: '2.5'
142
141
  required_rubygems_version: !ruby/object:Gem::Requirement
143
142
  requirements:
144
- - - ">="
143
+ - - ">"
145
144
  - !ruby/object:Gem::Version
146
- version: '0'
145
+ version: 1.3.1
147
146
  requirements: []
148
- rubyforge_project:
149
- rubygems_version: 2.7.6
147
+ rubygems_version: 3.0.2
150
148
  signing_key:
151
149
  specification_version: 4
152
150
  summary: Configuration DSL for Ruby libraries and applications
data/.gem_release.yml DELETED
@@ -1,3 +0,0 @@
1
- bump:
2
- file: lib/anyway/version.rb
3
- skip_ci: true
data/.gitignore DELETED
@@ -1,40 +0,0 @@
1
- # Numerous always-ignore extensions
2
- *.diff
3
- *.err
4
- *.orig
5
- *.log
6
- *.rej
7
- *.swo
8
- *.swp
9
- *.vi
10
- *~
11
- *.sass-cache
12
- *.iml
13
- .idea/
14
-
15
- # Sublime
16
- *.sublime-project
17
- *.sublime-workspace
18
-
19
- # OS or Editor folders
20
- .DS_Store
21
- .cache
22
- .project
23
- .settings
24
- .tmproj
25
- Thumbs.db
26
-
27
- .bundle/
28
- log/*.log
29
- pkg/
30
- spec/dummy/db/*.sqlite3
31
- spec/dummy/db/*.sqlite3-journal
32
- spec/dummy/tmp/
33
-
34
- Gemfile.lock
35
- Gemfile.local
36
- .rspec
37
- .ruby-version
38
- *.gem
39
-
40
- tmp/
data/.rubocop.yml DELETED
@@ -1,50 +0,0 @@
1
- AllCops:
2
- Include:
3
- - 'lib/**/*.rb'
4
- - 'lib/**/*.rake'
5
- - 'spec/**/*.rb'
6
- - 'Gemfile'
7
- - 'Rakefile'
8
- Exclude:
9
- - 'bin/**/*'
10
- - 'spec/dummy/**/*'
11
- - 'tmp/**/*'
12
- - 'gemfiles/vendor/**/*'
13
- - 'vendor/**/*'
14
- DisplayCopNames: true
15
- StyleGuideCopsOnly: false
16
- TargetRubyVersion: 2.3
17
-
18
- Style/Documentation:
19
- Exclude:
20
- - 'spec/**/*.rb'
21
-
22
- Style/StringLiterals:
23
- Enabled: false
24
-
25
- Style/BlockDelimiters:
26
- Exclude:
27
- - 'spec/**/*.rb'
28
-
29
- Metrics/MethodLength:
30
- Exclude:
31
- - 'spec/**/*.rb'
32
-
33
- Metrics/BlockLength:
34
- Exclude:
35
- - 'spec/**/*.rb'
36
-
37
- Metrics/ClassLength:
38
- Max: 140
39
-
40
- Metrics/LineLength:
41
- Max: 100
42
-
43
- Bundler/OrderedGems:
44
- Enabled: false
45
-
46
- Style/MutableConstant:
47
- Enabled: false
48
-
49
- Naming/MemoizedInstanceVariableName:
50
- Enabled: false
data/.travis.yml DELETED
@@ -1,30 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
-
4
- dist: trusty
5
- sudo: false
6
-
7
- notifications:
8
- email: false
9
-
10
- before_install:
11
- - gem update --system
12
- - gem install bundler -v '< 2'
13
-
14
- matrix:
15
- include:
16
- - rvm: ruby-head
17
- gemfile: gemfiles/railsmaster.gemfile
18
- - rvm: jruby-9.2.5.0
19
- gemfile: gemfiles/jruby.gemfile
20
- - rvm: jruby-9.1.15.0
21
- gemfile: gemfiles/jruby.gemfile
22
- - rvm: 2.5.1
23
- gemfile: gemfiles/rails5.gemfile
24
- - rvm: 2.5.1
25
- gemfile: gemfiles/rails42.gemfile
26
- - rvm: 2.3.2
27
- gemfile: gemfiles/rails5.gemfile
28
- allow_failures:
29
- - rvm: ruby-head
30
- gemfile: gemfiles/railsmaster.gemfile
data/CHANGELOG.md DELETED
@@ -1,112 +0,0 @@
1
- # Change log
2
-
3
- ## master
4
-
5
- ## 1.4.4 (2019-02-07)
6
-
7
- - Allow overriding default config file path via ENV with Rails integration ([@sponomarev][])
8
-
9
- ## 1.4.3 (2019-02-04)
10
-
11
- - Add a temporary fix for JRuby regression [#5550](https://github.com/jruby/jruby/issues/5550). ([@palkan][])
12
-
13
- ## 1.4.2 (2018-01-05)
14
-
15
- - Fix: detect Rails by presence of `Rails::VERSION` (instead of just `Rails`). ([@palkan][])
16
-
17
- ## 1.4.1 (2018-10-30)
18
-
19
- - Add `.flag_options` to mark some params as flags (value-less) for OptionParse. ([@palkan][])
20
-
21
- ## 1.4.0 (2018-10-29)
22
-
23
- - Add OptionParse integration ([@jastkand][])
24
-
25
- See more https://github.com/palkan/anyway_config/pull/18
26
-
27
- - Use underscored config name as an env prefix. ([@palkan][])
28
-
29
- For a config class:
30
-
31
- ```ruby
32
- class MyApp < Anyway::Config
33
- end
34
- ```
35
-
36
- Before this change we use `MYAPP_` prefix, now it's `MY_APP_`.
37
-
38
- You can specify the prefix explictly:
39
-
40
- ```ruby
41
- class MyApp < Anyway::Config
42
- env_prefix "MYAPP_"
43
- end
44
- ```
45
-
46
- ## 1.3.0 (2018-06-15)
47
-
48
- - Ruby 2.2 is no longer supported.
49
-
50
- - `Anyway::Config.env_prefix` method is introduced. ([@charlie-wasp][])
51
-
52
- ## 1.2.0 (2018-02-19)
53
-
54
- Now works on JRuby 9.1+.
55
-
56
- ## 1.1.3 (2017-12-20)
57
-
58
- - Allow to pass raw hash with explicit values to `Config.new`. ([@dsalahutdinov][])
59
-
60
- Example:
61
-
62
- ```ruby
63
- Sniffer::Config.new(
64
- overrides: {
65
- enabled: true,
66
- storage: {capacity: 500}
67
- }
68
- )
69
- ```
70
-
71
- See more https://github.com/palkan/anyway_config/pull/10
72
-
73
- ## 1.1.2 (2017-11-19)
74
-
75
- - Enable aliases for YAML. ([@onemanstartup][])
76
-
77
- ## 1.1.1 (2017-10-21)
78
-
79
- - Return deep duplicate of a Hash in `Env#fetch`. ([@palkan][])
80
-
81
- ## 1.1.0 (2017-10-06)
82
-
83
- - Add `#to_h` method. ([@palkan][])
84
-
85
- See [#4](https://github.com/palkan/anyway_config/issues/4).
86
-
87
- - Make it possible to extend configuration parameters. ([@palkan][])
88
-
89
- ## 1.0.0 (2017-06-20)
90
-
91
- - Lazy load and parse ENV configurtaion. ([@palkan][])
92
-
93
- - Add support for ERB in YML configuration. ([@palkan][])
94
-
95
- ## 0.5.0 (2017-01-20)
96
-
97
- - Drop `active_support` dependency. ([@palkan][])
98
-
99
- Use custom refinements instead of requiring `active_support`.
100
-
101
- No we're dependency-free!
102
-
103
- ## 0.1.0 (2015-01-20)
104
-
105
- Initial version.
106
-
107
- [@palkan]: https://github.com/palkan
108
- [@onemanstartup]: https://github.com/onemanstartup
109
- [@dsalahutdinov]: https://github.com/dsalahutdinov
110
- [@charlie-wasp]: https://github.com/charlie-wasp
111
- [@jastkand]: https://github.com/jastkand
112
- [@sponomarev]: https://github.com/sponomarev
data/Gemfile DELETED
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in anyway_config.gemspec
6
- gem 'sqlite3', platform: :mri
7
-
8
- gem 'activerecord-jdbcsqlite3-adapter', '~> 50.0', platform: :jruby
9
- gem 'jdbc-sqlite3', platform: :jruby
10
-
11
- gem 'pry-byebug', platform: :mri
12
-
13
- gemspec
14
-
15
- local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local"
16
-
17
- if File.exist?(local_gemfile)
18
- eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
19
- else
20
- gem 'rails', '~> 5.0'
21
- end
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require 'rspec/core/rake_task'
5
- require "rubocop/rake_task"
6
-
7
- RuboCop::RakeTask.new
8
-
9
- task(:spec).clear
10
- desc "Run specs with Rails app"
11
- RSpec::Core::RakeTask.new("spec") do |task|
12
- task.exclude_pattern = "spec/**/*_norails.rb"
13
- task.verbose = false
14
- end
15
-
16
- desc "Run acceptance specs without Rails"
17
- RSpec::Core::RakeTask.new("spec:norails") do |task|
18
- task.pattern = "spec/**/*_norails.rb"
19
- task.verbose = false
20
- end
21
-
22
- desc "Run the all specs and linters"
23
- task default: %w[rubocop spec:norails spec]