---
- name: update database
  shell: "../vendor/bin/drush updb -y"
  args:
    chdir: "{{ web_dir }}/web/"
  tags: deploy

- name: config sync import
  shell: "../vendor/bin/drush cim -y"
  args:
    chdir: "{{ web_dir }}/web/"
  when: config_import
  tags: deploy

- name: cache rebuild
  shell: "../vendor/bin/drush cr all"
  args:
    chdir: "{{ web_dir }}/web/"
  tags: deploy

# Internal deploy process (CI):
# Git checkout projectURI to /home/{user}/site/, allowing overwrite of:
#   /web/themes/custom/[*.tpl|*.yml]
#   /config
# "Build"? (e.g. sassc)
# Write correct settings.local
# (push/rsync from CI -> stage)
# [link to drutopia version]
# updb/cim/cr
#
# -> test - wipe config and import.
# -> stage/prod - compare configurations.
#
# Already configured via _hosting:
#   apache.conf
#   db (empty?)
#   user acct/apache process/etc
#   fpm pool
#   php.user.ini
#     ...email, logging, etc
#
#
# vendor:
#   - composer install
# compile css:
#   - sassc
#
# default: test
# SETTINGS_TARGET: copy localhost
#
# drupal (local):
#   - vendor, settings
#   - drush si
#   - chmod u+w defaultdir
#
# build:
#   - mk build
#   - git ark installation
#   - composer install -d build_dir --no_dev
#   - settings
#   - mk sass dir/file
#
# deploy_config:
#   - rsync config
#
# deploy_web:
#   - rsync web (excl default)
#
# deploy_vendor:
#   - rsync vendor
#
# deploy:
#   - config+vendor+web
#   - drush updb
#   - drush cim
#   - drush cr
#
#
#
# namespace :test do
#   desc "Run Behat tests."
#   task :behat => [:vendor] do
#     sh "./vendor/bin/behat --tags '~@javascript' --format pretty --out std --format junit --out reports"
#   end
#
#   desc "Run performance tests."
#   task :performance => [:vendor] do
#     sh "./vendor/bin/phpunit --bootstrap ./vendor/autoload.php --log-junit reports/performance.xml tests/"
#   end
# end
#
