bin/setup now installs JS, copies .env and creates secrets
This commit is contained in:
parent
6028b64cd7
commit
7a92df977b
1 changed files with 12 additions and 5 deletions
17
bin/setup
17
bin/setup
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'fileutils'
|
||||
require 'securerandom'
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
|
@ -13,14 +14,20 @@ FileUtils.chdir APP_ROOT do
|
|||
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
puts '== Installing dependencies (Ruby) =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
puts "\n== Installing dependencies (JS) =="
|
||||
system!('yarn -s')
|
||||
|
||||
puts "\n== Copying env file =="
|
||||
unless File.exist?('.env')
|
||||
FileUtils.cp '.env.template', '.env'
|
||||
end
|
||||
|
||||
puts "\n== Create new secrets =="
|
||||
File.write('.env', File.read('.env').gsub(/-- secret string --/) { SecureRandom.hex(64) })
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! 'bin/rails db:prepare'
|
||||
|
|
Loading…
Reference in a new issue