dry-initializer 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +10 -21
  3. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +10 -0
  4. data/.github/ISSUE_TEMPLATE/---bug-report.md +34 -0
  5. data/.github/ISSUE_TEMPLATE/---feature-request.md +18 -0
  6. data/.github/workflows/custom_ci.yml +74 -0
  7. data/.github/workflows/docsite.yml +34 -0
  8. data/.github/workflows/sync_configs.yml +34 -0
  9. data/.gitignore +2 -0
  10. data/.rspec +2 -2
  11. data/.rubocop.yml +65 -27
  12. data/CHANGELOG.md +10 -3
  13. data/CODE_OF_CONDUCT.md +13 -0
  14. data/CONTRIBUTING.md +29 -0
  15. data/Gemfile +26 -17
  16. data/LICENSE +20 -0
  17. data/README.md +11 -12
  18. data/docsite/source/attributes.html.md +106 -0
  19. data/docsite/source/container-version.html.md +39 -0
  20. data/docsite/source/index.html.md +43 -0
  21. data/docsite/source/inheritance.html.md +43 -0
  22. data/docsite/source/optionals-and-defaults.html.md +130 -0
  23. data/docsite/source/options-tolerance.html.md +27 -0
  24. data/docsite/source/params-and-options.html.md +74 -0
  25. data/docsite/source/rails-support.html.md +101 -0
  26. data/docsite/source/readers.html.md +43 -0
  27. data/docsite/source/skip-undefined.html.md +59 -0
  28. data/docsite/source/type-constraints.html.md +160 -0
  29. data/dry-initializer.gemspec +1 -1
  30. data/lib/dry/initializer/config.rb +5 -5
  31. data/lib/dry/initializer/dispatchers.rb +2 -2
  32. data/lib/dry/initializer/mixin/root.rb +1 -0
  33. data/lib/dry/initializer/struct.rb +2 -3
  34. data/spec/nested_type_spec.rb +4 -0
  35. data/spec/spec_helper.rb +7 -0
  36. data/spec/type_argument_spec.rb +2 -2
  37. data/spec/type_constraint_spec.rb +1 -1
  38. data/spec/value_coercion_via_dry_types_spec.rb +1 -1
  39. metadata +24 -4
  40. data/.travis.yml +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e17a987f9500b55fd7bf3c60caa5e8ce5c4c26cb78b94f339b62a63bdeb5a9e3
4
- data.tar.gz: 362138efc7974312bf747f060c7af4d4117e6b8c7648849998c1aefb39d14b1e
3
+ metadata.gz: f5d079daa17830b65177c99533e1b7f280bb4aee14dbcba097ba8c40de273abd
4
+ data.tar.gz: a59b00abe9c741b764152a6213ff40c29adbdf27094ecebbaaf766b2e056aa99
5
5
  SHA512:
6
- metadata.gz: fc4416e43fce6418f4708f5d7fc6753096009e9f2087f334bc11a2edeb44b3f9099d6d53ad9969d7e38ffefa524031c0e95fd4c7cb277ff7fed1a9ff63ebad5b
7
- data.tar.gz: a2745ea32279c9e6bd9a964b0cef5e876bf3f02afd604b4193e6223d629fc1ca6ee8fd22cf1543d652b9ff5548b3bb9a7fc28c7a06f4eeb04cf233b4ccf451de
6
+ metadata.gz: 4fee1158d5ddd7bfca050f61788ee7012bf0a0f424239095ea649c6dd34ba47b157627efe7261f9e5fdaef405654b589addd26990a912b72cd0f76e339003754
7
+ data.tar.gz: 64a5e73606be0a238d0dba9173d32f90d8366d0aae64edf378dd851705a07d4ede0906ed241cc85ff9cb9b5c5f3fe9734bfb77d53fb6fc71bf29565b8607c388
@@ -1,23 +1,12 @@
1
- ---
2
- engines:
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:
3
11
  rubocop:
4
12
  enabled: true
5
- checks:
6
- Rubocop/Style/FrozenStringLiteralComment:
7
- enabled: false
8
- Rubocop/Style/PercentLiteralDelimiters:
9
- enabled: false
10
- Rubocop/Lint/UnderscorePrefixedVariableName:
11
- enabled: false
12
- duplication:
13
- enabled: true
14
- config:
15
- languages:
16
- - ruby
17
- exclude_paths:
18
- - "benchmarks/**/*"
19
- - "spec/**/*"
20
- - "lib/tasks/**/*"
21
- ratings:
22
- paths:
23
- - "lib/**/*"
@@ -0,0 +1,10 @@
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
+
@@ -0,0 +1,34 @@
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 [our contribution guidelines](https://github.com/rom-rb/rom/blob/master/CONTRIBUTING.md)
13
+
14
+ **Before you report**
15
+
16
+ :warning: If you have a problem related to a schema, please **report it under [dry-schema issues](https://github.com/dry-rb/dry-schema/issues/new?assignees=&labels=bug&template=---bug-report.md&title=)** instead.
17
+
18
+ **Describe the bug**
19
+
20
+ A clear and concise description of what the bug is.
21
+
22
+ **To Reproduce**
23
+
24
+ Provide detailed steps to reproduce, an executable script would be best.
25
+
26
+ **Expected behavior**
27
+
28
+ A clear and concise description of what you expected to happen.
29
+
30
+ **Your environment**
31
+
32
+ - Affects my production application: **YES/NO**
33
+ - Ruby version: ...
34
+ - OS: ...
@@ -0,0 +1,18 @@
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.
@@ -0,0 +1,74 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - .github/workflows/custom_ci.yml
7
+ - lib/**
8
+ - spec/**
9
+ - Gemfile
10
+ - "*.gemspec"
11
+
12
+ jobs:
13
+ tests-mri:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: ["2.6.x", "2.5.x", "2.4.x", "2.3.x"]
19
+ include:
20
+ - ruby: "2.6.x"
21
+ coverage: "true"
22
+ steps:
23
+ - uses: actions/checkout@v1
24
+ - name: Set up Ruby
25
+ uses: actions/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{matrix.ruby}}
28
+ - name: Download test reporter
29
+ if: "matrix.coverage == 'true'"
30
+ run: |
31
+ mkdir -p tmp/
32
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
33
+ chmod +x ./tmp/cc-test-reporter
34
+ ./tmp/cc-test-reporter before-build
35
+ - name: Run all tests
36
+ env:
37
+ CI: "true"
38
+ COVERAGE: ${{matrix.coverage}}
39
+ run: |
40
+ gem install bundler
41
+ bundle config set without 'tools docs benchmarks'
42
+ bundle install --jobs 4 --retry 3
43
+ bundle exec rake
44
+ - name: Send coverage results
45
+ if: "matrix.coverage == 'true'"
46
+ env:
47
+ CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
48
+ GIT_COMMIT_SHA: ${{github.sha}}
49
+ GIT_BRANCH: ${{github.ref}}
50
+ GIT_COMMITTED_AT: ${{github.event.head_commit.timestamp}}
51
+ run: |
52
+ GIT_BRANCH=`ruby -e "puts ENV['GITHUB_REF'].split('/', 3).last"` \
53
+ GIT_COMMITTED_AT=`ruby -r time -e "puts Time.iso8601(ENV['GIT_COMMITTED_AT']).to_i"` \
54
+ ./tmp/cc-test-reporter after-build
55
+
56
+ tests-others:
57
+ runs-on: ubuntu-latest
58
+ strategy:
59
+ fail-fast: false
60
+ matrix:
61
+ image: ["jruby:9.2.8", "ruby:rc"]
62
+ container:
63
+ image: ${{matrix.image}}
64
+ steps:
65
+ - uses: actions/checkout@v1
66
+ - name: Install git
67
+ run: |
68
+ apt-get update
69
+ apt-get install -y --no-install-recommends git
70
+ - name: Run all tests
71
+ run: |
72
+ gem install bundler
73
+ bundle install --jobs 4 --retry 3 --without tools docs benchmarks
74
+ bundle exec rspec
@@ -0,0 +1,34 @@
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
@@ -0,0 +1,34 @@
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: Update configuration files from devtools
15
+ env:
16
+ GITHUB_LOGIN: dry-bot
17
+ GITHUB_TOKEN: ${{ secrets.GH_PAT }}
18
+ run: |
19
+ git clone https://github.com/dry-rb/devtools.git tmp/devtools
20
+
21
+ if [ -f ".github/workflows/custom_ci.yml" ]; then
22
+ rsync -av --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
23
+ else
24
+ rsync -av tmp/devtools/shared/ . ;
25
+ fi
26
+
27
+ git config --local user.email "dry-bot@dry-rb.org"
28
+ git config --local user.name "dry-bot"
29
+ git add -A
30
+ git commit -m "[devtools] config sync" || echo "nothing changed"
31
+ - name: Push changes
32
+ uses: ad-m/github-push-action@master
33
+ with:
34
+ github_token: ${{ secrets.GH_PAT }}
data/.gitignore CHANGED
@@ -8,3 +8,5 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /*.gem
11
+
12
+ .vscode
data/.rspec CHANGED
@@ -1,4 +1,4 @@
1
- --format documentation
2
1
  --color
3
2
  --require spec_helper
4
- --warnings
3
+ --order random
4
+
@@ -1,51 +1,89 @@
1
- ---
1
+ # this file is managed by dry-rb/devtools project
2
+
2
3
  AllCops:
3
- DisplayCopNames: true
4
- DisplayStyleGuide: true
5
- StyleGuideCopsOnly: true
6
- TargetRubyVersion: 2.3
7
- Exclude:
8
- - lib/tasks/*.rake
4
+ TargetRubyVersion: 2.4
9
5
 
10
- Bundler/DuplicatedGem:
6
+ Style/EachWithObject:
11
7
  Enabled: false
12
8
 
13
- Naming/FileName:
14
- Exclude:
15
- - lib/dry-initializer.rb
9
+ Style/StringLiterals:
10
+ Enabled: true
11
+ EnforcedStyle: single_quotes
16
12
 
17
- Style/CaseEquality:
13
+ Style/Alias:
18
14
  Enabled: false
19
15
 
20
- Style/ClassAndModuleChildren:
16
+ Style/LambdaCall:
17
+ Enabled: false
18
+
19
+ Style/StabbyLambdaParentheses:
21
20
  Enabled: false
22
21
 
23
- Style/ClassVars:
22
+ Style/FormatString:
24
23
  Enabled: false
25
24
 
26
25
  Style/Documentation:
27
26
  Enabled: false
28
27
 
29
- Style/DoubleNegation:
28
+ Layout/SpaceInLambdaLiteral:
30
29
  Enabled: false
31
30
 
32
- Style/Lambda:
33
- Exclude:
34
- - spec/**/*.rb
31
+ Layout/MultilineMethodCallIndentation:
32
+ Enabled: true
33
+ EnforcedStyle: indented
35
34
 
36
- Style/LambdaCall:
35
+ Metrics/LineLength:
36
+ Max: 100
37
+
38
+ Metrics/MethodLength:
39
+ Max: 22
40
+
41
+ Metrics/ClassLength:
42
+ Max: 150
43
+
44
+ Metrics/AbcSize:
45
+ Max: 20
46
+
47
+ Metrics/BlockLength:
48
+ Enabled: false
49
+
50
+ Metrics/CyclomaticComplexity:
51
+ Enabled: true
52
+ Max: 10
53
+
54
+ Lint/BooleanSymbol:
55
+ Enabled: false
56
+
57
+ Style/AccessModifierDeclarations:
58
+ Enabled: false
59
+
60
+ Style/BlockDelimiters:
37
61
  Enabled: false
38
62
 
39
- Style/RescueModifier:
63
+ Layout/IndentFirstArrayElement:
64
+ EnforcedStyle: consistent
65
+
66
+ Style/ClassAndModuleChildren:
40
67
  Exclude:
41
- - spec/**/*.rb
68
+ - "spec/**/*_spec.rb"
42
69
 
43
- Style/Semicolon:
70
+ Lint/HandleExceptions:
44
71
  Exclude:
45
- - spec/**/*.rb
72
+ - "spec/spec_helper.rb"
46
73
 
47
- Style/StringLiterals:
48
- EnforcedStyle: double_quotes
74
+ Naming/FileName:
75
+ Exclude:
76
+ - "lib/dry-*.rb"
77
+
78
+ Style/SymbolArray:
79
+ Exclude:
80
+ - "spec/**/*_spec.rb"
81
+
82
+ Style/ConditionalAssignment:
83
+ Enabled: false
84
+
85
+ Naming/MethodName:
86
+ Enabled: false
49
87
 
50
- Style/StringLiteralsInInterpolation:
51
- EnforcedStyle: double_quotes
88
+ Style/AsciiComments:
89
+ Enabled: false
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
+ ## [3.0.2] [2019-11-07]
9
+
10
+ ### Fixed
11
+
12
+ - Warnings about keyword arguments (flash-gordon)
13
+
8
14
  ## [3.0.1] [2019-04-15]
9
15
 
10
16
  ### Fixed
@@ -148,7 +154,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
148
154
  ```ruby
149
155
  class Location < String
150
156
  attr_reader :parameter # refers back to its parameter
151
-
157
+
152
158
  def initialize(name, parameter)
153
159
  super(name)
154
160
  @parameter = parameter
@@ -436,7 +442,7 @@ and to @gzigzigzeo for persuading me to do this refactoring.
436
442
 
437
443
  ### Added
438
444
  - No-undefined configuration of the initializer (nepalez, flash-gordon)
439
-
445
+
440
446
  You can either extend or include module `Dry::Initializer` with additional option
441
447
  `[undefined: false]`. This time `nil` will be assigned instead of
442
448
  `Dry::Initializer::UNDEFINED`. Readers becomes faster because there is no need
@@ -548,7 +554,7 @@ In this version the code has been rewritten for simplicity
548
554
 
549
555
  ### Internal
550
556
  - Refactor the way [#initializer] method is (re)defined (nepalez)
551
-
557
+
552
558
  When you extend class with `Dry::Initializer::Mixin`, the initializer is
553
559
  defined not "inside" the class per se, but inside the included module. The
554
560
  reference to that module is stored as class-level `__initializer_mixin__`.
@@ -881,3 +887,4 @@ First public release
881
887
  [2.6.0]: https://github.com/dry-rb/dry-initializer/compare/v2.5.0...v2.6.0
882
888
  [3.0.0]: https://github.com/dry-rb/dry-initializer/compare/v2.5.0...v3.0.0
883
889
  [3.0.1]: https://github.com/dry-rb/dry-initializer/compare/v3.0.0...v3.0.1
890
+ [3.0.2]: https://github.com/dry-rb/dry-initializer/compare/v3.0.1...v3.0.2
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.4.0, available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct)