From 2da1b4416c5a8fca5db31e20657c182b8a59376b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 17 Nov 2017 10:13:55 -0200 Subject: Global Makefile --- share/templater/drupal8/files/Makefile | 200 --------------------- share/templater/drupal8/files/Makefile.drupal8 | 200 +++++++++++++++++++++ share/templater/drupal8/setup | 12 +- share/templater/ikiwiki/files/Makefile | 39 ---- share/templater/ikiwiki/files/Makefile.ikiwiki | 39 ++++ share/templater/ikiwiki/files/www/Makefile | 35 ---- share/templater/ikiwiki/files/www/Makefile.ikiwiki | 35 ++++ share/templater/ikiwiki/setup | 8 +- share/templater/pelican/files/Makefile | 37 ---- share/templater/pelican/files/Makefile.pelican | 37 ++++ share/templater/pelican/setup | 8 +- share/templater/sphinx/files/Makefile | 160 ----------------- share/templater/sphinx/files/Makefile.sphinx | 160 +++++++++++++++++ share/templater/sphinx/setup | 8 +- share/templater/templater/files/Makefile | 18 ++ share/templater/templater/functions | 23 +++ 16 files changed, 516 insertions(+), 503 deletions(-) delete mode 100644 share/templater/drupal8/files/Makefile create mode 100644 share/templater/drupal8/files/Makefile.drupal8 delete mode 100644 share/templater/ikiwiki/files/Makefile create mode 100644 share/templater/ikiwiki/files/Makefile.ikiwiki delete mode 100644 share/templater/ikiwiki/files/www/Makefile create mode 100644 share/templater/ikiwiki/files/www/Makefile.ikiwiki delete mode 100644 share/templater/pelican/files/Makefile create mode 100644 share/templater/pelican/files/Makefile.pelican delete mode 100644 share/templater/sphinx/files/Makefile create mode 100644 share/templater/sphinx/files/Makefile.sphinx create mode 100644 share/templater/templater/files/Makefile (limited to 'share') diff --git a/share/templater/drupal8/files/Makefile b/share/templater/drupal8/files/Makefile deleted file mode 100644 index f424f3e..0000000 --- a/share/templater/drupal8/files/Makefile +++ /dev/null @@ -1,200 +0,0 @@ -# -# Makefile for a Drupal 8 Website -# - -# Parameters -CORE = 8 -PROJECT = drupal -ENV ?= dev -CONTAINER = kvmx # vagrant or even docker -DATE = $(shell date +%Y%m%d) -CWD = $(shell pwd) -DESTDIR ?= /var/www/data # vendor -DRUPAL = $(DESTDIR)/drupal-$(CORE) -DRUSH = drush -r $(DRUPAL) -l $(PROJECT) - -# Include local customizations/overrides, which might be .gitignore'd -# See https://www.gnu.org/software/make/manual/html_node/Include.html --include Makefile.local - -# Setup production environment -production: submodules post_receive drush settings ownership - -# Setup a development environment -develop: submodules $(CONTAINER) - #rm -rf $(DRUPAL)/sites/default - #ln -s $(PROJECT) $(DRUPAL)/sites/default - #vagrant ssh -c "$(DRUSH) pm-enable devel -y" - echo '( cd /srv/kvmx && make drush )' | kvmx ssh - #kvmx ssh "$(DRUSH) pm-enable devel -y" - -# Old target -# Install the platform -#platform: drupal drush settings symlinks initdb cache - -# Keep code in sync -sync-code: update drush cache import - -# Initialize and update git submodules -submodules: - git submodule sync --recursive - git submodule update --init --recursive - -# Setup the virtual machine using vagrant -vagrant: - vagrant up - -# Setup the virtual machine using kvmx -kvmx: - kvmx provision - -# Old target -# Download drupal, setup folder structure and config file -# -# You might want to use "-n" to avoid _drush_recursive_copy cpu hog if previous -# installation already exists when using 9p filesystem -#drupal: -# #rm -rf $(DESTDIR)/drupal-$(CORE)* && drush pm-download -y -v drupal-$(CORE) --destination=/tmp/drupal && mv /tmp/drupal/drupal-$(CORE).* $(DESTDIR)/ -# #drush pm-download -y -v drupal-$(CORE) --destination=$(DESTDIR) -# #( cd $(DRUPAL)/.. && ln -s drupal-$(CORE).* drupal-$(CORE) ) -# BASE=$(DESTDIR) drupal download $(CORE) - -# Old target -# Make the needed symlinks -#symlinks: -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/files -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/config -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/themes -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/modules -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/libraries - -# Default settings -default_settings: - test -s sites.php || cp $(DRUPAL)/sites/example.sites.php sites.php - test -s settings.dev.php || cp $(DRUPAL)/sites/default/default.settings.php settings.dev.php - test -s services.dev.yml || cp $(DRUPAL)/sites/default/default.services.yml services.dev.yml - -# Custom settings -custom_settings: - #test -s $(DRUPAL)/sites/sites.php || cp sites.php $(DRUPAL)/sites/sites.php - #mkdir -p $(DRUPAL)/sites/$(PROJECT) - #test -s $(DRUPAL)/sites/$(PROJECT)/settings.$(ENV).php || cp settings.dev.php $(DRUPAL)/sites/$(PROJECT)/settings.$(ENV).php - #test -s $(DRUPAL)/sites/$(PROJECT)/settings.php || ln -s settings.$(ENV).php $(DRUPAL)/sites/$(PROJECT)/settings.php - #test -s $(DRUPAL)/sites/$(PROJECT)/services.$(ENV).yml || cp services.dev.yml $(DRUPAL)/sites/$(PROJECT)/services.$(ENV).yml - #test -s $(DRUPAL)/sites/$(PROJECT)/services.yml || ln -s services.$(ENV).yml $(DRUPAL)/sites/$(PROJECT)/services.yml - #chmod 640 $(DRUPAL)/sites/$(PROJECT)/settings.php - #chmod 640 $(DRUPAL)/sites/$(PROJECT)/services.yml - test -s settings.$(ENV).php || cp settings.dev.php settings.$(ENV).php - test -s settings.php || ln -s settings.$(ENV).php settings.php - test -s services.$(ENV).yml || cp services.dev.yml services.$(ENV).yml - test -s services.yml || ln -s services.$(ENV).yml services.yml - chmod 640 settings.php - chmod 640 services.yml - -# Setup drupal settings -settings: default_settings custom_settings - test -s $(DRUPAL)/sites/sites.php || sudo cp sites.php $(DRUPAL)/sites/sites.php - -# Fix ownership -ownership: - sudo chown -R $(PROJECT). $(DRUPAL)/sites/$(PROJECT) - sudo chmod 755 $(DRUPAL)/sites/$(PROJECT) - -# Run drush makefile -drush: - sudo drush make -n --no-core drupal.make.yml $(DRUPAL) - -# Run drush site-install -site_install: settings - $(DRUSH) site-install -y - -# Run drush site-install, sqlite version -# See https://api.drupal.org/api/drupal/core%21INSTALL.sqlite.txt/8.4.x -site_install_sqlite: settings - mkdir -p sql/.ht.sqlite - touch sql/dumps/.ht.sqlite - $(DRUSH) site-install --db-url=sqlite://$(CWD)/sql/dumps/.ht.sqlite - -# Update the database -updatedb: - $(DRUSH) updatedb -y - -# Load the database dump, clear the drupal cache and fix image paths -# See https://www.drupal.org/node/628130 -initdb: - test -s sql/dumps/latest.sql.gz && gzip -dc sql/dumps/latest.sql.gz | $(DRUSH) sql-cli || true - test -s sql/dumps/latest.sql.gz && $(DRUSH) updatedb -y || true - -# Dump the database -dumpdb: - mkdir -p sql/dumps - rm -f sql/dumps/latest.sql.gz - rm -f sql/dumps/$(DATE).sql.gz - $(DRUSH) sql-dump > sql/dumps/$(DATE).sql - ( cd sql/dumps && gzip $(DATE).sql && ln -s $(DATE).sql.gz latest.sql.gz ) - -# Clear drupal cache -cache: - $(DRUSH) cache-rebuild - -# Destroy the database -destroydb: - echo "DROP DATABASE $(PROJECT); CREATE DATABASE $(PROJECT);" | $(DRUSH) sql-cli - -# Reinitializes the database -reinitdb: destroydb initdb - -# Cleanup develop environment -clean: - vagrant halt - vagrant destroy -f - kvmx stop - kvmx destroy - rm -rf vendor/drupal* - -# Export configuration -export: - $(DRUSH) config-export -y - -# Import configuration -import: - $(DRUSH) config-import -y - -# Diff configuration -# Needs https://github.com/eriktufvesson/drush-config-diff -diff: - $(DRUSH) config-diff - -# Update the codebase -update: pull submodules - -# Upgrade modules -upgrade-modules: - $(DRUSH) up - -# Upgrade drupal -upgrade-drupal: - BASE=$(DESTDIR) drupal upgrade $(CORE) - -# Configure update hook on remote host -post_receive: - git config receive.denyCurrentBranch ignore - cd .git/hooks && ln -sf ../../bin/post-receive - -# Pull changes -pull: - git pull - -# Reset the working copy -reset: - #git reset HEAD - git checkout -f - -# Fix local folder permission -perms: - chmod 755 . - -# Deploy code pushed on remote host -deploy: perms reset submodules - drush cache-rebuild - drush config-import -y diff --git a/share/templater/drupal8/files/Makefile.drupal8 b/share/templater/drupal8/files/Makefile.drupal8 new file mode 100644 index 0000000..55375a5 --- /dev/null +++ b/share/templater/drupal8/files/Makefile.drupal8 @@ -0,0 +1,200 @@ +# +# Makefile for a Drupal 8 Website +# + +# Parameters +CORE = 8 +PROJECT = drupal +ENV ?= dev +CONTAINER = kvmx # vagrant or even docker +DATE = $(shell date +%Y%m%d) +CWD = $(shell pwd) +DESTDIR ?= /var/www/data # vendor +DRUPAL = $(DESTDIR)/drupal-$(CORE) +DRUSH = drush -r $(DRUPAL) -l $(PROJECT) + +# Include local customizations/overrides, which might be .gitignore'd +# See https://www.gnu.org/software/make/manual/html_node/Include.html +#-include Makefile.local + +# Setup production environment +production: submodules post_receive drush settings ownership + +# Setup a development environment +develop: submodules $(CONTAINER) + #rm -rf $(DRUPAL)/sites/default + #ln -s $(PROJECT) $(DRUPAL)/sites/default + #vagrant ssh -c "$(DRUSH) pm-enable devel -y" + echo '( cd /srv/kvmx && make drush )' | kvmx ssh + #kvmx ssh "$(DRUSH) pm-enable devel -y" + +# Old target +# Install the platform +#platform: drupal drush settings symlinks initdb cache + +# Keep code in sync +sync-code: update drush cache import + +# Initialize and update git submodules +submodules: + git submodule sync --recursive + git submodule update --init --recursive + +# Setup the virtual machine using vagrant +vagrant: + vagrant up + +# Setup the virtual machine using kvmx +kvmx: + kvmx provision + +# Old target +# Download drupal, setup folder structure and config file +# +# You might want to use "-n" to avoid _drush_recursive_copy cpu hog if previous +# installation already exists when using 9p filesystem +#drupal: +# #rm -rf $(DESTDIR)/drupal-$(CORE)* && drush pm-download -y -v drupal-$(CORE) --destination=/tmp/drupal && mv /tmp/drupal/drupal-$(CORE).* $(DESTDIR)/ +# #drush pm-download -y -v drupal-$(CORE) --destination=$(DESTDIR) +# #( cd $(DRUPAL)/.. && ln -s drupal-$(CORE).* drupal-$(CORE) ) +# BASE=$(DESTDIR) drupal download $(CORE) + +# Old target +# Make the needed symlinks +#symlinks: +# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/files +# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/config +# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/themes +# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/modules +# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/libraries + +# Default settings +default_settings: + test -s sites.php || cp $(DRUPAL)/sites/example.sites.php sites.php + test -s settings.dev.php || cp $(DRUPAL)/sites/default/default.settings.php settings.dev.php + test -s services.dev.yml || cp $(DRUPAL)/sites/default/default.services.yml services.dev.yml + +# Custom settings +custom_settings: + #test -s $(DRUPAL)/sites/sites.php || cp sites.php $(DRUPAL)/sites/sites.php + #mkdir -p $(DRUPAL)/sites/$(PROJECT) + #test -s $(DRUPAL)/sites/$(PROJECT)/settings.$(ENV).php || cp settings.dev.php $(DRUPAL)/sites/$(PROJECT)/settings.$(ENV).php + #test -s $(DRUPAL)/sites/$(PROJECT)/settings.php || ln -s settings.$(ENV).php $(DRUPAL)/sites/$(PROJECT)/settings.php + #test -s $(DRUPAL)/sites/$(PROJECT)/services.$(ENV).yml || cp services.dev.yml $(DRUPAL)/sites/$(PROJECT)/services.$(ENV).yml + #test -s $(DRUPAL)/sites/$(PROJECT)/services.yml || ln -s services.$(ENV).yml $(DRUPAL)/sites/$(PROJECT)/services.yml + #chmod 640 $(DRUPAL)/sites/$(PROJECT)/settings.php + #chmod 640 $(DRUPAL)/sites/$(PROJECT)/services.yml + test -s settings.$(ENV).php || cp settings.dev.php settings.$(ENV).php + test -s settings.php || ln -s settings.$(ENV).php settings.php + test -s services.$(ENV).yml || cp services.dev.yml services.$(ENV).yml + test -s services.yml || ln -s services.$(ENV).yml services.yml + chmod 640 settings.php + chmod 640 services.yml + +# Setup drupal settings +settings: default_settings custom_settings + test -s $(DRUPAL)/sites/sites.php || sudo cp sites.php $(DRUPAL)/sites/sites.php + +# Fix ownership +ownership: + sudo chown -R $(PROJECT). $(DRUPAL)/sites/$(PROJECT) + sudo chmod 755 $(DRUPAL)/sites/$(PROJECT) + +# Run drush makefile +drush: + sudo drush make -n --no-core drupal.make.yml $(DRUPAL) + +# Run drush site-install +site_install: settings + $(DRUSH) site-install -y + +# Run drush site-install, sqlite version +# See https://api.drupal.org/api/drupal/core%21INSTALL.sqlite.txt/8.4.x +site_install_sqlite: settings + mkdir -p sql/.ht.sqlite + touch sql/dumps/.ht.sqlite + $(DRUSH) site-install --db-url=sqlite://$(CWD)/sql/dumps/.ht.sqlite + +# Update the database +updatedb: + $(DRUSH) updatedb -y + +# Load the database dump, clear the drupal cache and fix image paths +# See https://www.drupal.org/node/628130 +initdb: + test -s sql/dumps/latest.sql.gz && gzip -dc sql/dumps/latest.sql.gz | $(DRUSH) sql-cli || true + test -s sql/dumps/latest.sql.gz && $(DRUSH) updatedb -y || true + +# Dump the database +dumpdb: + mkdir -p sql/dumps + rm -f sql/dumps/latest.sql.gz + rm -f sql/dumps/$(DATE).sql.gz + $(DRUSH) sql-dump > sql/dumps/$(DATE).sql + ( cd sql/dumps && gzip $(DATE).sql && ln -s $(DATE).sql.gz latest.sql.gz ) + +# Clear drupal cache +cache: + $(DRUSH) cache-rebuild + +# Destroy the database +destroydb: + echo "DROP DATABASE $(PROJECT); CREATE DATABASE $(PROJECT);" | $(DRUSH) sql-cli + +# Reinitializes the database +reinitdb: destroydb initdb + +# Cleanup develop environment +clean: + vagrant halt + vagrant destroy -f + kvmx stop + kvmx destroy + rm -rf vendor/drupal* + +# Export configuration +export: + $(DRUSH) config-export -y + +# Import configuration +import: + $(DRUSH) config-import -y + +# Diff configuration +# Needs https://github.com/eriktufvesson/drush-config-diff +diff: + $(DRUSH) config-diff + +# Update the codebase +update: pull submodules + +# Upgrade modules +upgrade-modules: + $(DRUSH) up + +# Upgrade drupal +upgrade-drupal: + BASE=$(DESTDIR) drupal upgrade $(CORE) + +# Configure update hook on remote host +post_receive: + git config receive.denyCurrentBranch ignore + cd .git/hooks && ln -sf ../../bin/post-receive + +# Pull changes +pull: + git pull + +# Reset the working copy +reset: + #git reset HEAD + git checkout -f + +# Fix local folder permission +perms: + chmod 755 . + +# Deploy code pushed on remote host +deploy: perms reset submodules + drush cache-rebuild + drush config-import -y diff --git a/share/templater/drupal8/setup b/share/templater/drupal8/setup index 470bae1..fde815e 100755 --- a/share/templater/drupal8/setup +++ b/share/templater/drupal8/setup @@ -22,10 +22,6 @@ function templater_drupal8 { echo sql >> .gitignore fi - if ! grep -q "^Makefile.local" .gitignore; then - echo Makefile.local >> .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 . @@ -40,13 +36,7 @@ function templater_drupal8 { ln -sf services.dev.yml services.yml - if [ ! -e "Makefile" ]; then - cp $SHARE/drupal8/files/Makefile . - #elif ! grep -q ^drupal: Makefile; then - # grep -v '^#' $SHARE/drupal8/files/Makefile >> Makefile - else - cp $SHARE/drupal8/files/Makefile Makefile.drupal8 - fi + __templater_install_makefile $SHARE/drupal8/files/Makefile.drupal8 if [ ! -e "drupal.make.yml" ]; then cp $SHARE/drupal8/files/drupal.make.yml . diff --git a/share/templater/ikiwiki/files/Makefile b/share/templater/ikiwiki/files/Makefile deleted file mode 100644 index 8dc0c96..0000000 --- a/share/templater/ikiwiki/files/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# Ikiwiki Makefile by Silvio Rhatto (rhatto at riseup.net). -# -# This Makefile is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 3 of the License, or any later version. -# -# This Makefile is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -all: web web_deploy - -web: jhead - @ikiwiki --setup ikiwiki.yaml - @chmod +x bin/* - -web_deploy: - #git push web - #git annex sync - @rsync -avz --delete www/ templates:/var/sites/templates/www/ - -publish: web web_deploy - -post_receive: - cd .git/hooks && ln -sf ../../bin/post-receive - -whoami: - git config user.name "User" - git config user.email user@example.org - -jhead: - @find -name '*jpg' -exec jhead -dc -de -di -dx -du {} \; - @find -name '*jpeg' -exec jhead -dc -de -di -dx -du {} \; diff --git a/share/templater/ikiwiki/files/Makefile.ikiwiki b/share/templater/ikiwiki/files/Makefile.ikiwiki new file mode 100644 index 0000000..8dc0c96 --- /dev/null +++ b/share/templater/ikiwiki/files/Makefile.ikiwiki @@ -0,0 +1,39 @@ +# +# Ikiwiki Makefile by Silvio Rhatto (rhatto at riseup.net). +# +# This Makefile is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or any later version. +# +# This Makefile is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# + +all: web web_deploy + +web: jhead + @ikiwiki --setup ikiwiki.yaml + @chmod +x bin/* + +web_deploy: + #git push web + #git annex sync + @rsync -avz --delete www/ templates:/var/sites/templates/www/ + +publish: web web_deploy + +post_receive: + cd .git/hooks && ln -sf ../../bin/post-receive + +whoami: + git config user.name "User" + git config user.email user@example.org + +jhead: + @find -name '*jpg' -exec jhead -dc -de -di -dx -du {} \; + @find -name '*jpeg' -exec jhead -dc -de -di -dx -du {} \; diff --git a/share/templater/ikiwiki/files/www/Makefile b/share/templater/ikiwiki/files/www/Makefile deleted file mode 100644 index 0db794d..0000000 --- a/share/templater/ikiwiki/files/www/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# Ikiwiki Makefile by Silvio Rhatto (rhatto at riseup.net). -# -# This Makefile is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 3 of the License, or any later version. -# -# This Makefile is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -all: web web_deploy - -web: - @ikiwiki --setup ikiwiki.yaml - @chmod +x bin/* - -web_deploy: - #git push web - #git annex sync - @rsync -avz --delete www/ templates:/var/sites/templates/www/ - -publish: web web_deploy - -post_receive: - cd .git/hooks && ln -sf ../../bin/post-receive - -whoami: - git config user.name "User" - git config user.email user@example.org diff --git a/share/templater/ikiwiki/files/www/Makefile.ikiwiki b/share/templater/ikiwiki/files/www/Makefile.ikiwiki new file mode 100644 index 0000000..0db794d --- /dev/null +++ b/share/templater/ikiwiki/files/www/Makefile.ikiwiki @@ -0,0 +1,35 @@ +# +# Ikiwiki Makefile by Silvio Rhatto (rhatto at riseup.net). +# +# This Makefile is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or any later version. +# +# This Makefile is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# + +all: web web_deploy + +web: + @ikiwiki --setup ikiwiki.yaml + @chmod +x bin/* + +web_deploy: + #git push web + #git annex sync + @rsync -avz --delete www/ templates:/var/sites/templates/www/ + +publish: web web_deploy + +post_receive: + cd .git/hooks && ln -sf ../../bin/post-receive + +whoami: + git config user.name "User" + git config user.email user@example.org diff --git a/share/templater/ikiwiki/setup b/share/templater/ikiwiki/setup index d1e9b68..68fad55 100755 --- a/share/templater/ikiwiki/setup +++ b/share/templater/ikiwiki/setup @@ -26,13 +26,7 @@ function templater_ikiwiki { cp $SHARE/ikiwiki/files/ikiwiki.yaml. fi - if [ ! -e "Makefile" ]; then - cp $SHARE/ikiwiki/files/Makefile . - #elif ! grep -q ^wiki: Makefile; then - # grep -v '^#' $SHARE/ikiwiki/files/Makefile >> Makefile - else - cp $SHARE/ikiwiki/files/Makefile Makefile.ikiwiki - fi + __templater_install_makefile $SHARE/ikiwiki/files/Makefile.ikiwiki if [ ! -d "templates" ]; then cp -r $SHARE/ikiwiki/files/templates . diff --git a/share/templater/pelican/files/Makefile b/share/templater/pelican/files/Makefile deleted file mode 100644 index 45fb995..0000000 --- a/share/templater/pelican/files/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# This Makefile is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 3 of the License, or any later version. -# -# This Makefile is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA -# - -PY?=python -PELICAN?=pelican -PELICANOPTS= -BASEDIR=$(CURDIR) -INPUTDIR=$(BASEDIR)/content -OUTPUTDIR=$(BASEDIR)/output -CONFFILE=$(BASEDIR)/pelicanconf.py - -web: clean - $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) - -web_regenerate: - $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) - -web_deploy: - @rsync -avz --delete $(OUTPUTDIR)/ templates:/var/sites/templates/www/ - -clean: - [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) - -publish: web web_deploy - -.PHONY: web diff --git a/share/templater/pelican/files/Makefile.pelican b/share/templater/pelican/files/Makefile.pelican new file mode 100644 index 0000000..45fb995 --- /dev/null +++ b/share/templater/pelican/files/Makefile.pelican @@ -0,0 +1,37 @@ +# +# This Makefile is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 3 of the License, or any later version. +# +# This Makefile is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place - Suite 330, Boston, MA 02111-1307, USA +# + +PY?=python +PELICAN?=pelican +PELICANOPTS= +BASEDIR=$(CURDIR) +INPUTDIR=$(BASEDIR)/content +OUTPUTDIR=$(BASEDIR)/output +CONFFILE=$(BASEDIR)/pelicanconf.py + +web: clean + $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) + +web_regenerate: + $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) + +web_deploy: + @rsync -avz --delete $(OUTPUTDIR)/ templates:/var/sites/templates/www/ + +clean: + [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) + +publish: web web_deploy + +.PHONY: web diff --git a/share/templater/pelican/setup b/share/templater/pelican/setup index 93375ad..71929e7 100755 --- a/share/templater/pelican/setup +++ b/share/templater/pelican/setup @@ -19,13 +19,7 @@ function templater_pelican { cp $SHARE/sphinx/files/pelicanconf.py . - if [ ! -e "Makefile" ]; then - cp $SHARE/pelican/files/Makefile . - #elif ! grep -q pelican Makefile; then - # grep -v '^#' $SHARE/pelican/files/Makefile >> Makefile - else - cp $SHARE/ikiwiki/files/Makefile Makefile.pelican - fi + __templater_install_makefile $SHARE/pelican/files/Makefile.pelican if [ ! -d "content" ]; then cp -r $SHARE/pelican/files/content . diff --git a/share/templater/sphinx/files/Makefile b/share/templater/sphinx/files/Makefile deleted file mode 100644 index 6f8ddaa..0000000 --- a/share/templater/sphinx/files/Makefile +++ /dev/null @@ -1,160 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - -rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ManualdeSegurana.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ManualdeSegurana.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/ManualdeSegurana" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ManualdeSegurana" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -web: clean html - -web_deploy: - @rsync -avz --delete _build/html/ templates:/var/sites/templates/www/ - -publish: web web_deploy diff --git a/share/templater/sphinx/files/Makefile.sphinx b/share/templater/sphinx/files/Makefile.sphinx new file mode 100644 index 0000000..6f8ddaa --- /dev/null +++ b/share/templater/sphinx/files/Makefile.sphinx @@ -0,0 +1,160 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ManualdeSegurana.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ManualdeSegurana.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/ManualdeSegurana" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ManualdeSegurana" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +web: clean html + +web_deploy: + @rsync -avz --delete _build/html/ templates:/var/sites/templates/www/ + +publish: web web_deploy diff --git a/share/templater/sphinx/setup b/share/templater/sphinx/setup index ec70c1e..b378ac3 100755 --- a/share/templater/sphinx/setup +++ b/share/templater/sphinx/setup @@ -19,13 +19,7 @@ function templater_sphinx { cp $SHARE/sphinx/files/conf.py . - if [ ! -e "Makefile" ]; then - cp $SHARE/sphinx/files/Makefile . - #elif ! grep -q sphinx Makefile; then - # grep -v '^#' $SHARE/sphinx/files/Makefile >> Makefile - else - cp $SHARE/ikiwiki/files/Makefile Makefile.sphinx - fi + __templater_install_makefile $SHARE/sphinx/files/Makefile.sphinx if [ ! -d "_static" ]; then cp -r $SHARE/sphinx/files/_static . diff --git a/share/templater/templater/files/Makefile b/share/templater/templater/files/Makefile new file mode 100644 index 0000000..a53fcbb --- /dev/null +++ b/share/templater/templater/files/Makefile @@ -0,0 +1,18 @@ +# +# Global Makefile - https://templater.fluxo.info +# +# This Makefile contains basic, common targets and also includes +# any Makefile.* available in the current folder. +# + +# See http://unix.stackexchange.com/questions/32182/simple-command-line-http-server#32200 +# http://php.net/manual/en/features.commandline.webserver.php +serve: + python -m SimpleHTTPServer + # Or the Python 3 equivalent + #python3 -m http.server + #php -S localhost:8000 + +# Process any other Makefile whose filename matches Makefile.* +# See https://www.gnu.org/software/make/manual/html_node/Include.html +-include Makefile.* diff --git a/share/templater/templater/functions b/share/templater/templater/functions index af6be08..47c240b 100644 --- a/share/templater/templater/functions +++ b/share/templater/templater/functions @@ -81,3 +81,26 @@ function __templater_user_input { fi } +# Install the global Makefile +function __templater_install_makefile { + if [ -z "$1" ]; then + return + fi + + local src="$1" + local name="`basename $src`" + + # First ensure we have the main Makefile + if [ ! -e "Makefile" ]; then + cp $SHARE/templater/files/Makefile . + fi + + # Then copy the custom Makefile + if [ ! -e "$name" ]; then + cp $src . + fi + + #if ! grep -q "^Makefile.local" .gitignore; then + # echo Makefile.local >> .gitignore + #fi +} -- cgit v1.2.3