Created
April 1, 2012 04:15
-
-
Save jstrocel/2271147 to your computer and use it in GitHub Desktop.
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
puts "-----------------------------------------------------------------------" | |
puts " - HerokuReady template - " | |
puts " Heroku with MongoDB and Thin Web Server " | |
puts " Cucumber and Rspec with Autotest " | |
puts "-----------------------------------------------------------------------" | |
app_name = ask("What do you want to call your Heroku app?") | |
github_user = ask("Please Enter your Github User Name ():") | |
github_api = ask("Please Enter your Github API Key (Go to http//github.com/settings/admin):") | |
puts "-----------------------------------------------------------------------" | |
puts "Remove unneeded files" | |
puts "-----------------------------------------------------------------------" | |
run 'rm public/index.html' | |
run 'rm app/assets/images/rails.png' | |
run 'rm README' | |
run 'touch README' | |
puts "-----------------------------------------------------------------------" | |
puts "Create Gemfile" | |
puts "-----------------------------------------------------------------------" | |
run 'rm Gemfile' | |
create_file 'Gemfile', <<HERE | |
source 'http://rubygems.org' | |
gem 'rails', '3.2.2.rc1' | |
gem 'mongo_mapper' | |
gem 'foreman' | |
gem 'bson_ext' | |
gem 'thin' | |
gem 'jquery-rails' | |
group :assets do | |
gem 'sass-rails', '~> 3.2.3' | |
gem 'coffee-rails', '~> 3.2.1' | |
gem 'less' | |
gem 'uglifier' | |
end | |
group :test do | |
gem "factory_girl_rails", ">= 1.7.0" | |
gem "email_spec", ">= 1.2.1" | |
gem "cucumber-rails", ">= 1.3.0" | |
gem "capybara", ">= 1.1.2" | |
gem "database_cleaner", ">= 0.7.1" | |
gem "launchy", ">= 2.0.5" | |
end | |
group :test, :development do | |
gem 'autotest' | |
gem 'autotest-rails' | |
gem 'autotest-fsevent' | |
gem 'autotest-growl' | |
gem 'autotest-rails-pure' | |
gem 'ZenTest' | |
gem "rspec-rails", ">= 2.8.1" | |
end | |
HERE | |
puts "-----------------------------------------------------------------------" | |
puts "Create Procfile" | |
puts "-----------------------------------------------------------------------" | |
create_file 'Procfile', "web: bundle exec rails server thin -p $PORT -e $RACK_ENV" | |
puts "-----------------------------------------------------------------------" | |
puts "Create database config" | |
puts "-----------------------------------------------------------------------" | |
run 'rm config/database.yml' | |
create_file 'config/initializers/mongo_config.rb', 'MongoMapper.database = "todo-#{Rails.env}"' | |
run "script/rails generate mongo_mapper:config" | |
inject_into_file 'config/application.rb', :after => "# Configure the default encoding used in templates for Ruby 1.9.\n" do <<-'RUBY' | |
config.generators do |g| | |
g.orm :mongo_mapper | |
end | |
RUBY | |
end | |
puts "-----------------------------------------------------------------------" | |
puts "Commit to git" | |
puts "-----------------------------------------------------------------------" | |
append_file '.gitignore' do | |
'.DS_Store' | |
end | |
run "curl -F 'login=#{github_user}' -F 'token=#{github_api}' https://github.com/api/v2/yaml/repos/create -F name=#{app_name}" | |
git :init | |
git :add => '.' | |
git :commit => "-m 'Initial commit of Rails app for Heroku Cedar'" | |
run "git remote add origin [email protected]:#{github_user}/#{app_name}.git" | |
puts "-----------------------------------------------------------------------" | |
puts "Create Heroku app" | |
puts "-----------------------------------------------------------------------" | |
run "heroku create #{app_name} --stack cedar" | |
run "heroku addons:add mongohq:free" | |
puts "-----------------------------------------------------------------------" | |
puts "Push to Heroku" | |
puts "-----------------------------------------------------------------------" | |
run "git push -u origin master" | |
run "git push heroku master" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment