Skip to content

Instantly share code, notes, and snippets.

@hotsen
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save hotsen/9944883f467c4a666098 to your computer and use it in GitHub Desktop.

Select an option

Save hotsen/9944883f467c4a666098 to your computer and use it in GitHub Desktop.
Put this into bin folder of a rails 4.2 app and run it ...
#!/usr/bin/env ruby
require 'pathname'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
puts "[ boooootstrap:host ] Installing gem dependencies ..."
system "gem install bundler --conservative"
system "bundle check || bundle install --clean"
puts "[ boooootstrap:host ] Creating config files ..."
unless File.exist?("config/database.yml")
system "cp config/database.yml.example config/database.yml"
end
puts "[ boooootstrap:database ] Setting development database ..."
system "bin/rake db:setup"
# puts "[ boooootstrap:database ] Dropping development database ..."
# system "bin/rake db:drop"
#
# puts "[ boooootstrap:database ] Creating development database ..."
# system "bin/rake db:create"
#
# puts "[ boooootstrap:database ] Migrating development database ..."
# system "bin/rake db:migrate"
# puts "[ boooootstrap:database ] Migrating test database ..."
# system "bin/rake db:migrate RAILS_ENV=test"
puts "[ boooootstrap:database ] Seeding development database ..."
system "bin/rake db:seed"
puts "[ boooootstrap:database ] Seeding test database ..."
system "bin/rake db:seed RAILS_ENV=test"
puts "[ boooootstrap:test ] Running tests ..."
system "bin/rake test"
puts "[ boooootstrap:env ] Clearing tmp files ..."
system "bin/rake log:clear"
system "bin/rake tmp:create"
system "bin/rake tmp:clear"
puts "[ boooootstrap:env ] Loading dotenv variables ..."
system "bin/rake dotenv"
puts "[ boooootstrap:run ] Analyzing codebase ..."
system "bin/rake stats"
puts "[ boooootstrap:run ] Considering ..."
system "bin/rake notes"
puts "[ boooootstrap:run ] Starting rails server ..."
system "bin/bundle exec foreman start"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment