SlideShare a Scribd company logo
1 of 35
Download to read offline
RubyGems/Bundler/rbenv
Hiroshi SHIBATA / GMO Pepabo, Inc.
2018.08.26 LL Event 2018
Gems on Ruby
self.introduce
Executive Officer CPO(Chief Productivity Officer)
Director of Business Process Re-engineering Office
Director of Technical Division
at GMO Pepabo, Inc. @pepabo
Hiroshi SHIBATA @hsbt
https://www.hsbt.org
self.introduce
=> {
name: “SHIBATA Hiroshi”,
nickname: “hsbt”,
organizations: [“ruby”, “rubygems”, “bundler”,
“asakusarb”, “railsgirls”, “pepabo”, …],
commit_bits: [“ruby”, “rake”, “rubygems”, “bundler”,
“rdoc”, “psych”, “ruby-build”, “railsgirls”, “railsgirls-
jp”, …],
sites: [“hsbt.org”, “ruby-lang.org”, “rubyci.org”,
“railsgirls.com”, “railsgirls.jp”],
}
• History
• RubyGems
• Bundler
• rbenv/ruby-build
• RubyGems 3.0/4.0
• RubyGems & Bundler
Agenda
Answer
• Must buy “Web+DB
Press Vol.103”
• You should use
RubyGems/Bundler/
rbenv at all.
History
1.
• RAA(Ruby Application Archive)
• 2013/08: raa.ruby-lang.org 終了のご報告 https://
www.ruby-lang.org/ja/news/2013/08/08/rip-raa/
• RubyForge
• 2009/10: RubyForge To Be Phased Out, RubyGems.org
Takes Over Gem Hosting https://www.infoq.com/news/
2009/10/rubyforge-phased-out-rubygemsorg
• gems.github.com
• 2009/10: Gem Building is Defunct https://www.infoq.com/
news/2009/10/github-stops-gem-building
Packaging and Disribution(1)
• gemcutter.org:
• https://github.com/rubygems/gemcutter
• You can use `gem yank` command after you did invoke
`gem i gemcutter`.
• rubygems.org:
• gemcutter.org was renamed to rubygems.org.
• bundler:
• 2010: Released to 1.0.0 version.
Packaging and Disribution(2)
RubyGems
2.
• The package manager of Ruby libraries.
• `gem install rails -v “~> 5.2”`
• You can install specified version of Ruby libraries
that called `Gem`. RubyGems handles global
environment on your box.
• You could specify `gem ‘rails’, ‘~> 5.2’` syntax
without its dependency.
What’s rubygems?
What does mean “official”?
“official” means “Matz controllable”
Un-controllable examples:
• ruby-doc.org
• rubygems.org
• bundler.io
• Ruby version manager(rvm/rbenv/chruby)
“RubyTogether” maintains RubyGems, Bundler and
RubyGems.org(Rails Application).
• Merge latest stable version into Ruby Core
• Ruby 2.6.0 will bundle RubyGems 3.0(TBD)
• Ruby 2.7 or 3.0 will bundle RubyGems 4.0(TBD)
The policy of RubyGems versioning
• RubyGems have HackerOne project.
• 3 people handle vulnerability issues.
• But We have no workflow about security release.
• RubyGems 2.7.6 was accidentally released.
Security
Bundler
3.
• The vendoring tool of Ruby.
• RubyGems couldn’t care dependency of Ruby
libraries and isolate version managing with ruby
process.
• Bundler can do them with `Gemfile`
What’s bundler?
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec
# We need a newish Rake since Active Job sets its test tasks' descriptions.
gem "rake", ">= 11.1"
• RubyGems 2.x, 3.x uses Molinillo-0.5.7
• Bundler 1.16.x also uses Molinillo-0.6.4
• These are different versions and behavior of
dependency resolver.
Dependency Resolver incompatible
~/D/g/r/rubygems (master) > ls lib/rubygems/resolver/molinillo/lib/molinillo
delegates dependency_graph.rb gem_metadata.rb resolution.rb state.rb
dependency_graph errors.rb modules resolver.rb
~/D/g/b/bundler (master) > ls lib/bundler/vendor/molinillo/lib/molinillo
compatibility.rb dependency_graph errors.rb modules resolver.rb
delegates dependency_graph.rb gem_metadata.rb resolution.rb state.rb
rbenv/ruby-build
4.
• The Ruby version manager (not ruby library)
• The Ruby language will be released Dec.25 every
year. You need to take care ruby versions in your
box like Ruby 2.3, 2.4, 2.5…
• Ruby isolates library locations used by Ruby
versions.
• rbenv(and ruby-build) provides an environment
that makes version switching and its build
definitions.
What’s rbenv?
Version number and release cycle
We plan to release every Christmas day.
• 2.1.0: 2013/12/25
• 2.2.0: 2014/12/25
• 2.3.0: 2015/12/25
• 2.4.0: 2016/12/25
• 2.5.0: 2017/12/25
• 2.6.0: 2018/12/25(TBD)
• …
• 3.0.0: 2020/xx/xx
Ruby package manager
RVM
• To support Binary installation
• Applied Custom patchset
• Automatic installation of latest rubygems and
bundler
rbenv/ruby-build
• Modify environment variables.
• I’m also maintain them
chruby/ruby-install
• Modify a few environment variables.
rbenv/ruby-build
You can get them from
• homebrew
• git clone
Basic instructions are:
$ rbenv install 2.5.0
$ rbenv install 2.6.0-dev
$ RUBY_CONFIGURE_OPT=—disable-install-doc rbenv install 2.4.3
$ rbenv install jruby-9.1.16.0
$ RUBY_CONFIGURE_OPT= rbenv install rbx-3.89
RubyGems 3 & 4
5.
• Removed deprecated methods.
• Removed to support for < Ruby 2.2.
• Added warnings of deprecated methods.
• Server/Client side 2FA
What’s new in RubyGems 3?
• Surprisedly, RG 2.7 still supports Ruby 1.8.
Ruby 1.8 in 2018
~/D/g/r/rubygems (2.7) > rg respond_to
test/rubygems/test_gem_request_set_gem_dependency_api.rb
630: tf.close! if tf.respond_to? :close!
test/rubygems/test_gem_source.rb
60: response.uri = URI('http://example') if response.respond_to? :uri
test/rubygems/test_gem_package.rb
755: tf.close! if tf.respond_to? :close!
test/rubygems/test_gem_util.rb
45: if File.respond_to?(:realpath)
test/rubygems/test_gem_installer.rb
58: str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
65:if Gem.respond_to?(:activate_bin_path)
893: skip unless "".respond_to?(:force_encoding)
test/rubygems/test_gem_specification.rb
2305: s.required_rubygems_version = Gem::Requirement.new("> 0".freeze) if s.respond_to? :required_ruby
2316: if s.respond_to? :specification_version then
…snip
• We can use Keywords argument, Refinement,
Other cool features in RubyGems now.
• Simple build matrix
Only support Ruby 2.2+
• It has non-compatible features.
• Make enable as default for conservative option.
• Behaviour changes with default gems installer.
• Executables in bin folder conflict with their gem
versions.
• Make ruby gem install to user-install by default.
RubyGems 4
• We got the installation time when already installed
gems.
• To use conservative is ignore re-install action.
Make conservative option as default
~ > gem i rails
clone http://rubyonrails.org -> /Users/hsbt/Documents/rubyonrails.org
git ls-remote http://rubyonrails.org
hg identify http://rubyonrails.org
svn info http://rubyonrails.org
error Could not find version control system: http://rubyonrails.org
exists /Users/hsbt/Documents/github.com/rails/rails
Successfully installed rails-5.2.0
1 gem installed
~ > gem i rails —conservative
~ >
• Rubygems 4 will install the all gems to `~/.gem`
• Pros: Ruby in linux distribution has many of FAQ for gem
installation for using `sudo`. This change resolve this
issues.
• Cons: Ruby version manager like rbenv is not support it.
And This is big incompatible feature.
Make `--user-install` as default
RubyGems
&
Bundler
6.
• We are working to integrate RubyGems and
Bundler.
• But It’s still working progress status because
there is no plan to release Bundler 2.
• RubyGems 3&4 drop to support under the Ruby
2.2. Because Bundler 1.x still supports Ruby 1.8
and 1.9.
• I’m waiting to release Bundler 2 for this
integration.
RubyGems/Bundler integration
• Bundler was located rubygems repository as git
submodule
Bundler Integration(rubygems.rb)
if USE_BUNDLER_FOR_GEMDEPS
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
require 'rubygems/user_interaction'
Gem::DefaultUserInteraction.use_ui(ui) do
require "bundler"
@gemdeps = Bundler.setup
Bundler.ui = nil
@gemdeps.requested_specs.map(&:to_spec).sort_by(&:name)
end
else
rs = Gem::RequestSet.new
@gemdeps = rs.load_gemdeps path
rs.resolve_current.map do |s|
s.full_spec.tap(&:activate)
end
end
Ruby is designed to make
programmers happy.
Yukihiro Matz Matsumoto

More Related Content

What's hot

How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?Hiroshi SHIBATA
 
tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02Hiroshi SHIBATA
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled BundlerHiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHiroshi SHIBATA
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyHiroshi SHIBATA
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard WayHiroshi SHIBATA
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014Hiroshi SHIBATA
 
Gemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyHiroshi SHIBATA
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
 

What's hot (20)

How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
20140918 ruby kaigi2014
20140918 ruby kaigi201420140918 ruby kaigi2014
20140918 ruby kaigi2014
 
tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02tDiary annual report 2009 - Sapporo Ruby Kaigi02
tDiary annual report 2009 - Sapporo Ruby Kaigi02
 
20140925 rails pacific
20140925 rails pacific20140925 rails pacific
20140925 rails pacific
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
What's new in RubyGems3
What's new in RubyGems3What's new in RubyGems3
What's new in RubyGems3
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
From 'Legacy' to 'Edge'
From 'Legacy' to 'Edge'From 'Legacy' to 'Edge'
From 'Legacy' to 'Edge'
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard Way
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
20140626 red dotrubyconf2014
20140626 red dotrubyconf201420140626 red dotrubyconf2014
20140626 red dotrubyconf2014
 
Gemification plan of Standard Library on Ruby
Gemification plan of Standard Library on RubyGemification plan of Standard Library on Ruby
Gemification plan of Standard Library on Ruby
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 

Similar to Gems on Ruby

The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of RubyHiroshi SHIBATA
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Brian Sam-Bodden
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2rubyMarc Chung
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudHiro Asari
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしHiroshi SHIBATA
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHiroshi SHIBATA
 
070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイド070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイドTomoki Maeda
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems nhm taveer hossain khan
 
Open Source Saturday - How can I contribute to Ruby on Rails?
Open Source Saturday - How can I contribute to Ruby on Rails?Open Source Saturday - How can I contribute to Ruby on Rails?
Open Source Saturday - How can I contribute to Ruby on Rails?Pravin Mishra
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby CoreHiroshi SHIBATA
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage ServerLin Jen-Shin
 

Similar to Gems on Ruby (20)

The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
mruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなしmruby で mackerel のプラグインを作るはなし
mruby で mackerel のプラグインを作るはなし
 
Week6
Week6Week6
Week6
 
How to Begin Developing Ruby Core
How to Begin Developing Ruby CoreHow to Begin Developing Ruby Core
How to Begin Developing Ruby Core
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイド070929 Ruby勉強会#5 Rails開発ツールガイド
070929 Ruby勉強会#5 Rails開発ツールガイド
 
Let's refactor some Ruby code - EuRuKo 2018
Let's refactor some Ruby code - EuRuKo 2018Let's refactor some Ruby code - EuRuKo 2018
Let's refactor some Ruby code - EuRuKo 2018
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
RubyConfBD 2013 decouple, bundle and share with ruby gems
RubyConfBD 2013   decouple, bundle and share with ruby gems RubyConfBD 2013   decouple, bundle and share with ruby gems
RubyConfBD 2013 decouple, bundle and share with ruby gems
 
Open Source Saturday - How can I contribute to Ruby on Rails?
Open Source Saturday - How can I contribute to Ruby on Rails?Open Source Saturday - How can I contribute to Ruby on Rails?
Open Source Saturday - How can I contribute to Ruby on Rails?
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage Server
 

More from Hiroshi SHIBATA

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Hiroshi SHIBATA
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?Hiroshi SHIBATA
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Hiroshi SHIBATA
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Hiroshi SHIBATA
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩Hiroshi SHIBATA
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard wayHiroshi SHIBATA
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with RubyHiroshi SHIBATA
 

More from Hiroshi SHIBATA (9)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard way
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with Ruby
 

Recently uploaded

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Gems on Ruby

  • 1. RubyGems/Bundler/rbenv Hiroshi SHIBATA / GMO Pepabo, Inc. 2018.08.26 LL Event 2018 Gems on Ruby
  • 3. Executive Officer CPO(Chief Productivity Officer) Director of Business Process Re-engineering Office Director of Technical Division at GMO Pepabo, Inc. @pepabo Hiroshi SHIBATA @hsbt https://www.hsbt.org
  • 4. self.introduce => { name: “SHIBATA Hiroshi”, nickname: “hsbt”, organizations: [“ruby”, “rubygems”, “bundler”, “asakusarb”, “railsgirls”, “pepabo”, …], commit_bits: [“ruby”, “rake”, “rubygems”, “bundler”, “rdoc”, “psych”, “ruby-build”, “railsgirls”, “railsgirls- jp”, …], sites: [“hsbt.org”, “ruby-lang.org”, “rubyci.org”, “railsgirls.com”, “railsgirls.jp”], }
  • 5.
  • 6.
  • 7. • History • RubyGems • Bundler • rbenv/ruby-build • RubyGems 3.0/4.0 • RubyGems & Bundler Agenda
  • 8. Answer • Must buy “Web+DB Press Vol.103” • You should use RubyGems/Bundler/ rbenv at all.
  • 10. • RAA(Ruby Application Archive) • 2013/08: raa.ruby-lang.org 終了のご報告 https:// www.ruby-lang.org/ja/news/2013/08/08/rip-raa/ • RubyForge • 2009/10: RubyForge To Be Phased Out, RubyGems.org Takes Over Gem Hosting https://www.infoq.com/news/ 2009/10/rubyforge-phased-out-rubygemsorg • gems.github.com • 2009/10: Gem Building is Defunct https://www.infoq.com/ news/2009/10/github-stops-gem-building Packaging and Disribution(1)
  • 11. • gemcutter.org: • https://github.com/rubygems/gemcutter • You can use `gem yank` command after you did invoke `gem i gemcutter`. • rubygems.org: • gemcutter.org was renamed to rubygems.org. • bundler: • 2010: Released to 1.0.0 version. Packaging and Disribution(2)
  • 13. • The package manager of Ruby libraries. • `gem install rails -v “~> 5.2”` • You can install specified version of Ruby libraries that called `Gem`. RubyGems handles global environment on your box. • You could specify `gem ‘rails’, ‘~> 5.2’` syntax without its dependency. What’s rubygems?
  • 14. What does mean “official”? “official” means “Matz controllable” Un-controllable examples: • ruby-doc.org • rubygems.org • bundler.io • Ruby version manager(rvm/rbenv/chruby) “RubyTogether” maintains RubyGems, Bundler and RubyGems.org(Rails Application).
  • 15. • Merge latest stable version into Ruby Core • Ruby 2.6.0 will bundle RubyGems 3.0(TBD) • Ruby 2.7 or 3.0 will bundle RubyGems 4.0(TBD) The policy of RubyGems versioning
  • 16. • RubyGems have HackerOne project. • 3 people handle vulnerability issues. • But We have no workflow about security release. • RubyGems 2.7.6 was accidentally released. Security
  • 18. • The vendoring tool of Ruby. • RubyGems couldn’t care dependency of Ruby libraries and isolate version managing with ruby process. • Bundler can do them with `Gemfile` What’s bundler? # frozen_string_literal: true source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gemspec # We need a newish Rake since Active Job sets its test tasks' descriptions. gem "rake", ">= 11.1"
  • 19. • RubyGems 2.x, 3.x uses Molinillo-0.5.7 • Bundler 1.16.x also uses Molinillo-0.6.4 • These are different versions and behavior of dependency resolver. Dependency Resolver incompatible ~/D/g/r/rubygems (master) > ls lib/rubygems/resolver/molinillo/lib/molinillo delegates dependency_graph.rb gem_metadata.rb resolution.rb state.rb dependency_graph errors.rb modules resolver.rb ~/D/g/b/bundler (master) > ls lib/bundler/vendor/molinillo/lib/molinillo compatibility.rb dependency_graph errors.rb modules resolver.rb delegates dependency_graph.rb gem_metadata.rb resolution.rb state.rb
  • 21. • The Ruby version manager (not ruby library) • The Ruby language will be released Dec.25 every year. You need to take care ruby versions in your box like Ruby 2.3, 2.4, 2.5… • Ruby isolates library locations used by Ruby versions. • rbenv(and ruby-build) provides an environment that makes version switching and its build definitions. What’s rbenv?
  • 22. Version number and release cycle We plan to release every Christmas day. • 2.1.0: 2013/12/25 • 2.2.0: 2014/12/25 • 2.3.0: 2015/12/25 • 2.4.0: 2016/12/25 • 2.5.0: 2017/12/25 • 2.6.0: 2018/12/25(TBD) • … • 3.0.0: 2020/xx/xx
  • 23. Ruby package manager RVM • To support Binary installation • Applied Custom patchset • Automatic installation of latest rubygems and bundler rbenv/ruby-build • Modify environment variables. • I’m also maintain them chruby/ruby-install • Modify a few environment variables.
  • 24. rbenv/ruby-build You can get them from • homebrew • git clone Basic instructions are: $ rbenv install 2.5.0 $ rbenv install 2.6.0-dev $ RUBY_CONFIGURE_OPT=—disable-install-doc rbenv install 2.4.3 $ rbenv install jruby-9.1.16.0 $ RUBY_CONFIGURE_OPT= rbenv install rbx-3.89
  • 25. RubyGems 3 & 4 5.
  • 26. • Removed deprecated methods. • Removed to support for < Ruby 2.2. • Added warnings of deprecated methods. • Server/Client side 2FA What’s new in RubyGems 3?
  • 27. • Surprisedly, RG 2.7 still supports Ruby 1.8. Ruby 1.8 in 2018 ~/D/g/r/rubygems (2.7) > rg respond_to test/rubygems/test_gem_request_set_gem_dependency_api.rb 630: tf.close! if tf.respond_to? :close! test/rubygems/test_gem_source.rb 60: response.uri = URI('http://example') if response.respond_to? :uri test/rubygems/test_gem_package.rb 755: tf.close! if tf.respond_to? :close! test/rubygems/test_gem_util.rb 45: if File.respond_to?(:realpath) test/rubygems/test_gem_installer.rb 58: str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding 65:if Gem.respond_to?(:activate_bin_path) 893: skip unless "".respond_to?(:force_encoding) test/rubygems/test_gem_specification.rb 2305: s.required_rubygems_version = Gem::Requirement.new("> 0".freeze) if s.respond_to? :required_ruby 2316: if s.respond_to? :specification_version then …snip
  • 28. • We can use Keywords argument, Refinement, Other cool features in RubyGems now. • Simple build matrix Only support Ruby 2.2+
  • 29. • It has non-compatible features. • Make enable as default for conservative option. • Behaviour changes with default gems installer. • Executables in bin folder conflict with their gem versions. • Make ruby gem install to user-install by default. RubyGems 4
  • 30. • We got the installation time when already installed gems. • To use conservative is ignore re-install action. Make conservative option as default ~ > gem i rails clone http://rubyonrails.org -> /Users/hsbt/Documents/rubyonrails.org git ls-remote http://rubyonrails.org hg identify http://rubyonrails.org svn info http://rubyonrails.org error Could not find version control system: http://rubyonrails.org exists /Users/hsbt/Documents/github.com/rails/rails Successfully installed rails-5.2.0 1 gem installed ~ > gem i rails —conservative ~ >
  • 31. • Rubygems 4 will install the all gems to `~/.gem` • Pros: Ruby in linux distribution has many of FAQ for gem installation for using `sudo`. This change resolve this issues. • Cons: Ruby version manager like rbenv is not support it. And This is big incompatible feature. Make `--user-install` as default
  • 33. • We are working to integrate RubyGems and Bundler. • But It’s still working progress status because there is no plan to release Bundler 2. • RubyGems 3&4 drop to support under the Ruby 2.2. Because Bundler 1.x still supports Ruby 1.8 and 1.9. • I’m waiting to release Bundler 2 for this integration. RubyGems/Bundler integration
  • 34. • Bundler was located rubygems repository as git submodule Bundler Integration(rubygems.rb) if USE_BUNDLER_FOR_GEMDEPS ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path) require 'rubygems/user_interaction' Gem::DefaultUserInteraction.use_ui(ui) do require "bundler" @gemdeps = Bundler.setup Bundler.ui = nil @gemdeps.requested_specs.map(&:to_spec).sort_by(&:name) end else rs = Gem::RequestSet.new @gemdeps = rs.load_gemdeps path rs.resolve_current.map do |s| s.full_spec.tap(&:activate) end end
  • 35. Ruby is designed to make programmers happy. Yukihiro Matz Matsumoto