aboutsummaryrefslogtreecommitdiff
path: root/share/templater/drupal8/setup
blob: 70c0185a55a5bac9a52cef760f8e00a846dcce0f (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
65
66
67
68
69
70
71
72
73
74
75
#!/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.local.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 "settings.local.php" ]; then
      cp $SHARE/drupal7/files/settings.local.php settings.local.php
    fi

    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 [ ! -e "README.drupal8.md" ]; then
      cp $SHARE/drupal8/files/README.drupal8.md .
    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

    # Use pushtodeploy instead
    #if [ ! -e "bin/post-receive" ]; then
    #  mkdir -p bin && cp $SHARE/drupal8/files/bin/post-receive bin/
    #fi
    templater_echo "Please use pushtodeploy module for automatede deploymends"

    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