Mercurial > rsstweet
comparison bin/setup @ 72:257910c60eb3
Rails 5 \o/
| author | nanaya <me@myconan.net> |
|---|---|
| date | Fri, 13 May 2016 04:32:21 +0900 |
| parents | 541427960031 |
| children | f67f3ad50270 |
comparison
equal
deleted
inserted
replaced
| 71:e4cc80d72926 | 72:257910c60eb3 |
|---|---|
| 1 #!/usr/bin/env ruby | 1 #!/usr/bin/env ruby |
| 2 require "pathname" | 2 require "pathname" |
| 3 require "fileutils" | |
| 4 include FileUtils | |
| 3 | 5 |
| 4 # path to your application root. | 6 # path to your application root. |
| 5 APP_ROOT = Pathname.new File.expand_path("../../", __FILE__) | 7 APP_ROOT = Pathname.new File.expand_path("../../", __FILE__) |
| 6 | 8 |
| 7 Dir.chdir APP_ROOT do | 9 def system!(*args) |
| 10 system(*args) || abort("\n== Command #{args} failed ==") | |
| 11 end | |
| 12 | |
| 13 chdir APP_ROOT do | |
| 8 # This script is a starting point to setup your application. | 14 # This script is a starting point to setup your application. |
| 9 # Add necessary setup steps to this file: | 15 # Add necessary setup steps to this file. |
| 10 | 16 |
| 11 puts "== Installing dependencies ==" | 17 puts "== Installing dependencies ==" |
| 12 system "gem install bundler --conservative" | 18 system! "gem install bundler --conservative" |
| 13 system "bundle check || bundle install" | 19 system("bundle check") || system!("bundle install") |
| 14 | 20 |
| 15 # puts "\n== Copying sample files ==" | 21 # puts "\n== Copying sample files ==" |
| 16 # unless File.exist?("config/database.yml") | 22 # unless File.exist?('config/database.yml') |
| 17 # system "cp config/database.yml.sample config/database.yml" | 23 # cp 'config/database.yml.sample', 'config/database.yml' |
| 18 # end | 24 # end |
| 19 | 25 |
| 20 puts "\n== Preparing database ==" | 26 puts "\n== Preparing database ==" |
| 21 system "bin/rake db:setup" | 27 system! "bin/rails db:setup" |
| 22 | 28 |
| 23 puts "\n== Removing old logs and tempfiles ==" | 29 puts "\n== Removing old logs and tempfiles ==" |
| 24 system "rm -f log/*" | 30 system! "bin/rails log:clear tmp:clear" |
| 25 system "rm -rf tmp/cache" | |
| 26 | 31 |
| 27 puts "\n== Restarting application server ==" | 32 puts "\n== Restarting application server ==" |
| 28 system "touch tmp/restart.txt" | 33 system! "bin/rails restart" |
| 29 end | 34 end |
