Base for various CLI generation tools.
It's designed as a base for developers to build specific generation CLIs, so the common way is to add this gem as a runtime gem dependency.
For now it even has no executables.
require 'project_generator'
## Your specific generator, like a gem generator
module GemGenerator
## Inherit it's `Command` (`clamp`s CLI) from `ProjectGenerator::Command`
class Command < ProjectGenerator::Command
## You have to define `NAME` and `TEMPLATE` parameters
parameter 'NAME', 'name of a new gem'
parameter 'TEMPLATE', 'template path of a new gem'
def execute
## You can execute logic of a specific generator wherever you want
check_target_directory
refine_template_parameter if git?
process_files
initialize_git
FileUtils.rm_r @git_tmp_dir if git?
done
end
end
endBuilt-in options:
-
-i,--indentation: indentation type in generated project (tabsorspaces).Note: please, write templates with tabs to have this option working, because we can't safely transform number of spaces into tabs, but we can transform tabs into spaces.
After checking out the repo, run bundle install to install dependencies.
Then, run bundle exec rspec to run the tests.
To install this gem onto your local machine, run toys gem install.
To release a new version, run toys gem release %version%.
See how it works here.
Bug reports and pull requests are welcome on GitHub.
The gem is available as open source under the terms of the MIT License.