Switch from Makefile to simple ZSH build script

This commit is contained in:
James Dinsdale 2017-02-23 23:47:29 +00:00
parent 4f256c7d58
commit ceba65a207
No known key found for this signature in database
GPG key ID: DBCB56BD98007031
2 changed files with 23 additions and 12 deletions

View file

@ -1,12 +0,0 @@
target:
@cat /dev/null > zunit
@echo "#!/usr/bin/env zsh\n" >> zunit
@cat src/reports/*.zsh >> zunit
@cat $(filter-out src/zunit.zsh,$(wildcard src/*.zsh)) >> zunit
@cat src/commands/*.zsh >> zunit
@cat src/zunit.zsh >> zunit
@chmod u+x zunit
@echo "\033[0;32m✔\033[0;m ZUnit built successfully"
test:
@./zunit

23
build.zsh Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env zsh
# Clear the file to start with
cat /dev/null > zunit
# Start with the shebang
echo "#!/usr/bin/env zsh\n" >> zunit
# We need to do some fancy globbing
setopt EXTENDED_GLOB
# Print each of the source files into the target, removing any comments
# and blank lines from the compiled executable
cat src/**/(^zunit).zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> zunit
# Print the main command last
cat src/zunit.zsh | grep -v -E '^(\s*#.*[^"]|\s*)$' >> zunit
# Make sure the file is executable
chmod u+x zunit
# Let the user know we're finished
echo "\033[0;32m✔\033[0;m ZUnit built successfully"