Mountain Lion (10.8) has three main difference compared to Lion (10.7):
- XCode 4.4 does not install Command Line Tools by default
- X11 isn't available anymore
- The installed version of OpenSSL has some bugs
| #Session controller provides a token | |
| #/controllers/api/sessions_controller.rb | |
| class Api::SessionsController < Devise::SessionsController | |
| before_filter :authenticate_user!, :except => [:create] | |
| before_filter :ensure_params_exist, :except => [:destroy] | |
| respond_to :json | |
| def create | |
| resource = User.find_for_database_authentication(:email => params[:user_login][:email]) | |
| return invalid_login_attempt unless resource |
| require 'faye' | |
| Faye::WebSocket.load_adapter('thin') | |
| use Faye::RackAdapter, :mount => '/faye', :timeout => 25 | |
| require ::File.expand_path('../config/environment', __FILE__) | |
| run App::Application |
| require 'gollum/frontend/app' | |
| require 'digest/sha1' | |
| class App < Precious::App | |
| User = Struct.new(:name, :email, :password_hash, :can_write) | |
| before { authenticate! } | |
| before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end | |
| helpers do |
by Jonathan Rochkind, http://bibwild.wordpress.com
Capistrano automates pushing out a new version of your application to a deployment location.
I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".
| require 'benchmark' | |
| def explicit | |
| return "TEST" | |
| end | |
| def implicit | |
| "TEST" | |
| end |
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'daemons' | |
| dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
| daemon_options = { | |
| :multiple => false, | |
| :dir_mode => :normal, | |
| :dir => File.join(dir, 'tmp', 'pids'), | |
| :backtrace => true |
| module Paperclip | |
| class Cropper < Thumbnail | |
| def transformation_command | |
| if crop_command | |
| crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ') # super returns an array like this: ["-resize", "100x", "-crop", "100x100+0+0", "+repage"] | |
| else | |
| super | |
| end | |
| end |