dry-initializer 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +234 -242
  3. data/dry-initializer.gemspec +28 -15
  4. data/lib/dry/initializer/builders/attribute.rb +1 -1
  5. data/lib/dry/initializer/version.rb +1 -1
  6. metadata +24 -104
  7. data/.codeclimate.yml +0 -12
  8. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
  9. data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
  10. data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
  11. data/.github/workflows/custom_ci.yml +0 -58
  12. data/.github/workflows/docsite.yml +0 -34
  13. data/.github/workflows/sync_configs.yml +0 -56
  14. data/.gitignore +0 -12
  15. data/.rspec +0 -4
  16. data/.rubocop.yml +0 -102
  17. data/CODE_OF_CONDUCT.md +0 -13
  18. data/CONTRIBUTING.md +0 -29
  19. data/Gemfile +0 -36
  20. data/Gemfile.devtools +0 -16
  21. data/Guardfile +0 -5
  22. data/LICENSE.txt +0 -21
  23. data/Rakefile +0 -8
  24. data/benchmarks/compare_several_defaults.rb +0 -82
  25. data/benchmarks/plain_options.rb +0 -63
  26. data/benchmarks/plain_params.rb +0 -84
  27. data/benchmarks/with_coercion.rb +0 -71
  28. data/benchmarks/with_defaults.rb +0 -66
  29. data/benchmarks/with_defaults_and_coercion.rb +0 -59
  30. data/bin/.gitkeep +0 -0
  31. data/docsite/source/attributes.html.md +0 -106
  32. data/docsite/source/container-version.html.md +0 -39
  33. data/docsite/source/index.html.md +0 -43
  34. data/docsite/source/inheritance.html.md +0 -43
  35. data/docsite/source/optionals-and-defaults.html.md +0 -130
  36. data/docsite/source/options-tolerance.html.md +0 -27
  37. data/docsite/source/params-and-options.html.md +0 -74
  38. data/docsite/source/rails-support.html.md +0 -101
  39. data/docsite/source/readers.html.md +0 -43
  40. data/docsite/source/skip-undefined.html.md +0 -59
  41. data/docsite/source/type-constraints.html.md +0 -160
  42. data/project.yml +0 -2
  43. data/spec/attributes_spec.rb +0 -38
  44. data/spec/coercion_of_nil_spec.rb +0 -25
  45. data/spec/custom_dispatchers_spec.rb +0 -35
  46. data/spec/custom_initializer_spec.rb +0 -30
  47. data/spec/default_values_spec.rb +0 -83
  48. data/spec/definition_spec.rb +0 -111
  49. data/spec/invalid_default_spec.rb +0 -13
  50. data/spec/list_type_spec.rb +0 -32
  51. data/spec/missed_default_spec.rb +0 -14
  52. data/spec/nested_type_spec.rb +0 -48
  53. data/spec/optional_spec.rb +0 -71
  54. data/spec/options_tolerance_spec.rb +0 -11
  55. data/spec/public_attributes_utility_spec.rb +0 -22
  56. data/spec/reader_spec.rb +0 -87
  57. data/spec/repetitive_definitions_spec.rb +0 -69
  58. data/spec/several_assignments_spec.rb +0 -41
  59. data/spec/spec_helper.rb +0 -24
  60. data/spec/subclassing_spec.rb +0 -49
  61. data/spec/support/coverage.rb +0 -7
  62. data/spec/support/warnings.rb +0 -7
  63. data/spec/type_argument_spec.rb +0 -35
  64. data/spec/type_constraint_spec.rb +0 -96
  65. data/spec/value_coercion_via_dry_types_spec.rb +0 -29
@@ -1,20 +1,33 @@
1
- require File.expand_path('lib/dry/initializer/version', __dir__)
1
+ # frozen_string_literal: true
2
+ # this file is managed by dry-rb/devtools project
2
3
 
3
- Gem::Specification.new do |gem|
4
- gem.name = 'dry-initializer'
5
- gem.version = Dry::Initializer::VERSION
6
- gem.author = ['Vladimir Kochnev (marshall-lee)', 'Andrew Kozin (nepalez)']
7
- gem.email = 'andrew.kozin@gmail.com'
8
- gem.homepage = 'https://github.com/dry-rb/dry-initializer'
9
- gem.summary = 'DSL for declaring params and options of the initializer'
10
- gem.license = 'MIT'
4
+ lib = File.expand_path('lib', __dir__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'dry/initializer/version'
11
7
 
12
- gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
13
- gem.test_files = gem.files.grep(/^spec/)
14
- gem.extra_rdoc_files = Dir['README.md', 'LICENSE', 'CHANGELOG.md']
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'dry-initializer'
10
+ spec.authors = ["Vladimir Kochnev (marshall-lee)", "Andrew Kozin (nepalez)"]
11
+ spec.email = ["andrew.kozin@gmail.com"]
12
+ spec.license = 'MIT'
13
+ spec.version = Dry::Initializer::VERSION.dup
15
14
 
16
- gem.required_ruby_version = '>= 2.3'
15
+ spec.summary = "DSL for declaring params and options of the initializer"
16
+ spec.description = spec.summary
17
+ spec.homepage = 'https://dry-rb.org/gems/dry-initializer'
18
+ spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-initializer.gemspec", "lib/**/*"]
19
+ spec.bindir = 'bin'
20
+ spec.executables = []
21
+ spec.require_paths = ['lib']
17
22
 
18
- gem.add_development_dependency 'rspec', '~> 3.0'
19
- gem.add_development_dependency 'rake', '> 10'
23
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
+ spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-initializer/blob/master/CHANGELOG.md'
25
+ spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-initializer'
26
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-initializer/issues'
27
+
28
+ spec.required_ruby_version = ">= 2.4.0"
29
+
30
+ # to update dependencies edit project.yml
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
20
33
  end
@@ -71,7 +71,7 @@ module Dry::Initializer::Builders
71
71
 
72
72
  arity = @type.is_a?(Proc) ? @type.arity : @type.method(:call).arity
73
73
 
74
- if arity.abs == 1 || Dry::Types::Type.equal?(@type)
74
+ if arity.equal?(1) || arity.negative?
75
75
  "#{@val} = #{@item}.type.call(#{@val}) unless #{@null} == #{@val}"
76
76
  else
77
77
  "#{@val} = #{@item}.type.call(#{@val}, self) unless #{@null} == #{@val}"
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Initializer
3
- VERSION = '3.0.3'.freeze
3
+ VERSION = '3.0.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-initializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kochnev (marshall-lee)
@@ -9,83 +9,46 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-08 00:00:00.000000000 Z
12
+ date: 2020-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rspec
15
+ name: rake
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.0'
20
+ version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '3.0'
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
29
+ name: rspec
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '10'
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '10'
42
- description:
43
- email: andrew.kozin@gmail.com
41
+ version: '0'
42
+ description: DSL for declaring params and options of the initializer
43
+ email:
44
+ - andrew.kozin@gmail.com
44
45
  executables: []
45
46
  extensions: []
46
- extra_rdoc_files:
47
- - README.md
48
- - LICENSE
49
- - CHANGELOG.md
47
+ extra_rdoc_files: []
50
48
  files:
51
- - ".codeclimate.yml"
52
- - ".github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md"
53
- - ".github/ISSUE_TEMPLATE/---bug-report.md"
54
- - ".github/ISSUE_TEMPLATE/---feature-request.md"
55
- - ".github/workflows/custom_ci.yml"
56
- - ".github/workflows/docsite.yml"
57
- - ".github/workflows/sync_configs.yml"
58
- - ".gitignore"
59
- - ".rspec"
60
- - ".rubocop.yml"
61
49
  - CHANGELOG.md
62
- - CODE_OF_CONDUCT.md
63
- - CONTRIBUTING.md
64
- - Gemfile
65
- - Gemfile.devtools
66
- - Guardfile
67
50
  - LICENSE
68
- - LICENSE.txt
69
51
  - README.md
70
- - Rakefile
71
- - benchmarks/compare_several_defaults.rb
72
- - benchmarks/plain_options.rb
73
- - benchmarks/plain_params.rb
74
- - benchmarks/with_coercion.rb
75
- - benchmarks/with_defaults.rb
76
- - benchmarks/with_defaults_and_coercion.rb
77
- - bin/.gitkeep
78
- - docsite/source/attributes.html.md
79
- - docsite/source/container-version.html.md
80
- - docsite/source/index.html.md
81
- - docsite/source/inheritance.html.md
82
- - docsite/source/optionals-and-defaults.html.md
83
- - docsite/source/options-tolerance.html.md
84
- - docsite/source/params-and-options.html.md
85
- - docsite/source/rails-support.html.md
86
- - docsite/source/readers.html.md
87
- - docsite/source/skip-undefined.html.md
88
- - docsite/source/type-constraints.html.md
89
52
  - dry-initializer.gemspec
90
53
  - lib/dry-initializer.rb
91
54
  - lib/dry/initializer.rb
@@ -116,34 +79,14 @@ files:
116
79
  - lib/dry/initializer/version.rb
117
80
  - lib/tasks/benchmark.rake
118
81
  - lib/tasks/profile.rake
119
- - project.yml
120
- - spec/attributes_spec.rb
121
- - spec/coercion_of_nil_spec.rb
122
- - spec/custom_dispatchers_spec.rb
123
- - spec/custom_initializer_spec.rb
124
- - spec/default_values_spec.rb
125
- - spec/definition_spec.rb
126
- - spec/invalid_default_spec.rb
127
- - spec/list_type_spec.rb
128
- - spec/missed_default_spec.rb
129
- - spec/nested_type_spec.rb
130
- - spec/optional_spec.rb
131
- - spec/options_tolerance_spec.rb
132
- - spec/public_attributes_utility_spec.rb
133
- - spec/reader_spec.rb
134
- - spec/repetitive_definitions_spec.rb
135
- - spec/several_assignments_spec.rb
136
- - spec/spec_helper.rb
137
- - spec/subclassing_spec.rb
138
- - spec/support/coverage.rb
139
- - spec/support/warnings.rb
140
- - spec/type_argument_spec.rb
141
- - spec/type_constraint_spec.rb
142
- - spec/value_coercion_via_dry_types_spec.rb
143
- homepage: https://github.com/dry-rb/dry-initializer
82
+ homepage: https://dry-rb.org/gems/dry-initializer
144
83
  licenses:
145
84
  - MIT
146
- metadata: {}
85
+ metadata:
86
+ allowed_push_host: https://rubygems.org
87
+ changelog_uri: https://github.com/dry-rb/dry-initializer/blob/master/CHANGELOG.md
88
+ source_code_uri: https://github.com/dry-rb/dry-initializer
89
+ bug_tracker_uri: https://github.com/dry-rb/dry-initializer/issues
147
90
  post_install_message:
148
91
  rdoc_options: []
149
92
  require_paths:
@@ -152,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
95
  requirements:
153
96
  - - ">="
154
97
  - !ruby/object:Gem::Version
155
- version: '2.3'
98
+ version: 2.4.0
156
99
  required_rubygems_version: !ruby/object:Gem::Requirement
157
100
  requirements:
158
101
  - - ">="
@@ -163,27 +106,4 @@ rubygems_version: 3.0.3
163
106
  signing_key:
164
107
  specification_version: 4
165
108
  summary: DSL for declaring params and options of the initializer
166
- test_files:
167
- - spec/attributes_spec.rb
168
- - spec/coercion_of_nil_spec.rb
169
- - spec/custom_dispatchers_spec.rb
170
- - spec/custom_initializer_spec.rb
171
- - spec/default_values_spec.rb
172
- - spec/definition_spec.rb
173
- - spec/invalid_default_spec.rb
174
- - spec/list_type_spec.rb
175
- - spec/missed_default_spec.rb
176
- - spec/nested_type_spec.rb
177
- - spec/optional_spec.rb
178
- - spec/options_tolerance_spec.rb
179
- - spec/public_attributes_utility_spec.rb
180
- - spec/reader_spec.rb
181
- - spec/repetitive_definitions_spec.rb
182
- - spec/several_assignments_spec.rb
183
- - spec/spec_helper.rb
184
- - spec/subclassing_spec.rb
185
- - spec/support/coverage.rb
186
- - spec/support/warnings.rb
187
- - spec/type_argument_spec.rb
188
- - spec/type_constraint_spec.rb
189
- - spec/value_coercion_via_dry_types_spec.rb
109
+ test_files: []
@@ -1,12 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- version: "2"
4
-
5
- exclude_patterns:
6
- - "benchmarks/"
7
- - "examples/"
8
- - "spec/"
9
-
10
- plugins:
11
- rubocop:
12
- enabled: true
@@ -1,10 +0,0 @@
1
- ---
2
- name: "⚠️ Please don't ask for support via issues"
3
- about: See CONTRIBUTING.md for more information
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
-
@@ -1,30 +0,0 @@
1
- ---
2
- name: "\U0001F41B Bug report"
3
- about: See CONTRIBUTING.md for more information
4
- title: ''
5
- labels: bug
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Before you submit this: WE ONLY ACCEPT BUG REPORTS AND FEATURE REQUESTS**
11
-
12
- For more information see `CONTRIBUTING.md`.
13
-
14
- **Describe the bug**
15
-
16
- A clear and concise description of what the bug is.
17
-
18
- **To Reproduce**
19
-
20
- Provide detailed steps to reproduce, an executable script would be best.
21
-
22
- **Expected behavior**
23
-
24
- A clear and concise description of what you expected to happen.
25
-
26
- **Your environment**
27
-
28
- - Affects my production application: **YES/NO**
29
- - Ruby version: ...
30
- - OS: ...
@@ -1,18 +0,0 @@
1
- ---
2
- name: "\U0001F6E0 Feature request"
3
- about: See CONTRIBUTING.md for more information
4
- title: ''
5
- labels: feature
6
- assignees: ''
7
-
8
- ---
9
-
10
- Summary of what the feature is supposed to do.
11
-
12
- ## Examples
13
-
14
- Code examples showing how the feature could be used.
15
-
16
- ## Resources
17
-
18
- Additional information, like a link to the discussion forum thread where the feature was discussed etc.
@@ -1,58 +0,0 @@
1
- name: ci
2
-
3
- on:
4
- push:
5
- paths:
6
- - .github/workflows/custom_ci.yml
7
- - lib/**
8
- - spec/**
9
- - Rakefile
10
- - Gemfile
11
- - Gemfile.devtools
12
- - "*.gemspec"
13
- - ".rubocop.yml"
14
- pull_request:
15
- branches:
16
- - master
17
-
18
- jobs:
19
- tests:
20
- runs-on: ubuntu-latest
21
- strategy:
22
- fail-fast: false
23
- matrix:
24
- ruby:
25
- - "2.7"
26
- - "2.6"
27
- - "2.5"
28
- - "2.4"
29
- - "jruby"
30
- runtime_deps:
31
- - "dry-types-latest"
32
- - "dry-types-master"
33
- include:
34
- - ruby: "2.6"
35
- coverage: "true"
36
- - runtime_deps: "dry-types-master"
37
- dry_types_from_master: "true"
38
- steps:
39
- - uses: actions/checkout@v1
40
- - name: Set up Ruby
41
- uses: eregon/use-ruby-action@master
42
- with:
43
- ruby-version: ${{matrix.ruby}}
44
- - name: Install latest bundler
45
- run: |
46
- gem install bundler
47
- bundle config set without 'tools benchmarks docs'
48
- - name: Bundle install
49
- run: bundle install --jobs 4 --retry 3
50
- env:
51
- DRY_TYPES_FROM_MASTER: ${{matrix.dry_types_from_master}}
52
- - name: Run all tests
53
- env:
54
- DRY_TYPES_FROM_MASTER: ${{matrix.dry_types_from_master}}
55
- COVERAGE: ${{matrix.coverage}}
56
- CODACY_RUN_LOCAL: true
57
- CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}
58
- run: bundle exec rake
@@ -1,34 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- name: docsite
4
-
5
- on:
6
- push:
7
- paths:
8
- - docsite/**
9
- - .github/workflows/docsite.yml
10
- branches:
11
- - master
12
- - release-**
13
- tags:
14
-
15
- jobs:
16
- update-docs:
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: actions/checkout@v1
20
- - name: Set up Ruby
21
- uses: actions/setup-ruby@v1
22
- with:
23
- ruby-version: "2.6.x"
24
- - name: Install dependencies
25
- run: |
26
- gem install bundler
27
- bundle install --jobs 4 --retry 3 --without benchmarks sql
28
- - name: Symlink ossy
29
- run: mkdir -p bin && ln -sf "$(bundle show ossy)/bin/ossy" bin/ossy
30
- - name: Trigger dry-rb.org deploy
31
- env:
32
- GITHUB_LOGIN: dry-bot
33
- GITHUB_TOKEN: ${{ secrets.GH_PAT }}
34
- run: bin/ossy github workflow dry-rb/dry-rb.org ci
@@ -1,56 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- name: sync_configs
4
-
5
- on:
6
- repository_dispatch:
7
-
8
- jobs:
9
- sync-configs:
10
- runs-on: ubuntu-latest
11
- if: github.event.action == 'sync_configs'
12
- steps:
13
- - uses: actions/checkout@v1
14
- - name: Set up Ruby
15
- uses: eregon/use-ruby-action@master
16
- with:
17
- ruby-version: 2.6
18
- - name: Install latest bundler
19
- run: |
20
- gem install bundler
21
- bundle config set without 'tools benchmarks docs'
22
- - name: Install dependencies
23
- run: bundle install --jobs 4 --retry 3 --without tools test benchmarks docs
24
- - name: Symlink ossy
25
- run: ln -sf "$(bundle info ossy --path)/bin/ossy" bin/ossy
26
- - name: Clone devtools
27
- run: git clone https://github.com/dry-rb/devtools.git tmp/devtools
28
- - name: Compile file templates
29
- env:
30
- GITHUB_LOGIN: dry-bot
31
- GITHUB_TOKEN: ${{ secrets.GH_PAT }}
32
- run: |
33
- if [ -f "project.yml" ]; then
34
- for t in `ls tmp/devtools/templates`
35
- do
36
- bin/ossy t c tmp/devtools/templates/$t $(basename $t .erb) project.yml
37
- done
38
- fi
39
- - name: Update configuration files from devtools
40
- run: |
41
- if [ -f ".github/workflows/custom_ci.yml" ]; then
42
- rsync -arv --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
43
- else
44
- rsync -arv tmp/devtools/shared/ . ;
45
- fi
46
- - name: Commit changes
47
- run: |
48
- rm bin/ossy
49
- git config --local user.email "dry-bot@dry-rb.org"
50
- git config --local user.name "dry-bot"
51
- git add -A
52
- git commit -m "[devtools] sync configs" || echo "nothing changed"
53
- - name: Push changes
54
- uses: ad-m/github-push-action@master
55
- with:
56
- github_token: ${{ secrets.GH_PAT }}