diff --git a/bin/setup b/bin/setup index 94fd4d7..4aba81c 100755 --- a/bin/setup +++ b/bin/setup @@ -1,36 +1,33 @@ #!/usr/bin/env ruby -require 'fileutils' -include FileUtils +# frozen_string_literal: true -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +require 'fileutils' + +APP_ROOT = File.expand_path('..', __dir__).freeze def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") + system(*args) or abort "\n== Command #{args} failed ==" end -chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file. +FileUtils.chdir APP_ROOT do + puts '== Update RubyGems ==' + system! 'gem update --system' - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts '== Update Bundler ==' + system! "gem install bundler -v '~> 2.0'" - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') + puts '== Installing gems ==' + system 'bundle check' or system! 'bundle install' - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' - # end + puts '== Install JavaScript dependencies ==' + system! 'bin/rake yarn:install' - puts "\n== Preparing database ==" + puts '== Preparing database ==' system! 'bin/rails db:setup' - puts "\n== Removing old logs and tempfiles ==" + puts '== Removing old logs and tempfiles ==' system! 'bin/rails log:clear tmp:clear' - puts "\n== Restarting application server ==" + puts '== Restarting application server ==' system! 'bin/rails restart' end diff --git a/bin/update b/bin/update index 58bfaed..d70bd44 100755 --- a/bin/update +++ b/bin/update @@ -1,31 +1,33 @@ #!/usr/bin/env ruby -require 'fileutils' -include FileUtils +# frozen_string_literal: true -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +require 'fileutils' + +APP_ROOT = File.expand_path('..', __dir__).freeze def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") + system(*args) or 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. +FileUtils.chdir APP_ROOT do + puts '== Update RubyGems ==' + system! 'gem update --system' - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts '== Update Bundler ==' + system! "gem install bundler -v '~> 2.0'" - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') + puts '== Installing gems ==' + system 'bundle check' or system! 'bundle install' - puts "\n== Updating database ==" + puts '== Install JavaScript dependencies ==' + system! 'bin/rake yarn:install' + + puts '== Updating database ==' system! 'bin/rails db:migrate' - puts "\n== Removing old logs and tempfiles ==" + puts '== Removing old logs and tempfiles ==' system! 'bin/rails log:clear tmp:clear' - puts "\n== Restarting application server ==" + puts '== Restarting application server ==' system! 'bin/rails restart' end