From 831026a8d710f9e737c938f68aef87f2261e9b4d Mon Sep 17 00:00:00 2001 From: Ava Affine Date: Wed, 21 Feb 2024 10:22:01 -0800 Subject: [PATCH] add release-ci, artifacts, etc. Signed-off-by: Ava Affine --- .gitlab-ci.yml | 13 ++++- snippets/artifacts/default_fleshrc.f | 65 +++++++++++++++++++++++++ snippets/artifacts/install.sh | 32 ++++++++++++ snippets/artifacts/release_contents.txt | 23 +++++++++ 4 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 snippets/artifacts/default_fleshrc.f create mode 100644 snippets/artifacts/install.sh create mode 100644 snippets/artifacts/release_contents.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e844dd..5a5be6d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,10 +19,21 @@ compile-implicit-load: compile-release: stage: build script: - - cargo build --release + - cargo build -F implicit-load --release artifacts: paths: - target/release/flesh + - Readme.org + - Writing.org + - Shell.org + - snippets/flesh-mode.el + - snippets/genbind.f + - snippets/interactive-devel.f + - snippets/userlib.f + - LICENSE.md + - snippets/artifacts/default_fleshrc.f + - snippets/artifacts/release_contents.txt + - snippets/artifacts/install.sh only: variables: - $CI_COMMIT_TAG =~ /^v\d+.\d+.\d+-?.*$/ diff --git a/snippets/artifacts/default_fleshrc.f b/snippets/artifacts/default_fleshrc.f new file mode 100644 index 0000000..13a6e30 --- /dev/null +++ b/snippets/artifacts/default_fleshrc.f @@ -0,0 +1,65 @@ +#!/usr/bin/env flesh + +(set (q CFG_FLESH_POSIX) true) +(set (q CFG_FLESH_ENV) true) + +(def snippets 'flesh conf snippets' (concat HOME "/.flesh/")) +(def _user_libraries 'flesh support libs' + ((concat snippets '/userlib.f') + (concat snippets '/genbind.f') + (concat snippets '/interactive-devel.f') + ;; add your own scripts here + )) + +(def loadlibs 'load all flesh libs' + (lambda () + (let ((lib-iter (pop _user_libraries))) + (while (gt? (len lib-iter) 1) + (let ((lib (car lib-iter)) + (next (cdr lib-iter))) + (call lib) + (def lib-iter '' (pop next))))))) +;(loadlibs) + +(def user-paths 'custom path entries' + ((concat HOME "/bin") + ;; add more here + )) + +;; add path if not already included +;; only you can stop $PATH pollution +(map + (lambda (entry) (if (not (contains? (get-paths) entry)) + (add-path entry) + ())) + user-paths) + +(def _fancy-cwd 'prints (up to) last three segments of current path' + () + (let ((cdir (load-to-string pwd)) + (dir-segs (split cdir '/')) + (dir-iter (dq dir-segs)) + (i 0)) + (if (lte? (len dir-segs) 4) + cdir + (let ((final "")) + (while (lt? i 3) + (set (q final) (concat "/" (car dir-iter) final)) + (set (q dir-iter) (dq (cdr dir-iter))) + (inc i)) + (concat "..." final))))) + +;; (def CFG_FLESH_CD_CB "directory based configs" ....... ) +(def CFG_FLESH_L_PROMPT "left prompt" () + (concat + "[" USER "]" "\t" + (_fancy-cwd) + "\n" ;; newline before delimiter + )) + +(def CFG_FLESH_R_PROMPT "right prompt" () + (concat + "(" (load-to-string date "+%H:%M") ")" )) + +(def CFG_FLESH_PROMPT_DELIMITER "delimiter" () + " -> ") diff --git a/snippets/artifacts/install.sh b/snippets/artifacts/install.sh new file mode 100644 index 0000000..168a946 --- /dev/null +++ b/snippets/artifacts/install.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +if [ ! "$USER" == "root" ]; then + echo you will likely need root to place in /bin. + echo comment out this test to continue without it + exit +fi + +if [ ! -n "$SUDO_USER" ]; then + echo SUDO_USER not set, so I dont know where to install to + exit +fi + +libdir=/home/$SUDO_USER/.flesh/ + +if [ ! -d "$libdir" ]; then + mkdir $libdir +fi + +if [ -d "/home/$SUDO_USER/.emacs.d" ]; then + mv flesh-mode.el /home/$SUDO_USER/.emacs.d/ + chown $SUDO_USER:$SUDO_USER /home/$SUDO_USER/.emacs.d/flesh-mode.el +fi + +mv userlib.f $libdir +mv genbind.f $libdir +mv interactive-devel.f $libdir +mv default_fleshrc.f /home/$USER/.fleshrc +chown -R $SUDO_USER:$SUDO_USER $libdir + +mv flesh /bin/flesh +chmod +x /bin/flesh diff --git a/snippets/artifacts/release_contents.txt b/snippets/artifacts/release_contents.txt new file mode 100644 index 0000000..cf225ec --- /dev/null +++ b/snippets/artifacts/release_contents.txt @@ -0,0 +1,23 @@ +This file elaborates on the contents of this release zip + +1. LICENSE.md: A copy of the license these procedures are offered under +2. Readme.org: A snapshot of the readme at time of release +3. Writing.org: A snapshot of the language spec at time of release +4. Shell.org: A snapshot of the shell spec at time of release +5. flesh: A binary executable for the flesh interpreter + This binary will have been build with the + implicit-load flag +6. flesh-mode.el: A copy of the Emacs flesh mode +7. genbind.f: A snapshot of the genbind library, mostly included + as an example of metaprogramming in flesh. + +8. interactive-devel.f: A snapshot of the interactive development features. +9. userlib.f: A snapshot of the userlib at time of release +10: default_fleshrc.f: An example .fleshrc +11: install.sh An install script in shell for first time users. + this will overwrite .fleshrc with the example + this will install libraries to ~/.flesh/... + this will install flesh-mode.el in ~/.emacs.d if it exists + this will add the flesh binary to /bin/flesh + IT IS THE USER'S RESPONSIBILITY TO EDIT /etc/shells + Or to perform whatever tasks are desired to run flesh