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

A History of Bundles: 2010 to 2017

André Arko
November 16, 2017

A History of Bundles: 2010 to 2017

When Bundler 1.0 came out in 2010, it did something really great: installed all of your gems and let you use them in your app. Today, Bundler does something really great: it installs all your gems and lets you use them. So, given that, why has Bundler needed thousands upon thousands of hours of development work? What exactly has changed since then? Prepare to find out. We’ll cover performance improvements, server response optimizations, adapting to new versions of Ruby, and adding features to support new usecases. Learn the tricks of Bundler power users, and find out how to optimize your gem workfl

André Arko

November 16, 2017
Tweet

More Decks by André Arko

Other Decks in Technology

Transcript

  1. `bundle install` Y U SO SLOW see also terence lee

    & andré arko, ruby on ales 2012
  2. (that’s very nearly almost what Jamie Zawinski said, anyway) Some

    people, when confronted with a problem, think “I know, I'll write a webapp and throw it up on Heroku.” Now they have two problems.
  3. Deathmatch: Bundler vs. RubyGems see also `bundle install` Y U

    SO SLOW: Server Edition André Arko, Scottish RubyConf 2013 Terence Lee, Ruby on Ales 2013
  4. after the first source, use source blocks to stay safe

    source “https://rubygems.org" gem “some_gem” source “https://other-server.com" do gem “other_gem” end
  5. Gemfile → gems.rb (optional) Ruby version locked, upgradable bundle lock

    + --add-platform bundle doctor other notable features
  6. Gemfile → gems.rb (optional) Ruby version locked, upgradable bundle lock

    + --add-platform bundle doctor bundle pristine other notable features
  7. bundle update --major bundle update --minor bundle update --patch bundle

    config mirror checksum validation on install other notable features
  8. a plugin system! (beta) • command plugins: bundle ack •

    lifecycle plugins: before/after install/update, etc • source plugins: gem “foo”, mercurial: “https://example.com” other notable features
  9. best practices bundle config global_gem_cache true bundle config specific_platform true

    bundle config disable_multisource true bundle config only_update_to_newer_versions true
  10. best practices bundle config default_install_uses_path true bundle config global_gem_cache true

    bundle config specific_platform true bundle config disable_multisource true bundle config only_update_to_newer_versions true
  11. best practices override GitHub gems to use HTTPS with this

    line at the top of your Gemfile git_source(:github) {|r| “https://github.com/#{r}" } (or use bundle init to generate a Gemfile with this)
  12. power user tools instead of $ bundle exec rspec you

    can run $ bundle binstubs rspec-core once, then commit (and use) the stub $ bin/rspec
  13. power user tools $ bundle lock --add-platform java $ git

    add Gemfile.lock $ git commit -am “Locked for JRuby”
  14. power user tools $ git clone github.com/foo/foo ~/src/foo $ bundle

    config local.foo ~/src/foo [ make changes in ~/src/foo ] $ bundle exec rails s [ commit changes in ~/src/foo ] $ bundle exec rails s $ git add Gemfile.lock $ git commit -m “Use the latest foo”
  15. power user tools $ cat http.rb require 'bundler/inline' gemfile do

    source 'https://rubygems.org' gem 'http' end puts HTTP.get('http://example.com')
  16. $ gem uninstall http Successfully uninstalled http-3.0.0 $ ruby http.rb

    <!doctype html> <html> […] power user tools needed gems installed here
  17. power user tools search your gems with $ grep -R

    STRING $(bundle show --paths) then, open the gem you found in $EDITOR with $ bundle open GEMNAME make changes as needed for debugging, then $ bundle pristine GEMNAME
  18. power user tools silence gem install messages with $ bundle

    config --system ignore_messages true and you will never be told to HTTParty hard, ever again