summaryrefslogtreecommitdiff
path: root/bin/update
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2017-09-24 12:56:20 -0600
committermo <mo.khan@gmail.com>2017-09-24 12:56:20 -0600
commita67e0cb103f76df6095257857e5f980340f3c940 (patch)
tree7602d8e3f1c2bb721afaf4d891c1e3800c7166c6 /bin/update
parent96d66bcdb7bad43c3ec08349d2d978aec307ec90 (diff)
upgrade to rails 5.1
Diffstat (limited to 'bin/update')
-rwxr-xr-xbin/update29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/update b/bin/update
new file mode 100755
index 00000000..a8e4462f
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end