0.0
No release in over a year
Generator for gems.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.19
~> 3.9
~> 1.37.0
~> 0.21.0
~> 0.13.1
~> 0.12.1
~> 3.0

Runtime

 Project Readme

Gem Generator

Cirrus CI - Base Branch Build Status Codecov branch Code Climate license Gem

Gem for new gems generation.

It was created for myself, but you can suggest options for generation to adopt it for your usage.

Installation

Install it globally:

gem install gem_generator

Usage

With local template

gem_generator --namespace=your_github_nickname name_of_a_new_gem path/to/template

With GitHub template

gem_generator --namespace=your_github_nickname name_of_a_new_gem template_github_org/template_github_repo --git

Be aware: gem_generator uses template/ directory from the GitHub repo, not the root one.

Config file

You can create a config file, .gem_generator.yaml (or .yml) like this:

## This can be overwriten via `--namespace` CLI option, config just as default
:namespace: AlexWayfer

## These options have defaults from `git config --get user.*`
# :author:
#   :name: Alexander Popov
#   :email: alex.wayfer@gmail.com

Gem Generator will look for it in each directory from current to the root, so the common place for it in the home directory, but you can redefine it, for example, in some directory for work projects.

Template creation

Example of gem template you can see at AlexWayfer/gem_template.

Available paths:

Path part Example of source Example of result
gem_name gem_name.gemspec faraday-my_middleware.gemspec
gem_path lib/gem_path/version.rb.erb lib/faraday/my_middleware/version.rb

Any *.erb file will be rendered via ERB; if you want an *.erb file as result — name it as *.erb.erb (even if there are no tags).

Available variables:

Variable Example of result
name faraday-my_middleware
title Faraday My Middleware
path faraday/my_middleware
module_name Faraday::MyMiddleware
modules ['Faraday', 'MyMiddleware']
version_constant Faraday::MyMiddleware::VERSION
summary asked from user
summary_string summary wrapped in ' or ", depending on ' inside
description by default is summary with guaranteed dot at the end
indentation tabs or spaces, as user specified by option
github_path AlexWayfer/faraday-my_middleware
github_namespace_uri https://github.com/AlexWayfer
github_uri https://github.com/AlexWayfer/faraday-my_middleware
author_name Alexander Popov
author_name_string author name wrapped in ' or ", depending on ' inside
author_email alex.wayfer@gmail.com

By default indentation is tabs, but if a template spaces-indented — option will not affect. So, this option only for tabs-indented templates.

Git templates

You can create public git-templates and then guide users to call gem_generator gem_name your_org/your_repo --git, but be aware that gem_generator will look for template inside template/ directory to allow you having out-of-template README, specs (for the template itself), anything else.

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.