aboutsummaryrefslogtreecommitdiffstats
path: root/test/dummy/bin/update
diff options
context:
space:
mode:
authorSam Stephenson <sam@37signals.com>2018-02-08 11:01:46 -0600
committerSam Stephenson <sam@37signals.com>2018-02-08 11:01:46 -0600
commit38e1f12d79ec3313e42643e52f2d10cb5fbd5d5d (patch)
treee62eb8fa577c1c27820bcf8fef5b07b0c1a6085d /test/dummy/bin/update
parent68d350ddacedf604717f0d1074d7624fa57757c2 (diff)
downloadrails-38e1f12d79ec3313e42643e52f2d10cb5fbd5d5d.tar.gz
rails-38e1f12d79ec3313e42643e52f2d10cb5fbd5d5d.tar.bz2
rails-38e1f12d79ec3313e42643e52f2d10cb5fbd5d5d.zip
Add dummy app
Diffstat (limited to 'test/dummy/bin/update')
-rwxr-xr-xtest/dummy/bin/update31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/dummy/bin/update b/test/dummy/bin/update
new file mode 100755
index 0000000000..58bfaed518
--- /dev/null
+++ b/test/dummy/bin/update
@@ -0,0 +1,31 @@
+#!/usr/bin/env ruby
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = File.expand_path('..', __dir__)
+
+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')
+
+ # Install JavaScript dependencies if using Yarn
+ # system('bin/yarn')
+
+ 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