service_it 0.2.0 → 1.0.0

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: be1085eaf772f8657824e4495bdb6bb3ffe89362368fd922b7202ed8a7293966
4
- data.tar.gz: d27ac5b1a0f82925d1d13849a9a556c84565d5427765a3ebf925971e3c1a627a
3
+ metadata.gz: fbc4d1a0417b325824e46ebea9bd0a0f95b9a62f4c6fdff153d7309aef20fc9c
4
+ data.tar.gz: a2f728a79e46cac2e2fa9829786267269d98628cd58bd2a2c1d757a8ae3abf66
5
5
  SHA512:
6
- metadata.gz: 6eb0d062f6453045d96ef3549e01a8c6347eec3f4cf689b7fc96882f169171a2e8e7ac03634813fdec713ea3291ce475f0c867da06de6b96b6c89f4250bb0f09
7
- data.tar.gz: 585172ed14df1120bc16d551f8336c9fbf4bb84f5355c488084a0cd012af64880ecbb1fd4eb8e3469da712167059c97a16b7ddaaafd104fdcb45bbbe76dec4ae
6
+ metadata.gz: 12d152f0218349f96ffa2f75b831c629d024ec074b3d327d9d248771d2cd1e57774a8b373cb645c842e817525733e1bd4d05a986aa8c16a0b74e22014e01ab85
7
+ data.tar.gz: 71012594645c160acfe675067d52b6b4cc29bb85ebf5397b13d5dcaafb7a66266a535ce98b2184fe567807c0bdb62826193d1a86446dd31c12ccb9162507790a
data/README.md CHANGED
@@ -1,31 +1,34 @@
1
- # ServiceIt [![Gem Version](https://badge.fury.io/rb/service_it.svg)](https://badge.fury.io/rb/service_it) [![Build Status](https://travis-ci.org/iago-silva/service_it.svg?branch=master)](https://travis-ci.org/iago-silva/service_it) [![Code Climate](https://codeclimate.com/github/iago-silva/service_it.png)](https://codeclimate.com/github/iago-silva/service_it) [![Downloads](https://img.shields.io/gem/dt/service_it.svg)](https://rubygems.org/gems/service_it) [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
1
+ [![Gem Version](https://badge.fury.io/rb/service_it.svg)](https://badge.fury.io/rb/service_it) [![Build Status](https://travis-ci.org/iago-silva/service_it.svg?branch=master)](https://travis-ci.org/iago-silva/service_it) [![Code Climate](https://codeclimate.com/github/iago-silva/service_it.png)](https://codeclimate.com/github/iago-silva/service_it)
2
2
 
3
- Provide you a way to delegate responsibilities in your project using callables
3
+ # ServiceIt
4
+
5
+ [Service objects are a holy grail to keep your controllers and models slim and readable](https://medium.com/selleo/essential-rubyonrails-patterns-part-1-service-objects-1af9f9573ca1)
4
6
 
5
7
  <br/>
6
8
 
7
9
  ## Installation
8
10
 
9
- Add this line to your application's Gemfile:
11
+ $ gem install service_it
12
+
13
+ ## With Bundler
14
+
15
+ Add this line to your `Gemfile`:
10
16
 
11
- gem 'service_it', '~> 0.1.6'
17
+ gem 'service_it', '~> 0.2.0'
12
18
 
13
19
  And then execute:
14
20
 
15
21
  $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install service_it
20
22
 
21
- ## Generator
23
+ ## With Rails
24
+
25
+ You can use Rails generator to create a `Service`
22
26
 
23
27
  $ rails g service NAME
24
28
 
25
29
  ## Usage
26
30
 
27
31
  ```ruby
28
- # app/services/foo.rb
29
32
  class Foo < ServiceIt::Base
30
33
  def perform
31
34
  # here you can use params that became instance variables
@@ -40,7 +43,7 @@ Foo.call(params)
40
43
 
41
44
  ## Example
42
45
 
43
- Simple example to change status of a _transaction_ to complete
46
+ Simple example _using Rails_ to change status of a _transaction_ to complete
44
47
 
45
48
  $ rails g service CompleteTransaction
46
49
 
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rails
2
4
  module Generators
3
- # Generates a service by command line
5
+ # Generates a service by rails generator
4
6
  class ServiceGenerator < NamedBase
5
7
  source_root File.expand_path('templates', __dir__)
6
8
 
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ServiceIt
2
4
  # Inherit this class and implement perform method
3
5
  #
4
6
  # Documentation:
5
- # https://github.com/iago-silva/service_it#usage
7
+ # https://github.com/iago-silva/service_it
6
8
  class Base
7
9
  class << self
8
10
  # Call your service
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ServiceIt
4
+ VERSION = '1.0.0'.freeze
5
+ end
data/lib/service_it.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'service_it/base'
@@ -1,3 +1,5 @@
1
+ require 'spec_helper'
2
+
1
3
  describe ServiceIt do
2
4
  describe SayMyName do
3
5
  let(:name) { 'Heisenberg' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iago Silva
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -52,57 +38,21 @@ dependencies:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop-performance
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
41
  description: |-
84
- Provide you a way to delegate responsibilities in your
85
- project using callables
42
+ Service objects are a holy grail to keep your controllers and
43
+ models slim and readable
86
44
  email: iago.silva@interage.in
87
45
  executables: []
88
46
  extensions: []
89
47
  extra_rdoc_files: []
90
48
  files:
91
- - ".gitignore"
92
- - ".rspec"
93
- - ".rubocop.yml"
94
- - ".travis.yml"
95
- - Gemfile
96
- - Gemfile.lock
97
- - LICENSE.txt
98
49
  - README.md
99
- - Rakefile
100
50
  - lib/generators/rails/USAGE
101
51
  - lib/generators/rails/service_generator.rb
102
52
  - lib/generators/rails/templates/service.rb
103
53
  - lib/service_it.rb
104
54
  - lib/service_it/base.rb
105
- - service_it.gemspec
55
+ - lib/service_it/version.rb
106
56
  - spec/service_it_spec.rb
107
57
  - spec/spec_helper.rb
108
58
  - spec/support/test_classes.rb
@@ -129,9 +79,8 @@ rubyforge_project:
129
79
  rubygems_version: 2.7.3
130
80
  signing_key:
131
81
  specification_version: 4
132
- summary: Simple gem for Rails that allows you to isolate a piece of code and call
133
- it from anywhere
82
+ summary: Simple gem to keep your controllers and models slim and readable
134
83
  test_files:
135
- - spec/service_it_spec.rb
136
84
  - spec/spec_helper.rb
85
+ - spec/service_it_spec.rb
137
86
  - spec/support/test_classes.rb
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- .idea
11
-
12
- *.gem
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,12 +0,0 @@
1
- require:
2
- - rubocop-rspec
3
- - rubocop-performance
4
-
5
- inherit_mode:
6
- merge:
7
- - Exclude
8
-
9
- AllCops:
10
- TargetRubyVersion: 2.2
11
- Exclude:
12
- - 'lib/generators/rails/templates/**/*'
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- sudo: false
2
-
3
- cache: bundler
4
-
5
- language: ruby
6
-
7
- rvm:
8
- - 2.2
9
-
10
- script:
11
- - bundle exec rspec
12
- - bundle exec rubocop
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/Gemfile.lock DELETED
@@ -1,57 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- service_it (0.2.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.0)
10
- diff-lcs (1.3)
11
- jaro_winkler (1.5.2)
12
- parallel (1.17.0)
13
- parser (2.6.2.1)
14
- ast (~> 2.4.0)
15
- psych (3.1.0)
16
- rainbow (3.0.0)
17
- rspec (3.8.0)
18
- rspec-core (~> 3.8.0)
19
- rspec-expectations (~> 3.8.0)
20
- rspec-mocks (~> 3.8.0)
21
- rspec-core (3.8.0)
22
- rspec-support (~> 3.8.0)
23
- rspec-expectations (3.8.3)
24
- diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.8.0)
26
- rspec-mocks (3.8.0)
27
- diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.8.0)
29
- rspec-support (3.8.0)
30
- rubocop (0.67.2)
31
- jaro_winkler (~> 1.5.1)
32
- parallel (~> 1.10)
33
- parser (>= 2.5, != 2.5.1.1)
34
- psych (>= 3.1.0)
35
- rainbow (>= 2.2.2, < 4.0)
36
- ruby-progressbar (~> 1.7)
37
- unicode-display_width (>= 1.4.0, < 1.6)
38
- rubocop-performance (1.1.0)
39
- rubocop (>= 0.67.0)
40
- rubocop-rspec (1.32.0)
41
- rubocop (>= 0.60.0)
42
- ruby-progressbar (1.10.0)
43
- unicode-display_width (1.5.0)
44
-
45
- PLATFORMS
46
- ruby
47
-
48
- DEPENDENCIES
49
- bundler
50
- rspec
51
- rubocop
52
- rubocop-performance
53
- rubocop-rspec
54
- service_it!
55
-
56
- BUNDLED WITH
57
- 1.16.1
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Iago Silva
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,5 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- RSpec::Core::RakeTask.new(:spec)
4
-
5
- task default: :spec
data/service_it.gemspec DELETED
@@ -1,30 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'service_it'
6
- s.version = '0.2.0'
7
- s.date = '2018-07-27'
8
- s.authors = ['Iago Silva']
9
- s.email = 'iago.silva@interage.in'
10
- s.homepage = 'https://github.com/iago-silva/service_it'
11
- s.license = 'MIT'
12
- s.summary = 'Simple gem for Rails that allows you to isolate a piece of
13
- code and call it from anywhere'
14
- s.description = 'Provide you a way to delegate responsibilities in your
15
- project using callables'
16
-
17
- s.test_files = `git ls-files -- spec/*`.split("\n")
18
- s.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
-
22
- s.add_development_dependency 'bundler'
23
- s.add_development_dependency 'rspec'
24
-
25
- if RUBY_VERSION >= '2.2.0'
26
- s.add_development_dependency 'rubocop'
27
- s.add_development_dependency 'rubocop-performance'
28
- s.add_development_dependency 'rubocop-rspec'
29
- end
30
- end