Snippets
Created by
Housni Yakoob
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #
# Koobli3
#
# Copyright (c) 2015 Koobli3 <housni.yakoob@gmail.com>
#
# USAGE:
# make [OPTION] TARGET
#
# DESCRIPTION
# Builder for the Koobli3 project providing TARGETs that do everything from configuring and
# installing to cleaning.
#
# OPTIONS
# PROJECT=<name>
# <name> is a string and it is typically the name of the project. Using `sed`, this
# variable will be inserted into files, replacing instances of '__PROJECT__NAME__'
# with <name>.
#
# SECRET=<key>
# <key> will be used as the secret key for MCRYPT in session configuration file that is
# located at 'app/libraries/koobli3/config/bootstrap/session.php'. If this value is not
# provided, one is generated by grabbing the 'md5sum' output of a git object file.
#
# TARGETS
# prepare
# configure
# install
# clean
# distclean
# help
#
# OS detection
UNAME := $(shell uname)
ifeq ($(UNAME_S),Darwin)
OS = darwin
else
OS = linux
endif
ifndef SECRET
# Looks for the last file in the '.git/objects/*/*' directory and grabs the 'md5sum' of that
# file (omitting the file name from the output)
SECRET="$(shell md5sum $(shell ls -1 $(CURDIR)/.git/objects/*/* | tail -n 1) | cut -c -32)"
endif
prepare:
ifndef PROJECT
$(error PROJECT is not set)
endif
# target: configure - configures all files for the installation
configure:
prepare
cp $(CURDIR)/app/libraries/koobli3/config/bootstrap/connections.sample.php $(CURDIR)/app/libraries/koobli3/config/bootstrap/connections.php
chmod -R 0777 $(CURDIR)/app/resources/tmp
sed -i -e "s|__PROJECT__NAME__|$(PROJECT)|g" $(CURDIR)/app/libraries/koobli3/config/bootstrap.php
sed -i -e "s|__MCRYPT_SECRET_KEY__|$(SECRET)|g" $(CURDIR)/app/libraries/koobli3/config/bootstrap/session.php
# target: install - installs the app.
install:
git submodule update --init --recursive
./li3 db schema create Roles,Users,RolesUsers
./li3 db reload
wget -O $(CURDIR)/app/webroot/js/respond.js \
https://raw.github.com/scottjehl/Respond/master/src/respond.js
wget -O $(CURDIR)/app/webroot/js/bootstrap.min.js \
https://raw.github.com/twbs/bootstrap/master/dist/js/bootstrap.min.js
wget -O $(CURDIR)/app/webroot/css/bootstrap.min.css \
https://raw.github.com/twbs/bootstrap/master/dist/css/bootstrap.min.css
wget -O $(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.eot \
https://github.com/twbs/bootstrap/raw/master/dist/fonts/glyphicons-halflings-regular.eot
wget -O $(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.svg \
https://raw.github.com/twbs/bootstrap/master/dist/fonts/glyphicons-halflings-regular.svg
wget -O $(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.ttf \
https://github.com/twbs/bootstrap/raw/master/dist/fonts/glyphicons-halflings-regular.ttf
wget -O $(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.woff \
https://github.com/twbs/bootstrap/raw/master/dist/fonts/glyphicons-halflings-regular.woff
wget -O $(CURDIR)/app/webroot/js/jquery-latest.min.js \
http://code.jquery.com/jquery-latest.min.js
wget -O $(CURDIR)/app/webroot/js/modernizr.min.js \
http://modernizr.com/downloads/modernizr-latest.js
wget -O $(CURDIR)/app/webroot/js/holder.js \
https://raw.github.com/imsky/holder/master/holder.js
# target: install - Cleans out templates and log files.
clean:
\rm -rf $(CURDIR)/app/resources/tmp/cache/templates/*.php
\rm -rf $(CURDIR)/app/resources/tmp/cache/states/*.json
\rm -rf $(CURDIR)/app/resources/tmp/logs/*/*.log*
# target: install - Sets everything to the way it originally was.
distclean:
clean
./li3 db schema create
\rm $(CURDIR)/app/libraries/koobli3/config/bootstrap/connections.php
sed -i -e "s|define('PROJECT_NAME', '[^']*');|define('PROJECT_NAME', '__PROJECT__NAME__');|g" app/libraries/koobli3/config/bootstrap.php
sed -i -e "s|'secret'\s*=>\s*'[^']*'|'secret' => '__MCRYPT_SECRET_KEY__'|g" $(CURDIR)/app/libraries/koobli3/config/bootstrap/session.php
\rm $(CURDIR)/app/webroot/js/respond.js \
$(CURDIR)/app/webroot/js/bootstrap.min.js \
$(CURDIR)/app/webroot/css/bootstrap.min.css \
$(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.eot \
$(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.svg \
$(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.ttf \
$(CURDIR)/app/webroot/fonts/glyphicons-halflings-regular.woff \
$(CURDIR)/app/webroot/js/jquery-latest.min.js \
$(CURDIR)/app/webroot/js/modernizr.min.js \
$(CURDIR)/app/webroot/js/holder.js
# target: help - Display callable targets.
help:
egrep "^# target:" [Mm]akefile
.PHONY: prepare configure install clean distclean help
|
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.