From 4e8a8f73c3f4c73ec2dc2b4036aac2aa0a85d99a Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Sun, 9 Feb 2020 23:23:23 +0000
Subject: [PATCH] Setup scaffolding & basic build script

---
 .gitignore           | 17 ++++++++++
 .gitmodules          |  3 ++
 build                | 77 ++++++++++++++++++++++++++++++++++++++++++++
 lantern-build-engine |  1 +
 src/config.toml      | 15 +++++++++
 5 files changed, 113 insertions(+)
 create mode 100644 .gitignore
 create mode 100755 build
 create mode 160000 lantern-build-engine
 create mode 100644 src/config.toml

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..70bf74b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+
+# Created by https://www.gitignore.io/api/rust
+# Edit at https://www.gitignore.io/?templates=rust
+
+### Rust ###
+# Generated by Cargo
+# will have compiled files and executables
+/target/
+
+# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
+# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
+Cargo.lock
+
+# These are backup files generated by rustfmt
+**/*.rs.bk
+
+# End of https://www.gitignore.io/api/rust
diff --git a/.gitmodules b/.gitmodules
index cfcc0a5..8d9499f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "zola"]
 	path = zola
 	url = https://github.com/getzola/zola.git
+[submodule "lantern-build-engine"]
+	path = lantern-build-engine
+	url = https://gitlab.com/sbrl/lantern-build-engine.git
diff --git a/build b/build
new file mode 100755
index 0000000..0fcc908
--- /dev/null
+++ b/build
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+# Make sure the current directory is the location of this script to simplify matters
+cd "$(dirname "$(readlink -f "$0")")";
+################
+### Settings ###
+################
+
+# The name of this project
+project_name="pepperminty.wiki";
+
+# The path to the lantern build engine git submodule
+lantern_path=".";
+
+###
+# Custom Settings
+###
+
+# Put any custom settings here.
+zola="zola/target/release/zola";
+
+###############################################################################
+
+# Check out the lantern git submodule if needed
+if [ ! -f "${lantern_path}/lantern.sh" ]; then git submodule update --init "${lantern_path}"; fi
+
+source "${lantern_path}/lantern.sh";
+
+if [[ "$#" -lt 1 ]]; then
+	echo -e "${FBLE}${project_name}${RS} build script";
+	echo -e "    by Starbeamrainbowlabs";
+	echo -e "${LC}Powered by the lantern build engine, v${version}${RS}";
+	echo -e "";
+	echo -e "${CSECTION}Usage${RS}";
+	echo -e "    ./build ${CTOKEN}{action}${RS} ${CTOKEN}{action}${RS} ${CTOKEN}{action}${RS} ...";
+	echo -e "";
+	echo -e "${CSECTION}Available actions${RS}";
+	echo -e "    ${CACTION}setup${RS}    - Perform initial setup";
+	echo -e "    ${CACTION}build${RS}    - Build the static site";
+	echo -e "    ${CACTION}watch${RS}    - Start a livereload server";
+	echo -e "";
+	
+	exit 1;
+fi
+
+###############################################################################
+
+task_setup() {
+	task_begin "Checking environment";
+	check_command git true;
+	check_command rustc true;
+	check_command cargo true;
+	task_end 0;
+	
+	task_begin "Initialising submodules";
+	execute git submodule update --init;
+	task_end $?;
+	
+	task_begin "Compiling zola";
+	cd zola || { echo "Failed to cd into zola"; exit 1; };
+	execute cargo build --release;
+	task_end "$?";
+}
+
+task_build() {
+	task_begin "Building site";
+	"${zola}" build src;
+	task_end "$?";
+}
+task_serve() {
+	task_begin "Building site";
+	"${zola}" serve src;
+	task_end "$?";
+}
+
+###############################################################################
+
+tasks_run "$@";
diff --git a/lantern-build-engine b/lantern-build-engine
new file mode 160000
index 0000000..5cf2cfe
--- /dev/null
+++ b/lantern-build-engine
@@ -0,0 +1 @@
+Subproject commit 5cf2cfebf0ee66db9167eadaa8e1956bba58a730
diff --git a/src/config.toml b/src/config.toml
new file mode 100644
index 0000000..9c60373
--- /dev/null
+++ b/src/config.toml
@@ -0,0 +1,15 @@
+# The URL the site will be built for
+base_url = "https://pepperminty.wiki/"
+
+# Whether to automatically compile all Sass files in the sass directory
+compile_sass = false
+
+# Whether to do syntax highlighting
+# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
+highlight_code = true
+
+# Whether to build a search index to be used later on by a JavaScript library
+build_search_index = true
+
+[extra]
+# Put all your custom variables here
