-
-
Notifications
You must be signed in to change notification settings - Fork 981
Development Setup
This page is for setting up Rubygems on a local development machine to contribute patches/fixes/awesome stuff. If you need to host your own gem server, please consider checking out Geminabox. It’s a lot simpler than Rubygems and may suit your organization’s needs better.
Some things you’ll need to do in order to get this project up and running:
- Use Ruby 1.9.3
- Install bundler:
gem install bundler - Install redis, version 2.0 or higher. If you have homebrew, do
brew install redis -H, if you use macports, dosudo port install redis. - Clone the repo:
git clone git://github.com/rubygems/rubygems.org - Move into your cloned rubygems directory if you haven’t already:
cd rubygems.org - Rubygems is configured to use PostgreSQL (>= 8.4.x), for MySQL see below. Install with:
brew install postgres - Install dependencies:
bundle --local - Setup a database.yml
cp config/database.yml.example config/database.yml(double check/update) - Create the databases:
rake db:create:all - Redis should be running already, if not, run
redis-server. - Update the db schema:
rake db:migrate - Run the tests:
rake - Start the web server:
rails serverand browse to localhost:3000
If you need to host gems locally, *you probably don’t need to do this!): Make sure you run rake gemcutter:index:update before running the app on your own machine, this primes the filesystem gem index for local use.
- Modify Gemfile to use
mysqlinstead ofpg - If you’re running Max OS X Snow Leopard, the MySQL gem will fail to install without configuring it as follows:
bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
export ARCHFLAGS="-arch x86_64"- Continue setup as above, installing dependencies, setting up database.yml, etc.
Warning: Gem names are case sensitive (eg.
BlueClothvs.bluecloth2). MySQL has autf8_bincollation, but it appears that you still need to doBINARY name = ?for searching. It is recommended that you stick to PostgreSQL >= 8.4.x for development.
- Remove
pgandsilent-postgresgems from your Gemfile - Add
mysql2gem to your Gemfile:
gem "mysql2", "~> 0.2.11" # Actually, you can use any 0.2.x version- Run
bundle installcommand
Warning: Specify
mysql2version as I’ve provided, because it would not work with any 0.3.x gem versions.
For testing/developing the gem, cd into the gem directory. Please keep the code for the gem in there, don’t let it leak out into the Rails app.
A good way to get some test data is to import from a local gem directory. gem env will tell you where rubygems stores your gems. Run rake gemcutter:import:process #{INSTALLATION_DIRECTORY}/cache
If you see “Processing 0 gems…” you’ve probably specified the wrong directory. The proper directory will be full of .gem files.
In order to push a gem to your local installation use a command like the following:
RUBYGEMS_HOST=http://localhost:3000 gem push hola-0.0.3.gem Courtesy of Rails ERD

Be sure to read through the Contribution Guidelines.