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

What we’ve been up to with Bundler

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 Slide

  2. Colby Swandale
    @0xColby

    View Slide

  3. View Slide

  4. View Slide

  5. Past 12 months

    View Slide

  6. $ bundle doctor
    Contributed by @mistydemo ❤

    View Slide

  7. $ bundle add
    Contributed by @denniss ❤

    View Slide

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

    View Slide

  9. $ 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 Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  14. $ bundle new-command
    Hello World!

    View Slide

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

    View Slide

  16. $ 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 Slide

  17. $ bundler plugin install

    View Slide

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

    View Slide

  19. Plugins need more work & docs

    View Slide

  20. Lots and lots of bug fixes

    View Slide

  21. Improving error messages

    View Slide

  22. Performance

    View Slide

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

    View Slide

  24. 1.0.0 - August 29, 2010

    View Slide

  25. Bundler 2

    View Slide

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

    View Slide

  27. Things we're removing

    View Slide

  28. Ruby < 2.3

    View Slide

  29. Removing Capistrano & Vlad
    integration

    View Slide

  30. Gemfile Source Shortcuts

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  36. $ bundle show

    View Slide

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

    View Slide

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

    View Slide

  39. $ 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 Slide

  40. $ bundle info $ bundle list

    View Slide

  41. $ 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 Slide

  42. $ 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 Slide

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

    View Slide

  44. $ bundle viz

    View Slide

  45. $ bundle plugin install bundle-viz

    View Slide

  46. $ bundle console

    View Slide

  47. Persistant command arguments

    View Slide

  48. › 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 Slide

  49. › bundler config --parseable
    path=foo

    View Slide

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

    View Slide

  51. $ bundle config path ./vendor

    View Slide

  52. $ bundle package $ bundle cache

    View Slide

  53. Things we’re adding

    View Slide

  54. Global gem & extension cache

    View Slide

  55. Specific Platforms

    View Slide

  56. What’s a platform?

    View Slide

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

    View Slide

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

    View Slide

  59. View Slide

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

    View Slide

  61. 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 Slide

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

    View Slide

  63. Things we're changing

    View Slide

  64. $ bundle

    View Slide

  65. $ 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 Slide

  66. $ bundle update

    View Slide

  67. $ 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 Slide

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

    View Slide

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

    View Slide

  70. Testing Bundler 2

    View Slide

  71. Feature Flags!

    View Slide

  72. error_on_stderr
    auto_config_jobs
    init_gems_rb
    specific_platform
    global_gem_cache

    View Slide

  73. $ bundle config true

    View Slide

  74. $ gem install bundler ––pre

    View Slide

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

    View Slide

  76. Going Forward

    View Slide

  77. A major release every year

    View Slide

  78. Bundler will ship with ruby 2.5

    View Slide

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

    View Slide

  80. bundler.io

    View Slide

  81. bundler/bundler

    View Slide

  82. View Slide

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

    View Slide

  84. View Slide

  85. ͋Γ͕ͱ͏!

    View Slide