Mercurial > rsstweet
comparison bin/setup @ 185:f67f3ad50270
Update to latest rails and gems
| author | nanaya <me@nanaya.pro> |
|---|---|
| date | Sun, 14 Jul 2019 15:38:04 +0900 |
| parents | 257910c60eb3 |
| children | 2335107f35d0 |
comparison
equal
deleted
inserted
replaced
| 184:a35c2733552f | 185:f67f3ad50270 |
|---|---|
| 1 #!/usr/bin/env ruby | 1 #!/usr/bin/env ruby |
| 2 require "pathname" | 2 require 'fileutils' |
| 3 require "fileutils" | |
| 4 include FileUtils | |
| 5 | 3 |
| 6 # path to your application root. | 4 # path to your application root. |
| 7 APP_ROOT = Pathname.new File.expand_path("../../", __FILE__) | 5 APP_ROOT = File.expand_path('..', __dir__) |
| 8 | 6 |
| 9 def system!(*args) | 7 def system!(*args) |
| 10 system(*args) || abort("\n== Command #{args} failed ==") | 8 system(*args) || abort("\n== Command #{args} failed ==") |
| 11 end | 9 end |
| 12 | 10 |
| 13 chdir APP_ROOT do | 11 FileUtils.chdir APP_ROOT do |
| 14 # This script is a starting point to setup your application. | 12 # This script is a way to setup or update your development environment automatically. |
| 13 # This script is idempotent, so that you can run it at anytime and get an expectable outcome. | |
| 15 # Add necessary setup steps to this file. | 14 # Add necessary setup steps to this file. |
| 16 | 15 |
| 17 puts "== Installing dependencies ==" | 16 puts '== Installing dependencies ==' |
| 18 system! "gem install bundler --conservative" | 17 system! 'gem install bundler --conservative' |
| 19 system("bundle check") || system!("bundle install") | 18 system('bundle check') || system!('bundle install') |
| 20 | |
| 21 # puts "\n== Copying sample files ==" | |
| 22 # unless File.exist?('config/database.yml') | |
| 23 # cp 'config/database.yml.sample', 'config/database.yml' | |
| 24 # end | |
| 25 | |
| 26 puts "\n== Preparing database ==" | |
| 27 system! "bin/rails db:setup" | |
| 28 | 19 |
| 29 puts "\n== Removing old logs and tempfiles ==" | 20 puts "\n== Removing old logs and tempfiles ==" |
| 30 system! "bin/rails log:clear tmp:clear" | 21 system! 'bin/rails log:clear tmp:clear' |
| 31 | 22 |
| 32 puts "\n== Restarting application server ==" | 23 puts "\n== Restarting application server ==" |
| 33 system! "bin/rails restart" | 24 system! 'bin/rails restart' |
| 34 end | 25 end |
