Upgrade to Rails 5.0

Closes #377
This commit is contained in:
Artur Beljajev 2019-09-15 15:38:52 +03:00
parent bb108efedd
commit fa52001be6
141 changed files with 1388 additions and 1664 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

View file

@ -3,7 +3,7 @@ require 'pathname'
require 'fileutils'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
@ -22,7 +22,7 @@ Dir.chdir APP_ROOT do
end
puts "\n== Preparing database =="
system! 'bin/rake db:setup'
system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rake log:clear tmp:clear'

29
bin/update Normal file
View file

@ -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