This file contains 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
task 'db:test:prepare' => :close_postgres_connections | |
task :close_postgres_connections => :environment do | |
#Kill any other open connections on the test db | |
db_adapter = defined?(::ActiveRecord::Base) ? ActiveRecord::Base.connection : nil | |
db_adapter ||= defined?(::Sequel::Model) ? ::Sequel::Model.db : nil | |
if Rails.env.test? && db_adapter | |
db_config = Rails.configuration.database_configuration[Rails.env].symbolize_keys | |
begin |
This file contains 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
#WIP | |
#spec/spec_helper.rb | |
RSpec.configure do |config| | |
#Only for selenium based tested filtered with :js => true on tests | |
#eg: describe "Some test", :js => true do | |
# end | |
config.around(:each, :js => true) do |example| |
This file contains 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
gem 'launchy' | |
ENV["LAUNCHY_BROWSER"] = `which google-chrome`.strip | |
save_and_open_page |
This file contains 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 MoneyModel < ActiveRecord::Base | |
# =============== | |
# = Composition = | |
# =============== | |
composed_of :amount, :class_name => 'Money', :mapping => [[:amount_in_cents, :cents]] | |
composed_of :gst, :class_name => 'Money', :mapping => [[:gst_in_cents, :cents]] | |
composed_of :amount_including_gst, :class_name => 'Money', :mapping => [[:amount_including_gst_in_cents, :cents]] | |
end |
This file contains 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 CommaModel < ActiveRecord::Base | |
# ======= | |
# = CSV = | |
# ======= | |
comma do | |
some_column | |
native_column | |
association :to_s => 'Custom Label' | |
column_with_lambda 'Custom Header' do |p| p && Money.new(p) end | |
association_2 { |s| "'#{s.to_s(:csv)}" } |
This file contains 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
HUBOT_IRC_PORT="6667" HUBOT_IRC_SERVER="irc.freenode.net" HUBOT_IRC_ROOMS="#room_name room_password" HUBOT_IRC_NICK="hubot" bin/hubot |
This file contains 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
#Load in rails via: | |
# config/initializers/core_extensions.rb | |
#Forcibly require our core extensions after rails has loaded | |
Dir.glob(Rails.root.join('lib', 'core_ext', '*.rb')).each { |extension| require extension } |
This file contains 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
Rake::Task.class_eval do | |
#Required to ensure SimpleCov doesn't overwrite coverage shared values | |
alias :execute_without_simplecov_command :execute | |
def execute_and_set_simplecov_command args=nil | |
ENV['COV_COMMAND'] = "rspec:#{name}" if ENV['COVERAGE'] | |
execute_without_simplecov_command(args) | |
end | |
alias :execute :execute_and_set_simplecov_command | |
end |
This file contains 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
#!/bin/sh | |
# | |
# This script starts and stops the Resque daemon | |
# This script belongs in /engineyard/bin/resque | |
# | |
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH | |
CURDIR=`pwd` | |
usage() { |
This file contains 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
# | |
# Cookbook Name:: resque | |
# Recipe:: default | |
# | |
# Install resque on app_master rather than utility server so outbound traffic is routed via the Elastic IP | |
# | |
app_name = node[:engineyard][:environment][:apps][0][:name] | |
if ['app_master', 'app', 'util', 'solo'].include?(node[:instance_role]) |