aboutsummaryrefslogtreecommitdiff
path: root/share/templater/drupal7/setup
blob: 70ebe0763ca61a51362e1eb811e334db446cfefe (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
#!/bin/bash
#
# Drupal 7 templater module.
#

# Parameters
SHARE="$1"

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

# Drupal7 implementation
function templater_drupal7 {
  if [ ! -e 'settings.dev.php' ]; then
    templater_echo "Setting up Drupal 7..."

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

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

    ln -sf settings.dev.php settings.php

    templater_install_makefile $SHARE/drupal7/files/Makefile.drupal7

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

    if [ ! -e "README.drupal7.md" ]; then
      cp $SHARE/drupal7/files/README.drupal8.md .
    fi

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

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

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

# Dispatch
templater_drupal7