# Configuration file for Gitlab's Continuous Integration
# https://docs.gitlab.com/ee/ci/yaml/

stages:
  - build

build:
  stage: build

  # Get docker image (see https://docs.gitlab.com/ee/ci/docker/using_docker_images.html)
  image: benjick/grav:latest
#  image: grav:latest
#  -> repository does not exist or may require 'docker login'

  # Be kind with the server and cache the vendors so we don't re-download them. Probably.
  cache:
    paths:
      - vendor/

  before_script:
#    - pwd
#    > /builds/m3p2/grav-website
#    - ls -la
#    > the full project, including .git

    # Install composer like a monkey
    - cd bin
    - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    #- php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    - php composer-setup.php
    - php -r "unlink('composer-setup.php');"
    - cd ..

#    - php bin/composer.phar install
    - rm -R user/pages
    - git clone https://m3p2.ljbac.com/m3p2/courses.git user/pages

  script:
    - pwd
    - ls -la
    - bin/grav
