2011-10-14 15:40:41 +02:00
|
|
|
root_path = File.expand_path(File.dirname(__FILE__))
|
|
|
|
require File.join(root_path, "lib", "color")
|
|
|
|
include Color
|
|
|
|
|
|
|
|
#
|
|
|
|
# ruby ./update.rb development # or test or production (default)
|
|
|
|
#
|
|
|
|
envs = ["production", "test", "development"]
|
|
|
|
env = if envs.include?(ARGV[0])
|
|
|
|
ARGV[0]
|
|
|
|
else
|
|
|
|
"production"
|
|
|
|
end
|
|
|
|
|
2011-10-14 16:01:59 +02:00
|
|
|
puts green " == Update for ENV=#{env}"
|
2011-10-14 15:40:41 +02:00
|
|
|
|
|
|
|
# pull from github
|
2011-10-14 16:01:59 +02:00
|
|
|
`git pull`
|
2011-10-14 15:40:41 +02:00
|
|
|
|
|
|
|
`bundle install`
|
|
|
|
|
|
|
|
# migrate db
|
|
|
|
`bundle exec rake db:migrate RAILS_ENV=#{env}`
|
|
|
|
|
|
|
|
|
|
|
|
puts green " == Done! Now you can start/restart server"
|