Skip to content

Instantly share code, notes, and snippets.

View richievos's full-sized avatar

Richie Vos richievos

View GitHub Profile
require 'fileutils'
namespace :sprout do
desc "Fakes out sprout making it think your flex3sdk tool's exes are in your desired flex sdk path (FLEX_SDK_PATH)"
task :fake_flex_sdk do
sdk_cache = File.join(ENV['HOME'], '.sprouts', 'cache', 'sprout-flex3sdk-tool-3.3.0')
FileUtils.mkdir_p sdk_cache
FileUtils.touch(File.join(sdk_cache, 'flex_sdk_3.zip'))
FileUtils.ln_s ENV['FLEX_SDK_PATH'], File.join(sdk_cache, 'archive')
end
# Optional more complicated strat for the database.yml
require 'ftools'
namespace :config do
task :build do
File.mkdir_p temp_config_dir
# this is the place to hook after when creating a config file
end
task :update do
# upload contents of temp_config_dir to #{release_path}/config
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'json'
require 'yaml'
require 'highline/import'
require File.dirname(__FILE__) + '/../lib/coop/status'
cred_info = if File.exist?('config/coop-creds.yml')
YAML.load(File.read('config/coop-creds.yml'))
local_libraries = %w(restfulx random_project_one)
local_libraries_path = '~/workspace'
# this assumes you are dealing with something with the common gem format
# my_library/
# my_library/lib
# my_library/lib/my_library.rb
local_libraries.each do |library|
$: << "#{local_libraries_path}/#{library}/lib"
# sorry if this is confusing, but it's a rake task with an argument
task :setup_custom_symlinks, [:root_path] do |t, args|
require 'file_utils'
root_path = args.root_path
libraries = %w(restfulX ...)
vendor_dir = 'vendor/plugins'
FileUtils.mkdir_p vendor_dir
libraries.each do |library|
FileUtils.ln_s(File.join(root_path, library), File.join(vendor_dir, library)
namespace :bundler do
task :install, :roles => :app, :except => { :no_release => true } do
run("gem install bundler --source=http://gemcutter.org")
end
task :symlink_vendor, :roles => :app, :except => { :no_release => true } do
shared_gems = File.join(shared_path, 'vendor/gems/ruby/1.8')
release_gems = "#{release_path}/vendor/gems/ruby/1.8"
# if you don't commit your cache, add cache to this list
%w(gems specifications).each do |sub_dir|
module Capistrano
class Configuration
module Namespaces
def skippable_task(name, *args, &block)
task name, *args do
if find_servers_for_task(current_task).empty?
logger.info "skipping #{current_task.fully_qualified_name} since it matches no servers"
else
block.call
end
class CreatedContext
def p
Proc.new { |x| puts "proc: #{self.inspect} on #{x.inspect}"}
end
def l
lambda { |x| puts "lambda: #{self.inspect} on #{x.inspect}"}
end
end
AppTweeter = Struct.new(:status) do
class << self
def new_user(user)
update("#{user.name} just signed up!")
end
def update(status)
status = "[#{Rails.env}] #{status}" unless Rails.env.production?
Delayed::Job.enqueue AppTweeter.new(status)
end
require 'pp'
votes = {
"gus" => ["Colonel Panic", "Cigar Heroes"],
"shinji" => ["Bomb Squad","Taco Town"],
"nawara" => ["Colonel Panic", "Taco Town", "Danger!! Death Ray"],
"dodos" => [],
"richie" => ["Bomb Squad", "Death Ray", "Bomb Ray Death Squad"],
"colin" => ["Colonel Panic", "Taco Town"],
"joey" => ["Danger!! Death Ray", "Bomb Squad"]