#!/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 "== Installing dependencies =="
  system "gem install bundler --conservative"
  system "bundle check || bundle install --path vendor/bundle"

  puts "\n== Preparing database =="
  system "bin/rake db:setup"

  puts "\n== Removing old logs and tempfiles =="
  system "rm -f log/*"
  system "rm -rf tmp/cache"

  puts "\n== Manual tasks =="
  puts "\n* In config/secrets.yml change secret_key_base"
  puts "\n* config/schleuder-web.yml add tls_fingerprint and api_key (get them from the admins that run schleuder-api-daemon)."
end
