This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
OlderNewer