Overview
Gemsmith allows you to easily craft new gems via the command line with custom settings (if desired). If you are a fan of Bundler, then you'll appreciate the additional capabilities of this gem. Gemsmith is essentially an enhanced version of Bundler's gem building capabilities.
Features
- Builds a gem skeleton with Bundler functionality in mind.
- Supports common settings that can be applied to new gem creations.
- Supports binary skeletons with Thor command line functionality.
- Supports Ruby on Rails.
- Supports RSpec.
- Supports Pry.
- Supports Guard.
- Supports Code Climate.
- Supports Travis CI skeletons.
- Adds commonly needed README, CHANGELOG, LICENSE, etc. template files.
- Provides the ability to open any installed gem within your favorite editor.
Requirements
- A UNIX-based system.
- Ruby 2.0.x.
- RubyGems.
- Bundler.
Setup
Type the following from the command line to install:
gem install gemsmith
You can configure common settings for future gem builds by creating the following file:
~/.gemsmith/settings.yml
...using the following settings (for example):
---
:author_name: Brooke Kuhlmann
:author_email: brooke@redalchemist.com
:author_url: http://www.redalchemist.com
:company_name: Red Alchemist
If no options are configured, then the defaults are as follows:
gem_platform: Gem::Platform::RUBY
author_name: <git name>
author_email: <git email>
author_url: https://www.unknown.com
gem_url: <author URL>
company_name: <author name>
company_url: <author URL>
github_user: <github user>
year: <current year>
ruby_version: 2.0.0
ruby_patch: p0
rails_version: 3.2.0
Usage
From the command line, type: gemsmith help
gemsmith -c, [create=GEM_NAME] # Create new gem.
gemsmith -e, [edit] # Edit gem settings in default editor (assumes $EDITOR environment variable).
gemsmith -h, [help] # Show this message.
gemsmith -o, [open=NAME] # Opens gem in default editor (assumes $EDITOR environment variable).
gemsmith -r, [read=NAME] # Opens gem in default browser.
gemsmith -v, [version] # Show version.
For more gem creation options, type: gemsmith help create
-b, [--bin] # Add binary support.
-r, [--rails] # Add Rails support.
-p, [--pry] # Add Pry support.
# Default: true
-g, [--guard] # Add Guard support.
# Default: true
-s, [--rspec] # Add RSpec support.
# Default: true
-t, [--travis] # Add Travis CI support.
# Default: true
-c, [--code-climate] # Add Code Climate support.
# Default: true
Also, don't forget that once you have created your gem skeleton, the following rake tasks are also available to you via Bundler (i.e. rake -T):
rake build # Build <gem>-<version>.gem into the pkg directory
rake install # Build and install <gem>-<version>.gem into system gems
rake release # Create tag v0.1.1 and build and push <gem>-<version>.gem to Rubygems
Tests
To test, do the following:
- cd to the gem root.
- bundle install
- bundle exec rspec spec
Best Practices
- Semantic Versioning
- Best Practices While Cutting Gems.
- Ruby on Rails Gem Packaging.
- Gem Activation and You: Part I
- Gem Activation and You: Part II
- Why You Should Use a BSD Style License.
- Add -w to the RUBYOPT environment variable when testing. Details.
When To Include a Railtie (Crafting Rails Applications - Page 93 by José Valim)
- "Your gem needs to perform a given task while or after the Rails application is initialized."
- "Your gem needs to change a configuration value, such as setting a generator."
- "Your gem must provide Rake tasks and generators in nondefault locations (the default location for the former is lib/tasks and lib/gen- erators or lib/rails/generators for the latter)."
- "You want your gem to provide configuration options to the appli- cation, such as config.my_gem.key # :value."
Documentation
In order to make your gem easier to use and adopt by others, good documentation is always a plus. Consider submitting your gem to RubyDocs[http://rubydoc.info] once your gem is released and available for use. RubyDocs supports both RDoc and YARD formats.
Promotion
Once your gem is released, you might like to let the world know about the new awesomeness. Here are several resources:
Contributions
Read CONTRIBUTING for details.
Credits
Developed by Brooke Kuhlmann at Red Alchemist.
License
Copyright (c) 2011 Red Alchemist. Read the LICENSE for details.
History
Read the CHANGELOG for details.


