simple_ruby_service 1.0.1 → 1.0.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/.travis.yml +12 -0
- data/CHANGELOG.md +8 -0
- data/README.md +12 -3
- data/lib/simple_ruby_service/version.rb +1 -1
- data/simple_ruby_service.gemspec +10 -3
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 665fbb0eacfb11a6e7d863e72a0e091ad96831c0ce72644fb5467b592c567524
|
4
|
+
data.tar.gz: 98c5caa24124671cd21f56a0f625f8c340e198c3847d05454b9cb41c633ff64b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11211b2e212d4324a9c55a09f2a366c152f5e3d53c5069c35d7b77876844cbc6db397e5bb888ceba36d1165ad27cc3dd09c8751cbd3bb838123f68c5695c4b5
|
7
|
+
data.tar.gz: c1b45fe0900d696f739540cd9cd8f90d9c31133d8df14ebb2a60ad4743b90360241334c102dc70f1d26d4a8ee9415eb564d9631c401a3f633d7502b9b6b2c6be
|
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# SEE: https://docs.travis-ci.com/user/languages/ruby/
|
2
|
+
|
3
|
+
language: ruby
|
4
|
+
rvm:
|
5
|
+
- 2.5.3
|
6
|
+
before_install:
|
7
|
+
- gem install bundler:1.17.3
|
8
|
+
install: bundle _1.17.3_ install --jobs=3 --retry=3
|
9
|
+
env:
|
10
|
+
- 'TEST_RAILS_VERSION="~> 5.2.3"'
|
11
|
+
- 'TEST_RAILS_VERSION="~> 6.0.3"'
|
12
|
+
- 'TEST_RAILS_VERSION="~> 6.1.3.2"'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Simple Ruby Service
|
2
2
|
|
3
|
+
[](https://travis-ci.com/amazing-jay/simple_ruby_service)
|
4
|
+
[](https://codecov.io/gh/amazing-jay/simple_ruby_service)
|
5
|
+
|
3
6
|
Simple Ruby Service is a lightweight framework for Ruby that makes it easy to create Services and Service Objects (SOs).
|
4
7
|
|
5
8
|
The framework provides a simple DSL that:
|
6
9
|
|
7
|
-
1.
|
10
|
+
1. Incorporates ActiveModel validations and error handling
|
8
11
|
2. Encourages a succinct, idiomatic coding style
|
9
|
-
3.
|
12
|
+
3. Ducktypes Service Objects as Procs
|
10
13
|
|
11
14
|
## Requirements
|
12
15
|
|
@@ -34,12 +37,13 @@ Source code can be downloaded on GitHub
|
|
34
37
|
[github.com/amazing-jay/simple_ruby_service/tree/master](https://github.com/amazing-jay/simple_ruby_service/tree/master)
|
35
38
|
|
36
39
|
|
37
|
-
### The following examples illustrate how
|
40
|
+
### The following examples illustrate how to refactor complex business logic with Simple Ruby Service
|
38
41
|
|
39
42
|
See [Usage](https://github.com/amazing-jay/simple_ruby_service#usage) & [Creating Simple Ruby Services](https://github.com/amazing-jay/simple_ruby_service#creating-simple-ruby-services) for more information.
|
40
43
|
|
41
44
|
#### ::Before:: Vanilla Rails with a fat controller (a contrived example)
|
42
45
|
```ruby
|
46
|
+
# in app/controllers/some_controller.rb
|
43
47
|
class SomeController < ApplicationController
|
44
48
|
def show
|
45
49
|
raise unless params[:id].present?
|
@@ -54,6 +58,7 @@ end
|
|
54
58
|
|
55
59
|
#### ::After:: Refactored using an SO
|
56
60
|
```ruby
|
61
|
+
# in app/controllers/some_controller.rb
|
57
62
|
class SomeController < ApplicationController
|
58
63
|
def show
|
59
64
|
# NOTE: Simple Ruby Service Objects ducktype as Procs and do not need to be instantiated
|
@@ -61,6 +66,8 @@ class SomeController < ApplicationController
|
|
61
66
|
end
|
62
67
|
end
|
63
68
|
|
69
|
+
|
70
|
+
# in app/service_objects/do_something.rb
|
64
71
|
class DoSomething
|
65
72
|
include SimpleRubyService::ServiceObject
|
66
73
|
|
@@ -83,6 +90,7 @@ end
|
|
83
90
|
|
84
91
|
#### ::Alternate Form:: Refactored using a Service
|
85
92
|
```ruby
|
93
|
+
# in app/controllers/some_controller.rb
|
86
94
|
class SomeController < ApplicationController
|
87
95
|
def show
|
88
96
|
# NOTE: Simple Ruby Service methods can be chained together
|
@@ -93,6 +101,7 @@ class SomeController < ApplicationController
|
|
93
101
|
end
|
94
102
|
end
|
95
103
|
|
104
|
+
# in app/services/do_something.rb
|
96
105
|
class SomeService
|
97
106
|
include SimpleRubyService::Service
|
98
107
|
|
data/simple_ruby_service.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["i.jaycrouch@gmail.com"]
|
12
12
|
|
13
13
|
spec.summary = 'Simple Ruby Service is a lightweight framework for Ruby that makes it easy to create Services and Service Objects (SOs).'
|
14
|
-
spec.description = 'Simple Ruby Service is a lightweight framework for Ruby that makes it easy to create Services and Service Objects (SOs). The framework provides a simple DSL that:
|
14
|
+
spec.description = 'Simple Ruby Service is a lightweight framework for Ruby that makes it easy to create Services and Service Objects (SOs). The framework provides a simple DSL that: incorporates ActiveModel validations and error handling; encourages a succinct, idiomatic coding style; Ducktypes Service Objects as Procs.'
|
15
15
|
spec.homepage = 'https://github.com/amazing-jay/simple_ruby_service'
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
@@ -39,7 +39,6 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_dependency 'activemodel'
|
40
40
|
spec.add_dependency 'activesupport'
|
41
41
|
|
42
|
-
# spec.add_development_dependency 'actionpack'
|
43
42
|
spec.add_development_dependency "awesome_print", "~> 1.9.2"
|
44
43
|
spec.add_development_dependency "bundler", "~> 1.17"
|
45
44
|
spec.add_development_dependency "database_cleaner", "~> 2.0.1"
|
@@ -48,13 +47,21 @@ Gem::Specification.new do |spec|
|
|
48
47
|
spec.add_development_dependency "faker", "~> 2.18"
|
49
48
|
spec.add_development_dependency "listen", "~> 3.5.1"
|
50
49
|
spec.add_development_dependency "pry-byebug", "~> 3.9"
|
51
|
-
|
50
|
+
|
51
|
+
# must come before those below
|
52
|
+
if ENV['TEST_RAILS_VERSION'].nil?
|
53
|
+
spec.add_development_dependency 'rails', '~> 6.1.3.2'
|
54
|
+
else
|
55
|
+
spec.add_development_dependency 'rails', ENV['TEST_RAILS_VERSION'].to_s
|
56
|
+
end
|
57
|
+
|
52
58
|
spec.add_development_dependency "rake", "~> 10.0"
|
53
59
|
spec.add_development_dependency "rspec", "~> 3.0"
|
54
60
|
spec.add_development_dependency "rspec-rails", "~> 5.0.1"
|
55
61
|
spec.add_development_dependency "rubocop", "~> 0.60"
|
56
62
|
spec.add_development_dependency "rubocop-performance", "~> 1.5"
|
57
63
|
spec.add_development_dependency "rubocop-rspec", "~> 1.37"
|
64
|
+
spec.add_development_dependency "codecov", "~> 0.5.2"
|
58
65
|
spec.add_development_dependency "simplecov", "~> 0.16"
|
59
66
|
spec.add_development_dependency "sqlite3", "~> 1.4.2"
|
60
67
|
spec.add_development_dependency "webmock", "~> 3.13"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_ruby_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Crouch
|
@@ -248,6 +248,20 @@ dependencies:
|
|
248
248
|
- - "~>"
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '1.37'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: codecov
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "~>"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: 0.5.2
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - "~>"
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: 0.5.2
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
266
|
name: simplecov
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,8 +306,8 @@ dependencies:
|
|
292
306
|
version: '3.13'
|
293
307
|
description: 'Simple Ruby Service is a lightweight framework for Ruby that makes it
|
294
308
|
easy to create Services and Service Objects (SOs). The framework provides a simple
|
295
|
-
DSL that:
|
296
|
-
idiomatic coding style;
|
309
|
+
DSL that: incorporates ActiveModel validations and error handling; encourages a
|
310
|
+
succinct, idiomatic coding style; Ducktypes Service Objects as Procs.'
|
297
311
|
email:
|
298
312
|
- i.jaycrouch@gmail.com
|
299
313
|
executables: []
|
@@ -304,6 +318,7 @@ files:
|
|
304
318
|
- ".rspec"
|
305
319
|
- ".rubocop.yml"
|
306
320
|
- ".simplecov"
|
321
|
+
- ".travis.yml"
|
307
322
|
- CHANGELOG.md
|
308
323
|
- Gemfile
|
309
324
|
- LICENSE.txt
|