bin: get closer from the default template of Rails 6

This commit is contained in:
Pierre de La Morinerie 2020-07-09 10:45:04 +02:00
parent 0003dc167a
commit 4f8355664a
2 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,5 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'fileutils' require 'fileutils'
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path('..', __dir__)
@ -9,13 +8,15 @@ def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a starting point to setup your application.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts "\n== Installing dependencies ==" puts "\n== Installing dependencies =="
system! 'gem install bundler --conservative' system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install') system('bundle check') || system!('bundle install')
# Install JavaScript dependencies
system! 'bin/yarn install' system! 'bin/yarn install'
puts "\n== Updating webdrivers ==" puts "\n== Updating webdrivers =="
@ -23,7 +24,7 @@ chdir APP_ROOT do
puts "\n== Copying sample files ==" puts "\n== Copying sample files =="
unless File.exist?('.env') unless File.exist?('.env')
cp 'config/env.example', '.env' FileUtils.cp 'config/env.example', '.env'
end end
# Create the database, load the schema, and initialize it with the seed data # Create the database, load the schema, and initialize it with the seed data

View file

@ -1,6 +1,5 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'fileutils' require 'fileutils'
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path('..', __dir__)
@ -9,7 +8,7 @@ def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a way to update your development environment automatically. # This script is a way to update your development environment automatically.
# Add necessary update steps to this file. # Add necessary update steps to this file.