aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-07-05 18:58:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-07-05 18:58:03 -0300
commitf160642b16c5da9c60d6004defc14f2afc95aa62 (patch)
treedfb7c2d0455893f2816cb3557cf89406483d5e1d /share
parent9da19c8d2612fc09eb58c9604fe069c1fb2d6552 (diff)
downloadtemplater-master.tar.gz
templater-master.tar.bz2
Adds http_server and git modules; update IDEASHEADmaster
Diffstat (limited to 'share')
-rw-r--r--share/templater/git/files/Makefile.git8
-rwxr-xr-xshare/templater/git/setup2
-rw-r--r--share/templater/http_server/description1
-rw-r--r--share/templater/http_server/files/Makefile.http_server18
-rwxr-xr-xshare/templater/http_server/setup25
-rw-r--r--share/templater/sphinx/files/Makefile.sphinx3
-rw-r--r--share/templater/templater/files/Makefile29
7 files changed, 63 insertions, 23 deletions
diff --git a/share/templater/git/files/Makefile.git b/share/templater/git/files/Makefile.git
new file mode 100644
index 0000000..026176b
--- /dev/null
+++ b/share/templater/git/files/Makefile.git
@@ -0,0 +1,8 @@
+#
+# Makefile for Git-related tasks - https://templater.fluxo.info
+#
+
+# Configure a git post-receive hook
+post_receive:
+ git config receive.denyCurrentBranch ignore
+ test -s bin/post-receive && cd .git/hooks && ln -sf ../../bin/post-receive
diff --git a/share/templater/git/setup b/share/templater/git/setup
index 952e6ef..a9b26a0 100755
--- a/share/templater/git/setup
+++ b/share/templater/git/setup
@@ -18,6 +18,8 @@ function templater_git {
templater_user_input GIT_USER User "-> Choose a git user name"
templater_user_input GIT_EMAIL user@example.org "-> Choose a git email address"
+ templater_install_makefile $SHARE/git/files/Makefile.git
+
git init
git config user.name "$GIT_USER"
git config user.email "$GIT_EMAIL"
diff --git a/share/templater/http_server/description b/share/templater/http_server/description
new file mode 100644
index 0000000..836a709
--- /dev/null
+++ b/share/templater/http_server/description
@@ -0,0 +1 @@
+setup a simple HTTP server configuration
diff --git a/share/templater/http_server/files/Makefile.http_server b/share/templater/http_server/files/Makefile.http_server
new file mode 100644
index 0000000..c3d0ab3
--- /dev/null
+++ b/share/templater/http_server/files/Makefile.http_server
@@ -0,0 +1,18 @@
+#
+# HTTP Server Makefile - https://templater.fluxo.info
+#
+
+# Port to serve content
+HTTP_PORT="8000"
+HTTP_SERVER="http.server"
+
+# Base to serve the content
+HTTP_BASE="."
+
+# See http://unix.stackexchange.com/questions/32182/simple-command-line-http-server#32200
+# http://php.net/manual/en/features.commandline.webserver.php
+serve:
+ @if [ "$(HTTP_SERVER)" = "SimpleHTTPServer" ]; then cd $(HTTP_BASE) && python -m SimpleHTTPServer $(HTTP_PORT); fi
+ @if [ "$(HTTP_SERVER)" = "ssi_server" ]; then cd $(HTTP_BASE) && PYTHONDONTWRITEBYTECODE=0 ssi_server.py $(HTTP_PORT); fi
+ @if [ "$(HTTP_SERVER)" = "http.server" ]; then cd $(HTTP_BASE) && python3 -m http.server $(HTTP_PORT); fi
+ @if [ "$(HTTP_SERVER)" = "php" ]; then cd $(HTTP_BASE) && php -S localhost:$(HTTP_PORT); fi
diff --git a/share/templater/http_server/setup b/share/templater/http_server/setup
new file mode 100755
index 0000000..7983f73
--- /dev/null
+++ b/share/templater/http_server/setup
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# HTTP Server templater module.
+#
+
+# Parameters
+SHARE="$1"
+
+# Include basic functions
+source $SHARE/templater/functions || exit 1
+
+# Sphinx implementation
+function templater_http_server {
+ if [ ! -e "Makefile.http_server" ]; then
+ templater_echo "Setting up a basic HTTP Server functionality..."
+
+ templater_install_makefile $SHARE/http_server/files/Makefile.http_server
+
+ else
+ templater_echo "HTTP Server functionality already set"
+ fi
+}
+
+# Dispatch
+templater_http_server
diff --git a/share/templater/sphinx/files/Makefile.sphinx b/share/templater/sphinx/files/Makefile.sphinx
index 3369b20..eeaf393 100644
--- a/share/templater/sphinx/files/Makefile.sphinx
+++ b/share/templater/sphinx/files/Makefile.sphinx
@@ -1,4 +1,5 @@
-# Makefile for Sphinx documentation
+#
+# Makefile for Sphinx documentation - https://templater.fluxo.info
#
# You can set these variables from the command line.
diff --git a/share/templater/templater/files/Makefile b/share/templater/templater/files/Makefile
index 3a988d4..4f0db17 100644
--- a/share/templater/templater/files/Makefile
+++ b/share/templater/templater/files/Makefile
@@ -5,13 +5,6 @@
# any Makefile.* available in the current folder.
#
-# Port to serve content
-HTTP_PORT="8000"
-HTTP_SERVER="http.server"
-
-# Base to serve the content
-HTTP_BASE="."
-
# Set CONTAINER based in what we have available in the system
# This variable can be user in other, included Makefiles to handle virtualization tasks
ifeq ($(shell which kvmx > /dev/null && test -s kvmxfile && echo yes), yes)
@@ -24,18 +17,8 @@ else
CONTAINER = ''
endif
-# See http://unix.stackexchange.com/questions/32182/simple-command-line-http-server#32200
-# http://php.net/manual/en/features.commandline.webserver.php
-serve:
- @if [ "$(HTTP_SERVER)" = "SimpleHTTPServer" ]; then cd $(HTTP_BASE) && python -m SimpleHTTPServer $(HTTP_PORT); fi
- @if [ "$(HTTP_SERVER)" = "ssi_server" ]; then cd $(HTTP_BASE) && PYTHONDONTWRITEBYTECODE=0 ssi_server.py $(HTTP_PORT); fi
- @if [ "$(HTTP_SERVER)" = "http.server" ]; then cd $(HTTP_BASE) && python3 -m http.server $(HTTP_PORT); fi
- @if [ "$(HTTP_SERVER)" = "php" ]; then cd $(HTTP_BASE) && php -S localhost:$(HTTP_PORT); fi
-
-# Configure a git post-receive hook
-post_receive:
- git config receive.denyCurrentBranch ignore
- test -s bin/post-receive && cd .git/hooks && ln -sf ../../bin/post-receive
+# Default action
+default: all
# Process any other Makefile whose filename matches Makefile.*
# See https://www.gnu.org/software/make/manual/html_node/Include.html
@@ -45,6 +28,8 @@ post_receive:
-include Makefile.*
# Customization examples can be as simple as setting variables:
-#CONTAINER = vagrant
-#CONTAINER = docker
-#DESTDIR ?= vendor
+#CONTAINER = vagrant
+#CONTAINER = docker
+#DESTDIR ?= vendor
+#HTTP_PORT ="8080"
+#HTTP_SERVER ="ssi_server"