diff options
-rw-r--r-- | IDEAS.md | 4 | ||||
-rw-r--r-- | share/templater/git/files/Makefile.git | 8 | ||||
-rwxr-xr-x | share/templater/git/setup | 2 | ||||
-rw-r--r-- | share/templater/http_server/description | 1 | ||||
-rw-r--r-- | share/templater/http_server/files/Makefile.http_server | 18 | ||||
-rwxr-xr-x | share/templater/http_server/setup | 25 | ||||
-rw-r--r-- | share/templater/sphinx/files/Makefile.sphinx | 3 | ||||
-rw-r--r-- | share/templater/templater/files/Makefile | 29 |
8 files changed, 65 insertions, 25 deletions
@@ -1,5 +1,4 @@ -Ideas -===== +# Ideas * Bazaar: * README with basic info and HOWTO @@ -23,6 +22,7 @@ Ideas * [Wrangling Web Contributions: How to Build a CONTRIBUTING.md](https://mozillascience.github.io/working-open-workshop/contributing/) * [Good-CONTRIBUTING.md-template.md · GitHub](https://gist.github.com/PurpleBooth/b24679402957c63ec426) * [vue/CONTRIBUTING.md at dev · vuejs/vue · GitHub](https://github.com/vuejs/vue/blob/dev/.github/CONTRIBUTING.md) + * More Code of Conduct flavors * Modules: * Python * Flask 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" |