functional-light-service 0.2.5 → 0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c9ee1f86ecf3fed5b5f960947640127effa2379156378d7a3bd7efac0a0eaae
4
- data.tar.gz: 948a8c0e600137d6f4c4e5b686ddae5040ef3fbb39ef8ca77f3b6d30e57ea74a
3
+ metadata.gz: c2e4181b50ddcb052f267df328408dd0f617132d5f856a61d100f5eaee6a7df2
4
+ data.tar.gz: c372e9e09e36677b7209797efd24cb14446dc52810b7e6071e4f3044814b309e
5
5
  SHA512:
6
- metadata.gz: db7ae9750f2e72fc1e7e373d9b06f31cfab0d08142c7154a12c9b81e58828153eb72b48cff0c572c66a1799c82bae2c2364f8d1a3d8df04473095da99bedaf17
7
- data.tar.gz: 8825e95f8b9d6c363c561345716cab58f7e47200b806114021b82ae0005e094a5c03ad4d438708efa13ea209868c0b709071a5deeff6e472a192252035cf7931
6
+ metadata.gz: 956079386a37611a39f581754ae6dec46ea660c939340a19773c05ee46b83368ca7ddf44534dff1c78a28d0a9aacc524f3253ebb99b41125ce3c9cffe5ceaeb8
7
+ data.tar.gz: ff0c84baac2722ccd747b8cd378412448021b3c56920beb316034b3a8eab15298e105dd8811b16e75e175b0145c5b3d6b186d63621cf7f60a6fe959f004c45e9
data/.travis.yml CHANGED
@@ -4,14 +4,15 @@ env:
4
4
  - RUN_COVERAGE_REPORT=true
5
5
 
6
6
  rvm:
7
- - 2.5.0
7
+ - 2.5.3
8
8
  - 2.6.0
9
+ - 2.7.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.gemfile
24
+ - gemfiles/i18n_1_8.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.0" do
2
+ gem "dry-inflector", "~> 0.2.0"
3
3
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ ## 0.3.1 (2020-02-16)
2
+
3
+
4
+ ## 0.3.0 (2020-02-16)
5
+ ### Removed
6
+ - Rimosso completamente activesupport ( 2020-02-16 ) [ sphynx79]
7
+
8
+
9
+
10
+ ## 0.2.9.2 (2020-02-16)
11
+ ### Removed
12
+ - Rimosso ActiveSupport::Deprecation per i warning di deprecation ( 2020-02-16 ) [ sphynx79]
13
+
14
+
15
+
16
+ ## 0.2.9.1 (2020-02-16)
17
+ ### Fixed
18
+ - Sto cercando di sistemate il problema di travis che da errore per activesupport ( 2020-02-16 ) [ sphynx79]
19
+
20
+
21
+
22
+ ## 0.2.9 (2020-02-16)
23
+ ### Fixed
24
+ - Travis va in errore aggiunt activesupport al mio gemfile ( 2020-02-16 ) [ sphynx79]
25
+
26
+
27
+
28
+ ## 0.2.8 (2020-02-16)
29
+ ### Removed
30
+ - rimosso supporto a activesupport 5 ( 2020-02-16 ) [ sphynx79]
31
+
32
+
33
+
34
+ ## 0.2.7 (2020-02-16)
35
+ ### Fix
36
+ - Risolto problema travis bundle update ( 2020-02-16 ) [ sphynx79]
37
+
38
+
39
+
40
+ ## 0.2.6 (2020-02-16)
41
+ ### Fixed
42
+ - FiFix problem /dev/null windows, e corretto il bug sul metodo failure? ( 2020-02-16 ) [ sphynx79]
43
+
44
+
45
+
1
46
  ## 0.2.5 (2019-02-24)
2
47
 
3
48
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.3.1
@@ -16,9 +16,11 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = FunctionalLightService::VERSION
18
18
 
19
- # gem.add_dependency("activesupport", ">= 5.2.2")
19
+ gem.add_dependency("dry-inflector", ">= 0.2.0")
20
+ gem.add_dependency("i18n", ">= 1.8.2")
20
21
 
21
- gem.add_development_dependency("activesupport", "~> 5.2.0")
22
+ gem.add_development_dependency("i18n", ">= 1.8.2")
23
+ gem.add_development_dependency("dry-inflector", ">= 0.2.0")
22
24
  gem.add_development_dependency("rspec", "~> 3.0")
23
25
  gem.add_development_dependency("simplecov", "~> 0.16.1")
24
26
  gem.add_development_dependency("rubocop", "~> 0.63.1")
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.0"
6
+ gem "dry-inflector", "~> 0.2.0"
7
+
8
+ gemspec :path => "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activesupport", "~> 5.0"
6
5
  gem "appraisal", "~> 2.0"
6
+ gem "i18n", "~> 1.8.2"
7
7
 
8
8
  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
@@ -1,5 +1,3 @@
1
- require 'active_support/deprecation'
2
-
3
1
  module FunctionalLightService
4
2
  # rubocop:disable ClassLength
5
3
  class Context < Hash
@@ -35,7 +33,7 @@ module FunctionalLightService
35
33
  end
36
34
 
37
35
  def failure?
38
- success? == false
36
+ @outcome.failure?
39
37
  end
40
38
 
41
39
  def skip_remaining?
@@ -43,7 +41,7 @@ module FunctionalLightService
43
41
  end
44
42
 
45
43
  def reset_skip_remaining!
46
- @outcome = Success(nil)
44
+ @outcome = Success(:message => '', :error => nil)
47
45
  @skip_remaining = false
48
46
  end
49
47
 
@@ -90,14 +88,6 @@ module FunctionalLightService
90
88
  raise FailWithRollbackError
91
89
  end
92
90
 
93
- def skip_all!(message = nil)
94
- warning_msg = "Using skip_all! has been deprecated, " \
95
- "please use `skip_remaining!` instead."
96
- ActiveSupport::Deprecation.warn(warning_msg)
97
-
98
- skip_remaining!(message)
99
- end
100
-
101
91
  def skip_remaining!(message = nil)
102
92
  @outcome = Success(:message => message)
103
93
  @skip_remaining = true
@@ -1,3 +1,5 @@
1
+ require 'i18n'
2
+
1
3
  module FunctionalLightService
2
4
  class LocalizationAdapter
3
5
  def failure(message_or_key, action_class, i18n_options = {})
@@ -34,11 +36,12 @@ module FunctionalLightService
34
36
  scope = i18n_scope_from_class(action_class, type)
35
37
  options[:scope] = scope
36
38
 
37
- I18n.t(key, options)
39
+ I18n.t(key, **options)
38
40
  end
39
41
 
40
42
  def i18n_scope_from_class(action_class, type)
41
- "#{action_class.name.underscore}.light_service.#{type.to_s.pluralize}"
43
+ inflector = Dry::Inflector.new
44
+ "#{inflector.underscore(action_class.name)}.light_service.#{inflector.pluralize(type)}"
42
45
  end
43
46
  end
44
47
  end
@@ -1,3 +1,5 @@
1
+ require "dry/inflector"
2
+
1
3
  module FunctionalLightService
2
4
  module Organizer
3
5
  class Iterate
@@ -8,7 +10,8 @@ module FunctionalLightService
8
10
  return ctx if ctx.stop_processing?
9
11
 
10
12
  collection = ctx[collection_key]
11
- item_key = collection_key.to_s.singularize.to_sym
13
+ inflector = Dry::Inflector.new
14
+ item_key = inflector.singularize(collection_key).to_sym
12
15
  collection.each do |item|
13
16
  ctx[item_key] = item
14
17
  ctx = scoped_reduce(organizer, ctx, steps)
@@ -11,11 +11,12 @@ module FunctionalLightService
11
11
  call_method_exists = klass.methods.include?(:call)
12
12
  return if call_method_exists
13
13
 
14
- warning_msg = "The <#{klass.name}> class is an organizer, " \
14
+ warning_msg = "DEPRECATION WARNING:" \
15
+ "The <#{klass.name}> class is an organizer, " \
15
16
  "its entry method (the one that calls with & reduce) " \
16
17
  "should be named `call`. " \
17
18
  "Please use #{klass}.call going forward."
18
- ActiveSupport::Deprecation.warn(warning_msg)
19
+ print warning_msg
19
20
  end
20
21
 
21
22
  def self.caller_method(first_caller)
@@ -1,5 +1,3 @@
1
- require 'active_support/deprecation'
2
-
3
1
  module FunctionalLightService
4
2
  module Organizer
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
- warning_msg = "including FunctionalLightService::Organizer is deprecated. " \
12
- "Please use `extend FunctionalLightService::Organizer` instead"
13
- ActiveSupport::Deprecation.warn(warning_msg)
9
+ msg = "DEPRECATION WARNING:\n" \
10
+ "Including FunctionalLightService::Organizer is deprecated\n" \
11
+ "Please use `extend FunctionalLightService::Organizer` instead"
12
+ print msg
14
13
  extended(base_class)
15
14
  end
16
15
 
@@ -1,3 +1,3 @@
1
1
  module FunctionalLightService
2
- VERSION = "0.2.5".freeze
2
+ VERSION = "0.3".freeze
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'logger'
2
- require 'active_support/core_ext/string'
3
2
 
4
3
  require 'functional-light-service/version'
5
4
 
@@ -3,27 +3,27 @@ require 'spec_helper'
3
3
  describe "Including is discouraged" do
4
4
  context "when including FunctionalLightService::Organizer" do
5
5
  it "gives warning" do
6
- expected_msg = "including FunctionalLightService::Organizer is deprecated. " \
6
+ expected_msg = "DEPRECATION WARNING:\n" \
7
+ "Including FunctionalLightService::Organizer is deprecated\n" \
7
8
  "Please use `extend FunctionalLightService::Organizer` instead"
8
- expect(ActiveSupport::Deprecation).to receive(:warn)
9
- .with(expected_msg)
10
-
11
- class OrganizerIncludingLS
12
- include FunctionalLightService::Organizer
13
- end
9
+ expect do
10
+ class OrganizerIncludingLS
11
+ include FunctionalLightService::Organizer
12
+ end
13
+ end.to output(expected_msg).to_stdout
14
14
  end
15
15
  end
16
16
 
17
17
  context "when including FunctionalLightService::Action" do
18
18
  it "gives warning" do
19
- expected_msg = "including FunctionalLightService::Action is deprecated. " \
19
+ expected_msg = "DEPRECATION WARNING:\n" \
20
+ "Including FunctionalLightService::Action is deprecated\n" \
20
21
  "Please use `extend FunctionalLightService::Action` instead"
21
- expect(ActiveSupport::Deprecation).to receive(:warn)
22
- .with(expected_msg)
23
-
24
- class ActionIncludingLS
25
- include FunctionalLightService::Action
26
- end
22
+ expect do
23
+ class ActionIncludingLS
24
+ include FunctionalLightService::Action
25
+ end
26
+ end.to output(expected_msg).to_stdout
27
27
  end
28
28
  end
29
29
  end
@@ -4,10 +4,6 @@ require 'test_doubles'
4
4
  describe "Organizer should invoke with/reduce from a call method" do
5
5
  context "when the organizer does not have a `call` method" do
6
6
  it "gives warning" do
7
- expect(ActiveSupport::Deprecation)
8
- .to receive(:warn)
9
- .with(/^The <OrganizerWithoutCallMethod> class is an organizer/)
10
-
11
7
  class OrganizerWithoutCallMethod
12
8
  extend FunctionalLightService::Organizer
13
9
 
@@ -15,16 +11,14 @@ describe "Organizer should invoke with/reduce from a call method" do
15
11
  reduce([])
16
12
  end
17
13
  end
18
-
19
- OrganizerWithoutCallMethod.do_something
14
+ expect do
15
+ OrganizerWithoutCallMethod.do_something
16
+ end.to output(/The <OrganizerWithoutCallMethod> class is an organizer/).to_stdout
20
17
  end
21
18
  end
22
19
 
23
20
  context "when the organizer has the `call` method" do
24
21
  it "does not issue a warning" do
25
- expect(ActiveSupport::Deprecation)
26
- .not_to receive(:warn)
27
-
28
22
  class OrganizerWithCallMethod
29
23
  extend FunctionalLightService::Organizer
30
24
 
@@ -32,8 +26,7 @@ describe "Organizer should invoke with/reduce from a call method" do
32
26
  reduce([])
33
27
  end
34
28
  end
35
-
36
- OrganizerWithCallMethod.call
29
+ expect(OrganizerWithCallMethod.call).to be_a_kind_of(FunctionalLightService::Context)
37
30
  end
38
31
  end
39
32
  end
data/spec/spec_helper.rb CHANGED
@@ -15,10 +15,6 @@ end
15
15
  require 'functional-light-service'
16
16
  require 'functional-light-service/testing'
17
17
  require "functional-light-service/functional/null"
18
- require 'ostruct'
19
- require 'pry'
20
18
  require 'support'
21
19
  require 'test_doubles'
22
20
  require 'stringio'
23
-
24
- I18n.enforce_available_locales = true
metadata CHANGED
@@ -1,29 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: functional-light-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boscolo Michele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-24 00:00:00.000000000 Z
11
+ date: 2020-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: dry-inflector
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: 5.2.0
33
+ version: 1.8.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.8.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: i18n
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.8.2
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: dry-inflector
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.2.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
25
67
  - !ruby/object:Gem::Version
26
- version: 5.2.0
68
+ version: 0.2.0
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: rspec
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -101,8 +143,8 @@ files:
101
143
  - Rakefile
102
144
  - VERSION
103
145
  - functional-light-service.gemspec
104
- - gemfiles/activesupport_5.gemfile
105
- - gemfiles/activesupport_5.gemfile.lock
146
+ - gemfiles/dry_inflector_0_2.gemfile
147
+ - gemfiles/i18n_1_8.gemfile
106
148
  - lib/functional-light-service.rb
107
149
  - lib/functional-light-service/action.rb
108
150
  - lib/functional-light-service/configuration.rb
@@ -152,7 +194,6 @@ files:
152
194
  - spec/acceptance/organizer/reduce_until_spec.rb
153
195
  - spec/acceptance/organizer/with_callback_spec.rb
154
196
  - spec/acceptance/rollback_spec.rb
155
- - spec/acceptance/skip_all_warning_spec.rb
156
197
  - spec/acceptance/testing/context_factory_spec.rb
157
198
  - spec/action_expected_keys_spec.rb
158
199
  - spec/action_expects_and_promises_spec.rb
@@ -215,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
256
  - !ruby/object:Gem::Version
216
257
  version: '0'
217
258
  requirements: []
218
- rubygems_version: 3.0.2
259
+ rubygems_version: 3.0.3
219
260
  signing_key:
220
261
  specification_version: 4
221
262
  summary: A service skeleton with an emphasis on simplicity with a pinch a functional
@@ -239,7 +280,6 @@ test_files:
239
280
  - spec/acceptance/organizer/reduce_until_spec.rb
240
281
  - spec/acceptance/organizer/with_callback_spec.rb
241
282
  - spec/acceptance/rollback_spec.rb
242
- - spec/acceptance/skip_all_warning_spec.rb
243
283
  - spec/acceptance/testing/context_factory_spec.rb
244
284
  - spec/action_expected_keys_spec.rb
245
285
  - spec/action_expects_and_promises_spec.rb
@@ -1,82 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- light-service (0.6.1)
5
- activesupport (>= 3.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activesupport (5.0.0.1)
11
- concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (~> 0.7)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- appraisal (2.1.0)
16
- bundler
17
- rake
18
- thor (>= 0.14.0)
19
- ast (2.3.0)
20
- coderay (1.1.1)
21
- concurrent-ruby (1.0.2)
22
- diff-lcs (1.2.5)
23
- docile (1.1.5)
24
- i18n (0.7.0)
25
- json (2.0.2)
26
- method_source (0.8.2)
27
- minitest (5.9.0)
28
- parser (2.3.1.2)
29
- ast (~> 2.2)
30
- powerpack (0.1.1)
31
- pry (0.10.4)
32
- coderay (~> 1.1.0)
33
- method_source (~> 0.8.1)
34
- slop (~> 3.4)
35
- rainbow (2.1.0)
36
- rake (11.2.2)
37
- rspec (3.5.0)
38
- rspec-core (~> 3.5.0)
39
- rspec-expectations (~> 3.5.0)
40
- rspec-mocks (~> 3.5.0)
41
- rspec-core (3.5.2)
42
- rspec-support (~> 3.5.0)
43
- rspec-expectations (3.5.0)
44
- diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.5.0)
46
- rspec-mocks (3.5.0)
47
- diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.5.0)
49
- rspec-support (3.5.0)
50
- rubocop (0.42.0)
51
- parser (>= 2.3.1.1, < 3.0)
52
- powerpack (~> 0.1)
53
- rainbow (>= 1.99.1, < 3.0)
54
- ruby-progressbar (~> 1.7)
55
- unicode-display_width (~> 1.0, >= 1.0.1)
56
- ruby-progressbar (1.8.1)
57
- simplecov (0.12.0)
58
- docile (~> 1.1.0)
59
- json (>= 1.8, < 3)
60
- simplecov-html (~> 0.10.0)
61
- simplecov-html (0.10.0)
62
- slop (3.6.0)
63
- thor (0.19.1)
64
- thread_safe (0.3.5)
65
- tzinfo (1.2.2)
66
- thread_safe (~> 0.1)
67
- unicode-display_width (1.1.1)
68
-
69
- PLATFORMS
70
- ruby
71
-
72
- DEPENDENCIES
73
- activesupport (~> 5.0)
74
- appraisal (~> 2.0)
75
- light-service!
76
- pry (~> 0.10)
77
- rspec (~> 3.0)
78
- rubocop (~> 0.36)
79
- simplecov (~> 0.11)
80
-
81
- BUNDLED WITH
82
- 1.12.5
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe "skip_all! has been deprecated" do
4
- it "is now skip_remaining!" do
5
- class SkipAllDeprecatedAction
6
- extend FunctionalLightService::Action
7
-
8
- executed do |ctx|
9
- ctx.skip_all!("No need to execute other actions.")
10
- end
11
- end
12
-
13
- expected_msg = "Using skip_all! has been deprecated, " \
14
- "please use `skip_remaining!` instead."
15
- expect(ActiveSupport::Deprecation).to receive(:warn)
16
- .with(expected_msg)
17
-
18
- SkipAllDeprecatedAction.execute
19
- end
20
- end