diff options
-rw-r--r-- | TODO.md | 2 | ||||
-rw-r--r-- | share/templater/drupal8/files/puppet/Puppetfile (renamed from share/templater/drupal8/files/Puppetfile) | 0 | ||||
-rwxr-xr-x | share/templater/drupal8/setup | 4 | ||||
-rw-r--r-- | share/templater/templater/functions | 30 | ||||
-rwxr-xr-x | templater | 19 |
5 files changed, 48 insertions, 7 deletions
@@ -24,7 +24,7 @@ TODO * Code: * Makefiles: non-conflicting target names with aliases/shorthands in the main Makefile * Check/detect/verify mode, telling which modules are installed and checking for missing things (like LICENSE) - * Update and diff modes to compare/update configs between a project and templater's defaults + * Update mode to update configs between a project and templater's defaults * If git is in use, commit all changes, but check first it there are non-commited changes in the repo * Hugo: tell the user about adding a theme: http://gohugo.io/getting-started/quick-start/ * Be verbose about the need to review and edit files, adding LICENSE headers into source files, etc diff --git a/share/templater/drupal8/files/Puppetfile b/share/templater/drupal8/files/puppet/Puppetfile index 85b9e3c..85b9e3c 100644 --- a/share/templater/drupal8/files/Puppetfile +++ b/share/templater/drupal8/files/puppet/Puppetfile diff --git a/share/templater/drupal8/setup b/share/templater/drupal8/setup index f9c8dfc..738e4ec 100755 --- a/share/templater/drupal8/setup +++ b/share/templater/drupal8/setup @@ -43,9 +43,9 @@ function templater_drupal8 { fi if [ -d "puppet" ] && [ ! -e "puppet/Puppetfile" ]; then - cp $SHARE/drupal8/files/Puppetfile puppet/ + cp $SHARE/drupal8/files/puppet/Puppetfile puppet/ else - cp $SHARE/drupal8/files/Puppetfile puppet/Puppetfile.drupal8 + cp $SHARE/drupal8/files/puppet/Puppetfile puppet/Puppetfile.drupal8 fi if [ ! -e "bin/post-receive" ]; then diff --git a/share/templater/templater/functions b/share/templater/templater/functions index b8658d2..4507650 100644 --- a/share/templater/templater/functions +++ b/share/templater/templater/functions @@ -104,3 +104,33 @@ function templater_install_makefile { # echo Makefile.local >> .gitignore #fi } + +# Check differences +function templater_diff { + local module="$1" + local cwd="`pwd`" + + if [ -z "$module" ]; then + return + fi + + if [ ! -d "$SHARE/$module/files" ]; then + return + fi + + ( + cd $SHARE/$module/files + + find . -type f | while read file; do + # File exists, check differences + if [ -e "$cwd/$file" ]; then + diff -u $cwd/$file $file + else + # Use a templaterignore instead + if echo $file | grep -q -v 'example'; then + templater_echo "Missing $file" + fi + fi + done + ) +} @@ -65,16 +65,27 @@ templater_init # Go to project folder cd $PROJECT &> /dev/null -# Setup modules +# Process modules if [ -z "$MODULES" ]; then for project in `templater_implementations`; do templater_ask $project done else for module in $MODULES; do - if `templater_implementations | grep -q "^$module"`; then - #templater_$module - $SHARE/$module/setup $SHARE + # Skip options + if echo $module | grep -q '^--'; then + continue + fi + + #if `templater_implementations | grep -q "^$module"`; then + if [ -d "$SHARE/$module" ]; then + # Dispatch + if echo $* | grep -q -- '--diff'; then + templater_diff $module + #elif echo $* | grep -q -- '--update'; then + else + $SHARE/$module/setup $SHARE + fi else templater_echo "No such module $module, skipping" fi |