Skip to content

Instantly share code, notes, and snippets.

namespace :deploy do
task :setup_options do
# Set our group
set(:group) do
Capistrano::CLI.ui.ask("Enter cluster you want to deploy to (default 'default'): ")
end
set :group, 'default' unless group != ''
# Packages
Factory.sequence :package_tracking_number do |n|
"1Z9999W9999999999#{n}"
end
Factory.define :package do |p|
p.shipment { |shipment| shipment.association(:shipment) }
p.tracking_number { Factory.next(:package_tracking_number) }
p.vendor_type { |z| z.association(:package_fedex_envelope) }
p.weight 1.00
@bkaney
bkaney / gist:17072
Created October 16, 2008 03:36
Sample routing specs
describe UsersController, " (routing)" do
describe "generation" do
it "should route users's 'index' action correctly" do
route_for(:controller => 'admin/users', :action => 'index').should == "/admin/users"
end
# Other route_for's...
Index: lib/plugins/acts_as_asset/lib/everyone.rb
===================================================================
--- lib/plugins/acts_as_asset/lib/everyone.rb (revision 5414)
+++ lib/plugins/acts_as_asset/lib/everyone.rb (working copy)
@@ -17,11 +17,15 @@
# in the database for 'Everyone' -- this will allow referential integrity to be maintained
# when ACL records reference 'Everyone'
Asset.connection.execute("INSERT INTO assets(id, asset_type) VALUES(#{ID},'Everyone')");
+ # Sometimes within the context of a transaction, the finder was returning nil
+ # from the Everyone.find_by_id, so creating and object with the same data....
bkaney@brians-macbook-pro:~/Projects/plectix/kappa_web/trunk/base/vendor/plugins/clustered_servers $ rake
(in /Users/bkaney/Projects/plectix/kappa_web/trunk/base/vendor/plugins/clustered_servers)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -Ilib:lib "/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/aborting_job_test.rb" "test/crashing_job_test.rb" "test/delegating_job_test.rb" "test/failing_job_test.rb" "test/file_chaining_test.rb" "test/has_network_files_test.rb" "test/implied_last_step_job_test.rb" "test/imported_job_test.rb" "test/logging_test.rb" "test/multi_step_job_test.rb" "test/multiplication_file_test.rb" "test/parent_job_test.rb" "test/progress_verification_job_test.rb" "test/simple_job_test.rb"
== AddTestTables: migrating ==================================================
-- create_table("containers", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "containers_id_seq" for serial column "containers.id"
NOTICE: CREATE TABL
describe BooksController do
describe "route recognition" do
it "should generate params from POST /books" do
params_from(:post, '/books').should == {:controller => 'books', :action => 'create'}
end
# ...other routes here
Then /trivial/ do
SiteHelper.day_of_month(Date.today)
end
alias sgi32='sudo env ARCHFLAGS="-Os -arch i386 -fno-common" gem install --no-ri --no-rdoc'
alias sgi64='sudo env ARCHFLAGS="-Os -arch x86_64 -fno-common" gem install --no-ri --no-rdoc'
require 'net/http'
require 'uri'
require 'json'
require 'daemons'
# EDIT POST_RECEIVE_URL
POST_RECEIVE_URL = "http://integrity/push"
old_head, new_head, ref = STDIN.gets.split
revision_text = `git rev-list --pretty=medium #{new_head} ^#{old_head}`
@bkaney
bkaney / git-workflow.md
Created November 24, 2009 16:49
Git Workflow with Backporting to origin/master

Git Workflow

Consider three remote branches origin/master, origin/staging and origin/production. The master is the shared developers' edge. Staging is what is tested before a push to production and production is the code that gets deployed.

New Development