From 02af2dbd91cbd736b4144117a2b61953ec1fc025 Mon Sep 17 00:00:00 2001 From: Tim Riley Date: Mon, 6 Jan 2025 10:02:14 +1100 Subject: [PATCH] Add simple Parklife installation --- .gitignore | 5 +++-- Gemfile | 3 +++ Gemfile.lock | 5 +++++ Parkfile | 19 +++++++++++++++++++ bin/static-build | 14 ++++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Parkfile create mode 100755 bin/static-build diff --git a/.gitignore b/.gitignore index d254dad..0243582 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ .env*.local +build/ +db/*.sqlite log/* +node_modules/ public/ !public/*.html -node_modules/ -db/*.sqlite spec/examples.txt diff --git a/Gemfile b/Gemfile index d2ac27c..cd16f67 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,9 @@ gem "sqlite3" gem "commonmarker" gem "front_matter_parser" +# Static site generation +gem "parklife" + group :development do gem "hanami-webconsole", "~> 2.2" end diff --git a/Gemfile.lock b/Gemfile.lock index 9f13d21..5a4b05a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -233,6 +233,10 @@ GEM nenv (~> 0.1) shellany (~> 0.0) parallel (1.26.3) + parklife (0.6.1) + nokogiri + rack-test + thor parser (3.3.6.0) ast (~> 2.4.1) racc @@ -376,6 +380,7 @@ DEPENDENCIES hanami-validations (~> 2.2) hanami-view (~> 2.2) hanami-webconsole (~> 2.2) + parklife puma rack-test rake diff --git a/Parkfile b/Parkfile new file mode 100644 index 0000000..78a2823 --- /dev/null +++ b/Parkfile @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "hanami/boot" + +Parklife.application.configure do |config| + config.app = Site::App +end + +Parklife.application.routes do + root crawl: true + + # Add further paths not discovered by crawling from the root: + # + # get '/hidden/pages', crawl: true + # get '/feed.atom' + + # Services typically allow a custom 404 page. + # get '/404.html' +end diff --git a/bin/static-build b/bin/static-build new file mode 100755 index 0000000..9fdfed4 --- /dev/null +++ b/bin/static-build @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +set -eu + +# Build with Parklife - and forward arguments sent to this script. +bundle exec parklife build "$@" + +# Copy all public resources to ./build. +if [ -d public ]; then + cp -R public/* build +fi + +# List all files in the build (useful for debugging). +find build -type f | sort