Skip to content

Commit

Permalink
Support relying on embedded macro files #117
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed May 13, 2022
1 parent 618c211 commit b239425
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions scripts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

# Compiles all Fennel code into Lua assuming you have Aniseed cloned through dep.sh.
# Usage: deps/aniseed/scripts/compile.sh
# Usage: ANISEED_EMBED_PREFIX=my-plugin-name deps/aniseed/scripts/compile.sh

nvim --headless -u NONE \
-c "let &runtimepath = &runtimepath . ',deps/aniseed,' . getcwd()" \
-c "lua package.path = package.path .. ';$(pwd)/lua/?.lua;deps/aniseed/lua/?.lua'" \
-c "lua require('aniseed.compile').glob('**/*.fnl', 'fnl', 'lua')" \
+q

if [ -n "$ANISEED_EMBED_PREFIX" ]; then
find "lua/$ANISEED_EMBED_PREFIX" -type f -name "*.lua" -exec sed -i.aniseed_bak "s/\"aniseed\./\"$ANISEED_EMBED_PREFIX.aniseed./g" {} \;
find "lua/$ANISEED_EMBED_PREFIX" -type f -name "*.fnl" -exec sed -i.aniseed_bak "s/\"aniseed\./\"$ANISEED_EMBED_PREFIX.aniseed./g" {} \;
find . -type f -name '*.aniseed_bak' -delete
fi
4 changes: 3 additions & 1 deletion seed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ deps:

compile:
rm -rf lua
deps/aniseed/scripts/compile.sh

# Remove this if you only want Aniseed at compile time.
deps/aniseed/scripts/embed.sh aniseed example

# Also remove this embed prefix if you're not using Aniseed inside your plugin at runtime.
ANISEED_EMBED_PREFIX=example deps/aniseed/scripts/compile.sh

test:
rm -rf test/lua
deps/aniseed/scripts/test.sh

0 comments on commit b239425

Please sign in to comment.