Skip to content

Instantly share code, notes, and snippets.

@arteymix
Created August 18, 2014 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arteymix/4a162dd185ac0e4f781e to your computer and use it in GitHub Desktop.
Save arteymix/4a162dd185ac0e4f781e to your computer and use it in GitHub Desktop.
Kohana Makefile
# Kohana Makefile
# user and group for the web server
USER=apache
GROUP=apache
# kohana files
KOHANA=index.php .gitignore example.htaccess composer.json application/bootstrap.php
VERSION=3.3
# cache and log folders
CACHE=application/cache modules/twig/cache
LOGS=application/logs
DOC=apigen
DOCFLAGS=
# css and js minifier
CSSM=cssmin
CSSMFLAGS=
JSM=uglifyjs
JSMFLAGS=
# css and js files
CSS=$(shell find assets/css/ -type f -name '*.css' -not -name '*.min.css')
JS=$(shell find assets/js/ -type f -name '*.js' -not -name '*.min.js')
# phpunit
PHPUNIT=phpunit
PHPUNITFLAGS=
all: permissions clean minify
mkdir -p $(CACHE) $(LOGS)
# install kohana
install: $(KOHANA)
mkdir -p $(CACHE) $(LOGS)
$(KOHANA):
wget https://raw.githubusercontent.com/kohana/kohana/$(VERSION)/master/$@
permissions:
chown -R $(USER):$(GROUP) $(CACHE) $(LOGS)
chmod -R 777 $(CACHE) $(LOGS)
ifeq ($(shell selinuxenabled; echo $$?), 0)
chcon -R -t httpd_sys_script_rw_t $(CACHE)
chcon -R -t httpd_sys_script_ra_t $(LOGS)
endif
minify: $(patsubst %.css, %.min.css, $(CSS)) $(patsubst %.js, %.min.js, $(JS))
%.min.css: %.css
$(CSSM) $(CSSMFLAGS) $< > $@
%.min.js: %.js
$(JSM) $(JSMFLAGS) $< > $@
test:
$(PHPUNIT) $(PHPUNITFLAGS)
coverage:
$(PHPUNIT) $(PHPUNITFLAGS) --coverage-html coverage
documentation:
$(DOC) $(DOCFLAGS)
clean:
rm -rf $(CACHE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment