aboutsummaryrefslogtreecommitdiff
path: root/share/templater/drupal8/setup
blob: 738e4ecf12faed191b5d1ad706fca7eea93fc52f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Basic files templater module.
#

# Parameters
SHARE="$1"

# Include basic functions
source $SHARE/templater/functions || exit 1

# Drupal8 implementation
function templater_drupal8 {
  if [ ! -e 'settings.php' ]; then
    templater_echo "Setting up Drupal 8..."

    if [ ! -e ".gitignore" ] || ! grep -q "^settings.php" .gitignore; then
      echo settings.php      >> .gitignore
      echo settings.prod.php >> .gitignore
      echo services.yml      >> .gitignore
      echo files             >> .gitignore
      echo sql               >> .gitignore
    fi

    if [ ! -e "settings.dev.php" ]; then
      cp $SHARE/drupal8/files/default.settings.php settings.dev.php
      #cp $SHARE/drupal8/files/default.settings.php .
    fi

    ln -sf settings.dev.php settings.php

    if [ ! -e "services.yml" ]; then
      cp $SHARE/drupal8/files/default.services.yml services.dev.yml
      #cp $SHARE/drupal8/files/default.services.yml .
    fi

    ln -sf services.dev.yml services.yml

    templater_install_makefile $SHARE/drupal8/files/Makefile.drupal8

    if [ ! -e "drupal.make.yml" ]; then
      cp $SHARE/drupal8/files/drupal.make.yml .
    fi

    if [ -d "puppet" ] && [ ! -e "puppet/Puppetfile" ]; then
      cp $SHARE/drupal8/files/puppet/Puppetfile puppet/
    else
      cp $SHARE/drupal8/files/puppet/Puppetfile puppet/Puppetfile.drupal8
    fi

    if [ ! -e "bin/post-receive" ]; then
      mkdir -p bin && cp $SHARE/drupal8/files/bin/post-receive bin/
    fi

    mkdir -p files config/sync themes modules libraries vendor
    touch {files,config,themes,modules,libraries,vendor}/.empty
    git add -f {files,config/sync,themes,modules,libraries}/.empty
  else
    templater_echo "Drupal already set"
  fi
}

# Dispatch
templater_drupal8