diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/rails | 11 | ||||
| -rwxr-xr-x | bin/rake | 9 | ||||
| -rwxr-xr-x | bin/setup | 31 | 
3 files changed, 18 insertions, 33 deletions
| diff --git a/bin/rails b/bin/rails index 5badb2f..efc0377 100755 --- a/bin/rails +++ b/bin/rails | |||
| @@ -1,9 +1,4 @@ | |||
| 1 | #!/usr/bin/env ruby | 1 | #!/usr/bin/env ruby | 
| 2 | begin | 2 | APP_PATH = File.expand_path("../config/application", __dir__) | 
| 3 | load File.expand_path('../spring', __FILE__) | 3 | require_relative "../config/boot" | 
| 4 | rescue LoadError => e | 4 | require "rails/commands" | 
| 5 | raise unless e.message.include?('spring') | ||
| 6 | end | ||
| 7 | APP_PATH = File.expand_path('../config/application', __dir__) | ||
| 8 | require_relative '../config/boot' | ||
| 9 | require 'rails/commands' | ||
| diff --git a/bin/rake b/bin/rake index d87d5f5..4fbf10b 100755 --- a/bin/rake +++ b/bin/rake | |||
| @@ -1,9 +1,4 @@ | |||
| 1 | #!/usr/bin/env ruby | 1 | #!/usr/bin/env ruby | 
| 2 | begin | 2 | require_relative "../config/boot" | 
| 3 | load File.expand_path('../spring', __FILE__) | 3 | require "rake" | 
| 4 | rescue LoadError => e | ||
| 5 | raise unless e.message.include?('spring') | ||
| 6 | end | ||
| 7 | require_relative '../config/boot' | ||
| 8 | require 'rake' | ||
| 9 | Rake.application.run | 4 | Rake.application.run | 
| diff --git a/bin/setup b/bin/setup index 78c4e86..ec47b79 100755 --- a/bin/setup +++ b/bin/setup | |||
| @@ -1,38 +1,33 @@ | |||
| 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 set up or update your development environment automatically. | 
| 13 | # This script is idempotent, so that you can run it at any time 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 | # Install JavaScript dependencies if using Yarn | ||
| 22 | # system('bin/yarn') | ||
| 23 | |||
| 24 | 19 | ||
| 25 | # puts "\n== Copying sample files ==" | 20 | # puts "\n== Copying sample files ==" | 
| 26 | # unless File.exist?('config/database.yml') | 21 | # unless File.exist?("config/database.yml") | 
| 27 | # cp 'config/database.yml.sample', 'config/database.yml' | 22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml" | 
| 28 | # end | 23 | # end | 
| 29 | 24 | ||
| 30 | puts "\n== Preparing database ==" | 25 | puts "\n== Preparing database ==" | 
| 31 | system! 'bin/rails db:setup' | 26 | system! "bin/rails db:prepare" | 
| 32 | 27 | ||
| 33 | puts "\n== Removing old logs and tempfiles ==" | 28 | puts "\n== Removing old logs and tempfiles ==" | 
| 34 | system! 'bin/rails log:clear tmp:clear' | 29 | system! "bin/rails log:clear tmp:clear" | 
| 35 | 30 | ||
| 36 | puts "\n== Restarting application server ==" | 31 | puts "\n== Restarting application server ==" | 
| 37 | system! 'bin/rails restart' | 32 | system! "bin/rails restart" | 
| 38 | end | 33 | end | 
