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
desc "Show merb routes" | |
task :merb_routes => :merb_env do | |
require 'merb-core/rack/adapter/irb' | |
Merb::Rack::Console.new.show_routes | |
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
in environments/development.rb | |
Merb::BootLoader.before_app_loads do | |
DataMapper.setup(:default, 'mysql://user:demo@localhost/my_cool_app') | |
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
Merb::BootLoader.before_app_loads do | |
DataMapper.setup(:default, 'mysql://user:demo@localhost/app_db') | |
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
%w[net/http net/https uri ostruct rubygems json].each { |gem| require gem } | |
module HTTP | |
class UnSupportedFormat < StandardError; end | |
class UnAuthenticated < StandardError; end | |
MimeTypes = { :xml => "text/xml", :json => "application/json" } | |
def self.included(klass) | |
klass.extend ClassMethods | |
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
# This is used for updating all of our Submodules | |
# PLUGINS | |
# | |
# ==== Description | |
# | |
# Define your rails plugins here to be managed by git submodules. | |
# | |
# | |
@plugins = { |
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
# VersionControl.rb | |
# | |
# This is version control agnostic. You can use git, | |
# mercurial, subversion, bazaar | |
class VersionControl | |
class << self | |
# Run a command with any version control |
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 'rubygems' | |
require 'redis' | |
r = Redis.new | |
p 'set foo to "bar"' | |
r['foo'] = 'bar' | |
p 'value of foo' | |
p r['foo'] |
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
# Just drop this little diddy in your app to get some (not perfect) information on query times and such | |
# This will eventually become an official plugin but for those who can't wait, enjoy. | |
if defined?(NewRelic) | |
module MMNewRelicTracing | |
def self.included(model) | |
meths = %w[find find! paginate first last all count create create! update delete delete_all destroy destroy_all exists? find_by_id increment decrement set push push_all push_uniq pull pull_all] | |
model.metaclass.class_eval do | |
meths.each do |meth| |
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 Project | |
class Version | |
## | |
# The location of the version number file | |
# VERSION_FILE = File.join(Rails.root, 'config/build.version') | |
VERSION_FILE = File.join(File.dirname(__FILE__), 'build.version') | |
@@releases = %w[major minor point].freeze | |
## |
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
desc "Install Gem based on a branch (e.g. rake gemify[master] or rake gemify)." | |
task :gemify, :branch do |task, args| | |
branch = args[:branch].nil? || args[:branch] == '' ? 'master' : args[:branch] | |
puts "Going to checkout the #{branch} branch and build the gem for it." | |
# run commands | |
`rm -rf package` | |
`git checkout master` | |
`git pull origin #{branch}` |
OlderNewer