Skip to content

New build system #176

Closed
wants to merge 110 commits into from
Select commit
+92 −2
View
68 Makefile
@@ -0,0 +1,68 @@
+# Make mustaches
+
+# make a release
+release: test args tag build-wrappers
+ @echo Done!
+
+args:
+ifeq ($(version),)
+ @echo "Usage make release version=x.y.z"
+else
+ @echo "Releasing: ${version}"
+endif
+
+tag:
+ # splice in version
+ sed -i.bak -e "s|%version%|${version}|" mustache.js package.json
+ git commit -m 'Released ${version}' mustache.js package.json
+ # tag the version
+ git tag ${version}
+ # revert the version
+ sed -i.bak -e 's|exports.version = "${version}"|exports.version = "%version%"|' mustache.js
+ sed -i.bak -e 's|"version": "${version}"|"version": "%version%"|' package.json
+ git commit -m 'Back to non-released version' mustache.js package.json
+ rm *.bak
+
+build-wrappers:
+ # from that tag:
+ # build all wrappers / minify
+ git checkout $(version)
+ build/wrappers.sh $(version)
+ `echo "/*! Version: $(version) */" > mustache.min.js`
+ `uglifyjs mustache.js >> mustache.min.js`
+ mkdir wrappers/mustache-$(version)
+ cp mustache.js mustache.min.js package.json README.md LICENSE \
+ wrappers/mustache-$(version)/
+ cd wrappers; \
+ tar czf mustache-$(version).tar.gz mustache-$(version); \
+ cd ..
+ mv wrappers/mustache-$(version).tar.gz wrappers/mustache-$(version)/
+
+ git checkout gh-pages
+ mkdir ${version}
+ cp -r wrappers/mustache-* $(version)/
+ cp wrappers/mustache-$(version)/* $(version)
+ rm -rf wrappers
+
+ # update gh-pages with release links & travis
+
+ # add $(version)/index.html page (from template)
+ sed -e 's|%version%|$(version)|' \
+ -e 's|%date%|$(strip $(shell date))|' release-index.html > $(version)/index.html
+
+ # update index.html to point to $(vesion)
+ cat index.html.pre > index.html
+ for release in `ls -rp | grep '/'`; do relno=`echo $$release | sed -e 's|/||'`; echo "<li><a href=\"$${release}\">$${relno}</a></li>" >> index.html; done
+ cat index.html.post >> index.html
+ git add $(version)
+ git commit -m 'Release $(version)' index.html $(version)
+ git clean -fdx
+ git checkout new-build-system
+ # update npm
+ # update cdnjs
+
+# make test
+test:
+ rspec spec/mustache_spec.rb
+
+PHONY: test release args tag build-wrappers
View
22 build/wrappers.sh
@@ -0,0 +1,22 @@
+#!/bin/sh -ex
+if [ -z "$1" ]; then
+ echo "Usage: ./build-wrapper.sh x.y.z"
+ exit 1
+fi
+version=$1
+cd wrappers
+ for wrapper in *; do
+ target_dir="mustache-${wrapper}"
+ mkdir -p $target_dir
+ target=$target_dir/${wrapper}.mustache.js
+ touch $target
+ cat ${wrapper}/mustache.js.pre >> ${target}
+ cat ../mustache.js >> ${target}
+ cat ${wrapper}/mustache.js.post >> ${target}
+ uglifyjs ${target} > ${target_dir}/${wrapper}.mustache.min.js
+ cp ../README.md ${target_dir}
+ cp ../LICENSE ${target_dir}
+ tar czf ${target_dir}.tar.gz ${target_dir}
+ mv ${target_dir}.tar.gz ${target_dir}
+ done
+cd ..
View
2 mustache.js
@@ -7,7 +7,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};
(function (exports) {
exports.name = "mustache.js";
- exports.version = "0.5.0-dev";
+ exports.version = "%version%";
exports.tags = ["{{", "}}"];
exports.parse = parse;
exports.compile = compile;
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "mustache",
- "version": "0.5.0-dev",
+ "version": "%version%",
"description": "Logic-less {{mustache}} templates with JavaScript",
"author": "mustache.js Authors <http://github.com/janl/mustache.js>",
"keywords": ["mustache", "template", "templates", "ejs"],
Something went wrong with that request. Please try again.