Skip to content

Instantly share code, notes, and snippets.

# you'd obviously have more settings somewhere
set :scm, :git
set :repository, "git@github.com:defunkt/github.git"
set :branch, "origin/master"
set :migrate_target, :current
set(:latest_release) { fetch(:current_path) }
set(:release_path) { fetch(:current_path) }
set(:current_release) { fetch(:current_path) }
@hedgehog
hedgehog / hypothetical_libcloud_example.rb
Created December 29, 2009 08:45
Hypothetical port of the libcloud example to Ruby
## from libcloud.types import Provider
## from libcloud.providers import get_driver
require 'fog/types'
require 'fog/providers'
## EC2 = get_driver(Provider.EC2)
## Slicehost = get_driver(Provider.SLICEHOST)
## Rackspace = get_driver(Provider.RACKSPACE)
EC2 = Fog::Provider.new(:ec2) # syntax 1
#!/usr/bin/env ruby
def parse_missing_required(input)
matches = input.match(/Missing these required gems:([\s\S]*)You're running:/)
matches[1].strip.split("\n").map do |line|
m = line.match(/^\s*(\S+)\s+(\S+\s+[0-9.]+)/)
p line if m.nil?
{:name => m[1], :version => m[2]}
end
end
# Gemfile
gem "cc-wordpress", "0.5.0", :git => "file:///usr/src/cc-wordpress",
:tag => "default"
@hedgehog
hedgehog / gist:386057
Created May 1, 2010 04:43
EC2 AMI with chef-server installed
# install_chef_server.sh
#
# From list post by John Merrells <john@merrells.com>
# Modified by Mike Bailey <mike@bailey.net.au>
logfile="/root/log.txt"
echo "-----" >> $logfile
# New sources.list
cat > /etc/apt/sources.list << EOF
# Background:
# @repo = Grit::Repo.new(@active_project_folder)
When /^the repository status is clean$/ do
steps %Q{
Then no files are untracked
And no files are changed
And no files are added
And no files are deleted
}
end
@hedgehog
hedgehog / gist:734462
Created December 9, 2010 07:58
Role example from Opscode's rails-quick-start repo
name "base"
description "Base role applied to all nodes."
run_list(
"recipe[apt]",
"recipe[git]",
"recipe[build-essential]",
"recipe[ruby]"
)
@hedgehog
hedgehog / gist:734465
Created December 9, 2010 08:00
Role example from Opscode's rails-quick-start repo after `bundle install ...` downloads cookbooks
name "base"
description "Base role applied to all nodes."
run_list(
"recipe[cc-apt-0cb9519bf687]",
"recipe[cc-git-730475fa9847]",
"recipe[cc-build-essential-b458e6200289]",
"recipe[cc-ruby-e42796a7e807]"
)
@hedgehog
hedgehog / gist:734475
Created December 9, 2010 08:23
Example listing of Bundler installed cookbooks
$ bundle install --gemfile /path/to/rails-quick-start.gemfile \
--install-path /path/to/rails-quick-start/cookbooks
$ ls /path/to/rails-quick-start/cookbooks
cache cc-packages-35e85e0ab6b2
cc-apache2-490a410a8a38 cc-passenger_apache2-ef5688ef1e51
cc-application-144f665d1e52 cc-passenger_enterprise-ce23f03ac342
cc-apt-0cb9519bf687 cc-radiant-38c2de357868
cc-aws-502ce059e3e2 cc-rails-564b986e7bd7
cc-build-essential-b458e6200289 cc-ruby-e42796a7e807
@hedgehog
hedgehog / gist:734523
Created December 9, 2010 09:25
wget a Github tagged cookbook archive
$ cd /tmp
$ wget --no-check-certificate -o qa-latest.tgz https://github.com/cookbooks/cc-activemq/tarball/qa-latest