My RubyGems ToolboxPresented by Nickolas Kenyeres
A gem is a valuable nugget of reusable code
A gem is easy to install
gem install sinatra
Many gems live on RubyGems.org
& They wait anxiously for you to download them
Gems install to your Ruby $LOADPATH
A gem just needs to be required
require sinatra
get '/hi' do "Hello World!" end
–Confucius
“Above all else, a gem wants to be depended on”
Tell Bundler what you need
source 'https://rubygems.org'
gem 'sinatra', '~> 1.4.6' gem 'sqlite3'
Then tell Bundler what to do
bundle install
BUNDLER IS AN OPTIMIST
Bundler will give you version 2.0 if it exists Bundler knows no upper bound
gem 'sinatra', '>= 1.4’
BUNDLER IS A PESSIMIST
Bundler will give you less than version 2.02.0 is out of bounds
gem 'sinatra', '~> 1.4’
I AM A BIGGER PESSIMIST
Bundler will give you less than version 1.5.0 1.5.0 is out of bounds
gem 'sinatra', '~> 1.4.6’
Bundler works with Git
gem 'sinatra', git: https://github.com/sinatra/sinatra.git, branch: '2.2.0-alpha'
Bundler does Groups
gem 'rspec', group: [:development, :test]
group :production do gem 'unicorn' end
Ruby gems are often best in class
Documentation Test coverage
Semantic versioning Idiomatic
Configurable
SidekiqBackground jobs
https://github.com/mperham/sidekiq
RoadieInline styles in HTML email
https://github.com/Mange/roadie
CarrierwaveFile uploads made easy
https://github.com/carrierwaveuploader/carrierwave
Devise & Pundit Authentication & Authorization
https://github.com/plataformatec/devise
https://github.com/elabs/pundit
Nickolas Kenyeres | http://www.knicklabs.com