What we’ve been up to with Bundler

81faf651bd1a239298307c7fd6efe944?s=47 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

81faf651bd1a239298307c7fd6efe944?s=128

Colby Swandale

September 20, 2017
Tweet

Transcript

  1. What we’ve been up to with Bundler

  2. Colby Swandale @0xColby

  3. None
  4. None
  5. Past 12 months

  6. $ bundle doctor Contributed by @mistydemo ❤

  7. $ bundle add Contributed by @denniss ❤

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

  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
  10. # Gemfile source 'https://rubygems.org' gem 'rack' # Added at 2017-09-13

    08:48:14 gem "rspec", "~> 3.6"
  11. $ bundle add rails --version "~> 5.0.0" --source "https:// gems.example.com"

    --group "development"
  12. bundler plugins Contributed by @asutoshpalai & @fotanus ❤

  13. # plugins.rb module MyBundlerPlugin class Plugin < Bundler::Plugin::API command “new-command“

    def exec(command, args) puts “Hello World” end end end
  14. $ bundle new-command Hello World!

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

    !” end
  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.
  17. $ bundler plugin install <gem>

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

  19. Plugins need more work & docs

  20. Lots and lots of bug fixes

  21. Improving error messages

  22. Performance

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

  24. 1.0.0 - August 29, 2010

  25. Bundler 2

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

  27. Things we're removing

  28. Ruby < 2.3

  29. Removing Capistrano & Vlad integration

  30. Gemfile Source Shortcuts

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

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

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

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

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

    ‘my-gem' end
  36. $ bundle show

  37. $ bundle show Gems included by the bundle: * bundler

    (1.15.4) * rack (2.0.3)
  38. $ bundler show rack /Users/c/.gem/ruby/2.4.1/gems/rack-2.0.3

  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
  40. $ bundle info $ bundle list

  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)
  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
  43. $ bundler info rack --path /Users/c/.gem/ruby/2.4.1/gems/rack-2.0.3

  44. $ bundle viz

  45. $ bundle plugin install bundle-viz

  46. $ bundle console

  47. Persistant command arguments

  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.
  49. › bundler config --parseable path=foo

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

  51. $ bundle config path ./vendor

  52. $ bundle package $ bundle cache

  53. Things we’re adding

  54. Global gem & extension cache

  55. Specific Platforms

  56. What’s a platform?

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

  58. # mygem.gemspec Gem::Specification.new do |s| s.name = “mygem" s.summary =

    "my awesome gem" s.platform = Gem::Platform::RUBY # default
  59. None
  60. GEM remote: https://rubygems.org/ specs: libv8 (6.0.286.54.1) PLATFORMS ruby DEPENDENCIES libv8

    BUNDLED WITH 1.15.4
  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
  62. $ irb -rbundler irb(main):003:0> Bundler.setup irb(main):002:0> Gem.loaded_specs[“libv8”].platform => #<Gem::Platform:0x00000001d911a0 @cpu="x86_64",

    @os=“linux", @cpu="x86_64", @os="linux", @version=nil>
  63. Things we're changing

  64. $ bundle

  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
  66. $ bundle update

  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!
  68. $ bundler update To update everything, pass the `--all` flag.

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

  70. Testing Bundler 2

  71. Feature Flags!

  72. error_on_stderr auto_config_jobs init_gems_rb specific_platform global_gem_cache

  73. $ bundle config <feature> true

  74. $ gem install bundler ––pre

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

    Bundler 2
  76. Going Forward

  77. A major release every year

  78. Bundler will ship with ruby 2.5

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

  80. bundler.io

  81. bundler/bundler

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

    $'*($%'(*)()*&($%
  84. None
  85. ͋Γ͕ͱ͏!