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 full-size slide

  2. André Arko
    @indirect
      

    View full-size slide

  3. bundle install

    View full-size slide

  4. probably what you want
    bundle install

    View full-size slide

  5. installs the Gemfile
    bundle install

    View full-size slide

  6. after edits or git pulls
    bundle install

    View full-size slide

  7. bundle update

    View full-size slide

  8. probably not
    what you want
    bundle update

    View full-size slide

  9. updates every gem
    bundle update

    View full-size slide

  10. this may be surprising
    bundle update

    View full-size slide

  11. much more useful
    bundle update

    View full-size slide

  12. updates GEM
    as Gemfile allows
    bundle update

    View full-size slide

  13. updates GEM
    along with child deps
    bundle update

    View full-size slide

  14. lists bundled gems
    bundle show

    View full-size slide

  15. prints the path to GEM
    bundle show

    View full-size slide

  16. opens GEM in $EDITOR
    bundle open

    View full-size slide

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

    View full-size slide

  18. sneakily useful
    bundle show --paths

    View full-size slide

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

    View full-size slide

  20. Rails 4 sneak preview

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  25. creates a Gemfile for you
    bundle init

    View full-size slide

  26. bundle git locals

    View full-size slide

  27. bundle git locals
    use git checkouts
    directly

    View full-size slide

  28. bundle git locals
    changes apply
    instantly

    View full-size slide

  29. bundle git locals
    commits update
    lock file

    View full-size slide

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

    View full-size slide

  31. enforce ruby versions
    ruby "1.9.3"

    View full-size slide

  32. sets Heroku ruby version
    ruby "1.9.3"

    View full-size slide

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

    View full-size slide

  34. literal dependency graph
    bundle viz

    View full-size slide

  35. load your gems,
    then open IRB
    bundle console

    View full-size slide

  36. create a new gem
    named NAME
    bundle gem NAME

    View full-size slide

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

    View full-size slide

  38. tasks update when
    bundler updates
    bundle gem NAME

    View full-size slide

  39. go forth and bundle

    View full-size slide