diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e844dd..6a193d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,11 @@ default: image: rust:latest +stages: + - build + - test + - release + compile-with-posix-features: stage: build script: @@ -15,20 +20,7 @@ compile-implicit-load: stage: build script: - cargo build -F implicit-load - -compile-release: - stage: build - script: - - cargo build --release - artifacts: - paths: - - target/release/flesh - only: - variables: - - $CI_COMMIT_TAG =~ /^v\d+.\d+.\d+-?.*$/ - except: - - branches - + unit-tests: stage: test script: @@ -38,3 +30,52 @@ userlib-tests: stage: test script: - cargo run --no-default-features snippets/userlib.f snippets/userlib-tests.f + +prepare-release: + stage: release + script: + - cargo build -F implicit-load --release + - | + tar -czf flesh-$CI_COMMIT_TAG.tar.gz \ + --xform='s,target/release/,,' \ + --xform='s,snippets/,,' \ + --xform='s,snippets/release/,,' \ + --xform='s,release/,,' \ + 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/release/default_fleshrc.f \ + snippets/release/release_contents.txt \ + snippets/release/install.sh + - echo $CI_COMMIT_TAG > VERSION + - echo $CI_JOB_ID > ID + artifacts: + paths: + - flesh-$CI_COMMIT_TAG.tar.gz + - VERSION + - ID + rules: + - if: '$CI_COMMIT_TAG =~ "/^v\d+.\d+.\d+/"' + +create-release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: prepare-release + artifacts: true + script: + - echo "running job for release!" + rules: + - if: '$CI_COMMIT_TAG =~ "/^v\d+.\d+.\d+/"' + release: + name: 'Release $(cat VERSION)' + description: 'This release was cut automatically from a git tag. See release_contents.txt for more information on the contents of the release.' + tag_name: $CI_COMMIT_TAG + assets: + links: + - name: Get the release here + url: https://gitlab.com/whom/relish/-/jobs/`cat ID`/artifacts/file/flesh-`cat VERSION`.tar.gz diff --git a/Readme.org b/Readme.org index a8cab6a..1e2e6f0 100644 --- a/Readme.org +++ b/Readme.org @@ -166,9 +166,6 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt - Can pass args to flesh scripts (via command line) - Can pass args to flesh scripts (via interpreter) - declare macros -- Release CI -- Make an icon if you feel like it -- Post release to relevant channels ** TODO v1.1 tasks - all autocomplete is done via configurable userfunction, default documented with 1:1 functionality - Pipe also operates on stderr diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..9285dd2 Binary files /dev/null and b/logo.png differ diff --git a/snippets/release/default_fleshrc.f b/snippets/release/default_fleshrc.f new file mode 100644 index 0000000..13a6e30 --- /dev/null +++ b/snippets/release/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/release/install.sh b/snippets/release/install.sh new file mode 100644 index 0000000..dd1e1ae --- /dev/null +++ b/snippets/release/install.sh @@ -0,0 +1,33 @@ +#!/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/$SUDO_USER/.fleshrc +chown -R $SUDO_USER:$SUDO_USER $libdir +chown $SUDO_USER:$SUDO_USER /home/$SUDO_USER/.fleshrc + +mv flesh /bin/flesh +chmod +x /bin/flesh diff --git a/snippets/release/release_contents.txt b/snippets/release/release_contents.txt new file mode 100644 index 0000000..cf225ec --- /dev/null +++ b/snippets/release/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