-
Notifications
You must be signed in to change notification settings - Fork 164
Create a new project
Jeweler comes with a generator aptly named jeweler
. It generates a basic project structure, sets up git, and prepares it to be on GitHub.
There are a number of choices you can make about your project, but the simplest incantation looks like:
$ bin/jeweler my_awesome_new_gem
create .gitignore
create Rakefile
create LICENSE
create README.rdoc
create .document
create lib
create lib/my_awesome_new_gem.rb
create test
create test/helper.rb
create test/test_my_awesome_new_gem.rb
Jeweler has prepared your gem in my_awesome_new_gem
Here’s some of the things it handles for you:
- Creates a stub ruby file for your library to live in,
lib/my_awesome_new_gem.rb
- Creates a failing test using Shoulda,
test/test_my_awesome_new_gem.rb
- Creates a MIT license file
- Creates a Rakefile with tasks for:
- Managing your gem and releases
- Running tests
- Generating documentation
- Initializes a git repository and adds all files, and ignores some reasonable files
- Adds GitHub as the origin remote, using your GitHub username and the project name
If you don’t like the defaults, you have some tough (or maybe easy if you’re opinionated) choices to make about your gem.
By default, jeweler only creates the project locally. If you want create the repo on GithHub, use --create-repo
.
Jeweler defaults to shoulda, but jeweler supports a number of others as well:
- test/unit (use
--testunit
) - minitest (use
--minitest
) - shoulda (use
--shoulda
) - rspec (use
--rspec
) - micronaut (use
--micronaut
) - bacon (use
--bacon
)
Additionally, you can generate a scaffold for cucumber features. It will automatically be setup for the testing framework you chose (except for bacon, which doesn’t seem to work inside of cucumber). Use --cucumber
.
Jeweler will automatically be able to release to GitHub, but you also have a few other options:
Jeweler defaults to using the standard RDoc.
- RDoc (use
--rdoc
) -
YARD (use
--yard
)
There’s a few other tools you can enable for your project:
Once you know your own defaults, you can set an environment variable JEWELER_OPTS
, and from then on, jeweler will use those defaults.
In bash, for example, you’d add something like this to ~/.bashrc
: export JEWELER_OPTS="--rspec"