https://github.com/davydovanton/hanami-operation-generator
Simple library for generating operations for hanami-dry-system project
https://github.com/davydovanton/hanami-operation-generator
Last synced: 3 months ago
JSON representation
Simple library for generating operations for hanami-dry-system project
- Host: GitHub
- URL: https://github.com/davydovanton/hanami-operation-generator
- Owner: davydovanton
- License: mit
- Created: 2020-02-21T21:38:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-01T18:41:16.000Z (over 5 years ago)
- Last Synced: 2025-01-21T22:08:56.566Z (5 months ago)
- Language: Ruby
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Hanami::Operation::Generator
**IMPORTANT: this library working only with hanami 1.3.4+ (or master)**
Simple library wich will generate operation for hanami-dry-system
## Installation
Add this line to your application's Gemfile:
```ruby
group :plugins do
gem "hanami-operation-generator", github: 'davydovanton/hanami-operation-generator'
end
```## Usage
Just call `hanami generate operation ` in terminal. This command will generate two files. Example:
```
$ hanami generate operation order showcreate project_path/lib/orders/operations/show.rb
create project_path/spec/orders/operations/show_spec.rb
```If you open both files you will see this:
```ruby
# in project_path/lib/orders/operations/show.rb# frozen_string_literal: true
module Orders
module Operations
class List < ::Libs::Operation
include Import[
]def call()
Success(true)
end
end
end
end# ----------------------------------
# in project_path/spec/orders/operations/show_spec.rb
# frozen_string_literal: true
RSpec.describe Orders::Operations::List, type: :operation do
subject { operation.call }let(:operation) do
described_class.new
endit { expect(subject).to be_success }
context 'with real dependencies' do
subject { operation.call }let(:operation) { described_class.new }
it { expect(subject).to be_success }
end
end
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/davydovanton/hanami-operation-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Hanami::Operation::Generator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/hanami-operation-generator/blob/master/CODE_OF_CONDUCT.md).