functional-light-service 0.2.5 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/project-build.yml +39 -0
  3. data/.rubocop.yml +103 -15
  4. data/.solargraph.yml +11 -0
  5. data/.travis.yml +7 -5
  6. data/Appraisals +2 -2
  7. data/CHANGELOG.md +108 -0
  8. data/Gemfile +2 -2
  9. data/README.md +3 -1
  10. data/VERSION +1 -1
  11. data/functional-light-service.gemspec +14 -6
  12. data/gemfiles/dry_inflector_0_2_1.gemfile +5 -0
  13. data/gemfiles/i18n_1_8_11.gemfile +5 -0
  14. data/lib/functional-light-service/action.rb +3 -4
  15. data/lib/functional-light-service/configuration.rb +1 -1
  16. data/lib/functional-light-service/context/key_verifier.rb +2 -2
  17. data/lib/functional-light-service/context.rb +152 -165
  18. data/lib/functional-light-service/functional/enum.rb +3 -7
  19. data/lib/functional-light-service/functional/maybe.rb +1 -0
  20. data/lib/functional-light-service/functional/null.rb +1 -1
  21. data/lib/functional-light-service/functional/option.rb +0 -2
  22. data/lib/functional-light-service/functional/result.rb +4 -10
  23. data/lib/functional-light-service/localization_adapter.rb +5 -2
  24. data/lib/functional-light-service/organizer/iterate.rb +4 -1
  25. data/lib/functional-light-service/organizer/verify_call_method_exists.rb +3 -2
  26. data/lib/functional-light-service/organizer/with_reducer_log_decorator.rb +2 -2
  27. data/lib/functional-light-service/organizer.rb +4 -5
  28. data/lib/functional-light-service/testing/context_factory.rb +2 -0
  29. data/lib/functional-light-service/version.rb +1 -1
  30. data/lib/functional-light-service.rb +0 -1
  31. data/spec/acceptance/fail_spec.rb +42 -16
  32. data/spec/acceptance/include_warning_spec.rb +14 -14
  33. data/spec/acceptance/not_having_call_method_warning_spec.rb +4 -11
  34. data/spec/acceptance/organizer/reduce_if_spec.rb +32 -0
  35. data/spec/context/inspect_spec.rb +6 -21
  36. data/spec/context_spec.rb +1 -1
  37. data/spec/lib/deterministic/monad_axioms.rb +2 -0
  38. data/spec/lib/deterministic/monad_spec.rb +2 -0
  39. data/spec/lib/deterministic/null_spec.rb +2 -0
  40. data/spec/lib/enum_spec.rb +3 -1
  41. data/spec/sample/looks_up_tax_percentage_action_spec.rb +3 -1
  42. data/spec/spec_helper.rb +9 -12
  43. data/spec/test_doubles.rb +21 -9
  44. metadata +144 -22
  45. data/gemfiles/activesupport_5.gemfile +0 -8
  46. data/gemfiles/activesupport_5.gemfile.lock +0 -82
  47. data/spec/acceptance/skip_all_warning_spec.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c9ee1f86ecf3fed5b5f960947640127effa2379156378d7a3bd7efac0a0eaae
4
- data.tar.gz: 948a8c0e600137d6f4c4e5b686ddae5040ef3fbb39ef8ca77f3b6d30e57ea74a
3
+ metadata.gz: abc2dc23dfcaceae6802c421d5c4231debc7d9fb056ea7901da835ee7c998e4c
4
+ data.tar.gz: fac3e050fff1ae34b5cff4d366b81db0f7ee49748e95d79061a26c47353758a7
5
5
  SHA512:
6
- metadata.gz: db7ae9750f2e72fc1e7e373d9b06f31cfab0d08142c7154a12c9b81e58828153eb72b48cff0c572c66a1799c82bae2c2364f8d1a3d8df04473095da99bedaf17
7
- data.tar.gz: 8825e95f8b9d6c363c561345716cab58f7e47200b806114021b82ae0005e094a5c03ad4d438708efa13ea209868c0b709071a5deeff6e472a192252035cf7931
6
+ metadata.gz: cc75d56878d79463fdadd24ccc9ff404c043cca3372f996a9c5d3ab3e72cc85037204d839bdd7ed3d84a2b93d5b348d7f53af192ec05f47c373397a25617ab92
7
+ data.tar.gz: ea0679e575006d6804f4b3c825c4cbf569b611877f00a136821d49b700abd45d651c4cb38b05fb2483c318ab474bd7d3108bd5032dda3a8e80009a91d677e355
@@ -0,0 +1,39 @@
1
+ name: CI Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master ]
6
+ pull_request:
7
+ branches: [ main, master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os: [ubuntu, macos, windows]
16
+ ruby: [2.6.8, 2.7.4, 3.0.2]
17
+ gemfile: [dry_inflector_0_2_1, i18n_1_8_11]
18
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
19
+ env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
20
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ - run: bundle install --jobs 4 --retry 3
27
+ - run: bundle exec rspec spec
28
+ - run: bundle exec rubocop
29
+ codecov:
30
+ name: Codecov
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ - uses: codecov/codecov-action@v2
35
+ with:
36
+ files: ./coverage/coverage.xml # optional
37
+ flags: unittests # optional
38
+ name: codecov-simplecov # optional
39
+ verbose: true # optional (default = false)
data/.rubocop.yml CHANGED
@@ -1,13 +1,17 @@
1
+ # require: rubocop-performance
2
+
1
3
  AllCops:
4
+ TargetRubyVersion: 2.7
2
5
  Exclude:
3
6
  - 'lib/functional-light-service.rb'
4
7
  - 'vendor/bundle/**/*'
5
8
  - 'gemfiles/vendor/bundle/**/*'
6
9
  - 'bin/*'
7
10
  - 'functional-light-service.gemspec'
8
- TargetRubyVersion: 2.6
11
+ NewCops: enable
12
+ SuggestExtensions: false
9
13
 
10
- Documentation:
14
+ Style/Documentation:
11
15
  Enabled: false
12
16
 
13
17
  Style/FrozenStringLiteralComment:
@@ -34,6 +38,12 @@ Style/HashSyntax:
34
38
  Style/TrivialAccessors:
35
39
  AllowPredicates: true
36
40
 
41
+ Style/MissingRespondToMissing:
42
+ Enabled: false
43
+
44
+ Style/Alias:
45
+ Enabled: false
46
+
37
47
  Style/Lambda:
38
48
  EnforcedStyle: literal
39
49
 
@@ -48,25 +58,103 @@ Metrics/BlockLength:
48
58
  Exclude:
49
59
  - 'spec/**/*.rb'
50
60
 
51
- Layout/TrailingBlankLines:
52
- Enabled: false
53
-
54
- Layout/EndOfLine:
55
- EnforcedStyle: lf
56
-
57
- Metrics/LineLength:
58
- Max: 100
59
-
60
61
  Metrics/AbcSize:
61
62
  Max: 24
62
63
 
63
- Naming/UncommunicativeMethodParamName:
64
+ Naming/MethodParameterName:
64
65
  Enabled: false
65
66
 
66
- Style/Alias:
67
+ Layout/TrailingEmptyLines:
67
68
  Enabled: false
68
69
 
69
- Style/MissingRespondToMissing:
70
- Enabled: false
70
+ Layout/LineLength:
71
+ Max: 100
72
+
73
+ Layout/EndOfLine:
74
+ Enabled: False
75
+
76
+ Lint/ConstantDefinitionInBlock:
77
+ Exclude:
78
+ - 'spec/**/*.rb'
71
79
 
80
+ Lint/EmptyClass:
81
+ Exclude:
82
+ - 'spec/**/*.rb'
72
83
 
84
+ # Defaults after the Rubocop upgrade
85
+ Gemspec/DateAssignment: # new in 1.10
86
+ Enabled: true
87
+ Layout/LineEndStringConcatenationIndentation: # new in 1.18
88
+ Enabled: true
89
+ Layout/SpaceBeforeBrackets: # new in 1.7
90
+ Enabled: true
91
+ Lint/AmbiguousAssignment: # new in 1.7
92
+ Enabled: true
93
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
94
+ Enabled: true
95
+ Lint/AmbiguousRange: # new in 1.19
96
+ Enabled: true
97
+ Lint/DeprecatedConstants: # new in 1.8
98
+ Enabled: true
99
+ Lint/DuplicateBranch: # new in 1.3
100
+ Enabled: true
101
+ Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
102
+ Enabled: true
103
+ Lint/EmptyBlock: # new in 1.1
104
+ Enabled: true
105
+ Lint/EmptyInPattern: # new in 1.16
106
+ Enabled: true
107
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
108
+ Enabled: true
109
+ Lint/LambdaWithoutLiteralBlock: # new in 1.8
110
+ Enabled: true
111
+ Lint/NoReturnInBeginEndBlocks: # new in 1.2
112
+ Enabled: true
113
+ Lint/NumberedParameterAssignment: # new in 1.9
114
+ Enabled: true
115
+ Lint/OrAssignmentToConstant: # new in 1.9
116
+ Enabled: true
117
+ Lint/RedundantDirGlobSort: # new in 1.8
118
+ Enabled: true
119
+ Lint/SymbolConversion: # new in 1.9
120
+ Enabled: true
121
+ Lint/ToEnumArguments: # new in 1.1
122
+ Enabled: true
123
+ Lint/TripleQuotes: # new in 1.9
124
+ Enabled: true
125
+ Lint/UnexpectedBlockArity: # new in 1.5
126
+ Enabled: true
127
+ Lint/UnmodifiedReduceAccumulator: # new in 1.1
128
+ Enabled: true
129
+ Style/ArgumentsForwarding: # new in 1.1
130
+ Enabled: true
131
+ Style/CollectionCompact: # new in 1.2
132
+ Enabled: true
133
+ Style/DocumentDynamicEvalDefinition: # new in 1.1
134
+ Enabled: true
135
+ Style/EndlessMethod: # new in 1.8
136
+ Enabled: true
137
+ Style/HashConversion: # new in 1.10
138
+ Enabled: true
139
+ Style/HashExcept: # new in 1.7
140
+ Enabled: true
141
+ Style/IfWithBooleanLiteralBranches: # new in 1.9
142
+ Enabled: true
143
+ Style/InPatternThen: # new in 1.16
144
+ Enabled: true
145
+ Style/MultilineInPatternThen: # new in 1.16
146
+ Enabled: true
147
+ Style/NegatedIfElseCondition: # new in 1.2
148
+ Enabled: true
149
+ Style/NilLambda: # new in 1.3
150
+ Enabled: true
151
+ Style/QuotedSymbols: # new in 1.16
152
+ Enabled: true
153
+ Style/RedundantArgument: # new in 1.4
154
+ Enabled: true
155
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
156
+ Enabled: true
157
+ Style/StringChars: # new in 1.12
158
+ Enabled: true
159
+ Style/SwapValues: # new in 1.1
160
+ Enabled: true
data/.solargraph.yml ADDED
@@ -0,0 +1,11 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - resources/**/*
6
+ - coverage/**/*
7
+ - spec/**/*
8
+ domains: []
9
+ reporters:
10
+ - rubocop
11
+ max_files: 5000
data/.travis.yml CHANGED
@@ -4,14 +4,15 @@ env:
4
4
  - RUN_COVERAGE_REPORT=true
5
5
 
6
6
  rvm:
7
- - 2.5.0
8
- - 2.6.0
7
+ - 2.6.6
8
+ - 2.7.2
9
+ - 3.0.0
9
10
 
10
11
  before_install:
11
12
  - 'echo ''gem: --no-ri --no-rdoc'' > ~/.gemrc'
13
+ - yes | gem update --system --force
12
14
  - gem install bundler
13
- - bundle update simplecov
14
- - bundle install --path vendor/bundle
15
+ - bundle install --gemfile=Gemfile --clean --path vendor/bundle
15
16
 
16
17
  # uncomment this line if your project needs to run something other than `rake`:
17
18
  script:
@@ -19,4 +20,5 @@ script:
19
20
  - bundle exec rubocop
20
21
 
21
22
  gemfile:
22
- - gemfiles/activesupport_5.gemfile
23
+ - gemfiles/dry_inflector_0_2_1.gemfile
24
+ - gemfiles/i18n_1_8_11.gemfile
data/Appraisals CHANGED
@@ -1,3 +1,3 @@
1
- appraise "activesupport-5" do
2
- gem "activesupport", "~> 5.2.0"
1
+ appraise "dry-inflector-0.2.1" do
2
+ gem "dry-inflector", "~> 0.2.1"
3
3
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,111 @@
1
+ ## 0.4.4 (2022-01-27)
2
+ ### Updated
3
+ - Aggiornato la versione è sistemato problema upload codeconv ( 2022-01-27 ) [ sphynx79]
4
+
5
+
6
+
7
+ ## 0.4.3 (2022-01-27)
8
+ ### Added
9
+ - Aggiunto lo stato di codecov nel file readme ( 2022-01-27 ) [ sphynx79]
10
+
11
+
12
+
13
+ ## 0.4.2 (2022-01-27)
14
+ ### Fixed
15
+ - sistemato il path dove codeconv cerca il file del coverage ( 2022-01-27 ) [ sphynx79]
16
+
17
+
18
+
19
+ ## 0.4.1 (2022-01-27)
20
+ ### Added
21
+ - aggiunto supporto per codecov.com ( 2022-01-27 ) [ sphynx79]
22
+
23
+
24
+
25
+ ## 0.4.0 (2022-01-27)
26
+ ### Aupdated
27
+ - Aggioranto il readme, invece di travis uso il simbolo di github actions per vedere se tutti i test hanno dato esito positivo (rubocop,rspec) ( 2022-01-27 ) [ sphynx79]
28
+
29
+
30
+
31
+ ## 0.3.9 (2022-01-26)
32
+
33
+
34
+ ## 0.3.8 (2022-01-26)
35
+ ### Added
36
+ - Aggiunto actions per fare i test in github ( 2022-01-26 ) [ sphynx79]
37
+
38
+
39
+
40
+ ## 0.3.7 (2022-01-26)
41
+
42
+
43
+ ## 0.3.6 (2022-01-26)
44
+
45
+
46
+ ## 0.3.5 (2022-01-26)
47
+
48
+
49
+ ## 0.3.4 (2021-12-15)
50
+
51
+
52
+ ## 0.3.3 (2021-12-15)
53
+ ### Fixed
54
+ - Corretto il problema di passare un hash per avere il dettaglio dell'errore quando fallisce ( 2021-12-15 ) [ sphynx]
55
+
56
+
57
+
58
+ ## 0.3.2 (2020-07-17)
59
+ ### Changed
60
+ - Ottimizzato performance di Deterministic [enum,result] ( 2020-07-17 ) [ sphynx79]
61
+
62
+
63
+
64
+ ## 0.3.1 (2020-02-16)
65
+
66
+
67
+ ## 0.3.0 (2020-02-16)
68
+ ### Removed
69
+ - Rimosso completamente activesupport ( 2020-02-16 ) [ sphynx79]
70
+
71
+
72
+
73
+ ## 0.2.9.2 (2020-02-16)
74
+ ### Removed
75
+ - Rimosso ActiveSupport::Deprecation per i warning di deprecation ( 2020-02-16 ) [ sphynx79]
76
+
77
+
78
+
79
+ ## 0.2.9.1 (2020-02-16)
80
+ ### Fixed
81
+ - Sto cercando di sistemate il problema di travis che da errore per activesupport ( 2020-02-16 ) [ sphynx79]
82
+
83
+
84
+
85
+ ## 0.2.9 (2020-02-16)
86
+ ### Fixed
87
+ - Travis va in errore aggiunt activesupport al mio gemfile ( 2020-02-16 ) [ sphynx79]
88
+
89
+
90
+
91
+ ## 0.2.8 (2020-02-16)
92
+ ### Removed
93
+ - rimosso supporto a activesupport 5 ( 2020-02-16 ) [ sphynx79]
94
+
95
+
96
+
97
+ ## 0.2.7 (2020-02-16)
98
+ ### Fix
99
+ - Risolto problema travis bundle update ( 2020-02-16 ) [ sphynx79]
100
+
101
+
102
+
103
+ ## 0.2.6 (2020-02-16)
104
+ ### Fixed
105
+ - FiFix problem /dev/null windows, e corretto il bug sul metodo failure? ( 2020-02-16 ) [ sphynx79]
106
+
107
+
108
+
1
109
  ## 0.2.5 (2019-02-24)
2
110
 
3
111
 
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in light_service.gemspec
3
+ # Specify your gem's dependencies in functional-light-service.gemspec
4
4
  gemspec
5
5
 
6
- gem 'appraisal', '~> 2.0'
6
+ gem "appraisal", "~> 2.4.1"
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # FunctionalLightService
2
2
  [![Gem Version](https://img.shields.io/gem/v/functional-light-service.svg)](https://rubygems.org/gems/functional-light-service)
3
- [![Build Status](https://travis-ci.org/sphynx79/functional-light-service.svg?branch=master)](https://travis-ci.org/sphynx79/functional-light-service)
3
+ [![CI Tests](https://github.com/sphynx79/functional-light-service/actions/workflows/project-build.yml/badge.svg)](https://github.com/sphynx79/functional-light-service/actions/workflows/project-build.yml)
4
+ [![Codecov](https://codecov.io/gh/sphynx79/functional-light-service/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sphynx79/functional-light-service)
4
5
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
6
+ [![Download Count](https://ruby-gem-downloads-badge.herokuapp.com/functional-light-service?type=total)](https://rubygems.org/gems/functional-light-service)
5
7
 
6
8
  ## Table of Content
7
9
  * [Requirements](#requirements)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.4.4
@@ -15,12 +15,20 @@ Gem::Specification.new do |gem|
15
15
  gem.name = "functional-light-service"
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = FunctionalLightService::VERSION
18
+ gem.required_ruby_version = '>= 2.6.0'
18
19
 
19
- # gem.add_dependency("activesupport", ">= 5.2.2")
20
+ gem.add_runtime_dependency("dry-inflector", "~> 0.2", ">= 0.2.1")
21
+ gem.add_runtime_dependency("i18n", "~> 1.8", ">= 1.8.11")
20
22
 
21
- gem.add_development_dependency("activesupport", "~> 5.2.0")
22
- gem.add_development_dependency("rspec", "~> 3.0")
23
- gem.add_development_dependency("simplecov", "~> 0.16.1")
24
- gem.add_development_dependency("rubocop", "~> 0.63.1")
25
- gem.add_development_dependency("pry", "~> 0.12.2")
23
+
24
+ gem.add_development_dependency("i18n", "~> 1.8", ">= 1.8.11")
25
+ gem.add_development_dependency("dry-inflector", "~> 0.2", ">= 0.2.1")
26
+ gem.add_development_dependency("rspec", "~> 3.10.0")
27
+ gem.add_development_dependency("simplecov", "~> 0.21.2")
28
+ gem.add_development_dependency("simplecov-cobertura", "~> 2.1.0")
29
+ gem.add_development_dependency("rubocop", "~> 1.25.0")
30
+ gem.add_development_dependency("rubocop-performance", "~> 1.13.2")
31
+ gem.add_development_dependency("pry", "~> 0.14.1")
32
+ gem.add_development_dependency("solargraph", "~> 0.44.2")
33
+ gem.add_development_dependency("nokogiri", "~> 1.12.5")
26
34
  end
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "dry-inflector", "~> 0.2.1"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "i18n", "~> 1.8.11"
4
+
5
+ gemspec :path => "../"
@@ -1,5 +1,3 @@
1
- require 'active_support/deprecation'
2
-
3
1
  module FunctionalLightService
4
2
  module Action
5
3
  def self.extended(base_class)
@@ -8,9 +6,10 @@ module FunctionalLightService
8
6
  end
9
7
 
10
8
  def self.included(base_class)
11
- msg = "including FunctionalLightService::Action is deprecated. " \
9
+ msg = "DEPRECATION WARNING:\n" \
10
+ "Including FunctionalLightService::Action is deprecated\n" \
12
11
  "Please use `extend FunctionalLightService::Action` instead"
13
- ActiveSupport::Deprecation.warn(msg)
12
+ print msg
14
13
  base_class.extend Macros
15
14
  end
16
15
 
@@ -15,7 +15,7 @@ module FunctionalLightService
15
15
  private
16
16
 
17
17
  def _default_logger
18
- logger = Logger.new("/dev/null")
18
+ logger = Logger.new(nil)
19
19
  logger.level = Logger::WARN
20
20
  logger
21
21
  end
@@ -24,7 +24,7 @@ module FunctionalLightService
24
24
 
25
25
  def error_message
26
26
  "#{type_name} #{format_keys(keys_not_found(keys))} " \
27
- "to be in the context during #{action}"
27
+ "to be in the context during #{action}"
28
28
  end
29
29
 
30
30
  def throw_error_predicate(_keys)
@@ -95,7 +95,7 @@ module FunctionalLightService
95
95
 
96
96
  def error_message
97
97
  "promised or expected keys cannot be a " \
98
- "reserved key: [#{format_keys(violated_keys)}]"
98
+ "reserved key: [#{format_keys(violated_keys)}]"
99
99
  end
100
100
 
101
101
  def keys