mk
A CLI tool to create new projects from templates.
Install
gem install mk.rbUsage
mk <template_name> <project_name>This will:
- Copy the template to
./<project_name> - Replace
ExampleGemwith your project's constant name (e.g.,MyProject) - Replace
examplegemwith your project name (e.g.,my_project) - Rename any files containing these placeholders
Example
mk ruby my_awesome_gemCreates a new directory my_awesome_gem from the ruby template with all placeholders replaced.
Templates
Templates are searched in this order:
-
~/templates/<template_name>- Your local templates (takes priority) - Bundled templates included with the gem
To override a bundled template, create one with the same name in ~/templates/.
Creating Templates
Templates are regular directories containing your project boilerplate. Use these placeholders:
-
ExampleGem- Replaced with the constant name (e.g.,MyAwesomeGem) -
examplegem- Replaced with the project name (e.g.,my_awesome_gem)
Placeholders work in both file contents and file/directory names.
Example
mk ruby my_gemTemplate file ~/templates/ruby/lib/examplegem.rb:
class ExampleGem
VERSION = "0.1.0"
endOutput file my_gem/lib/my_gem.rb:
class MyGem
VERSION = "0.1.0"
endContributing
Bug reports and pull requests are welcome on GitHub.
Development
After checking out the repo:
bin/setup
bundle exec rake testGenerate documentation:
bundle exec yard doc
bundle exec yard server # Browse at http://localhost:8808License
The gem is available as open source under the terms of the MIT License.