class Object

Constants

APP_PATH

This command will automatically be run when you run “rails” with Rails 3 gems installed from the root of your application.

Public Instance Methods

_autopilot_setup() click to toggle source
# File lib/gaku/testing/common_rake.rb, line 50
def _autopilot_setup
  term_cover = " 1> /dev/null 2> /dev/null"
  puts "Setting up DB User, Database, and Extensions..."
  `sudo -u postgres psql -c "CREATE USER manabu WITH PASSWORD 'manabu';"#{term_cover}`
  `sudo -u postgres psql -c "ALTER USER manabu CREATEDB;"#{term_cover}`
  `sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS hstore;"#{term_cover}`

  `sudo -u postgres psql -c "DROP DATABASE gaku_test;"#{term_cover}`
  `sudo -u postgres psql -c "CREATE DATABASE gaku_test;"#{term_cover}`
  `sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"gaku_test\" to manabu;"#{term_cover}`
  `sudo -u postgres psql gaku_test -c "CREATE EXTENSION hstore;"#{term_cover}`
  `sudo -u postgres psql -c "ALTER DATABASE gaku_test OWNER TO manabu;"#{term_cover}`
  
  `sudo -u postgres psql -c "DROP DATABASE gaku_development;"#{term_cover}`
  `sudo -u postgres psql -c "CREATE DATABASE gaku_development;"#{term_cover}`
  `sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"gaku_development\" to manabu;"#{term_cover}`
  `sudo -u postgres psql gaku_development -c "CREATE EXTENSION hstore;"#{term_cover}`
  `sudo -u postgres psql -c "ALTER DATABASE gaku_development OWNER TO manabu;"#{term_cover}`
  puts "Done."

  puts "Running tasks..."
  `bundle exec rails app:update:bin db:environment:set db:migrate RAILS_ENV=test`
  puts "Done. If the test app does not run normally please follow the setup guide at: "
  puts "https://github.com/GAKUEngine/gaku"
end