Skip to content

Instantly share code, notes, and snippets.

View andyferra's full-sized avatar

Andy Ferra andyferra

View GitHub Profile
$ cap deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote git@github.com:andyferra/piggyback-savings.git master"
* executing "git clone -q git@github.com:andyferra/piggyback-savings.git /var/www/apps/piggybacksavings.com/releases/20090305184815 && cd /var/www/apps/piggybacksavings.com/releases/20090305184815 && git checkout -q -b deploy 0f8c9391ccf3c9630e7115df965152ac54a2291f && (echo 0f8c9391ccf3c9630e7115df965152ac54a2291f > /var/www/apps/piggybacksavings.com/releases/20090305184815/REVISION)"
servers: ["209.20.75.75"]
[209.20.75.75] executing command
** [209.20.75.75 :: out] Permission denied (publickey).
deploy@Piggyback:~$ git clone git@github.com:andyferra/piggyback-savings.git
Initialized empty Git repository in /home/deploy/piggyback-savings/.git/
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
fetch-pack from 'git@github.com:andyferra/piggyback-savings.git' failed.
[alias]
co = checkout
st = status
br = branch
ci = commit
df = diff
lg = log -p
[apply]
whitespace = nowarn
[color]
class LabeledFormBuilder < ActionView::Helpers::FormBuilder
%w(text_field password_field file_field).each do |method_name|
define_method(method_name) do |field_name, *args|
options = args.extract_options!
options[:class] = field_class(options, method_name)
@template.content_tag(:div, field_label(field_name, options) + super(field_name, options), :class => 'field')
end
end
@andyferra
andyferra / deploy.rb
Created March 11, 2009 18:37
Multi-stage Capistrano recipe with Passenger
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :use_sudo, false # deploy user should own the application directory
set :user, 'deploy'
set :runner, user
default_run_options[:pty] = true
class PostsController < ApplicationController
before_filter :require_user, :only => :preview
caches_page :index, :show, :with_tags
def index
@posts = Post.paginate( :order => 'published_at DESC', :page => params[:page] )
respond_to do |wants|
wants.html
<VirtualHost *:80>
<Directory /var/www/public_html/***********.com/production/current/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
</Directory>
DocumentRoot /var/www/public_html/***********.com/production/current/public
def javascript_for_controller
if File.exists?( File.join( RAILS_ROOT, 'public/javascripts', "#{params[:controller]}.js") )
javascript_include_tag params[:controller]
end
end
@andyferra
andyferra / production.rb
Created June 16, 2009 23:21
Consolidate pre-deployment tasks before shipping to Heroku
# Supresses automatic updates of SASS so as not to offend your Heroku slug
Sass::Plugin.options[:never_update] = true
package {
import flash.display.*;
import flash.events.*;
import net.slideshowpro.slideshowpro.*;
public class Slideshow extends Sprite {
private var _ssp;
private var _flashVars;