Skip to content

Commit

Permalink
[mozilla#224] Makefile for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottDowne committed Dec 15, 2010
1 parent 12bad18 commit 9535dbe
Show file tree
Hide file tree
Showing 11 changed files with 6,008 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Make sure $JSSHELL points to your js shell binary in .profile or .bashrc
TOOLSDIR=./tools

all: release

create-release: clean
mkdir ./release

# Version number used in naming release files.
VERSION ?= $(error Specify a version for your release (e.g., VERSION=0.5))

release: release-files zipped

release-files: popcorn yui release-docs

zipped: release-files
gzip -c ./release/popcorn-${VERSION}.min.js > ./release/popcorn-${VERSION}.min.js.gz
find ./release -print | zip -j ./release/popcorn.js-${VERSION}.zip -@

release-docs: create-release
cp AUTHORS ./release
cat README | sed -e 's/@VERSION@/${VERSION}/' > ./release/README
cp LICENSE ./release
cp CHANGELOG ./release

pretty: create-release
${TOOLSDIR}/jsbeautify.py ${JSSHELL} popcorn.js > ./release/popcorn-${VERSION}.js.tmp
# check for any parsing errors in pretty version of popcorn.js
${JSSHELL} -f ${TOOLSDIR}/fake-dom.js -f ./release/popcorn-${VERSION}.js.tmp
cat ./release/popcorn-${VERSION}.js.tmp | sed -e 's/@VERSION@/${VERSION}/' > ./release/popcorn-${VERSION}.js
rm -f ./release/popcorn-${VERSION}.js.tmp

popcorn: create-release
cp popcorn.js ./release/popcorn-${VERSION}.js.tmp
# check for any parsing errors in popcorn.js
${JSSHELL} -f ${TOOLSDIR}/fake-dom.js -f ./release/popcorn-${VERSION}.js.tmp
cat ./release/popcorn-${VERSION}.js.tmp | sed -e 's/@VERSION@/${VERSION}/' > ./release/popcorn-${VERSION}.js
rm -f ./release/popcorn-${VERSION}.js.tmp

yui: create-release
# java -jar ${TOOLSDIR}/yui/yuicompressor-2.4.2.jar --nomunge popcorn.js -o ./release/popcorn-${VERSION}.min.js
java -jar ${TOOLSDIR}/yui/yuicompressor-2.4.2.jar popcorn.js -o ./release/popcorn-${VERSION}.min.js
# check for any parsing errors in compiled version of popcorn.js
${JSSHELL} -f ${TOOLSDIR}/fake-dom.js -f ./release/popcorn-${VERSION}.min.js

check: check-lint

check-lint:
${TOOLSDIR}/jslint.py ${JSSHELL} popcorn.js

# Most targets use commands that need a js shell path specified
JSSHELL ?= $(error Specify a valid path to a js shell binary in ~/.profile: export JSSHELL=C:\path\js.exe or /path/js)

clean:
rm -fr ./release
7 changes: 7 additions & 0 deletions tools/cleaner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Swap escaped bits in code. See jsshellhelper.py for creation of __escaped_string
function __unescape_string() {
return __escaped_string.replace(/@DQUOTE@/g, '"').
replace(/@SQUOTE@/g, "'").
replace(/@NEWLINE@/g, '\n').
replace(/@BACKSLASH@/g, '\\');
}
Empty file added tools/fake-dom.js
Empty file.
Loading

0 comments on commit 9535dbe

Please sign in to comment.