rails_services 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fc4964ed8a04bba20c8098d333195f81bfbf4f842ac09db9bac7113eca4f4c2
4
- data.tar.gz: d0bc860c1bee886dd923ef379a728f8eaf7ba8c918092cc5026f6cc1a42d660f
3
+ metadata.gz: a03e068552adcb9e44d914b7387aee0823352a97344f5fedd2235769c9422d60
4
+ data.tar.gz: f4497409f14385d5dc43a31838aebbb634c545dcc4a1e9b589b76269e84b0219
5
5
  SHA512:
6
- metadata.gz: c8c3fa58a147354c9f29b2a08192b0b20dc03090029c7d1f524db94cd0613a2d7e11e31badd6733f4451c840d3a0112766bfd5182a0a8fea4a551e4112ccdb39
7
- data.tar.gz: a0b6f429baf0ef7cccbbbf3f31da12d1518e7b041d76276a6edbb25e4d4960d020691e15d6ada17cbf0b6f28eadac44c3cc8cae7da3068242dcef5f5a49a0ad0
6
+ metadata.gz: f140478c96620b1a44b90a06594ac4f376c9e97f0e970067cdcac4e30facecab51a4f6f75b2805492dd90ccb99fc19d97d8728490fa7e0ffc416fd25489db07b
7
+ data.tar.gz: f1361bdc5334403134e7989790abf87a68273d7592e3c1ac380581a3eeed4eea9e24671067357a7f61f75f7008af6e185df6a4062b619731490473d40ac6c150
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [3.0.1] - 2021-12-21
6
+ ### Added
7
+ - Updated gem spec to just require Rails (no more specific versions)
8
+
9
+ ## [3.0.0] - 2020-04-12
10
+ ### Added
11
+ - Added Form object option,
12
+ - Updated for Rails 6
13
+
14
+ ## [2.5.0] - 2019-02-14
15
+ ### Fixed
16
+ - Miscellaneous bug fixes
17
+
5
18
  ## [2.0.1] - 2017-07-16
6
19
  ### Added
7
20
  - Updating gem for the Rails verions 4 AND 5
data/README.md CHANGED
@@ -1,17 +1,14 @@
1
1
  # RailsServices
2
2
 
3
3
  [![Code Climate](https://codeclimate.com/github/imageaid/rails_service_generator.png)](https://codeclimate.com/github/imageaid/rails_service_generator)
4
- [![Test Coverage](https://codeclimate.com/github/imageaid/rails_service_generator/coverage.png)](https://codeclimate.com/github/imageaid/rails_service_generator)
5
4
  [![Gem Version](https://badge.fury.io/rb/rails_services.svg)](http://badge.fury.io/rb/rails_services)
6
5
 
7
- A simple gem for Rails that adds a generator for easily creating a service class and/or form object and its accompanying spec or test unit file.
6
+ A gem for Rails that adds a generator for easily creating a service class and/or form object and its accompanying spec or test unit file.
8
7
 
9
8
  ## Requirements
10
-
11
9
  Rails 4 and higher
12
10
 
13
11
  ## Installation
14
-
15
12
  Add this line to your application's Gemfile:
16
13
 
17
14
  gem 'rails_services'
@@ -25,48 +22,55 @@ Or install it yourself as:
25
22
  $ gem install rails_services
26
23
 
27
24
  ## Usage
28
-
29
25
  Examples:
30
26
 
31
- $ rails generate rails_services:create Service Model|Controller --sub_folder Sub-folder [opt]
27
+ $ [bundle exec] rails generate rails_services:create Service ParentFolder --sub_folder SubFolder [opt]
32
28
 
33
- $ rails generate rails_services:destroy Service Model|Controller --sub_folder Sub-folder [opt]
29
+ $ [bundle exec] rails generate rails_services:destroy Service ParentFolder --sub_folder SubFolder [opt]
34
30
 
35
- $ rails generate rails_services:form Form Model|Controller --sub_folder Sub-folder [opt] --accessors name email [opt]
31
+ $ [bundle exec] rails generate rails_services:form Form ParentFolder --sub_folder SubFolder [opt] --accessors name email [opt]
32
+
33
+ ## v3.0.0 CHANGES AND REMOVALS
34
+ ### CHANGES
35
+ There are four primary changes in v3.0.0:
36
36
 
37
- ## CHANGES AND NOTES
38
- ### Notes: Sub-folders
39
- Sub-folders are optional but, at this time, you may only use one sub-folder. I generally use the sub-folders when I have a naturally grouped set of services.
37
+ 1. All services have `include BaseService`
38
+ 2. The `call` method is an instance method rather than a class method
39
+ 3. You may generate a `Form` model
40
+ 4. An updated command line interface (see below)
40
41
 
41
- ### Changes: new argument structure for the command line
42
- Previous versions of the gem used plain old arguments to create or destroy the appropriate files. Over time, this became
43
- more unwieldy than imagined. From version 3.0.0 forward, there are only two arguments: `object_name` and `parent_name`.
42
+ #### Updated command line interface
43
+ Previous versions of the gem used plain old arguments to create or destroy the appropriate files. Over time, this became more unwieldy than imagined. From v3.0.0 forward, there are only two arguments: `object_name` and `parent_name`. Additionally, the previously available optional argument, `instance`, was removed (see REMOVALS section, below).
44
44
 
45
- If you would like to add a sub-folder to the service or form, you can now provide the `class_option` for it:
46
- `--sub_folder NAME_OF_FOLDER`. Similarly, for the form generator, you can pass in an array of `attr_accessors` with
47
- the following: `--accessors accessor_1_name accessor_2_name ...`.
45
+ If you would like to add a sub-folder to the service or form, you can now provide the `class_option` for it: `--sub_folder NAME_OF_FOLDER`. Similarly, for the form generator, you can pass in an array of `attr_accessors` with the following: `--accessors accessor_1_name accessor_2_name ...` (use regular strings as these will be 'converted' to symbols).
48
46
 
49
- ### Changes: Instance Argument REMOVED
50
- An instance argument was added in version 2.0.0. While the version 2.x line allowed users to choose between the old and new style,
51
- (new = service clases inherited from a `BaseService` class and instantiated the service), the version 3.x line removes this option. BE AWARE :).
47
+ ### REMOVALS:
48
+ There was one significant removal from the gem:
52
49
 
53
- ## Upgrading
54
- There are two primary changes in version 3:
50
+ 1. No more `instance` argument in the command line interface (see below)
55
51
 
56
- First, all services now include the `BaseService` class and methods in the services are,
57
- by default, instance methods rather than class methods.
52
+ #### Instance argument dropped
53
+ An instance argument was added in v2.0.0 which allowed users to choose what style of service class to create. The gem defaulted to using this new style.
58
54
 
59
- Second, the gem now allows you to generate a `Form` object/model.
55
+ While the v2.x line continued to allow users a choice between the old and new^ styles, the v3.x line removes this choice. All services will be created with the now-not-so-new style. BE AWARE :)!
60
56
 
61
- **Converting Old Service Classes** - Should you want to update your older/previously built services with this approach,
62
- you only need to do the following:
57
+ ^The new style creates service clases inherited from a `BaseService` class; allows for optional instantiation of the service (`Service.new(args*).call`), and uses an instance method for `call`.
58
+
59
+ ## NOTES
60
+ ### Upgrading to current service class style
61
+ Should you want to update your older/previously built services with this 'new' style, you only need to do the following:
63
62
 
64
63
  # include the base service in your class
65
64
  class ClassName
66
65
  include BaseService
67
66
 
68
- # Then ... optionally, add an initialize method and
69
- # change the method signatures, simply removing self. from the definition(s)
67
+ # Then ... optionally, add an initialize method
68
+ def initialize(*args)
69
+ # ...
70
+ super
71
+ end
72
+
73
+ # Finally, change the method signatures, simply removing `self.` from the definition(s), as follows:
70
74
  def self.call
71
75
  # ...
72
76
  end
@@ -76,28 +80,29 @@ you only need to do the following:
76
80
  end
77
81
  # and so on for other, similarly defined methods
78
82
 
79
- ## Generator Result (create service and create form)
83
+ ### Sub-folders
84
+ Sub-folders are optional but, at this time, you may only use one sub-folder. I generally only use the sub-folders when I have a naturally grouped set of services.
80
85
 
81
- Two files are created (spec or test based on your `test_framework`).
86
+ ## Generator results
87
+ ### Create service and create form
88
+ Two files are created: the requested class and either a spec or test class, based on your testing framework (minitest or rspec).
82
89
 
83
90
  For services:
84
91
 
85
- + app/services/model|controller/[sub-folder]/thing.rb
86
- + spec/services/model|controller/[sub-folder]/thing_spec.rb
87
- + test/services/model|controller/[sub-folder]/thing_test.rb
92
+ + app/services/[parent-folder]/[sub-folder]/thing.rb
93
+ + spec/services/[parent-folder]/[sub-folder]/thing_spec.rb OR
94
+ + test/services/[parent-folder]/[sub-folder]/thing_test.rb
88
95
 
89
96
  For forms:
90
97
 
91
- + app/forms/model|controller/[sub-folder]/thing_form.rb
92
- + spec/forms/model|controller/[sub-folder]/thing_form_spec.rb
93
- + test/forms/model|controller/[sub-folder]/thing_form_test.rb
98
+ + app/forms/[parent-folder]/[sub-folder]/thing_form.rb
99
+ + spec/forms/[parent-folder]/[sub-folder]/thing_form_spec.rb OR
100
+ + test/forms/[parent-folder]/[sub-folder]/thing_form_test.rb
94
101
 
95
- ## Generator Result (destroy service)
96
-
97
- Pretty simple here ... it just removes the files it created
102
+ ### Destroy service
103
+ Pretty simple here ... it just removes the files it created!
98
104
 
99
105
  ## Contributing
100
-
101
106
  1. Fork it ( https://github.com/imageaid/rails_services/fork )
102
107
  2. Create your feature branch (`git checkout -b my-new-feature`)
103
108
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -1,3 +1,3 @@
1
1
  module RailsServices
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Kaminsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-12 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
18
- - !ruby/object:Gem::Version
19
- version: '4'
20
- - - "<"
17
+ - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: '7'
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">"
28
- - !ruby/object:Gem::Version
29
- version: '4'
30
- - - "<"
24
+ - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: '7'
26
+ version: '0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: minitest
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
115
  - !ruby/object:Gem::Version
122
116
  version: '0'
123
117
  requirements: []
124
- rubygems_version: 3.0.3
118
+ rubygems_version: 3.1.6
125
119
  signing_key:
126
120
  specification_version: 4
127
121
  summary: A Ruby gem that adds a rails generator for creating service classes and form