Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neonspectra committed Nov 9, 2023
1 parent 11ee6b8 commit a954e82
Show file tree
Hide file tree
Showing 57 changed files with 3,202 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/arise-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# .github/workflows/arise-deploy.yml
name: Deploy Arise to html branch

on:
# Runs on pushes targeting the default branch
# Only runs when the push contains changes to the site source itself. No need to rebuild the site if it's just program files that have changed.
push:
branches: ["main"]
paths: ['arise-source/**']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
name: Deploy Arise
steps:
- name: git-checkout
uses: actions/checkout@v2

- name: Install pandoc
run: sudo apt-get install -y pandoc

- name: Build Arise
run: bash arise build

- name: Push to live branch
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: html # Feel free to change this. This is where Arise artefacts will be pushed.
FOLDER: arise-out # The Arise build output location. Don't change this.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Handled automatically -- Don't change this unless you're pushing to a different repo
MESSAGE: "Commit: ({sha}) {msg}" # Copies commit msg from main to the deploy version branch
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arise-out/
1,233 changes: 1,233 additions & 0 deletions LICENSE/README.md

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
![ARISE](./docs/logo/arise-logo_transparent.png)

# Arise // Bash Static Site Generator
*Cyberpunk websites for the modern web.*

---

## Overview

There was a time before React, before Wordpress, and before even javascript and php. And the webmasters who ran the 'net back then made do with what they had. They wrangled their webservers to the fullest and they hacked together sites that could do what they need-- somehow.

The web has grown up a lot since then, but unfortunately many of the modern tools we've built on top of are just way too complicated to maintain on the day-to-day without a fully staffed corporate webdev team.

The goal of Arise is to take the lessons of yesteryear and make something novel. Arise is a cloud-native static site generator written in Bash, designed to be a fusion of ultra-stable timeless 90s technology and modern DevOps paradigms. Arise is designed around use cases like individual blogs and personal websites.

## Why Use Arise

Arise is written in Bash with very few dependencies outside of the standard GNU toolchain. Arise is designed with longterm simplicity and maintainability in mind. It is unlikely that the core code Arise runs on will break in the near future due to language or dependency updates.

Arise supports modern SEO features that are built into your pages out of the box without any extra effort necessary:
- [OpenGraph](https://ogp.me/) and [TwitterCard](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards) support for rich embed details
- Dynamically generated RSS feed
- Dynamically generated search engine sitemap

Arise is built to be practical and let you build a website that actually has real content on it and isn't just a single-page placeholder. Arise uses a modular page architecture with support for dynamically generated metadata-rich index pages to keep your site hierarchy traversable by end users.

## Live Example

A live demo of Arise can be found at https://ari.se.net

The example site is actually deployed straight from this repository, so the contents you see there are exactly what you get if you were to fork this exact repo and host it yourself.

## Getting Started / Documentation

All of the documentation for getting started with Arise can be found within this repository.

- [Getting Started with Arise](docs/guides/getting-started/README.md)
- [Cloudflare Pages](docs/guides/getting-started/cloudflare/README.md)
- [DigitalOcean](docs/guides/getting-started/digitalocean/README.md)
- [GitHub Pages](docs/guides/getting-started/github-pages/README.md)
- [Creating Arise Pages](docs/guides/creating-arise-pages/README.md)
- [Running Arise Locally](docs/guides/running-arise-locally/README.md)

## Dependencies
- Bash 5.1
- **Used for:** 😐
- **Why:** Do you see what language this program is written in?
- [pandoc](https://pandoc.org/)
- **Used for:** `build_page` - Function that builds pages from a `.md` source file
- **Why:** Arise uses Pandoc for conversion of Markdown to HTML. If your source pages are already in HTML and you don't need Markdown conversion, you can disable Markdown conversion on individual pages with the use of an Arise page option (see above).
- GNU `date`
- **Used for:** `build_rss` - RSS feed generator function
- **Why:** You see, RSS is kind of ridiculous because it asks for dates in RFC-822 (stupid) rather than the usual ISO 8601 format used by developers who weren't dropped on their head as a child. GNU's implementation of the date command has a flag to accomodate this, but it's not available on BSD/macOS.
- GNU `find`
- **Used for:** `build_toc` - Function that builds TOC/index pages
- **Why:** Only the GNU version supports `-maxdepth`. This flag is used for the TOC indexer function to ensure that only folders in the current directory (and not subfolders of those) get put into your indices.
- GNU `awk`
- **Used for:** `evaluate_inline` - Function that performs inline bash snippet evaluations. This is disabled by default because this functionality is still WIP.
- **Why:** Using `awk` in any capacity is the equivalent of staring into a horrific eldrich abyss not meant for mere mortals. Making those commands portable is another story entirely.
- GNU `sed`
- **Used for:** `build_header` - Function that populates headers with metadata from page source files
Dependency for the header metadata tag population.
- **Why:** This script makes use of the GNU version of the '-i' flag. BSD sed will not let you run inline sed replacements without forcing you to do an extra file write to create a backup of the original file, which you then have to run ANOTHER command to delete (literally why).

## Wishlist / To-Do / Feature Ideas
- Refactor inline bash evaluation function and enable its usage. Right now it only works on very tiny/simple snippets. The main reason I wrote the logic was because I thought it would be funny to implement (it was). Some refactoring is absolutely necessary to make this feature practical/useful and not just a good meme.
- Allow inline bash evaluations in the site headers and footers
- Add support for metadata tag usage in the site footer.
- Move the hardcoded TOC formatting in `build_toc` into a configurable template within `.config`
- Bundle and implement [Markdown.pl](https://daringfireball.net/projects/markdown/) as a fallback rendering engine for systems that do not have pandoc installed.
- Add support for inline include statements for html snippets saved in the `/config` folder so that it's possible to write reusable little bits for pages.
- Implement better error handling. Right now it's wishy washy and in many ways basically nonexistent-- most stuff will silently error or otherwise not gracefully cause an abort.
- As far as dependency checks, right now it only checks if your bash version is good. Maybe could consider implementing checks for the other dependencies. It's really hard to determine if something is GNU or not, though.

## License, Disclaimers, and Acknowledgements
All the legal bulldrek relevant to this repository can be found [here](LICENSE/README.md).

A summary\* of the license terms (which is not a substitute for the above-linked licensing information itself) is:
- The example site is MIT License
- **TL;DR:** You can edit and do whatever with it. Go crazy, choom. You can license your own website built off my example however you damn please.
- The logo is Creative Commons CC-BY-SA 4.0
- **TL;DR:** You can do what you want with it as long as you let anyone else do the same with any derivatives you redistribute.
- All the Arise code itself is AGPL 3.0
- **TL;DR:** You have to give people a copy of your version of the source code if you modify and/or redistribute it in any way when you use it to create and deploy your website.
- If you don't modify the Arise software code itself and don't redistribute it, you don't need to host the source code for other people. But, to be clear, removing the link to this repository from the help function constitutes as modification as far as AGPL is concerned.
- AGPL scares a lot of people. I'm not a lawyer and this is not legal advice, but check out [this cool article about AGPL](https://writing.kemitchell.com/2021/01/24/Reading-AGPL.html) and maybe it will make it a little less scary for you :)

\*This summary highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material. Also, I am not a lawyer and none of this is legal advice.

---

*Made with 💙 by [Spectra Secure](https://twitter.com/spectrasecure)*

*Inspired by the geniuses over at [motherfuckingwebsite.com](https://motherfuckingwebsite.com/)*
159 changes: 159 additions & 0 deletions arise
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#!/bin/bash
######################################
# ARISE
# https://github.com/neonspectra/arise
arise_version="1.0.0"
######################################

##############################################################
# Begin main script function
# Don't edit below this line unless you know what you're doing
##############################################################

cd "$(dirname $0)"

# Set the site config directories. Don't touch this-- changing the config location is not supported at this time
config="arise-out/config"
source arise-source/config/arise.conf

# Check if we're running a current version of bash before potentially causing code that won't run properly on ancient bash versions
[ "$BASH_VERSINFO" -lt 5 ] && echo -e 'ERROR: Arise requires Bash version 5 or greater to run. Please install a newer version of Bash or ensure that you are using the newest version installed on your computer.\n\nYour current version of Bash is: '"$BASH_VERSINFO"'\n\nYou can verify the current running version of Bash by running the following command: echo "$BASH_VERSINFO"' && exit 1

# Makes sure that our paths have or don't have a '/' as expected regardless of user input.
## Favicon should have a '/' at the start of the path.
[[ $favicon != '' ]] && [[ ${favicon:0:1} != '/' ]] && favicon='/'"$favicon"
## Base URL should not have a '/' at the end.
[[ ${base_url: -1} == '/' ]] && base_url=${base_url::-1}

# Source functions
for FILE in lib/functions/inline/* ; do [[ $FILE == *.sh ]] && source $FILE ; done
for FILE in lib/functions/subshell/* ; do [[ $FILE == *.sh ]] && source $FILE ; done

# Display our pretty logo no matter what when the program is run :)
arise_logo

# Set default build settings
force_overwrite=false
keep_source=false

# Read our arguments and set the build mode for processing. Display help if an invalid option is made.
if [[ $@ == "build" ]]; then
arise_build="full"
echo "Starting site deploy. Building full site."
elif [[ $@ == "build -k" ]]; then
arise_build="full"
keep_source=true
echo "Starting site deploy. Building full site. Source .md files will be retained in the final output."
elif [[ $@ == "build -f" ]]; then
arise_build="full"
echo "Starting site deploy. Building full site."
echo;
read -p 'WARNING: Specifying "-f" will DELETE the current contents of '"$(realpath arise-out)"'. Proceed? [y/N]: ' -n 1 -r;
echo;
if [[ $REPLY =~ ^[Yy]$ ]]; then
force_overwrite=true;
else
echo 'Aborting.';
exit 1;
fi;
elif [[ $@ == "build -kf" ]] || [[ $@ == "build -fk" ]]; then
arise_build="full"
keep_source=true
echo "Starting site deploy. Building full site. Source .md files will be retained in the final output."
echo;
read -p 'WARNING: Specifying "-f" will DELETE the current contents of '"$(realpath arise-out)"'. Proceed? [y/N]: ' -n 1 -r;
echo;
if [[ $REPLY =~ ^[Yy]$ ]]; then
force_overwrite=true;
else
echo 'Aborting.';
exit 1;
fi;
else
while getopts ":psrkf" options; do
case "${options}" in
p)
[[ -n "$arise_build" ]] && { arise_help; echo -e '\n\nERROR: Multiple exclusive build options detected. Aborting.'; exit 1; }
arise_build="pages_only";
echo "Starting site deploy. Building pages only.";
;;
s)
[[ -n "$arise_build" ]] && { arise_help; echo -e '\n\nERROR: Multiple exclusive build options detected. Aborting.'; exit 1; }
arise_build="sitemap_only";
echo "Starting site deploy. Building sitemap only.";
;;
r)
[[ -n "$arise_build" ]] && { arise_help; echo -e '\n\nERROR: Multiple exclusive build options detected. Aborting.'; exit 1; }
arise_build="rss_only";
echo "Starting site deploy. Building RSS feed only.";
;;
k)
keep_source=true;
echo "Source .md files will be retained in the final output."l
;;
f)
echo;
read -p 'WARNING: Specifying "-f" will DELETE the current contents of '"$(realpath arise-out)"'. Proceed? [y/N]: ' -n 1 -r;
echo;
if [[ $REPLY =~ ^[Yy]$ ]]; then
force_overwrite=true;
else
echo 'Aborting.';
exit 1;
fi;
;;
esac
done
fi

[[ -z "$arise_build" ]] && { arise_help; exit 1; }
echo

# Make sure "arise_out" is empty and copy the source files over there to work from during the build process.
[[ -d arise-out ]] && [[ "$force_overwrite" == true ]] && rm -rf arise-out
mkdir -p arise-out
[[ -n "$(ls -A arise-out)" ]] && echo -e 'ERROR: The build output directory "/arise-out" is not empty. Program aborted to prevent overwrite of existing data.\n\nPlease empty the output directory before running Arise again or run your command with the "-f" flag to overwrite the existing output (dangerous).' && exit 1
cp -r "arise-source/". "arise-out"
## Set an absolute path for $config
config=$(realpath $config)

# Define a temporary file for a list of all source files for post-build cleanup
removelist="arise-out/arise-remove-$RANDOM.tmp"
touch $removelist
removelist=$(realpath $removelist)

# Run the build process depending on whatever options have been set
if [[ "$arise_build" == "full" ]] || [[ "$arise_build" == "pages_only" ]]; then
echo -n "Building pages..."
build_page_tree arise-out || { echo "ERROR: An error was encountered while building pages. Aborting build cycle."; exit 1; }
echo " DONE."
fi

if [[ "$arise_build" == "full" ]] || [[ "$arise_build" == "rss_only" ]]; then
echo -n "Building RSS feed..."
build_rss arise-out/rss.xml || { echo "ERROR: An error was encountered while building the RSS feed. Aborting build cycle."; exit 1; }
echo " DONE."
fi

if [[ "$arise_build" == "full" ]] || [[ "$arise_build" == "sitemap_only" ]]; then
echo -n "Building sitemap..."
build_sitemap arise-out/sitemap.xml || { echo "ERROR: An error was encountered while building the sitemap. Aborting build cycle."; exit 1; }
echo " DONE."
fi

if [[ "$keep_source" == false ]]; then
echo -n "Cleaning up build source files from output..."
# Remove every page that we built from as part of the build cycle
while read fname; do
[[ -f "$fname" ]] && rm "$fname"
done <$removelist
# Remove site config templates
rm "$config/header.html"
rm "$config/content_header.html"
rm "$config/footer.html"
rm "$config/arise.conf"
echo " DONE."
fi

rm $removelist
echo -e '\nBuild completed! Built artefacts have been generated at:\n'"$(realpath arise-out)"
Binary file added arise-source/arise-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions arise-source/config/arise.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

##############################################################
# ARISE SITE CONFIG - Edit these variables to fit your website
##############################################################

# Set your base website URL here.
export base_url='https://ari.se.net'

# Set the path to your favicon. This should be an absolute path with reference to your siteroot.
# This variable is only used for your RSS feed, hence why it only allows up to a singular image to be set. Your primary site favicons should be configured by editing the /config/header.html file.
export favicon="/config/favicon/favicon.ico"

# Set the global human-readable site name for your website. This string is usable in your site header as {{global_name}}. This is also used as the title for your RSS feed.
export global_name="Arise"
1 change: 1 addition & 0 deletions arise-source/config/content_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p class="date">// {{published_date}} // <i>by {{author}}</i></p>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arise-source/config/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions arise-source/config/favicon/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/config/favicon/mstile-150x150.png"/>
<TileColor>#00aba9</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added arise-source/config/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arise-source/config/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added arise-source/config/favicon/favicon.ico
Binary file not shown.
Binary file added arise-source/config/favicon/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions arise-source/config/favicon/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a954e82

Please sign in to comment.