Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dependencies Testing With Appraisal And Bundler

Dependencies Testing With Appraisal And Bundler

Revised talk after given at RubyKaigi 2013 (https://speakerdeck.com/sikachu/you-have-to-test-multiple-versions-of-your-gems-dependencies-you-used-appraisal-its-super-affective)

Presented at RedDotRubyConf 2013 on June 8, 2013.

Prem Sichanugrist

June 08, 2013
Tweet

More Decks by Prem Sichanugrist

Other Decks in Programming

Transcript

  1. I use a gem called “Appraisal” to test my gems

    against multiple versions of its dependencies. You should give it a try! #RDRC
  2. I use a gem called “Appraisal” to test my gems

    against multiple versions of its dependencies. You should give it a try! #RDRC http://git.io/i-love-appraisal
  3. ~>

  4. Why was this so bad? • Time consuming • Can’t

    test against multiple versions at once • Doesn’t handle dependency of dependency • Dependency hell • $ rm -Rf $GEM_HOME
  5. $ rvm gemset create rails-3-2 $ rvm gemset use rails-3-2

    $ gem install rails -v 3.2.13 $ rake $ rvm gemset create rails-3-1 $ rvm gemset use rails-3-1 $ gem install rails -v 3.1.12 $ rake # ...
  6. This is good, but ... • Waste of space; gems

    are not shared • Contributors need to use Ruby manager that supports Gemset • May need to have bootstrap script to setup gemsets
  7. $ bundle install --gemfile=rails-3-2.gemfile $ export BUNDLE_GEMFILE=rails-3-2.gemfile $ bundle exec

    rake $ bundle install --gemfile=rails-3-1.gemfile $ export BUNDLE_GEMFILE=rails-3-1.gemfile $ bundle exec rake
  8. # Run "test" task against all versions $ rake appraisal

    test # Run "test" task against a single version $ rake appraisal:rails-3-1 test
  9. Appraisal • Allow you to set dependencies in a single

    place • Generate sub-Gemfiles for you • Install multiple versions of dependencies • Setup Bundler to use the correct version of dependency
  10. 1.0

  11. Already in master • source • ruby • gem •

    git • group • gemspec * Not tested in Appraisals file yet
  12. W ork In Progress # Run "test" task against all

    versions $ rake appraisal test
  13. W ork In Progress # Run "test" task against all

    versions $ appraisal rake test
  14. W ork In Progress # Run "test" task against a

    single version $ rake appraisal:rails-3-1 test
  15. W ork In Progress # Run "test" task against a

    single version $ appraisal rails3-1 rake test
  16. W ork In Progress # Run Ruby test on a

    single file $ appraisal rails3-1 ruby -Itest test/foo_test.rb
  17. Thank you! Prem Sichanugrist (@sikachu) Tweet your love: http://git.io/i-love-appraisal http://learn.thoughtbot.com

    – Promo code: REDDOT $49 off first month of Prime I also have some stickers