Skip to content

Latest commit

 

History

History
190 lines (146 loc) · 6.23 KB

CONTRIBUTING.md

File metadata and controls

190 lines (146 loc) · 6.23 KB

Contribution Guidelines

From the Rubinius contribution page:

Writing code and participating should be fun, not an exercise in perseverance. Stringent commit polices, for whatever their other qualities may bring, also mean longer turnaround times.

Submit a patch and once it’s accepted, you’ll get commit access to the repository. Feel free to fork the repository and send a pull request, once it’s merged in you’ll get added. If not, feel free to bug qrush about it.

Also, if you’re hacking on RubyGems.org, hop in #rubygems on irc.freenode.net! Chances are someone else will be around to answer questions or bounce ideas off of.

How To Contribute

  • Follow the steps described in Development Setup
  • Create a topic branch: git checkout -b awesome_feature
  • Commit your changes
  • Keep up to date: git fetch && git rebase origin/master

Once you’re ready:

  • Fork the project on GitHub
  • Add your repository as a remote: git remote add your_remote your_repo
  • Push up your branch: git push your_remote awesome_feature
  • Create a Pull Request for the topic branch, asking for review.

Once it’s accepted:

  • If you want access to the core repository feel free to ask! Then you can change origin to point to the Read+Write URL:
git remote set-url origin [email protected]:rubygems/rubygems.org.git

Otherwise, you can continue to hack away in your own fork.

If you’re looking for things to hack on, please check GitHub Issues. If you’ve found bugs or have feature ideas don’t be afraid to pipe up and ask the mailing list or IRC channel (#rubygems on irc.freenode.net) about them.

Acceptance

Contributions WILL NOT be accepted without tests.

If you haven't tested before, start reading up in the test/ directory to see what's going on. If you've got good links regarding TDD or testing in general feel free to add them here!

Branching

For your own development, use the topic branches. Basically, cut each feature into its own branch and send pull requests based off those.

On the main repo, branches are used as follows:

Branch Used for...
`master` The main development branch. **Always** should be fast-forwardable.
`production` What’s currently on https://rubygems.org. Should be updated when deploys happen from master.
Topic branches Individual features/fixes. These should be moved around/rebased on top of the latest master before submitting. Makes your patches easier to merge and keep the history clean if at all possible.

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.

Environment

  • Use Ruby 2.1.5
  • Use Rubygems 2.2.2
  • 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, do sudo port install redis.
  • Rubygems is configured to use PostgreSQL (>= 8.4.x).
    • Install with: brew install postgres
    • Initialize the database and start the DB server
    initdb /usr/local/var/postgres -E utf8 pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
  • If you want to use MySQL instead
    • Install with: brew install mysql
    • Start the DB server with: sudo /usr/local/mysql/support-files/mysql.server start

Getting the code

  • 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
  • If you're using MySQL - replace pg with mysql2 in the Gemfile
    • sed -i "s/gem 'pg'/gem 'mysql2'/" Gemfile
  • Install dependencies: bundle install

Setting up the database

  • Get set up: ./script/setup
  • Run the database rake tasks if needed: rake db:create:all db:drop:all db:setup db:test:prepare --trace

Running tests

  • Start redis: redis-server
  • Run the tests: rake

Importing gems into the database

  • Import gems into the database with Rake task. rake gemcutter:import:process vendor/cache
    • To import a small set of gems you can point the import process to any gems cache directory, like a very small rvm gemset for instance, or specifying GEM_PATH/cache instead of vendor/cache.
  • If you need the index available - needed when working in conjunction with bundler-api - then run rake gemcutter:index:update. This primes the filesystem gem index for local use.

Getting the test data

  • 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.

Pushing gems

  • 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

When everything is set up, start the web server with rails server and browse to localhost:3000 or use Pow!

Database Layout

Courtesy of Rails ERD

Rubygems.org Domain Model