No commit activity in last 3 years
No release in over 3 years
RubyGems plugin to generate a new gem skeleton based on customizable templates.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2
>= 0.5.7
>= 0
>= 2.2
~> 2.13
>= 0.7
>= 0.8

Runtime

>= 0.18.1
 Project Readme

gem-newgem Click here to lend your support to: gem-new_gem and make a donation at www.pledgie.com ! githalytics.com alpha

Description

This is a rubygems plugin useful to generate new gem skeleton based on a default or custom template.

$ gem install gem-newgem
$ gem new fancy_stuff --summary "This newgem will do some fancy stuff"

Similar tools

You can achieve pretty much the same with bundle gem GEMNAME but you'll be stuck with bundler predefined template. I've based my template on that but added more automation and more features.

These tools are also out there, last time I checked (Dec 2013) only Ore is being maintained.

Ore | RubiGen | gem-init | prigner

If you like the idea of creating custom generators take a look at thor (used by this gem) and how to start the generator from your ruby script.

If you are looking to bootstrap new rails apps maybe rails-composer is for you.

Installation

$ gem install gem-newgem

Usage

Use either the long form $ gem newgem GEMNAME or the short form $ gem new GEMNAME

$ gem new GEMNAME [--template TEMPLATE_NAME] [--summary "This newgem will do some awesome stuff"]

$ gem new --help
Usage: gem newgem GEMNAME [options]

  Options:
    -t, --template TEMPLATE_NAME     Use TEMPLATE instead of `default` template
                                     By default, all templates are looked at ~/.newgem-templates/
    -s, --summary "SUMMARY_TEXT"     Set the gem summary text now in case you want to save time.

  Common Options:
    -h, --help                       Get help on this command
    -V, --[no-]verbose               Set the verbose level of output
    -q, --quiet                      Silence commands
        --config-file FILE           Use this config file instead of default
        --backtrace                  Show stack backtrace on errors
        --debug                      Turn on Ruby debugging

  Arguments:
    GEMNAME          name of the gem skeleton to generate.

  Summary:
    Generate new gem skeleton based on a default or custom template.

  Defaults:
    --template default --summary "TODO: Write a gem summary"

You can't use templates absolute paths, so place your templates at ~/.newgem-templates/ and provide just the name of the template. A default template which I personally use will be placed there as a starting point, you can fork it to customize your preferences.

Example:

$ gem new play_piano -t default -s "Gem that plays all day"
      create  play_piano
      create  play_piano/play_piano.gemspec
      create  play_piano/.gitignore
      create  play_piano/.rspec
      create  play_piano/.travis.yml
      create  play_piano/CHANGELOG.md
      create  play_piano/Gemfile
      create  play_piano/LICENSE.md
      create  play_piano/README.md
      create  play_piano/Rakefile
      create  play_piano/lib/play_piano.rb
      create  play_piano/lib/play_piano/version.rb
      create  play_piano/spec/play_piano_spec.rb
      create  play_piano/spec/spec_helper.rb
INFO: Initializing git repo at play_piano/
  git init
Initialized empty Git repository in ~/apps/gem-newgem/play_piano/.git/
  git add .
INFO: Will add remote so you get ready to push to github
  git remote add github git@github.com:elgalu/play_piano.git
INFO: Make branch tracking automatic
  git config --add branch.master.remote github
  git config --add branch.master.merge refs/heads/master

Contributing

  1. Fork it.
  2. Make your feature addition or bug fix and create your feature branch.
  3. Add specs/tests for it. This is important so I don't break it in a future version unintentionally.
  4. Commit, create a new Pull Request.
  5. Check that your pull request passes the build.

TODO

License

Released under the MIT License. See the LICENSE file for further details.