The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
20 Favorite Ruby Gems (Ignite RailsConf)
1. authlogic
class UserSession < Authlogic::Session::Base
end
class ApplicationController < ActionController::Base
private
def current_user_session
UserSession.find
end
def current_user
current_user_session && current_user_session.record
end
binarylogic
2. bcrypt-ruby
require 'bcrypt'
class User < ActiveRecord::Base
# users.password_hash in the database is a :string
include BCrypt
def password
@password ||= Password.new(password_hash)
end
def password=(new_password)
@password = Password.create(new_password)
self.password_hash = @password
end
end
codahale
3. capybara
describe "the signup process", :type => :request do
before :each do
User.make(:email => 'user@ex.com', :password => 'caplin')
end
it "signs me in" do
within("#session") do
fill_in 'Login', :with => 'user@example.com'
fill_in 'Password', :with => 'password'
end
click_link 'Sign in'
end
end
jnicklas
5. factory_girl
Factory.define :simple_map, :parent => :map do |m|
m.name "Simple Map"
m.size 5
m.after_create do |map|
map.with_grid do |grid|
grid.add_feature(Terrain::Dirt,1,1,3,3)
grid.add_feature(MapObjects::BlueCrystal,1,1)
grid.add_feature(Landmarks::Mountain,4,4)
end
end
end
context "saving and restoring" do
it "preserves all data types in the grid" do
map = Factory(:simple_map)
map.feature_at(1,1).terrain.name.should == Terrain::Dirt
end
end
thoughtbot
9. grb
=> create new branch `branch`
$ grb new [branch]
=> track branch
$ grb track `branch`
=> add a remote repo
$ grb remote_add `name` `repo path`
=> remove a remote repo
$ grb remote_rm `name`
jinzhu
10. guard (guard-*)
guard 'bundler' do
watch('Gemfile')
end
guard 'rspec' do
watch(%r{^spec/.+_spec.rb})
watch(%r{^lib/(.+).rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
guard 'coffeescript', :output => 'public/js/compiled' do
watch(%r{^app/coffeescripts/.+.coffee})
end
thibaudgg
12. omniauth
require 'oa-oauth'
use OmniAuth::Strategies::Twitter, 'KEY', 'SECRET'
# redirect user to /auth/twitter
# twitter redirects user to /auth/twitter/callback
get '/auth/twitter/callback' do
auth_hash = request.env['omniauth.auth']
end
intridea
18. spork
Guard is now watching at '/Users/subelsky/code/exp-world'
Starting Spork for RSpec
Spork server for RSpec successfully started
Guard::RSpec is running, with RSpec 2!
Running all specs
Using RSpec
Loading Spork.prefork block...
........................................................
Finished in 2 seconds
74 examples, 0 failures
URL