Contributing to will_paginate

Contributions are welcome, especially for bug fixes and compatibility updates. As the project is in maintenance mode, new features are unlikely to be accepted.

Setting Up Your Development Environment

The project includes scripts and configuration to help you set up a consistent development environment.

Prerequisites

  • Ruby
  • Bundler
  • Git
  • For local database setup (Option 1): Homebrew (on macOS) to install MySQL and PostgreSQL.
  • For containerized setup (Option 2): Docker and Docker Compose.

Option 1: Local Setup (macOS with Homebrew)

  1. Run the bootstrap script:

    This script will install required services using Homebrew and configure bundler for the correct library paths.

    script/bootstrap

    On systems without Homebrew, you must ensure that MySQL 5.7, PostgreSQL, and MongoDB 4.x are installed and running.

  2. Start Services:

    Ensure your databases (MySQL, PostgreSQL) are running. If you installed them with Homebrew, you can use brew services start mysql@5.7 and brew services start postgresql.

Using Docker is the easiest way to get all required database services running with the correct versions.

  1. Start the services:

    From the root of the project, run:

    docker-compose up -d

    This will start MySQL, PostgreSQL, and MongoDB containers in the background, mapped to the ports specified in .envrc and docker-compose.yml.

  2. Install Gems:

    With the services running, install the gem dependencies:

    bundle install

Running the Test Suite

The project has a comprehensive test suite. The main test script runs the ActiveRecord tests against three different database adapters.

To run all tests:

script/test_all

This script will execute the RSpec suite for sqlite3, mysql, and postgres sequentially.

The test suite is also configured to run against different versions of Rails and Ruby, as defined in .github/workflows/test.yml. You can switch between different test environments by setting the BUNDLE_GEMFILE environment variable:

# Example: Run tests against the Rails 6.0 Gemfile
BUNDLE_GEMFILE=environments/Gemfile.rails6.0.rb bundle exec script/test_all

Submitting a Pull Request

  1. Fork the repository on GitHub.
  2. Create a new branch for your changes (git checkout -b my-feature-branch).
  3. Make your changes and add tests to cover them.
  4. Ensure the test suite passes (script/test_all).
  5. Commit your changes and push the branch to your fork (git push origin my-feature-branch).
  6. Open a pull request from your fork to the main mislav/will_paginate repository.