diff --git a/.gitignore b/.gitignore index 24bba68..fdeaaac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,15 @@ # PHP-related files -.idea/ -.phpintel/ /vendor/ /phpunit.xml /twigc.phar -# OS X-generated files +# macOS-generated files ._* .DS_Store .DS_Store? .Spotlight-V100 .Trashes -Icon\? +Icon? # Windows-generated files Desktop.ini @@ -19,7 +17,8 @@ ehthumbs.db Thumbs.db # Editor-generated files +.idea/ +.phpintel/ *~ .*.s[a-w][a-z] *.sublime-workspace - diff --git a/LICENCE b/LICENCE index c8c6c30..04d4c80 100644 --- a/LICENCE +++ b/LICENCE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) dana geier +Copyright (c) dana Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -18,4 +18,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/Makefile b/Makefile index 9dad973..7a66a01 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,45 @@ ## # This file is part of twigc. # -# @author dana geier +# @author dana # @license MIT -all: build +all: build +build: phar +phar: clean twigc.phar +test: test-unit test-integration + +help: + @echo 'Available targets:' + @echo 'all ................ Equivalent to `build`' + @echo 'build .............. Equivalent to `vendor`' + @echo 'install ............ Install phar to `/usr/local/bin/twigc`' + @echo 'clean .............. Remove phar' + @echo 'distclean .......... Remove phar and vendor directory' + @echo 'phar ............... Equivalent to `twigc.phar`' + @echo 'test ............... Run unit and integration tests' + @echo 'test-integration ... Run integration tests against phar' + @echo 'test-unit .......... Run unit tests against source' + @echo 'twigc.phar ......... Build phar' + @echo 'vendor ............. Install vendor directory via Composer' vendor: composer install -twigc.phar: vendor +twigc.phar: + composer install -q --no-dev php -d phar.readonly=0 bin/compile + composer install -q -build: twigc.phar +test-unit: vendor + vendor/bin/phpunit -install: build +test-integration: twigc.phar + ./twigc.phar --help | grep -q -- --version + echo 'hello {{ name }}' | ./twigc.phar -j '{ "name": "foo" }' | grep -qF 'hello foo' + echo 'hello {{ name }}' | ./twigc.phar -p name=foo | grep -qF 'hello foo' + +install: twigc.phar cp twigc.phar /usr/local/bin/twigc clean: @@ -23,5 +48,4 @@ clean: distclean: clean rm -rf vendor/ -.PHONY: all build install clean distclean - +.PHONY: all clean distclean install test test-integration test-unit diff --git a/README.md b/README.md index 36264b7..708e7e8 100644 --- a/README.md +++ b/README.md @@ -5,99 +5,201 @@ for interacting with Twig through shell scripts and other command-line applications. -## Usage overview - -``` -Usage: - twigc [options] [--] [