Skip to content

Commit a954e82

Browse files
committed
1.0.0
1 parent 11ee6b8 commit a954e82

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3202
-0
lines changed

.github/workflows/arise-deploy.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# .github/workflows/arise-deploy.yml
2+
name: Deploy Arise to html branch
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
# 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.
7+
push:
8+
branches: ["main"]
9+
paths: ['arise-source/**']
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Allow one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
# Default to bash
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
name: Deploy Arise
28+
steps:
29+
- name: git-checkout
30+
uses: actions/checkout@v2
31+
32+
- name: Install pandoc
33+
run: sudo apt-get install -y pandoc
34+
35+
- name: Build Arise
36+
run: bash arise build
37+
38+
- name: Push to live branch
39+
uses: s0/git-publish-subdir-action@develop
40+
env:
41+
REPO: self
42+
BRANCH: html # Feel free to change this. This is where Arise artefacts will be pushed.
43+
FOLDER: arise-out # The Arise build output location. Don't change this.
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Handled automatically -- Don't change this unless you're pushing to a different repo
45+
MESSAGE: "Commit: ({sha}) {msg}" # Copies commit msg from main to the deploy version branch

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
arise-out/

LICENSE/README.md

Lines changed: 1233 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
![ARISE](./docs/logo/arise-logo_transparent.png)
2+
3+
# Arise // Bash Static Site Generator
4+
*Cyberpunk websites for the modern web.*
5+
6+
---
7+
8+
## Overview
9+
10+
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.
11+
12+
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.
13+
14+
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.
15+
16+
## Why Use Arise
17+
18+
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.
19+
20+
Arise supports modern SEO features that are built into your pages out of the box without any extra effort necessary:
21+
- [OpenGraph](https://ogp.me/) and [TwitterCard](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/abouts-cards) support for rich embed details
22+
- Dynamically generated RSS feed
23+
- Dynamically generated search engine sitemap
24+
25+
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.
26+
27+
## Live Example
28+
29+
A live demo of Arise can be found at https://ari.se.net
30+
31+
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.
32+
33+
## Getting Started / Documentation
34+
35+
All of the documentation for getting started with Arise can be found within this repository.
36+
37+
- [Getting Started with Arise](docs/guides/getting-started/README.md)
38+
- [Cloudflare Pages](docs/guides/getting-started/cloudflare/README.md)
39+
- [DigitalOcean](docs/guides/getting-started/digitalocean/README.md)
40+
- [GitHub Pages](docs/guides/getting-started/github-pages/README.md)
41+
- [Creating Arise Pages](docs/guides/creating-arise-pages/README.md)
42+
- [Running Arise Locally](docs/guides/running-arise-locally/README.md)
43+
44+
## Dependencies
45+
- Bash 5.1
46+
- **Used for:** 😐
47+
- **Why:** Do you see what language this program is written in?
48+
- [pandoc](https://pandoc.org/)
49+
- **Used for:** `build_page` - Function that builds pages from a `.md` source file
50+
- **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).
51+
- GNU `date`
52+
- **Used for:** `build_rss` - RSS feed generator function
53+
- **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.
54+
- GNU `find`
55+
- **Used for:** `build_toc` - Function that builds TOC/index pages
56+
- **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.
57+
- GNU `awk`
58+
- **Used for:** `evaluate_inline` - Function that performs inline bash snippet evaluations. This is disabled by default because this functionality is still WIP.
59+
- **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.
60+
- GNU `sed`
61+
- **Used for:** `build_header` - Function that populates headers with metadata from page source files
62+
Dependency for the header metadata tag population.
63+
- **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).
64+
65+
## Wishlist / To-Do / Feature Ideas
66+
- 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.
67+
- Allow inline bash evaluations in the site headers and footers
68+
- Add support for metadata tag usage in the site footer.
69+
- Move the hardcoded TOC formatting in `build_toc` into a configurable template within `.config`
70+
- Bundle and implement [Markdown.pl](https://daringfireball.net/projects/markdown/) as a fallback rendering engine for systems that do not have pandoc installed.
71+
- 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.
72+
- 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.
73+
- 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.
74+
75+
## License, Disclaimers, and Acknowledgements
76+
All the legal bulldrek relevant to this repository can be found [here](LICENSE/README.md).
77+
78+
A summary\* of the license terms (which is not a substitute for the above-linked licensing information itself) is:
79+
- The example site is MIT License
80+
- **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.
81+
- The logo is Creative Commons CC-BY-SA 4.0
82+
- **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.
83+
- All the Arise code itself is AGPL 3.0
84+
- **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.
85+
- 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.
86+
- 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 :)
87+
88+
\*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.
89+
90+
---
91+
92+
*Made with 💙 by [Spectra Secure](https://twitter.com/spectrasecure)*
93+
94+
*Inspired by the geniuses over at [motherfuckingwebsite.com](https://motherfuckingwebsite.com/)*

arise

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#!/bin/bash
2+
######################################
3+
# ARISE
4+
# https://github.com/neonspectra/arise
5+
arise_version="1.0.0"
6+
######################################
7+
8+
##############################################################
9+
# Begin main script function
10+
# Don't edit below this line unless you know what you're doing
11+
##############################################################
12+
13+
cd "$(dirname $0)"
14+
15+
# Set the site config directories. Don't touch this-- changing the config location is not supported at this time
16+
config="arise-out/config"
17+
source arise-source/config/arise.conf
18+
19+
# Check if we're running a current version of bash before potentially causing code that won't run properly on ancient bash versions
20+
[ "$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
21+
22+
# Makes sure that our paths have or don't have a '/' as expected regardless of user input.
23+
## Favicon should have a '/' at the start of the path.
24+
[[ $favicon != '' ]] && [[ ${favicon:0:1} != '/' ]] && favicon='/'"$favicon"
25+
## Base URL should not have a '/' at the end.
26+
[[ ${base_url: -1} == '/' ]] && base_url=${base_url::-1}
27+
28+
# Source functions
29+
for FILE in lib/functions/inline/* ; do [[ $FILE == *.sh ]] && source $FILE ; done
30+
for FILE in lib/functions/subshell/* ; do [[ $FILE == *.sh ]] && source $FILE ; done
31+
32+
# Display our pretty logo no matter what when the program is run :)
33+
arise_logo
34+
35+
# Set default build settings
36+
force_overwrite=false
37+
keep_source=false
38+
39+
# Read our arguments and set the build mode for processing. Display help if an invalid option is made.
40+
if [[ $@ == "build" ]]; then
41+
arise_build="full"
42+
echo "Starting site deploy. Building full site."
43+
elif [[ $@ == "build -k" ]]; then
44+
arise_build="full"
45+
keep_source=true
46+
echo "Starting site deploy. Building full site. Source .md files will be retained in the final output."
47+
elif [[ $@ == "build -f" ]]; then
48+
arise_build="full"
49+
echo "Starting site deploy. Building full site."
50+
echo;
51+
read -p 'WARNING: Specifying "-f" will DELETE the current contents of '"$(realpath arise-out)"'. Proceed? [y/N]: ' -n 1 -r;
52+
echo;
53+
if [[ $REPLY =~ ^[Yy]$ ]]; then
54+
force_overwrite=true;
55+
else
56+
echo 'Aborting.';
57+
exit 1;
58+
fi;
59+
elif [[ $@ == "build -kf" ]] || [[ $@ == "build -fk" ]]; then
60+
arise_build="full"
61+
keep_source=true
62+
echo "Starting site deploy. Building full site. Source .md files will be retained in the final output."
63+
echo;
64+
read -p 'WARNING: Specifying "-f" will DELETE the current contents of '"$(realpath arise-out)"'. Proceed? [y/N]: ' -n 1 -r;
65+
echo;
66+
if [[ $REPLY =~ ^[Yy]$ ]]; then
67+
force_overwrite=true;
68+
else
69+
echo 'Aborting.';
70+
exit 1;
71+
fi;
72+
else
73+
while getopts ":psrkf" options; do
74+
case "${options}" in
75+
p)
76+
[[ -n "$arise_build" ]] && { arise_help; echo -e '\n\nERROR: Multiple exclusive build options detected. Aborting.'; exit 1; }
77+
arise_build="pages_only";
78+
echo "Starting site deploy. Building pages only.";
79+
;;
80+
s)
81+
[[ -n "$arise_build" ]] && { arise_help; echo -e '\n\nERROR: Multiple exclusive build options detected. Aborting.'; exit 1; }
82+
arise_build="sitemap_only";
83+
echo "Starting site deploy. Building sitemap only.";
84+
;;
85+
r)
86+
[[ -n "$arise_build" ]] && { arise_help; echo -e '\n\nERROR: Multiple exclusive build options detected. Aborting.'; exit 1; }
87+
arise_build="rss_only";
88+
echo "Starting site deploy. Building RSS feed only.";
89+
;;
90+
k)
91+
keep_source=true;
92+
echo "Source .md files will be retained in the final output."l
93+
;;
94+
f)
95+
echo;
96+
read -p 'WARNING: Specifying "-f" will DELETE the current contents of '"$(realpath arise-out)"'. Proceed? [y/N]: ' -n 1 -r;
97+
echo;
98+
if [[ $REPLY =~ ^[Yy]$ ]]; then
99+
force_overwrite=true;
100+
else
101+
echo 'Aborting.';
102+
exit 1;
103+
fi;
104+
;;
105+
esac
106+
done
107+
fi
108+
109+
[[ -z "$arise_build" ]] && { arise_help; exit 1; }
110+
echo
111+
112+
# Make sure "arise_out" is empty and copy the source files over there to work from during the build process.
113+
[[ -d arise-out ]] && [[ "$force_overwrite" == true ]] && rm -rf arise-out
114+
mkdir -p arise-out
115+
[[ -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
116+
cp -r "arise-source/". "arise-out"
117+
## Set an absolute path for $config
118+
config=$(realpath $config)
119+
120+
# Define a temporary file for a list of all source files for post-build cleanup
121+
removelist="arise-out/arise-remove-$RANDOM.tmp"
122+
touch $removelist
123+
removelist=$(realpath $removelist)
124+
125+
# Run the build process depending on whatever options have been set
126+
if [[ "$arise_build" == "full" ]] || [[ "$arise_build" == "pages_only" ]]; then
127+
echo -n "Building pages..."
128+
build_page_tree arise-out || { echo "ERROR: An error was encountered while building pages. Aborting build cycle."; exit 1; }
129+
echo " DONE."
130+
fi
131+
132+
if [[ "$arise_build" == "full" ]] || [[ "$arise_build" == "rss_only" ]]; then
133+
echo -n "Building RSS feed..."
134+
build_rss arise-out/rss.xml || { echo "ERROR: An error was encountered while building the RSS feed. Aborting build cycle."; exit 1; }
135+
echo " DONE."
136+
fi
137+
138+
if [[ "$arise_build" == "full" ]] || [[ "$arise_build" == "sitemap_only" ]]; then
139+
echo -n "Building sitemap..."
140+
build_sitemap arise-out/sitemap.xml || { echo "ERROR: An error was encountered while building the sitemap. Aborting build cycle."; exit 1; }
141+
echo " DONE."
142+
fi
143+
144+
if [[ "$keep_source" == false ]]; then
145+
echo -n "Cleaning up build source files from output..."
146+
# Remove every page that we built from as part of the build cycle
147+
while read fname; do
148+
[[ -f "$fname" ]] && rm "$fname"
149+
done <$removelist
150+
# Remove site config templates
151+
rm "$config/header.html"
152+
rm "$config/content_header.html"
153+
rm "$config/footer.html"
154+
rm "$config/arise.conf"
155+
echo " DONE."
156+
fi
157+
158+
rm $removelist
159+
echo -e '\nBuild completed! Built artefacts have been generated at:\n'"$(realpath arise-out)"

arise-source/arise-icon.png

18.8 KB
Loading

arise-source/config/arise.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
##############################################################
4+
# ARISE SITE CONFIG - Edit these variables to fit your website
5+
##############################################################
6+
7+
# Set your base website URL here.
8+
export base_url='https://ari.se.net'
9+
10+
# Set the path to your favicon. This should be an absolute path with reference to your siteroot.
11+
# 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.
12+
export favicon="/config/favicon/favicon.ico"
13+
14+
# 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.
15+
export global_name="Arise"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p class="date">// {{published_date}} // <i>by {{author}}</i></p>
15.5 KB
Loading
18.1 KB
Loading

0 commit comments

Comments
 (0)