--- modules/damieng/graphical_editor/loncapa_daxe/build.sh 2015/09/14 15:58:57 1.4 +++ modules/damieng/graphical_editor/loncapa_daxe/build.sh 2015/12/03 17:29:46 1.6 @@ -1,43 +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 Daxe latest version from github +# get dependencies and Daxe latest version from github +pub get pub upgrade daxe -# compile LON-CAPA Daxe - -# 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 - - -# copy Daxe resource files - -mkdir -p dist/packages/daxe -# note the / at the end of the paths, it copies only the contents -rsync -a packages/daxe/ dist/packages/daxe/ --exclude CVS --exclude '*.dart' --exclude packages --exclude src +# compile LON-CAPA Daxe and copy resource files +pub build -# copy LON-CAPA Daxe files +# 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 -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' --exclude 'jsme' +# remove JSME (included in LON-CAPA) +rm -r build/web/jsme +# 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/ -# extract JSME -unzip -d dist 'JSME_2015-03-03_xsiframe.zip' -mv 'dist/JSME_2015-03-03_xsiframe/jsme' dist/ -rm -r 'dist/JSME_2015-03-03_xsiframe' +# rename build/web +mv build/web build/daxe