Browse Source

Updated readme and added makefile.

master
Daniel Sissom 10 months ago
parent
commit
c65d63ac53
Signed by: djsissom GPG Key ID: 2C30FFB796852389
2 changed files with 263 additions and 3 deletions
  1. + 250
    - 0
      Makefile
  2. + 13
    - 3
      README

+ 250
- 0
Makefile

@ -0,0 +1,250 @@
################################################################################
#
# Makefile for generalized web build
#
################################################################################
#===============================================================================
# Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#===============================================================================
BUILDDIR = build
SRCDIR = .
PUG = pug
PUGFLAGS = --pretty --path .
PUGFLAGS_PROD = --path .
PUGDIR = $(SRCDIR)
TMPLDIR = $(PUGDIR)/templates
SASS = sassc
SASSFLAGS = --line-numbers --style expanded
SASSFLAGS_PROD = --style compressed
SASSEXT = scss
SASSDIR = $(SRCDIR)/style
CSSDIR = $(BUILDDIR)/style
JS = cp
JSFLAGS =
JSFLAGS_PROD =
JSSRCDIR = $(SRCDIR)/script
JSDIR = $(BUILDDIR)/script
JSVENDOR = cp
JSVENDORFLAGS =
JSVENDORFLAGS_PROD =
JSVENDORSRCDIR = $(SRCDIR)/script/vendor
JSVENDORDIR = $(BUILDDIR)/script/vendor
JQUERY_VERSION = 1.12.0
IMG = cp
IMGFLAGS =
IMGFLAGS_PROD =
IMGSRCDIR = $(SRCDIR)/media/img
IMGDIR = $(BUILDDIR)/media/img
VID = cp
VIDFLAGS =
VIDFLAGS_PROD =
VIDSRCDIR = $(SRCDIR)/media/vid
VIDDIR = $(BUILDDIR)/media/vid
FONT = cp
FONTFLAGS =
FONTFLAGS_PROD =
FONTSRCDIR = $(SRCDIR)/media/font
FONTDIR = $(BUILDDIR)/media/font
EXT = cp
EXTFLAGS =
EXTFLAGS_PROD =
EXTDIR = $(SRCDIR)/extras
#===============================================================================
# Files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#===============================================================================
PUGTEMPLATES = $(shell find $(TMPLDIR) -type f -name \*.pug -print)
PUGFILES = $(shell find $(PUGDIR) -type d -path $(TMPLDIR) -prune -o -type f -name \*.pug -print)
MDFILES = $(shell find $(PUGDIR) -type d -path $(TMPLDIR) -prune -o -type f -name \*.md -print)
HTMLFILES = $(patsubst $(PUGDIR)/%.pug, $(BUILDDIR)/%.html, $(PUGFILES))
SASSFILES = $(wildcard $(SASSDIR)/[^_]*.$(SASSEXT))
SASSSTUBS = $(wildcard $(SASSDIR)/_*.$(SASSEXT))
CSSFILES = $(patsubst $(SASSDIR)/%.$(SASSEXT), $(CSSDIR)/%.css, $(SASSFILES))
JSFILES_SRC = $(wildcard $(JSSRCDIR)/*.js)
JSFILES = $(patsubst $(JSSRCDIR)/%, $(JSDIR)/%, $(JSFILES_SRC))
JSVENDORFILES_SRC = $(wildcard $(JSVENDORSRCDIR)/*.js)
JSVENDORFILES = $(patsubst $(JSVENDORSRCDIR)/%, $(JSVENDORDIR)/%, $(JSVENDORFILES_SRC))
IMGFILES_SRC = $(wildcard $(IMGSRCDIR)/*)
IMGFILES = $(patsubst $(IMGSRCDIR)/%, $(IMGDIR)/%, $(IMGFILES_SRC))
VIDFILES_SRC = $(wildcard $(VIDSRCDIR)/*)
VIDFILES = $(patsubst $(VIDSRCDIR)/%, $(VIDDIR)/%, $(VIDFILES_SRC))
FONTFILES_SRC = $(wildcard $(FONTSRCDIR)/*)
FONTFILES = $(patsubst $(FONTSRCDIR)/%, $(FONTDIR)/%, $(FONTFILES_SRC))
FEEDFILES_SRC = $(wildcard $(EXTDIR)/feed.*)
TXTFILES_SRC = $(wildcard $(EXTDIR)/*.txt)
PNGFILES_SRC = $(wildcard $(EXTDIR)/*.png)
ICOFILES_SRC = $(wildcard $(EXTDIR)/*.ico)
XMLFILES_SRC = $(wildcard $(EXTDIR)/*.xml)
HTACCESS_SRC = $(EXTDIR)/.htaccess
CNAME_SRC = $(EXTDIR)/CNAME
FEEDFILES = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(FEEDFILES_SRC))
TXTFILES = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(TXTFILES_SRC))
PNGFILES = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(PNGFILES_SRC))
ICOFILES = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(ICOFILES_SRC))
XMLFILES = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(XMLFILES_SRC))
HTACCESS = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(HTACCESS_SRC))
CNAME = $(patsubst $(EXTDIR)/%, $(BUILDDIR)/%, $(CNAME_SRC))
#===============================================================================
# Rules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#===============================================================================
.PHONY: all html css js jsvendor img vid font extras feed production deploy clean
all: html css js jsvendor img vid font extras feed
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
html: $(HTMLFILES)
$(HTMLFILES): $(PUGTEMPLATES)
$(BUILDDIR)/%.html: $(PUGDIR)/%.pug
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(PUG) $(PUGFLAGS) -o $(dir $@) $<
if [[ `grep '{{JQUERY_VERSION}}' $@` ]]; then sed -i "s/{{JQUERY_VERSION}}/$(JQUERY_VERSION)/" $@; fi
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
css: $(CSSFILES)
$(CSSFILES): $(SASSFILES) $(SASSSTUBS)
$(CSSDIR)/%.css: $(SASSDIR)/%.$(SASSEXT)
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(SASS) $(SASSFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
js: $(JSFILES)
$(JSFILES): $(JSFILES_SRC)
$(JSDIR)/%.js: $(JSSRCDIR)/%.js
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(JS) $(JSFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
jsvendor: $(JSVENDORFILES)
$(JSVENDORFILES): $(JSVENDORFILES_SRC)
$(JSVENDORDIR)/%.js: $(JSVENDORSRCDIR)/%.js
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(JSVENDOR) $(JSVENDORFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
img: $(IMGFILES)
$(IMGFILES): $(IMGFILES_SRC)
$(IMGDIR)/%: $(IMGSRCDIR)/%
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(IMG) $(IMGFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
vid: $(VIDFILES)
$(VIDFILES): $(VIDFILES_SRC)
$(VIDDIR)/%: $(VIDSRCDIR)/%
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(VID) $(VIDFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
font: $(FONTFILES)
$(FONTFILES): $(FONTFILES_SRC)
$(FONTDIR)/%: $(FONTSRCDIR)/%
if [[ ! -d $(dir $@) ]]; then mkdir -p $(dir $@); fi
$(FONT) $(FONTFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
extras: $(FEEDFILES) $(TXTFILES) $(PNGFILES) $(ICOFILES) $(XMLFILES) $(HTACCESS) $(CNAME)
$(BUILDDIR)/feed.%: $(EXTDIR)/feed.%
$(EXT) $(EXTFLAGS) $< $@
$(BUILDDIR)/%.txt: $(EXTDIR)/%.txt
$(EXT) $(EXTFLAGS) $< $@
$(BUILDDIR)/%.png: $(EXTDIR)/%.png
$(EXT) $(EXTFLAGS) $< $@
$(BUILDDIR)/%.ico: $(EXTDIR)/%.ico
$(EXT) $(EXTFLAGS) $< $@
$(BUILDDIR)/%.xml: $(EXTDIR)/%.xml
$(EXT) $(EXTFLAGS) $< $@
$(BUILDDIR)/.htaccess: $(EXTDIR)/.htaccess
$(EXT) $(EXTFLAGS) $< $@
$(BUILDDIR)/CNAME: $(EXTDIR)/CNAME
$(EXT) $(EXTFLAGS) $< $@
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
feed: $(FEEDFILES_SRC)
$(FEEDFILES_SRC): $(PUGFILES) $(MDFILES)
./mkfeed.py feed.rss
mv feed.rss extras/feed.rss
./mkfeed.py feed.atom
mv feed.atom extras/feed.atom
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
production: all
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
deploy: production
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
clean:
rm -v $(HTMLFILES) \
$(CSSFILES) \
$(JSFILES) \
$(JSVENDORFILES) \
$(IMGFILES) \
$(VIDFILES) \
$(FONTFILES) \
$(FEEDFILES) \
$(TXTFILES) \
$(PNGFILES) \
$(ICOFILES) \
$(XMLFILES) \
$(HTACCESS) \
$(CNAME)

+ 13
- 3
README

@ -1,9 +1,19 @@
In build upstream bare repo (webserver:/usr/local/src/web/example.com/www/), run:
# git worktree add /srv/beta/example.com/www master
# git worktree add /srv/prod/example.com/www release
# git init --bare --shared=group
# git config receive.denyCurrentBranch updateInstead
# git config receive.denyNonFastForwards false
?(# git config core.sharedRepository true)
# git worktree add /srv/prod/example.com/www master
# git worktree add /srv/beta/example.com/www release
# git worktree add /srv/dev/example.com/www dev
# chown -R root:srv .
# chmod -R g+xwX .
# chmod -R g+swX .
# chown root:srv /srv/prod/example.com/www
# chmod g+swX /srv/prod/example.com/www
# chown root:srv /srv/beta/example.com/www
# chmod g+swX /srv/beta/example.com/www
# chown root:srv /srv/dev/example.com/www
# chmod g+swX /srv/dev/example.com/www
and add your user (on the server) to the srv group.

Loading…
Cancel
Save