Zervices
Zervices is a simple Ruby gem designed to streamline the creation of service objects within your Rails application.
Installation
Add Zervices to your Gemfile:
gem 'zervices'
Then, run
bundle install
Usage
To generate a new service object, use the following command:
rails g zervice foo/bar
Replace foo/bar
with the desired name of your service object. This will create a new file in the app/services
directory,
named foo/bar.rb
, with the following structure:
class Services::Foo::Bar < ApplicationService
def call(object, params)
end
end
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number
in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the
created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/dabit/zervices
License
The gem is available as open source under the terms of the MIT License.