--- modules/damieng/graphical_editor/loncapa_daxe/build.sh 2015/05/07 15:38:52 1.2 +++ modules/damieng/graphical_editor/loncapa_daxe/build.sh 2015/12/03 17:29:46 1.6 @@ -1,33 +1,35 @@ #!/bin/sh # Create a distribution that can run in any browser, without the source code. -# Once the dist directory is on a web server, Daxe can be launched with a URL like -# http://localhost/dist/daxe.html?config=config/loncapa_config.xml +# Once the daxe directory is on a web server, Daxe can be launched with a URL like +# http://localhost/daxe/daxe.html?config=config/loncapa_config.xml -# reset the dist directory -rm -rf dist -mkdir dist +# get dependencies and Daxe latest version from github +pub get +pub upgrade daxe -# compile LON-CAPA Daxe +# compile LON-CAPA Daxe and copy resource files +pub build -# NOTE: dart2js is in dart-sdk/bin, which should be on the PATH -dart2js --minify --out=dist/loncapa_daxe.min.js web/loncapa_daxe.dart -rm dist/*.js.map dist/*.deps +# extract JSME if necessary +if [ ! -d build/web/jsme ]; then + echo "Extracting JSME..." + unzip -q -d build/web 'JSME_2015-03-03_xsiframe.zip' 'JSME_2015-03-03_xsiframe/jsme/*' + mv 'build/web/JSME_2015-03-03_xsiframe/jsme' build/web/ + rmdir 'build/web/JSME_2015-03-03_xsiframe' +fi -# copy Daxe files -mkdir -p dist/packages/daxe -# note the / at the end of the paths, it copies only the contents -rsync -a ../daxe/lib/ dist/packages/daxe/ --exclude CVS --exclude '*.dart' --exclude packages --exclude src +# remove JSME (included in LON-CAPA) +rm -r build/web/jsme - -# copy LON-CAPA Daxe files - -cp daxe.html dist/ - -rsync -a web/ dist/ --exclude CVS --exclude '*.dart' --exclude packages --exclude tests --exclude nodes --exclude '*.html' --exclude 'XHTML_config.xml' --exclude 'xhtml1-strict.xsd' +# replace web/loncapa_daxe.html by daxe.html (which does not link to a dart file) +rm build/web/loncapa_daxe.html +cp daxe.html build/web/ +# rename build/web +mv build/web build/daxe