about summary refs log tree commit diff stats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rails11
-rwxr-xr-xbin/rake9
-rwxr-xr-xbin/setup31
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
2begin 2APP_PATH = File.expand_path("../config/application", __dir__)
3 load File.expand_path('../spring', __FILE__) 3require_relative "../config/boot"
4rescue LoadError => e 4require "rails/commands"
5 raise unless e.message.include?('spring')
6end
7APP_PATH = File.expand_path('../config/application', __dir__)
8require_relative '../config/boot'
9require '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
2begin 2require_relative "../config/boot"
3 load File.expand_path('../spring', __FILE__) 3require "rake"
4rescue LoadError => e
5 raise unless e.message.include?('spring')
6end
7require_relative '../config/boot'
8require 'rake'
9Rake.application.run 4Rake.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
2require 'pathname' 2require "fileutils"
3require 'fileutils'
4include FileUtils
5 3
6# path to your application root. 4# path to your application root.
7APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 5APP_ROOT = File.expand_path("..", __dir__)
8 6
9def system!(*args) 7def system!(*args)
10 system(*args) || abort("\n== Command #{args} failed ==") 8 system(*args) || abort("\n== Command #{args} failed ==")
11end 9end
12 10
13chdir APP_ROOT do 11FileUtils.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"
38end 33end