Skip to content

Instantly share code, notes, and snippets.

View ocean's full-sized avatar
Ahoy there 🚢

Drew Robinson ocean

Ahoy there 🚢
View GitHub Profile
# Right, now to rewrite this in Ruby :-)
<?
/*
* This example would probably work best if you're using
* an MVC framework, but it can be used standalone as well.
*
* This example also assumes you are using Predis, the excellent
* PHP Redis library available here:
# sweet bro.
%w(rubygems sinatra haml sass dm-core dm-timestamps).each {|gem| require gem}
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/dev.db")
DataMapper.auto_upgrade!
get '/' do
haml :index
end
desc "Deploy to Heroku"
task :deploy_heroku do
app = 'myappname'
temp_path = "/tmp/heroku-deploys/#{app}"
deploy_path = "~/heroku-deploys/#{app}"
system "mkdir -p #{temp_path}"
system "rm -rf #{temp_path}/*"
system "tar -C . -cf - . | tar -C #{temp_path}/ -xpf -"
system "cd #{temp_path} && find . -regex '.*git.*' -exec rm -rf {} \\;"