RubyConf 2017 Day Two

Ruby Conf 2017 Day Two

A New Pair of Shoes! by Jason R. Clark


$ rbenv install jruby-
$ gem install shoes --pre


packages into a jar

Demo apps



shoes-core      swt
Shoes::Rect --- Shoes::Swt::Rect

swt can be swapped out with others, for example Electron

gem 'warbler'
gem 'furoshiki' (OS-specific packaging on top of warbler)
gem 'shoes-manual'

A History of Bundles: 2010 to 2017 by Andre Arko

Two insights (Making bundler 1.0)

  1. need a runtime dependency resolver For example if lib A depends on lib C version 1.5 lib B depends on lib C version 1.5.1

1.5.1 is probably okay but need to figure out that’s true more than install-time because two conflicting dependencies may

  1. resolution needs a lock file installing different gems on different computers in a deterministic way

Now it’s too slow (2010-2012)

Cool new stuff!

$ bundle clean
$ bundle outdated
$ bundle cache

big deal for CI and heroku

(2012-2015) separate bundler API and new features

So many new Bundler users DDoSed, a completely new Bundler API separately from ruby gem repo. Separated database from but out of sync. Aside from the distributed system of data, there were also propagation delays and CDN caching in canada.

More cool new stuff!

bundler first CVE for sourced gem

problem: anyone can publish to ruby gem with the same name and the resolution can be ambigous. solution: (don’t put source in your gem or) if you use source put the gems inside the source block.

(2015-2017) a new hope!

Other notable features

Gemfile -> gems.rb (optional)
Ruby version locked, upgradable
bundle lock + ---add platform
bundle doctor - to figure why bundle isn't working
bundle pristine - work just like gem pristine
bundle update --patch (allow just the major minor)
bundle config mirror
checksum validation on install

a plugin system! (beta)

The future (2017-????)

Bundler 2.0 expected release date christmas. While we do plan on making breaking changes, we do believe in compatibility and each on-by default config options can be disabled for compatbility for bundler 1.x.

On by default (Best practices)

bundle config only_update_to_newer_versions true
bundle config disable_multisource true
bundle config specific_platform ture
bundle config global_gem-cache true
bundle config default_install_uses_path true (nokogiri doesn't get compiled twice yay)

Lightning Pro-tips

$ bundle open <GEMNAME>
<edit you gem>
$ bundle pristine <GEMNAME>

Dispelling the dark magic: Inside a Ruby debugger by Daniel Azuma

mystery of the debugger

like how the total eclipse can be mysterfiying for the ancients

I am a puts debugger by tenderlove

Debugger features live coding

TracePoint has been available since Ruby 2.0

debuggers at the basic level are straightforward!

In about 60 lines we can write a complete MiniDebug class + module that breakpoint, irb, step/out and over

MiniDebug class

def initialize(description, breakpoint, line_number)
  <add the description and breakpoint to an arary>

In the add_breakpoint method

Tracepoint.trace(... <other events>, :call) |tp| do
  <find the matching breakpoint class and line>

JRuby: What Why How by Thomas E Enebo and Charles Oliver Nutter

Use of java libraries



$ jirb
> frame = "hello!"
> frame.set_size 300, 300
> frame.add button

JVM Tooling

Comes with visual JDK

Java JVM Just in time compiler (JIT)

Benchmarks compared to CRuby High Performance

JRuby 1.25x (Slightly faster than CRuby)
JRuby + JIT 1.34x
JRuby + JIT + inline 5x
JRuby + JIT + inline + indy 8x
JRuby + JIT + indy + inline + Graal 8+x

Do we need it?

Better concurrency

MRI requires a process per concurrent request

JRuby can handle all rewuests in on e process

JRuby on Rails

Why are we lagging behind

  1. compatbility
    ARJDBC -> AR    to     Java  Database Connectivity
            |                |     |             |
           ActiveRecord     jruby  Postgresql   connectivity library
            |                |
            Rails            Ruby

Multiple versions of each library

  1. will be supporting a subset of versions

Set Up App

bundle install = 90% of the work Run through the tests, migrate

Deploying JRuby

Recommended books

Migration case studies

Good news

Bad news

We could use some help