Skip to content

Commit

Permalink
Merge Popcorn.js v0.9 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher De Cairos committed Oct 5, 2011
2 parents 57ceac8 + aae4e9f commit ce66d47
Show file tree
Hide file tree
Showing 127 changed files with 5,329 additions and 3,904 deletions.
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "players/sequence"]
path = players/sequence
url = git://github.com/rwldrn/popcorn.sequence.git

[submodule "modules/sequence"]
path = modules/sequence
url = https://github.com/rwldrn/popcorn.sequence.git
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Cole Gillespie
Nick Doiron
Bobby Richter
Jon Buckley
Mathew Schranz
Brian Chirls
104 changes: 68 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PLUGINS_DIR = ${PREFIX}/plugins
PARSERS_DIR = ${PREFIX}/parsers
PLAYERS_DIR = ${PREFIX}/players
EFFECTS_DIR = $(PREFIX)/effects
MODULES_DIR = $(PREFIX)/modules

# Version number used in naming release files. Defaults to git commit sha.
VERSION ?= $(shell git show -s --pretty=format:%h)
Expand All @@ -27,6 +28,10 @@ POPCORN_SRC = ${PREFIX}/popcorn.js
POPCORN_DIST = ${DIST_DIR}/popcorn.js
POPCORN_MIN = ${DIST_DIR}/popcorn.min.js

# modules
MODULES_DIST = ${DIST_DIR}/popcorn.modules.js
MODULES_MIN = ${DIST_DIR}/popcorn.modules.min.js

# plugins
PLUGINS_DIST = ${DIST_DIR}/popcorn.plugins.js
PLUGINS_MIN = ${DIST_DIR}/popcorn.plugins.min.js
Expand All @@ -52,32 +57,44 @@ PARSERS_SRC := $(filter-out %unit.js, $(shell find ${PARSERS_DIR} -name 'popcorn
# Grab all popcorn.<player-name>.js files from players dir
PLAYERS_SRC := $(filter-out %unit.js, $(shell find ${PLAYERS_DIR} -name 'popcorn.*.js' -print))

# Grab all popcorn.<effect-name>.js files from players dir
# Grab all popcorn.<effect-name>.js files from effects dir
EFFECTS_SRC := $(filter-out %unit.js, $(shell find $(EFFECTS_DIR) -name 'popcorn.*.js' -print))

# Grab all popcorn.<player-name>.unit.js files from plugins dir
# Grab all popcorn.<Module-name>.js files from modules dir
MODULES_SRC := $(filter-out %unit.js, $(shell find $(MODULES_DIR) -name 'popcorn.*.js' -print))

# Grab all popcorn.<plugin-name>.unit.js files from plugins dir
PLUGINS_UNIT := $(shell find ${PLUGINS_DIR} -name 'popcorn.*.unit.js' -print)

# Grab all popcorn.<player-name>.unit.js files from parsers dir
# Grab all popcorn.<parser-name>.unit.js files from parsers dir
PARSERS_UNIT := $(shell find ${PARSERS_DIR} -name 'popcorn.*.unit.js' -print)

# Grab all popcorn.<player-name>.unit.js files from players dir
PLAYERS_UNIT := $(shell find ${PLAYERS_DIR} -name 'popcorn.*.unit.js' -print)

# Grab all popcorn.<effects>.unit.js files from players dir
# Grab all popcorn.<effects>.unit.js files from effects dir
EFFECTS_UNIT := $(shell find $(EFFECTS_DIR) -name 'popcorn.*.unit.js' -print)

# Grab all popcorn.<module-name>.unit.js files from modules dir
MODULES_UNIT := $(shell find $(MODULES_DIR) -name 'popcorn.*.unit.js' -print)

# popcorn + plugins
POPCORN_COMPLETE_LIST := --js ${POPCORN_SRC} \
$(shell for js in ${MODULES_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PARSERS_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PLAYERS_SRC} ; do echo --js $$js ; done)
POPCORN_COMPLETE_DIST = ${DIST_DIR}/popcorn-complete.js
POPCORN_COMPLETE_MIN = ${DIST_DIR}/popcorn-complete.min.js

# Create a versioned license header for js files we ship: arg1=source arg2=dest
add_license = cat ${PREFIX}/LICENSE_HEADER | sed -e 's/@VERSION/${VERSION}/' > $(2) ; \
cat $(1) >> $(2)
# Create a versioned license header for js files we ship
add_license = cat $(PREFIX)/LICENSE_HEADER | sed -e 's/@VERSION/${VERSION}/' > $(1).__hdr__ ; \
cat $(1).__hdr__ $(1) >> $(1).__tmp__ ; rm -f $(1).__hdr__ ; \
mv $(1).__tmp__ $(1)

# Create a version parameter for Popcorn
add_version = cat $(1) | sed -e 's/@VERSION/${VERSION}/' > $(1).__tmp__ ; \
mv $(1).__tmp__ $(1)

# Run the file through jslint
run_lint = @@$(RHINO) build/jslint-check.js $(1)
Expand All @@ -92,23 +109,35 @@ ${DIST_DIR}:

popcorn: ${POPCORN_DIST}

${POPCORN_DIST}: ${POPCORN_SRC} | ${DIST_DIR}
@@echo "Building" ${POPCORN_DIST}
@@$(call add_license, $(POPCORN_SRC), $(POPCORN_DIST))
${POPCORN_DIST}: $(POPCORN_SRC) | $(DIST_DIR)
@@echo "Building" $(POPCORN_DIST)
@@cp $(POPCORN_SRC) $(POPCORN_DIST)
@@$(call add_license, $(POPCORN_DIST))
@@$(call add_version, $(POPCORN_DIST))

min: ${POPCORN_MIN} ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} $(EFFECTS_MIN) ${POPCORN_COMPLETE_MIN}
min: setup ${POPCORN_MIN} ${MODULES_MIN} ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} $(EFFECTS_MIN) ${POPCORN_COMPLETE_MIN}

${POPCORN_MIN}: ${POPCORN_DIST}
@@echo "Building" ${POPCORN_MIN}
@@$(call compile, --js ${POPCORN_DIST}, ${POPCORN_MIN}.tmp)
@@$(call add_license, ${POPCORN_MIN}.tmp, ${POPCORN_MIN})
@@rm ${POPCORN_MIN}.tmp
@@$(call compile, --js $(POPCORN_DIST), $(POPCORN_MIN))
@@$(call add_license, $(POPCORN_MIN))
@@$(call add_version, $(POPCORN_MIN))

${POPCORN_COMPLETE_MIN}: update ${POPCORN_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
${POPCORN_COMPLETE_MIN}: ${POPCORN_SRC} ${MODULES_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
@@echo "Building" ${POPCORN_COMPLETE_MIN}
@@$(call compile, ${POPCORN_COMPLETE_LIST}, ${POPCORN_COMPLETE_MIN}.tmp)
@@$(call add_license, ${POPCORN_COMPLETE_MIN}.tmp, ${POPCORN_COMPLETE_MIN})
@@rm ${POPCORN_COMPLETE_MIN}.tmp
@@$(call compile, $(POPCORN_COMPLETE_LIST), $(POPCORN_COMPLETE_MIN))
@@$(call add_license, $(POPCORN_COMPLETE_MIN))
@@$(call add_version, $(POPCORN_COMPLETE_MIN))

modules: setup ${MODULES_DIST}

${MODULES_MIN}: ${MODULES_DIST}
@@echo "Building" ${MODULES_MIN}
@@$(call compile, $(shell for js in ${MODULES_SRC} ; do echo --js $$js ; done), ${MODULES_MIN})

${MODULES_DIST}: ${MODULES_SRC} ${DIST_DIR}
@@echo "Building ${MODULES_DIST}"
@@cat ${MODULES_SRC} > ${MODULES_DIST}

plugins: ${PLUGINS_DIST}

Expand Down Expand Up @@ -150,16 +179,24 @@ $(EFFECTS_DIST): $(EFFECTS_SRC) $(DIST_DIR)
@@echo "Building $(EFFECTS_DIST)"
@@cat $(EFFECTS_SRC) > $(EFFECTS_DIST)

complete: update ${POPCORN_SRC} ${PARSERS_SRC} ${PLUGINS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
@@echo "Building popcorn + plugins + parsers + players + effects..."
@@cat ${POPCORN_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) > ${POPCORN_COMPLETE_DIST}.tmp
@@$(call add_license, ${POPCORN_COMPLETE_DIST}.tmp, ${POPCORN_COMPLETE_DIST})
@@rm ${POPCORN_COMPLETE_DIST}.tmp
complete: setup ${POPCORN_SRC} ${MODULES_SRC} ${PARSERS_SRC} ${PLUGINS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) ${DIST_DIR}
@@echo "Building popcorn + modules + plugins + parsers + players + effects..."
@@cat ${POPCORN_SRC} ${MODULES_SRC} ${PLUGINS_SRC} ${PARSERS_SRC} ${PLAYERS_SRC} $(EFFECTS_SRC) > $(POPCORN_COMPLETE_DIST)
@@$(call add_license, $(POPCORN_COMPLETE_DIST))
@@$(call add_version, $(POPCORN_COMPLETE_DIST))

lint:
@@echo "Checking Popcorn against JSLint..."
@@$(call run_lint,popcorn.js)

lint-core-tests:
@@echo "Checking core unit tests against JSLint..."
@@$(call run_lint,test/popcorn.unit.js)

lint-modules:
@@echo "Checking all modules against JSLint..."
@@$(call run_lint,$(MODULES_SRC))

lint-plugins:
@@echo "Checking all plugins against JSLint..."
@@$(call run_lint,$(PLUGINS_SRC))
Expand All @@ -176,6 +213,10 @@ lint-effects:
@@echo "Checking all effects against JSLint..."
@@$(call run_lint,$(EFFECTS_SRC))

lint-modules-tests:
@@echo "Checking modules unit tests against JSLint..."
@@$(call run_lint,$(MODULES_UNIT))

lint-plugin-tests:
@@echo "Checking plugin unit tests against JSLint..."
@@$(call run_lint,$(PLUGINS_UNIT))
Expand All @@ -192,7 +233,7 @@ lint-player-tests:
@@echo "Checking player unit tests against JSLint..."
@@$(call run_lint,$(PLAYERS_UNIT))

lint-unit-tests: lint-plugin-tests lint-parser-tests lint-player-tests lint-effects-tests
lint-unit-tests: lint-modules-tests lint-plugin-tests lint-parser-tests lint-player-tests lint-effects-tests
@@echo "completed"

# Create a mirror copy of the tree in dist/ using popcorn-complete.js
Expand All @@ -212,6 +253,7 @@ testing: complete
@@rm -fr ${TESTING_MIRROR}/AUTHORS ${TESTING_MIRROR}/LICENSE ${TESTING_MIRROR}/LICENSE_HEADER \
${TESTING_MIRROR}/Makefile ${TESTING_MIRROR}/readme.md
@@touch "${TESTING_MIRROR}/THIS IS A TESTING MIRROR -- READ-ONLY"
$(call overwrite_js, ${TESTING_MIRROR}/modules)
$(call overwrite_js, ${TESTING_MIRROR}/plugins)
$(call overwrite_js, ${TESTING_MIRROR}/players)
$(call overwrite_js, ${TESTING_MIRROR}/parsers)
Expand All @@ -222,16 +264,6 @@ clean:
@@echo "Removing Distribution directory:" ${DIST_DIR}
@@rm -rf ${DIST_DIR}

# Setup any git submodules we need
SEQUENCE_SRC = ${PLAYERS_DIR}/sequence/popcorn.sequence.js

setup: ${SEQUENCE_SRC} update

update:
setup:
@@echo "Updating submodules..."
@@git submodule update
@@cd players/sequence; git pull origin master

${SEQUENCE_SRC}:
@@echo "Setting-up submodules..."
@@git submodule init
@@git submodule update --init
6 changes: 4 additions & 2 deletions build/jslint-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ var ok = {
"Use '!==' to compare with 'null'.": true,
"Expected an assignment or function call and instead saw an expression.": true,
"Expected a 'break' statement before 'case'.": true,
"'e' is already defined.": true
"'e' is already defined.": true,
"Don't make functions within a loop.": true,
"['out'] is better written in dot notation.": true
};

function check(src)
Expand All @@ -26,7 +28,7 @@ function check(src)
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
}
}

if ( found > 0 ) {
print( "\n" + found + " Error(s) found." );
} else {
Expand Down
86 changes: 0 additions & 86 deletions demos/popcorn/index.html

This file was deleted.

Loading

0 comments on commit ce66d47

Please sign in to comment.