#!/usr/bin/env ruby
require "pathname"
require "rake"

include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path("../../",  __FILE__)

puts APP_ROOT

chdir APP_ROOT do
  # This script is a starting point to setup your application.
  # Add necessary setup steps to this file:

  unless system("bin/bundle check &> /dev/null")
    puts "\n== Installing dependencies =="
    sh "bin/bundle install --path=vendor/bundle"
    sh "bin/bundle clean"
  end

  puts "\n== Removing old logs and tempfiles =="
  touch "tmp/restart.txt"
  puts ""
end
