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

Hack your bundle for fun and profit (La Conf 2013)

Hack your bundle for fun and profit (La Conf 2013)

Bundler has turned out to be a super-usful tool for installing and managing dependencies, but it has hidden depths! This talk discusses some of the ways you can use Bundler and other tools together to boost your development productivity. I’ll walk through how to use the lesser-known but very handy commands like bundle gem, bundle open, and a few others. I’ll show you how to use Bundler to make sure you always run your app on the right version of Ruby, how to search through every gem in your Gemfile with a single command, and how to check for newer versions of the gems you use.

André Arko

May 10, 2013
Tweet

More Decks by André Arko

Other Decks in Technology

Transcript

  1. Hack your bundle
    for fun and profit

    View Slide

  2. André Arko
    @indirect
      

    View Slide

  3. View Slide

  4. View Slide

  5. bundle install

    View Slide

  6. probably what you want
    bundle install

    View Slide

  7. installs the Gemfile
    bundle install

    View Slide

  8. after edits or git pulls
    bundle install

    View Slide

  9. bundle update

    View Slide

  10. probably not
    what you want
    bundle update

    View Slide

  11. updates every gem
    bundle update

    View Slide

  12. this may be surprising
    bundle update

    View Slide

  13. much more useful
    bundle update

    View Slide

  14. updates GEM
    as Gemfile allows
    bundle update

    View Slide

  15. updates GEM
    along with child deps
    bundle update

    View Slide

  16. bundle show

    View Slide

  17. lists bundled gems
    bundle show

    View Slide

  18. prints the path to GEM
    bundle show

    View Slide

  19. opens GEM in $EDITOR
    bundle open

    View Slide

  20. lists paths to every
    bundled gem
    bundle show --paths

    View Slide

  21. sneakily useful
    bundle show --paths

    View Slide

  22. finds “foo” in any gem
    grep "foo" `bundle
    show --paths`

    View Slide

  23. Rails 4 sneak preview

    View Slide

  24. Rails 4 sneak preview
    (well… DHH does this)

    View Slide

  25. gives you a binary that
    you can run from cron
    bundle binstubs

    View Slide

  26. no more cd in cronjobs
    /myapp/bin/rake foo

    View Slide

  27. if your Ruby location
    is known, check it in
    /myapp/bin/rake foo

    View Slide

  28. creates a Gemfile for you
    bundle init

    View Slide

  29. bundle git locals

    View Slide

  30. bundle git locals
    use git checkouts
    directly

    View Slide

  31. bundle git locals
    changes apply
    instantly

    View Slide

  32. bundle git locals
    commits update
    lock file

    View Slide

  33. bundle config
    local.rack
    ~/sw/rack

    View Slide

  34. enforce ruby versions
    ruby "1.9.3"

    View Slide

  35. sets Heroku ruby version
    ruby "1.9.3"

    View Slide

  36. bundle won’t load
    on wrong versions
    ruby "1.9.3"

    View Slide

  37. literal dependency graph
    bundle viz

    View Slide

  38. View Slide

  39. load your gems,
    then open IRB
    bundle console

    View Slide

  40. create a new gem
    named NAME
    bundle gem NAME

    View Slide

  41. gemspec, directories,
    release tasks, all there
    bundle gem NAME

    View Slide

  42. tasks update when
    bundler updates
    bundle gem NAME

    View Slide

  43. go forth and bundle

    View Slide