Skip to content

Commit

Permalink
Teach bin/setup about our environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Draper committed Oct 21, 2015
1 parent 2050494 commit 723b418
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
24 changes: 14 additions & 10 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@ require 'pathname'
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"

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# end
puts "\n== Copying sample files =="
unless File.exist?("config/database.yml")
system "cp config/database.pg.yml config/database.yml"
end
unless File.exist?("certs/v2_key")
system "cp certs/v2_key.dev certs/v2_key"
end
unless File.exist?("REGION")
File.open("REGION", "w") { |f| f.puts "0" }
end

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

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

puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
puts "\n== Preparing tests =="
system "bin/rake test:vmdb:setup"
end
16 changes: 16 additions & 0 deletions bin/update
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
require 'pathname'

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

Dir.chdir APP_ROOT do
puts "== Installing dependencies =="
system "bundle update"

puts "\n== Migrating database =="
system "bin/rake db:migrate db:seed"

puts "\n== Resetting tests =="
system "bin/rake test:vmdb:setup"
end

0 comments on commit 723b418

Please sign in to comment.