From b84216e4c96fc245233a02656fb85ce704bf8ef5 Mon Sep 17 00:00:00 2001 From: Dan Croak Date: Sun, 5 Jul 2009 17:18:49 -0400 Subject: [PATCH] tweaking script/create_project and heroku:setup rake tasks --- lib/tasks/heroku.rake | 8 +++++--- script/create_project | 29 +++++++++++++++-------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/lib/tasks/heroku.rake b/lib/tasks/heroku.rake index 9faf1a5..c51f2fc 100644 --- a/lib/tasks/heroku.rake +++ b/lib/tasks/heroku.rake @@ -1,3 +1,5 @@ +require 'rake' + namespace :heroku do def ask_yn(q) print "#{q} (y/n) " @@ -6,7 +8,7 @@ namespace :heroku do def ask_value(q) print " #{q}: " - STDIN.gets.strip.downcase + STDIN.gets.strip end desc "Prompt for all the config vars and set them on the Heroku app" @@ -34,7 +36,7 @@ namespace :heroku do puts "Setting all config vars on Heroku app" vars_string = vars.map { |k,v| "#{k}='#{v}'" }.join(' ') - sh "heroku config:add #{vars_string}" + `heroku config:add #{vars_string}` end desc "Create a new app" @@ -43,7 +45,7 @@ namespace :heroku do unless $?.success? puts "It doesn't look like this is a Heroku app (no git remote)." exit 1 unless ask_yn("Would you like to create a Heroku app now?") - sh "heroku create" + `heroku create` end end diff --git a/script/create_project b/script/create_project index 151844f..d71a71b 100755 --- a/script/create_project +++ b/script/create_project @@ -1,5 +1,6 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' +require File.join(File.dirname(__FILE__), "..", "lib", "tasks", "heroku.rake") require 'rubygems' require 'activesupport' require 'pathname' @@ -52,22 +53,22 @@ Dir.glob("#{project_directory}/**/session_store.rb").each do |file| search_and_replace(file, changesession, Digest::MD5.hexdigest("#{project_name} #{datestring}")) end -run("git commit -a -m 'Initial commit'") -run("rake db:migrate") +run("git commit -a -m 'New Heroku Suspenders app'") + +run "rake heroku:setup" + +puts "Deploying..." +run "git push heroku master" +run "heroku rake db:migrate" + +puts "Opening app..." +run "heroku open" + +run("rake db:migrate RAILS_ENV=development") run("rake db:migrate RAILS_ENV=test") run("rake db:migrate RAILS_ENV=cucumber") run("rake") -puts -puts "If you want email, edit config/initializers/mail.rb" -puts "If you want error notifications, edit config/initializers/hoptoad.rb" -puts "If you want file uploads, edit config/s3.yml" -puts -puts "When you're ready to deploy, run these commands:" -puts -puts "heroku create (or heroku create #{project_name})" -puts "git push heroku master" -puts "heroku rake db:migrate" -puts "heroku open" - +puts "Rename your app at any time with:" +puts "heroku rename newname" -- libgit2 0.21.2