https://github.com/alexwayfer/project_generator
Base for various CLI generation tools
https://github.com/alexwayfer/project_generator
Last synced: about 1 year ago
JSON representation
Base for various CLI generation tools
- Host: GitHub
- URL: https://github.com/alexwayfer/project_generator
- Owner: AlexWayfer
- License: mit
- Created: 2021-11-08T21:22:51.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T15:13:09.000Z (about 1 year ago)
- Last Synced: 2025-04-09T22:09:10.974Z (about 1 year ago)
- Language: Ruby
- Size: 89.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Project Generator
[](https://cirrus-ci.com/github/AlexWayfer/project_generator)
[](https://codecov.io/gh/AlexWayfer/project_generator)
[](https://codeclimate.com/github/AlexWayfer/project_generator)
[](https://inch-ci.org/github/AlexWayfer/project_generator)
[](https://rubygems.org/gems/project_generator)
[](LICENSE.txt)
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
```ruby
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](https://github.com/AlexWayfer/gem_toys#release).
## Contributing
Bug reports and pull requests are welcome on [GitHub](https://github.com/AlexWayfer/project_generator).
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).