zervices 0.1.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 +7 -0
- data/CHANGELOG.md +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/lib/generators/templates/application_service.rb.erb +5 -0
- data/lib/generators/templates/service.rb.erb +5 -0
- data/lib/generators/templates/service_test.rb.erb +7 -0
- data/lib/generators/zervice_generator.rb +19 -0
- data/lib/zervices/version.rb +5 -0
- data/lib/zervices.rb +10 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a7c05596555af5a8fe4d0a2b1d97d7c0076043dcb69619aeaa0287c62f7fd56
|
4
|
+
data.tar.gz: 95a7bc4eed594b9fe0c51e6b65b7fbed6c209ff0e50181f868d25df440564295
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc4ff4982f87684aff0ad465fbedbde2b9f1aaf5ecc58ebf36bbec0e33ac1a5b8ef428d2b062b5040097b76af4fb56eb2421cf04325ea61dff2e4057991c1529
|
7
|
+
data.tar.gz: 7978f6f37dc30030a630d025d27197711026cddbc2bdad6a681fa8ff70ffcffbf1a2fd9e684280756ed41d2a9a8a32172136dafe9ac790f2868dd5074245e010
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## [v0.1.3] - 2024-08-24
|
4
|
+
|
5
|
+
### Initial Release
|
6
|
+
|
7
|
+
* Service Object Generation: Introduced the core functionality to generate service objects in the app/services directory.
|
8
|
+
* Rails Generator Command: Added rails generate zervice ServiceName command to automate the creation of service objects.
|
9
|
+
* Standard Structure: Ensured that all generated service objects follow a consistent structure with an initialize method for parameters and a call method for business logic.
|
10
|
+
* Minimal Configuration: The gem works out of the box with minimal configuration required, providing a straightforward setup for Rails applications.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 David Padilla
|
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/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Zervices
|
2
|
+
|
3
|
+
Zervices is a simple Ruby gem designed to streamline the creation of service objects within your Rails application.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add Zervices to your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'zervices'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then, run
|
14
|
+
|
15
|
+
```sh
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
To generate a new service object, use the following command:
|
22
|
+
|
23
|
+
```sh
|
24
|
+
rails g zervice foo/bar
|
25
|
+
```
|
26
|
+
|
27
|
+
Replace `foo/bar`with the desired name of your service object. This will create a new file in the `app/services` directory,
|
28
|
+
named `foo/bar.rb`, with the following structure:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
class Services::Foo::Bar < ApplicationService
|
32
|
+
def call(object, params)
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
## Development
|
39
|
+
|
40
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
41
|
+
|
42
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number
|
43
|
+
in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the
|
44
|
+
created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/dabit/zervices
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/named_base"
|
4
|
+
|
5
|
+
class ZerviceGenerator < Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
def create_application_service_file
|
9
|
+
template "application_service.rb.erb", "app/services/application_service.rb", skip: true
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_service_file
|
13
|
+
template "service.rb.erb", "app/services/#{file_path}.rb"
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_test_file
|
17
|
+
template "service_test.rb.erb", "test/services/#{file_path}_test.rb"
|
18
|
+
end
|
19
|
+
end
|
data/lib/zervices.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zervices
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Padilla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6'
|
27
|
+
description: The quickest service generator in the wild west
|
28
|
+
email:
|
29
|
+
- 380364-dabit@users.noreply.gitlab.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- CHANGELOG.md
|
35
|
+
- LICENSE.txt
|
36
|
+
- README.md
|
37
|
+
- lib/generators/templates/application_service.rb.erb
|
38
|
+
- lib/generators/templates/service.rb.erb
|
39
|
+
- lib/generators/templates/service_test.rb.erb
|
40
|
+
- lib/generators/zervice_generator.rb
|
41
|
+
- lib/zervices.rb
|
42
|
+
- lib/zervices/version.rb
|
43
|
+
homepage: https://gitlab.com/dabit/zervices
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata:
|
47
|
+
homepage_uri: https://gitlab.com/dabit/zervices
|
48
|
+
source_code_uri: https://gitlab.com/dabit/zervices
|
49
|
+
changelog_uri: https://gitlab.com/dabit/zervices/CHANGELOG.md
|
50
|
+
rubygems_mfa_required: 'true'
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 3.0.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.5.10
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: The quickest service generator in the wild west
|
70
|
+
test_files: []
|