All Projects → thoughtbot → Appraisal

thoughtbot / Appraisal

Licence: mit
A Ruby library for testing your library against different versions of dependencies.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Appraisal

Ruby Units
A unit handling library for ruby
Stars: ✭ 389 (-63.81%)
Mutual labels:  rubygems
Gemstash
A RubyGems.org cache and private gem server
Stars: ✭ 638 (-40.65%)
Mutual labels:  rubygems
Api schema
DSL for describing APIs and generate swagger json
Stars: ✭ 18 (-98.33%)
Mutual labels:  rubygems
Ruby Fann
Ruby library for interfacing with FANN (Fast Artificial Neural Network)
Stars: ✭ 425 (-60.47%)
Mutual labels:  rubygems
Mailcatcher
Catches mail and serves it through a dream.
Stars: ✭ 5,512 (+412.74%)
Mutual labels:  rubygems
Materialize Sass
Materializecss rubygem for Rails Asset Pipeline / Sprockets
Stars: ✭ 785 (-26.98%)
Mutual labels:  rubygems
Gemsmith
A command line interface for smithing Ruby gems.
Stars: ✭ 354 (-67.07%)
Mutual labels:  rubygems
Drafting
Ruby gem for saving drafts of ActiveRecord models
Stars: ✭ 41 (-96.19%)
Mutual labels:  rubygems
Unread
Handle unread records and mark them as read with Ruby on Rails
Stars: ✭ 638 (-40.65%)
Mutual labels:  rubygems
Rack Throttle
Rack middleware for rate-limiting incoming HTTP requests.
Stars: ✭ 898 (-16.47%)
Mutual labels:  rubygems
Gem Release
Release your ruby gems with ease.
Stars: ✭ 448 (-58.33%)
Mutual labels:  rubygems
Bundler
Manage your Ruby application's gem dependencies
Stars: ✭ 4,846 (+350.79%)
Mutual labels:  rubygems
Rails Settings
Manage settings with Ruby on Rails
Stars: ✭ 807 (-24.93%)
Mutual labels:  rubygems
Papertrail Cli
Command-line client for Papertrail hosted syslog & app log management service
Stars: ✭ 397 (-63.07%)
Mutual labels:  rubygems
Kitchen Terraform
Test Kitchen plugins for testing Terraform configurations
Stars: ✭ 963 (-10.42%)
Mutual labels:  rubygems
Deep pluck
Allow you to pluck attributes from nested associations without loading a bunch of records.
Stars: ✭ 385 (-64.19%)
Mutual labels:  rubygems
One
The open source Cloud & Edge Computing Platform bringing real freedom to your Enterprise Cloud 🚀
Stars: ✭ 725 (-32.56%)
Mutual labels:  rubygems
Hanami Webpack
A RubyGem to allow you to use the Webpack as your asset pipeline in Hanami.
Stars: ✭ 50 (-95.35%)
Mutual labels:  rubygems
Datev
Ruby gem for DATEV exports via CSV
Stars: ✭ 33 (-96.93%)
Mutual labels:  rubygems
Leaky Gems
A list of Ruby gems that have known memory leaks (and issues)
Stars: ✭ 895 (-16.74%)
Mutual labels:  rubygems

Appraisal

Build Status

Find out what your Ruby gems are worth.

Synopsis

Appraisal integrates with bundler and rake to test your library against different versions of dependencies in repeatable scenarios called "appraisals." Appraisal is designed to make it easy to check for regressions in your library without interfering with day-to-day development using Bundler.

Installation

In your package's .gemspec:

s.add_development_dependency "appraisal"

Note that gems must be bundled in the global namespace. Bundling gems to a local location or vendoring plugins is not supported. If you do not want to pollute the global namespace, one alternative is RVM's Gemsets.

Setup

Setting up appraisal requires an Appraisals file (similar to a Gemfile) in your project root, named "Appraisals" (note the case), and some slight changes to your project's Rakefile.

An Appraisals file consists of several appraisal definitions. An appraisal definition is simply a list of gem dependencies. For example, to test with a few versions of Rails:

appraise "rails-3" do
  gem "rails", "3.2.14"
end

appraise "rails-4" do
  gem "rails", "4.0.0"
end

The dependencies in your Appraisals file are combined with dependencies in your Gemfile, so you don't need to repeat anything that's the same for each appraisal. If something is specified in both the Gemfile and an appraisal, the version from the appraisal takes precedence.

Usage

Once you've configured the appraisals you want to use, you need to install the dependencies for each appraisal:

$ bundle exec appraisal install

This will resolve, install, and lock the dependencies for that appraisal using bundler. Once you have your dependencies set up, you can run any command in a single appraisal:

$ bundle exec appraisal rails-3 rake test

This will run rake test using the dependencies configured for Rails 3. You can also run each appraisal in turn:

$ bundle exec appraisal rake test

If you want to use only the dependencies from your Gemfile, just run rake test as normal. This allows you to keep running with the latest versions of your dependencies in quick test runs, but keep running the tests in older versions to check for regressions.

In the case that you want to run all the appraisals by default when you run rake, you can override your default Rake task by put this into your Rakefile:

if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
  task :default => :appraisal
end

(Appraisal sets APPRAISAL_INITIALIZED environment variable when it runs your process. We put a check here to ensure that appraisal rake command should run your real default task, which usually is your test task.)

Note that this may conflict with your CI setup if you decide to split the test into multiple processes by Appraisal and you are using rake to run tests by default. Please see Travis CI Integration for more detail.

Commands

appraisal clean                  # Remove all generated gemfiles and lockfiles from gemfiles folder
appraisal generate               # Generate a gemfile for each appraisal
appraisal help [COMMAND]         # Describe available commands or one specific command
appraisal install                # Resolve and install dependencies for each appraisal
appraisal list                   # List the names of the defined appraisals
appraisal update [LIST_OF_GEMS]  # Remove all generated gemfiles and lockfiles, resolve, and install dependencies again
appraisal version                # Display the version and exit

Under the hood

Running appraisal install generates a Gemfile for each appraisal by combining your root Gemfile with the specific requirements for each appraisal. These are stored in the gemfiles directory, and should be added to version control to ensure that the same versions are always used.

When you prefix a command with appraisal, the command is run with the appropriate Gemfile for that appraisal, ensuring the correct dependencies are used.

Removing Gems using Appraisal

It is common while managing multiple Gemfiles for dependencies to become deprecated and no longer necessary, meaning they need to be removed from the Gemfile for a specific appraisal. To do this, use the remove_gem declaration within the necessary appraise block in your Appraisals file.

Example Usage

Gemfile

gem 'rails', '~> 4.2'

group :test do
  gem 'rspec', '~> 4.0'
  gem 'test_after_commit'
end

Appraisals

appraise 'rails-5' do
  gem 'rails', '~> 5.2'

  group :test do
    remove_gem :test_after_commit
  end
end

Using the Appraisals file defined above, this is what the resulting Gemfile will look like:

gem 'rails', '~> 5.2'

group :test do
  gem 'rspec', '~> 4.0'
end

Version Control

When using Appraisal, we recommend you check in the Gemfiles that Appraisal generates within the gemfiles directory, but exclude the lockfiles there (*.gemfile.lock.) The Gemfiles are useful when running your tests against a continuous integration server such as Travis CI.

Travis CI integration

If you're using Appraisal and using Travis CI, we're recommending you to setup Travis to run the test against multiple generated Gemfiles. This can be done by using gemfile setting:

# In .travis.yml
gemfile:
  - gemfiles/3.0.gemfile
  - gemfiles/3.1.gemfile
  - gemfiles/3.2.gemfile

Please note that if you've set your default rake task to run the test against all versions of its dependency, you might have to set a script setting:

script: "bundle exec rake test"

That will make sure that each of the test sub-job are not getting run more than one time.

You can also run your tests against multiple versions of Ruby locally, just like running on Travis CI, by using WWTD.

Circle CI Integration

In Circle CI you can override the default testing behaviour to customize your testing. Using this feature you can configure appraisal to execute your tests.

In order to this you can put the following configuration in your circle.yml file:

dependencies:
  post:
    - bundle exec appraisal install
test:
  pre:
    - bundle exec appraisal rake db:create
    - bundle exec appraisal rake db:migrate
  override:
    - bundle exec appraisal rspec

Notice that we are running an rspec suite. You can customize your testing command in the override section and use your favourite one.

Credits

thoughtbot

Appraisal is maintained and funded by thoughtbot, inc

Thank you to all the contributors

The names and logos for thoughtbot are trademarks of thoughtbot, inc.

License

Appraisal is Copyright © 2010-2013 Joe Ferris and thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].