The project is in a healthy, maintained state
Base for various CLI generation tools.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.0
~> 1.3
 Project Readme

Project Generator

Cirrus CI - Base Branch Build Status Codecov branch Code Climate Inline docs Gem License

Base for various CLI generation tools.

Installation

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.

Usage

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
end

Built-in options:

  • -i, --indentation: indentation type in generated project (tabs or spaces).

    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.

Development

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.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

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