Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop'
Browse files Browse the repository at this point in the history
Conflicts:
	readme.md
  • Loading branch information
magoni committed Sep 19, 2014
2 parents 5a631d3 + 4b0d9b1 commit 78ba205
Show file tree
Hide file tree
Showing 54 changed files with 4,357 additions and 2,648 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
*.pyc
*dev.html
todo.md

.DS_Store
.DS_Store
tags
24 changes: 23 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
language: node_js
script: phantomjs tests/run.js

env:
- TEST_DIVA=source
- TEST_DIVA=build

install:
- npm install less
- wget http://dl.google.com/closure-compiler/compiler-latest.zip
- unzip compiler-latest.zip
- chmod a+rx compiler.jar
- phantomjs --version

before_script: ./build.sh all

script: ./build.sh test

notifications:
irc:
channels:
- "chat.freenode.net#ddmal"
on_success: change
on_failure: change
skip_join: true
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Authors of diva.js

Wendy Liu (wendy.liu[at]mail.mcgill.ca)
Evan Magoni
Andrew Hankinson (andrew.hankinson[at]mail.mcgill.ca)
Laurent Pugin (lxpugin[at]gmail.com)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Diva.js

Copyright (C) 2011, 2012 by Wendy Liu, Andrew Hankinson, Laurent Pugin
Copyright (C) 2011-2014 by Wendy Liu, Evan Magoni, Andrew Hankinson, Laurent Pugin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
121 changes: 121 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash

# Path to the Closure Compiler .jar file
CLOSURE_COMPILER_PATH="/usr/local/bin/closure-compiler"

# If running in Travis CI, use local compiler.jar
if [ "$TRAVIS" = "true" ]; then
CLOSURE_COMPILER_PATH="java -jar ../../compiler.jar"
fi

less ()
{
# Builds the CSS files from the LESS source files.
# Creates a minified version called diva.min.css in build/css
# and a non-minified version called diva.css.
# See build/css/readme.md for more information.
mkdir -p build/css
lessc source/css/imports.less > build/css/diva.css
lessc source/css/imports.less > build/css/diva.min.css -x
}

minify ()
{
# Builds the minified Javascript files from the source files.
# Creates a minified file called diva.min.js in build/js which contains
# all the relevant Javascript (except for jQuery, which must
# be included separately).
# See build/js/readme.md for more information.
echo "Using Closure path:" $CLOSURE_COMPILER_PATH

source_files=( "utils.js" "diva.js" "plugins/*" )

mkdir -p build/js
cd source/js && eval $CLOSURE_COMPILER_PATH" --js "${source_files[@]:0}" --js_output_file ../../build/js/diva.min.js"
cd ../../
cp -R source/js/ build/js/
}

all ()
{
if [ -d "build" ]; then
echo "Removing old build directory"
rm -r build/*
fi

mkdir -p build/demo
cp -R source/img build/
cp -R source/processing build/
less
minify
cp demo/index.html build/
cp demo/diva/* build/demo
cp demo/beromunster.json build/demo/
cp readme.md build/
}

test ()
{
if [ "$TEST_DIVA" = "source" ]; then
echo "Testing source"
phantomjs tests/run.js tests/source.html
else
echo "Testing build"
phantomjs tests/run.js
fi
}

release()
{
# Creates a zip file containing just the files we need for the release.
VERSION=$1
if [ -z "$1"]; then
echo "Syntax: ./build.sh release VERSION"
exit 1
fi

all
release_dir="diva-"$VERSION

if [ -d $release_dir ]; then
echo "Release Path exists. Removing."
rm -r $release_dir
fi

mkdir -p $release_dir

# Copy all the files over (within loop, $1==source_file, $2==dest_file)
for file in "readme.md readme.md" "AUTHORS AUTHORS" "LICENSE LICENSE" "build/js/ diva.js/js" "build/css/ diva.js/css" "build/img/ diva.js/img" "source/processing/ processing"
do
# parameterize each $file. nb: global positional params get overwritten.
set -- $file
build_path=$release_dir"/"$2

if [ -f $1 ]; then
cp $1 $build_path
elif [ -d $1 ]; then
mkdir -p $build_path
cp -R $1 $build_path
else echo "Skipping "$build_path
fi
done
tar -zvcf $release_dir".tar.gz" $release_dir
zip -r $release_dir".zip" $release_dir
}

case "$1" in
"less" ) less;;
"minify" ) minify;;
"test" ) test;;
"all" ) all;;
"release" ) release $2;;
* )
echo "Build options:"
echo " all - Builds CSS and Javascript, copies source to build directory"
echo " less - Compiles CSS from the LESS source"
echo " minify - Builds Javascript source"
echo " test - Runs unit tests with PhantomJS"
echo " release VERSION - Builds release package"
;;
esac

Loading

0 comments on commit 78ba205

Please sign in to comment.