A helper to aid you with generating blank Trailblazer concept files including: operations, contracts, finders, and representables.
Install the gem and add to the application's Gemfile by executing:
$ gem 'trailblazer-wizard'
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install trailblazer-wizard
All concept files are generated inside the app/concepts
directory.
To generate files, simply run this command:
$ wizard [--model] [--actions] [--only] [--except] [--context]
Argument | Type | Presence | Description |
---|---|---|---|
model | String | Required | The model. |
actions | Array | Required | The files' names. |
only | Array | Optional | Only the specified concept types. |
except | Array | Optional | Except the specified concept types. |
context | String | Optional | A directory to group concept files, nil by default. |
Allowed concept types are: operation | finder | form (meant for contracts) | view (meant for representables)
wizard --model=User --actions=create --only=operation,form
This command will generate:
app/concepts/user/operation/create.rb
app/concepts/user/form/create.rb
wizard --model=User --context=admin --actions=index --only=operation
Generates:
app/concepts/user/admin/operation/index.rb
To change the base directory app/concepts
, or maybe pluralize concept directories, or even use alternative
concept type names... there is the possibility to apply these tweaks by creating an initializer:
# config/initializers/trailblazer_wizard.rb
TrailblazerWizard.configure do |config|
config.base_directory = "example/example"
config.puralize = true
config.alt_types = {
form: :contract,
view: 'representable'
}
end
Bug reports and pull requests are welcome on GitHub at https://github.com/aredda/trailblazer-wizard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Wizard project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.