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

Always Be Bundling - Denver gSchool

hone
July 14, 2014

Always Be Bundling - Denver gSchool

Talk about RubyGems, Bundler, and the Ruby Community given at the Denver gSchool class

hone

July 14, 2014
Tweet

More Decks by hone

Other Decks in Programming

Transcript

  1. $ tree ├── bin │ └── rackup ├── lib │

    ├── rack │ │ ├── server.rb │ └── rack.rb ├── rack.gemspec ├── Rakefile ├── README.rdoc └── test ├── spec_lobster.rb
  2. LOAD_PATH $ ruby -e "require 'pp';pp '$LOAD_PATH'" ["/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0 /x86_64-linux",

    "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/vendor_ruby/2.1.0", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/vendor_ruby/2.1.0 /x86_64-linux", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/vendor_ruby", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/x86_64-linux"]
  3. require require 'rack' ├── lib │ └── rack.rb require 'rack/auth/abstract/handler'

    ├── lib │ └── rack.rb │ │ ├── auth │ │ │ ├── abstract │ │ │ │ ├── handler.rb
  4. ~> (eat chunky bacon operator) ~> 3.0.0: >= 3.0.0, <

    3.1.0 ~> 3.0.1: >= 3.0.1, < 3.1.0 ~> 3.1: >= 3.1.0, < 4.0.0 ~> 3: >= 3.0.0, < 4.0.0
  5. bundle gem $ bundle gem new_gem create new_gem/Gemfile create new_gem/Rakefile

    create new_gem/LICENSE.txt create new_gem/README.md create new_gem/.gitignore create new_gem/new_gem.gemspec create new_gem/lib/new_gem.rb create new_gem/lib/new_gem/version.rb Initializing git repo in /tmp/new_gem
  6. Rake Tasks $ cat Rakefile require "bundler/gem_tasks" $ rake -T

    rake build # Build new_gem-0.0.1.gem into the pkg directory rake install # Build and install new_gem-0.0.1. gem into system gems rake release # Create tag v0.0.1 and build and push new_gem-0.0.1.gem to Rubygems
  7. rake build $ rake build new_gem 0.0.1 built to pkg/new_gem-0.0.1.gem.

    $ gem install pkg/new_gem-0.0.1.gem Successfully installed new_gem-0.0.1 1 gem installed
  8. bundle init $ bundle init Writing new Gemfile to /tmp/foobar/Gemfile

    $ cat Gemfile # A sample Gemfile source "https://rubygems.org" # gem "rails"
  9. bundle install $ bundle install --path vendor/bundle Fetching git://github.com/sinatra/sinatra.git Fetching

    gem metadata from https://rubygems.org/......... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Installing rspec-support 3.0.2 Installing diff-lcs 1.2.5 Using bundler 1.6.3 Installing tilt 1.4.1 Installing rspec-mocks 3.0.2 ... Installing rspec 3.0.0 Installing rack 1.4.0 (was 1.5.2) Installing rack-protection 1.5.3 Using sinatra 1.4.5 from git://github.com/sinatra/sinatra.git (at master) Your bundle is complete!
  10. bundle update source "https://rubygems.org" gem "rack", "1.5.2" gem "sinatra", github:

    "sinatra/sinatra" group :development, :test do gem "rspec" end
  11. bundle update $ bundle install Fetching gem metadata from https://rubygems.

    org/......... Fetching additional metadata from https: //rubygems.org/.. Resolving dependencies... You have requested: rack = 1.5.2 The bundle currently has rack locked at 1.4.0. Try running `bundle update rack`
  12. bundle update $ bundle update rack Fetching gem metadata from

    https://rubygems.org/......... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using diff-lcs 1.2.5 Using rspec-support 3.0.2 Using tilt 1.4.1 Using bundler 1.6.2 Using rspec-expectations 3.0.2 Using rspec-mocks 3.0.2 Using rspec-core 3.0.2 Using rspec 3.0.0 Installing rack 1.5.2 (was 1.4.0) Using rack-protection 1.5.3 Using sinatra 1.4.5 from git://github.com/sinatra/sinatra.git (at master) Your bundle is updated!
  13. GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.5) rack (1.5.2) rack-protection (1.5.3)

    rack rspec (3.0.0) rspec-core (~> 3.0.0) rspec-expectations (~> 3.0.0) rspec-mocks (~> 3.0.0) rspec-core (3.0.2) rspec-support (~> 3.0.0) rspec-expectations (3.0.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.0.0) rspec-mocks (3.0.2) rspec-support (~> 3.0.0) rspec-support (3.0.2) tilt (1.4.1)
  14. require "bundler/setup" $ ruby -e "require 'pp';require 'bundler/setup';pp $:" ["/tmp/foo/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib",

    "/home/hone/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.2 /lib/gems/bundler-1.6.2/lib", "/home/hone/.rvm/gems/ruby-2.1.2 @global/gems/bundler-1.6.2/lib", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0 /x86_64-linux", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/vendor_ruby/2.1.0", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/vendor_ruby/2.1.0 /x86_64-linux", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/vendor_ruby", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0", "/home/hone/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/x86_64-linux"]
  15. “I almost feel like Ruby is one of my children,

    but in fact, it is the result of the combined efforts of many people. Without their help, Ruby could never have become what it is.” - Yukihiro Matsumoto, “Matz”, まつもとゆきひろ
  16. Language has a grammar. But it also has a culture.

    It shapes the way we experience world.
  17. “I hope to see Ruby help every programmer in the

    world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language.” - Yukihiro Matsumoto, “Matz”, まつもとゆきひろ
  18. Top 5 Committers $ git shortlog -s --since=2012 | sort

    -rn | \ head -6 2739 nobu <--- 867 akr 710 svn 635 ko1 596 naruse 448 zzak