on 57a058b help sign in
70 lines 2.0 kB history raw
1#!/usr/bin/env bash
3# Use this script to automate building the website. You'll need a fresh copy of the repository and a fresh fakezod booted with the static-site-dev branch of Arvo. The site is built in two steps because Urbit typically runs out of memory before finishing a full build. One fakezod is usually good for only a single build.
5# Strip trailing slashes on input parameters
7site=${1%/}
8ship=${2%/}
10# Copy static_site to ship
12copy_static_site ()
14 echo -e "Copying source files from $site to $ship"
15 rm -rf $ship/home/web
16 cp -r $site/static-site $ship/home/web
17 cp $site/static-site/index.hoon $ship/home/web.hoon
18 rm -rf $ship/home/ren/partials
19 cp -r $site/partials $ship/home/ren/partials
20 cp $site/urb.hoon $ship/home/ren
23# Print instructions if both parameters aren't provided
25if [[ $# -lt 2 ]] ; then
26 printf 'This command needs two arguments:\n(1) the path to your urbit.org repository\n(2) the path to your pier\n'
27 exit 0
28fi
30# Print instructions
32read -n1 -s -r -p $'Boot your fake ~zod and run |mount %, then press any key to continue\n'
34# Create dist folder
36dist="dist-$(date -u '+%Y.%-m.%-d...%H.%M.%S')"
37mkdir $dist
39# Render Posts
41copy_static_site $site $ship
42rm -rf $ship/home/web/docs
43read -n1 -s -r -p $'Wait for sync, then run |static in your urbit, wait for it to finish, then press any key to continue\n'
45# Copy results of first render (posts) to dist folder
47echo -e "Copying posts from $site to $ship"
48cp -r $ship/.urb/put/web/* $dist
50# Render docs
52copy_static_site $site $ship
53rm -rf $ship/home/web/posts
54read -n1 -s -r -p $'Wait for sync, then run |static in your urbit again, wait for it to finish, then press any key to continue\n'
56# Copy results of second render (docs) to distj folder
58cp -rn $ship/.urb/put/web/* $dist # cp -n prevents overwriting exist folders
60# Remove unecessary files
62rm -rf $dist/posts/update
63rm -rf $dist/index
64rm -rf $dist/js/*
66# Copy JavaScript
68cp -r $site/static-site/js $dist
70echo -e "Find your website in $dist"