dry-configurable 0.8.2 → 0.11.2
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 +93 -22
- data/LICENSE +1 -1
- data/README.md +17 -28
- data/dry-configurable.gemspec +28 -19
- data/lib/dry-configurable.rb +2 -0
- data/lib/dry/configurable.rb +23 -131
- data/lib/dry/configurable/class_methods.rb +103 -0
- data/lib/dry/configurable/compiler.rb +45 -0
- data/lib/dry/configurable/config.rb +81 -115
- data/lib/dry/configurable/constants.rb +12 -0
- data/lib/dry/configurable/dsl.rb +62 -0
- data/lib/dry/configurable/dsl/args.rb +58 -0
- data/lib/dry/configurable/{error.rb → errors.rb} +5 -1
- data/lib/dry/configurable/instance_methods.rb +46 -0
- data/lib/dry/configurable/methods.rb +32 -0
- data/lib/dry/configurable/setting.rb +95 -12
- data/lib/dry/configurable/settings.rb +43 -63
- data/lib/dry/configurable/test_interface.rb +3 -5
- data/lib/dry/configurable/version.rb +3 -1
- metadata +31 -17
- data/.codeclimate.yml +0 -23
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -25
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -17
- data/Rakefile +0 -12
- data/lib/dry/configurable/settings/argument_parser.rb +0 -50
- data/rakelib/rubocop.rake +0 -18
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-configurable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Holland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 0.4.7
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: dry-equalizer
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.2'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: bundler
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,40 +100,40 @@ dependencies:
|
|
86
100
|
- - ">="
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: '0'
|
89
|
-
description:
|
103
|
+
description: A mixin to add configuration functionality to your classes
|
90
104
|
email:
|
91
105
|
- andyholland1991@aol.com
|
92
106
|
executables: []
|
93
107
|
extensions: []
|
94
108
|
extra_rdoc_files: []
|
95
109
|
files:
|
96
|
-
- ".codeclimate.yml"
|
97
|
-
- ".gitignore"
|
98
|
-
- ".rspec"
|
99
|
-
- ".travis.yml"
|
100
110
|
- CHANGELOG.md
|
101
|
-
- CONTRIBUTING.md
|
102
|
-
- Gemfile
|
103
111
|
- LICENSE
|
104
112
|
- README.md
|
105
|
-
- Rakefile
|
106
113
|
- dry-configurable.gemspec
|
107
114
|
- lib/dry-configurable.rb
|
108
115
|
- lib/dry/configurable.rb
|
116
|
+
- lib/dry/configurable/class_methods.rb
|
117
|
+
- lib/dry/configurable/compiler.rb
|
109
118
|
- lib/dry/configurable/config.rb
|
110
|
-
- lib/dry/configurable/
|
119
|
+
- lib/dry/configurable/constants.rb
|
120
|
+
- lib/dry/configurable/dsl.rb
|
121
|
+
- lib/dry/configurable/dsl/args.rb
|
122
|
+
- lib/dry/configurable/errors.rb
|
123
|
+
- lib/dry/configurable/instance_methods.rb
|
124
|
+
- lib/dry/configurable/methods.rb
|
111
125
|
- lib/dry/configurable/setting.rb
|
112
126
|
- lib/dry/configurable/settings.rb
|
113
|
-
- lib/dry/configurable/settings/argument_parser.rb
|
114
127
|
- lib/dry/configurable/test_interface.rb
|
115
128
|
- lib/dry/configurable/version.rb
|
116
|
-
-
|
117
|
-
homepage: https://github.com/dry-rb/dry-configurable
|
129
|
+
homepage: https://dry-rb.org/gems/dry-configurable
|
118
130
|
licenses:
|
119
131
|
- MIT
|
120
132
|
metadata:
|
121
|
-
|
133
|
+
allowed_push_host: https://rubygems.org
|
122
134
|
changelog_uri: https://github.com/dry-rb/dry-configurable/blob/master/CHANGELOG.md
|
135
|
+
source_code_uri: https://github.com/dry-rb/dry-configurable
|
136
|
+
bug_tracker_uri: https://github.com/dry-rb/dry-configurable/issues
|
123
137
|
post_install_message:
|
124
138
|
rdoc_options: []
|
125
139
|
require_paths:
|
@@ -128,14 +142,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
142
|
requirements:
|
129
143
|
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
145
|
+
version: 2.4.0
|
132
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
147
|
requirements:
|
134
148
|
- - ">="
|
135
149
|
- !ruby/object:Gem::Version
|
136
150
|
version: '0'
|
137
151
|
requirements: []
|
138
|
-
rubygems_version: 3.0.
|
152
|
+
rubygems_version: 3.0.3
|
139
153
|
signing_key:
|
140
154
|
specification_version: 4
|
141
155
|
summary: A mixin to add configuration functionality to your classes
|
data/.codeclimate.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
engines:
|
2
|
-
rubocop:
|
3
|
-
enabled: true
|
4
|
-
checks:
|
5
|
-
Rubocop/Metrics/LineLength:
|
6
|
-
enabled: true
|
7
|
-
max: 120
|
8
|
-
Rubocop/Style/Documentation:
|
9
|
-
enabled: false
|
10
|
-
Rubocop/Lint/HandleExceptions:
|
11
|
-
enabled: true
|
12
|
-
exclude:
|
13
|
-
- rakelib/*.rake
|
14
|
-
Rubocop/Style/FileName:
|
15
|
-
enabled: true
|
16
|
-
exclude:
|
17
|
-
- lib/dry-configurable.rb
|
18
|
-
ratings:
|
19
|
-
paths:
|
20
|
-
- lib/**/*.rb
|
21
|
-
exclude_paths:
|
22
|
-
- spec/**/*
|
23
|
-
- examples/**/*
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: trusty
|
3
|
-
sudo: required
|
4
|
-
cache: bundler
|
5
|
-
bundler_args: --without console
|
6
|
-
after_success:
|
7
|
-
- '[ -d coverage ] && bundle exec codeclimate-test-reporter'
|
8
|
-
rvm:
|
9
|
-
- 2.3.8
|
10
|
-
- 2.4.5
|
11
|
-
- 2.5.3
|
12
|
-
- 2.6.1
|
13
|
-
- jruby-9.2.6.0
|
14
|
-
env:
|
15
|
-
global:
|
16
|
-
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
17
|
-
- COVERAGE='true'
|
18
|
-
notifications:
|
19
|
-
email: false
|
20
|
-
webhooks:
|
21
|
-
urls:
|
22
|
-
- https://webhooks.gitter.im/e/19098b4253a72c9796db
|
23
|
-
on_success: change # options: [always|never|change] default: always
|
24
|
-
on_failure: always # options: [always|never|change] default: always
|
25
|
-
on_start: false # default: false
|
data/CONTRIBUTING.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Issue Guidelines
|
2
|
-
|
3
|
-
## Reporting bugs
|
4
|
-
|
5
|
-
If you found a bug, report an issue and describe what's the expected behavior versus what actually happens. If the bug causes a crash, attach a full backtrace. If possible, a reproduction script showing the problem is highly appreciated.
|
6
|
-
|
7
|
-
## Reporting feature requests
|
8
|
-
|
9
|
-
Report a feature request **only after discussing it first on [discuss.dry-rb.org](https://discuss.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
|
10
|
-
|
11
|
-
## Reporting questions, support requests, ideas, concerns etc.
|
12
|
-
|
13
|
-
**PLEASE DON'T** - use [discuss.dry-rb.org](http://discuss.dry-rb.org) instead.
|
14
|
-
|
15
|
-
# Pull Request Guidelines
|
16
|
-
|
17
|
-
A Pull Request will only be accepted if it addresses a specific issue that was reported previously, or fixes typos, mistakes in documentation etc.
|
18
|
-
|
19
|
-
Other requirements:
|
20
|
-
|
21
|
-
1) Do not open a pull request if you can't provide tests along with it. If you have problems writing tests, ask for help in the related issue.
|
22
|
-
2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
|
23
|
-
3) Add API documentation if it's a new feature
|
24
|
-
4) Update API documentation if it changes an existing feature
|
25
|
-
5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](github.com/dry-rb/dry-rb.org) which updates user documentation and guides
|
26
|
-
|
27
|
-
# Asking for help
|
28
|
-
|
29
|
-
If these guidelines aren't helpful, and you're stuck, please post a message on [discuss.dry-rb.org](https://discuss.dry-rb.org).
|
data/Gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
platforms :mri do
|
7
|
-
gem 'codeclimate-test-reporter', require: false
|
8
|
-
gem 'simplecov', require: false
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
group :tools do
|
13
|
-
gem 'guard'
|
14
|
-
gem 'guard-rspec'
|
15
|
-
gem 'listen', '3.0.6'
|
16
|
-
gem 'pry-byebug', platform: :mri
|
17
|
-
end
|
data/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require 'bundler/gem_tasks'
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
5
|
-
|
6
|
-
require 'rspec/core'
|
7
|
-
require 'rspec/core/rake_task'
|
8
|
-
|
9
|
-
task default: :spec
|
10
|
-
|
11
|
-
desc 'Run all specs in spec directory'
|
12
|
-
RSpec::Core::RakeTask.new(:spec)
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Dry
|
2
|
-
# Argument parser
|
3
|
-
#
|
4
|
-
# Passing and array or arguments, it will decide which one are arguments
|
5
|
-
# and which one are options.
|
6
|
-
#
|
7
|
-
# We have a limitation if setting the value without options, as a hash
|
8
|
-
# having the same key as one of the valid options, will parse the value
|
9
|
-
# as options. In this case, all unknown options will be reject with an exception.
|
10
|
-
#
|
11
|
-
# @example
|
12
|
-
# p = Dry::Configurable::ArgumentParser.new.('db:sqlite', reader: true)
|
13
|
-
#
|
14
|
-
# p[0] # => 'db:sqlite'
|
15
|
-
# p[1] # => ArgumentParser::DEFAULT_PROCESSOR
|
16
|
-
# p[2] # => { reader: true }
|
17
|
-
module Configurable
|
18
|
-
class Settings
|
19
|
-
# @private
|
20
|
-
class ArgumentParser
|
21
|
-
DEFAULT_PROCESSOR = ->(v) { v }
|
22
|
-
|
23
|
-
# @private
|
24
|
-
def call(val, opts, block)
|
25
|
-
if block && block.parameters.empty?
|
26
|
-
raise ArgumentError unless Undefined.equal?(opts)
|
27
|
-
|
28
|
-
processor = DEFAULT_PROCESSOR
|
29
|
-
|
30
|
-
value, options = Settings.capture(&block), val
|
31
|
-
else
|
32
|
-
processor = block || DEFAULT_PROCESSOR
|
33
|
-
|
34
|
-
if Undefined.equal?(opts) && val.is_a?(Hash) && val.key?(:reader)
|
35
|
-
value, options = Undefined, val
|
36
|
-
else
|
37
|
-
value, options = val, opts
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
[value, processor, options(Undefined.default(options, EMPTY_HASH))]
|
42
|
-
end
|
43
|
-
|
44
|
-
def options(reader: false)
|
45
|
-
{ reader: reader }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/rakelib/rubocop.rake
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rubocop/rake_task'
|
3
|
-
|
4
|
-
Rake::Task[:default].enhance [:rubocop]
|
5
|
-
|
6
|
-
RuboCop::RakeTask.new do |task|
|
7
|
-
task.options << '--display-cop-names'
|
8
|
-
end
|
9
|
-
|
10
|
-
namespace :rubocop do
|
11
|
-
desc 'Generate a configuration file acting as a TODO list.'
|
12
|
-
task :auto_gen_config do
|
13
|
-
exec 'bundle exec rubocop --auto-gen-config'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
rescue LoadError
|
18
|
-
end
|