Run all setup steps on startup

It's a bit dirty, but it works :)
This commit is contained in:
Matt-Yorkley
2019-06-15 00:03:27 +01:00
committed by François Turbelin
parent 53a0f70aa0
commit 60e67ae1a4
2 changed files with 1 additions and 23 deletions

View File

@@ -28,8 +28,7 @@ services:
command: >
bash -c "(bundle check || bundle install) &&
wait-for-it -t 30 db:5432 &&
bundle exec rake db:create &&
bundle exec rake ofn:dev:setup &&
bundle exec rake db:setup db:test:prepare ofn:sample_data || true &&
rm -f tmp/pids/server.pid &&
bundle exec rails s -p 3000 -b '0.0.0.0'"

View File

@@ -1,26 +1,5 @@
namespace :ofn do
namespace :dev do
desc 'Setup dev environment'
task setup: :environment do
p '== Entering setup'
# NOTE: Could be helpful to drop and create again the db here
# Rake::Task['db:drop'].invoke
# Rake::Task['db:create'].invoke
unless Spree::User.table_exists? && Spree::User.count
p '== Load data schema'
Rake::Task['db:schema:load'].invoke
# TODO: Integrate the tasks loading data
# Issue to reach stdin while creating Admin account
# Rake::Task['db:seed'].invoke
# Rake::Task['ofn:sample_data'].invoke
end
p '== Migrate'
Rake::Task['db:migrate'].invoke
end
desc 'load sample data'
task load_sample_data: :environment do
require_relative '../../spec/factories'