The project is in a healthy, maintained state
A gem that will help you generate concept files for Trailblazer more easily and quickly.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

trailblazer-wizard

A helper to aid you with generating blank Trailblazer concept files including: operations, contracts, finders, and representables.

Installation

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

Usage

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)

Example 1:

wizard --model=User --actions=create --only=operation,form

This command will generate:

app/concepts/user/operation/create.rb
app/concepts/user/form/create.rb

Example 2: with context

wizard --model=User --context=admin --actions=index --only=operation

Generates:

app/concepts/user/admin/operation/index.rb

Configuration

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

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Wizard project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.