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

What we’ve been up to with Bundler

Colby Swandale
September 20, 2017

What we’ve been up to with Bundler

The Bundler core team has been working hard towards the Bundler 2 release. In this presentation we'll talk about the new features introduced in Bundler recently and also talk the big changes for the upcoming Bundler 2 release.

Presented at RubyKaigi 2017

Colby Swandale

September 20, 2017
Tweet

More Decks by Colby Swandale

Other Decks in Programming

Transcript

  1. What we’ve been
    up to with Bundler

    View full-size slide

  2. Colby Swandale
    @0xColby

    View full-size slide

  3. Past 12 months

    View full-size slide

  4. $ bundle doctor
    Contributed by @mistydemo ❤

    View full-size slide

  5. $ bundle add
    Contributed by @denniss ❤

    View full-size slide

  6. # Gemfile
    source 'https://rubygems.org'
    gem 'rack'

    View full-size slide

  7. $ bundle add rspec
    Fetching gem metadata from https://rubygems.org/..........
    Fetching version metadata from https://rubygems.org/.
    Resolving dependencies...
    Resolving dependencies...
    Using bundler 1.15.4
    Using diff-lcs 1.3
    Using rack 2.0.3
    Using rspec-support 3.6.0
    Using rspec-core 3.6.0
    Using rspec-expectations 3.6.0
    Using rspec-mocks 3.6.0
    Using rspec 3.6.0

    View full-size slide

  8. # Gemfile
    source 'https://rubygems.org'
    gem 'rack'
    # Added at 2017-09-13 08:48:14
    gem "rspec", "~> 3.6"

    View full-size slide

  9. $ bundle add rails --version "~> 5.0.0" --source "https://
    gems.example.com" --group "development"

    View full-size slide

  10. bundler plugins
    Contributed by @asutoshpalai & @fotanus ❤

    View full-size slide

  11. # plugins.rb
    module MyBundlerPlugin
    class Plugin < Bundler::Plugin::API
    command “new-command“
    def exec(command, args)
    puts “Hello World”
    end
    end
    end

    View full-size slide

  12. $ bundle new-command
    Hello World!

    View full-size slide

  13. # plugins.rb
    Bundler::Plugin::API.hook "before-install-all" do |deps|
    puts “Installing #{deps.map(&:name).join(‘, ‘)} !”
    end

    View full-size slide

  14. $ bundler install
    Installing rack !
    Using bundler 1.15.4
    Using rack 2.0.3
    Bundle complete! 1 Gemfile dependency, 2 gems now installed.
    Use `bundle info [gemname]` to see where a bundled gem is
    installed.

    View full-size slide

  15. $ bundler plugin install

    View full-size slide

  16. # Gemfile
    source 'https://rubygems.org'
    gem 'rack'
    plugin 'my-bundler-plugin'

    View full-size slide

  17. Plugins need more work & docs

    View full-size slide

  18. Lots and lots of bug fixes

    View full-size slide

  19. Improving error messages

    View full-size slide

  20. 1.16 will likely be the last 1.xx
    version

    View full-size slide

  21. 1.0.0 - August 29, 2010

    View full-size slide

  22. Things we’re adding
    Things we’re removing
    Things we’re changing

    View full-size slide

  23. Things we're removing

    View full-size slide

  24. Removing Capistrano & Vlad
    integration

    View full-size slide

  25. Gemfile Source Shortcuts

    View full-size slide

  26. gem ‘rack’, github: ‘user/repo’
    gemcutter:
    rubygems:
    rubyforge:
    gist:
    bitbucket:

    View full-size slide

  27. gem ‘mygem1’, source: ‘https://mygemserver.private'
    gem ‘mygem2’, git: ‘https://github.com/org/repo.git'
    gem ‘mygem3’, path: ‘path/to/gem’

    View full-size slide

  28. git_source(:github) do |repo_name|
    repo_name = “#{repo_name}/#{repo_name}” unless repo_name.include(“/“)
    “https://github.com/#{repo_name}.git"
    end

    View full-size slide

  29. gem ‘rack’, github: ‘user/repo’

    View full-size slide

  30. # Gemfile
    source 'https://rubygems.org'
    gem 'rack'
    github ‘my-org/my-repo’ do
    gem ‘my-gem'
    end

    View full-size slide

  31. $ bundle show

    View full-size slide

  32. $ bundle show
    Gems included by the bundle:
    * bundler (1.15.4)
    * rack (2.0.3)

    View full-size slide

  33. $ bundler show rack
    /Users/c/.gem/ruby/2.4.1/gems/rack-2.0.3

    View full-size slide

  34. $ bundle show --verbose
    * bundler (1.15.4)
    Summary: The best way to manage your application’s…
    Homepage: http://bundler.io
    Status: Up to date
    * rack (2.0.3)
    Summary: a modular Ruby webserver interface
    Homepage: http://rack.github.io/
    Status: Up to date

    View full-size slide

  35. $ bundle info $ bundle list

    View full-size slide

  36. $ bundle list
    Gems included by the bundle:
    * actionmailer (5.1.3)
    * actionpack (5.1.3)
    * actionview (5.1.3)
    * activejob (5.1.3)
    * activesupport (5.1.3)
    * builder (3.2.3)
    * bundler (1.15.4)
    * capistrano (2.15.9)
    * capistrano-notifier (0.4.1)
    * concurrent-ruby (1.0.5)
    * erubi (1.6.1)

    View full-size slide

  37. $ bundler info rack
    * rack (2.0.3)
    Summary: a modular Ruby webserver interface
    Homepage: http://rack.github.io/
    Path: /Users/c/.gem/ruby/2.4.1/gems/rack-2.0.3

    View full-size slide

  38. $ bundler info rack --path
    /Users/c/.gem/ruby/2.4.1/gems/rack-2.0.3

    View full-size slide

  39. $ bundle viz

    View full-size slide

  40. $ bundle plugin install bundle-viz

    View full-size slide

  41. $ bundle console

    View full-size slide

  42. Persistant command arguments

    View full-size slide

  43. › bundler install --path foo
    Fetching gem metadata from https://rubygems.org/..
    Fetching version metadata from https://rubygems.org/.
    Using bundler 1.15.4
    Fetching rack 2.0.3
    Installing rack 2.0.3
    Bundle complete! 1 Gemfile dependency, 2 gems now installed.
    Bundled gems are installed into ./foo.

    View full-size slide

  44. › bundler config --parseable
    path=foo

    View full-size slide

  45. bundle install --with ––without ––path -–system

    View full-size slide

  46. $ bundle config path ./vendor

    View full-size slide

  47. $ bundle package $ bundle cache

    View full-size slide

  48. Things we’re adding

    View full-size slide

  49. Global gem & extension cache

    View full-size slide

  50. Specific Platforms

    View full-size slide

  51. What’s a platform?

    View full-size slide

  52. Specifies OS, OS Version,
    CPU Arch, Ruby Engine,
    Engine Version

    View full-size slide

  53. # mygem.gemspec
    Gem::Specification.new do |s|
    s.name = “mygem"
    s.summary = "my awesome gem"
    s.platform = Gem::Platform::RUBY # default

    View full-size slide

  54. GEM
    remote: https://rubygems.org/
    specs:
    libv8 (6.0.286.54.1)
    PLATFORMS
    ruby
    DEPENDENCIES
    libv8
    BUNDLED WITH
    1.15.4

    View full-size slide

  55. GEM
    remote: https://rubygems.org/
    specs:
    libv8 (6.0.286.54.1)
    libv8 (6.0.286.54.1-x86_64-linux)
    PLATFORMS
    ruby
    x86_64-linux
    DEPENDENCIES
    libv8
    BUNDLED WITH
    1.15.4

    View full-size slide

  56. $ irb -rbundler
    irb(main):003:0> Bundler.setup
    irb(main):002:0> Gem.loaded_specs[“libv8”].platform
    => #@os="linux", @version=nil>

    View full-size slide

  57. Things we're changing

    View full-size slide

  58. $ bundler
    Bundler version 2.0.0 (2017-09-10 commit 0b0456249)
    Bundler commands:
    Primary commands:
    bundle install [OPTIONS] # Install the current environment to the
    bundle update [OPTIONS] # Update the current environment
    bundle cache [OPTIONS] # Locks and then caches all of the gems
    bundle exec [OPTIONS] # Run the command in context of the
    bundle config NAME [VALUE] # Retrieve or set a configuration value
    bundle help [COMMAND] # Describe available commands or one
    Utilities:
    bundle add GEM VERSION # Add gem to Gemfile and run bundl
    bundle binstubs GEM [OPTIONS] # Install the binstubs of the listed
    bundle check [OPTIONS] # Checks if the dependencies listed
    bundle doctor [OPTIONS] # Checks the bundle for common
    -V, [--verbose], [--no-verbose] # Enable verbose output mode

    View full-size slide

  59. $ bundle update

    View full-size slide

  60. $ bundler update
    Fetching gem metadata from https://rubygems.org/...
    Fetching gem metadata from https://rubygems.org/.
    Resolving dependencies...
    Fetching rack 2.0.3 (was 1.6.8)
    Installing rack 2.0.3 (was 1.6.8)
    Removing rack (1.6.8)
    Bundle updated!

    View full-size slide

  61. $ bundler update
    To update everything, pass the `--all` flag.

    View full-size slide

  62. github.com/bundler/rfcs/pull/6

    View full-size slide

  63. Testing Bundler 2

    View full-size slide

  64. Feature Flags!

    View full-size slide

  65. error_on_stderr
    auto_config_jobs
    init_gems_rb
    specific_platform
    global_gem_cache

    View full-size slide

  66. $ bundle config true

    View full-size slide

  67. $ gem install bundler ––pre

    View full-size slide

  68. Bundler 1 will not work after a
    bundle install with Bundler 2

    View full-size slide

  69. Going Forward

    View full-size slide

  70. A major release every year

    View full-size slide

  71. Bundler will ship with ruby 2.5

    View full-size slide

  72. 0xColby
    colby-swandale
    slack.bundler.io#bundler

    View full-size slide

  73. bundler/bundler

    View full-size slide

  74. Bundler ❤ Contributors
    %&'()*$%&()*$%&+'(
    $%&& +)*,
    (*)$&($%&'&'*()*&($
    (*)$'*+)*&$%&($%&'
    $+&'()*$()*$%&'()*
    (*)$'*()*+($%-($%&'
    $'*($%'(*)()*&($%

    View full-size slide