annotate bin/update @ 72:257910c60eb3

Rails 5 \o/
author nanaya <me@myconan.net>
date Fri, 13 May 2016 04:32:21 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
1 #!/usr/bin/env ruby
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
2 require "pathname"
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
3 require "fileutils"
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
4 include FileUtils
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
5
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
6 # path to your application root.
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
7 APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
8
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
9 def system!(*args)
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
10 system(*args) || abort("\n== Command #{args} failed ==")
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
11 end
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
12
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
13 chdir APP_ROOT do
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
14 # This script is a way to update your development environment automatically.
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
15 # Add necessary update steps to this file.
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
16
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
17 puts "== Installing dependencies =="
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
18 system! "gem install bundler --conservative"
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
19 system("bundle check") || system!("bundle install")
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
20
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
21 puts "\n== Updating database =="
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
22 system! "bin/rails db:migrate"
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
23
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
24 puts "\n== Removing old logs and tempfiles =="
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
25 system! "bin/rails log:clear tmp:clear"
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
26
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
27 puts "\n== Restarting application server =="
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
28 system! "bin/rails restart"
257910c60eb3 Rails 5 \o/
nanaya <me@myconan.net>
parents:
diff changeset
29 end