Skip to content

Instantly share code, notes, and snippets.

@selman
Created September 7, 2010 23:08
Show Gist options
  • Save selman/569310 to your computer and use it in GitHub Desktop.
Save selman/569310 to your computer and use it in GitHub Desktop.
Padrino heroku template
RAKEFILE = <<-RAKEFILE
require File.dirname(__FILE__) + '/config/boot.rb'
require 'thor'
require 'padrino-core/cli/rake'
PadrinoTasks.init
RAKEFILE
PV = Padrino.version
GEMFILE = <<-GEMFILE
source :rubygems
gem 'rack-flash'
gem 'haml'
gem 'data_mapper'
gem 'padrino-core', "#{PV}"
gem 'padrino-helpers', "#{PV}" #optional
gem 'padrino-mailer', "#{PV}" #optional
gem 'padrino-admin', "#{PV}" #optional
group :production do
gem 'dm-postgres-adapter'
end
group :development do
gem 'heroku'
gem 'padrino-gen', "#{PV}"
gem 'rake'
gem 'thin' # or mongrel
gem 'dm-sqlite-adapter'
end
group :test do
gem 'rspec', '~> 1.3.1', :require => "spec"
gem 'rack-test', :require => "rack/test"
end
GEMFILE
GITIGNORE = <<-GITIGNORE
## MAC OS
.DS_Store
## TEXTMATE
*.tmproj
tmtags
## EMACS
*~
\#*
.\#*
## VIM
*.swp
## PROJECT::GENERAL
.bundle
db/*.db
## PROJECT::SPECIFIC
GITIGNORE
SLUGIGNORE = <<-SLUGIGNORE
test
spec
SLUGIGNORE
say
tiny = yes?("Do you need a tiny structure?").present?
project :orm => :datamapper, :test => :rspec, :script => :rightjs, :renderer => :haml, :stylesheet => :sass, :tiny => tiny
create_file destination_root('Rakefile'), RAKEFILE
create_file destination_root('.gitignore'), GITIGNORE
say "You must say yes :)", :red
create_file destination_root('Gemfile'), GEMFILE
create_file destination_root('.slugignore'), SLUGIGNORE
gsub_file 'config/database.rb', /\".*production\.db\"\)/, "ENV['DATABASE_URL']"
say "Bundling application dependencies using bundler (without production) ...", :red
in_root { run 'bundle install --without production' }
say
if yes?("Would you like to generate the padrino admin?")
generate :admin
rake "dm:create dm:migrate"
end
say "now edit your db/seed.rb"
say "git init"
say "git add ."
say "git commit -m \"initial commit for app\""
say "heroku create"
say "heroku config:add BUNDLE_WITHOUT=\"development test\""
say "git push heroku master"
say "heroku rake dm:migrate"
say "heroku rake seed"
say "heroku open"
say
say "to learn same procedures with activerecord look here:"
say "http://www.padrinorb.com/guides/blog-tutorial#deploying-our-application", :red
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment