diff options
| author | Gubolin <gubolin@fantasymail.de> | 2015-01-24 10:04:34 +0100 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2015-01-24 10:04:34 +0100 |
| commit | 3960ec456021910ead8f4e65e59d4e764442822b (patch) | |
| tree | 1867287a5516140dcf1a604a87649d2596d7d1ec /binary.sh | |
| parent | abd2808e3ec474c3c72e22d3cea7e98a941521e8 (diff) | |
| download | snap-3960ec456021910ead8f4e65e59d4e764442822b.tar.gz snap-3960ec456021910ead8f4e65e59d4e764442822b.zip | |
add the possibility to load binary projects dynamically
Diffstat (limited to 'binary.sh')
| -rwxr-xr-x | binary.sh | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -7,7 +7,7 @@ fi if [[ $# < 2 ]] then - echo "Usage: binary.sh OPTION PLATFORM [FILE]" + echo "Usage: binary.sh OPTION PLATFORM [FILE/URL]" echo "" echo "OPTIONS:" echo " -m Mobile" @@ -17,7 +17,7 @@ then echo " Mobile amazon-fireos android blackberry10 firefoxos ios ubuntu wp8 win8 tizen" echo " Desktop win osx linux32 linux64" echo "" - echo "If FILE is given, it will be #open-ed inside Snap\! immediately" + echo "If FILE/URL is given, it will be #open-ed inside Snap\! immediately. URL will be loaded at runtime." exit 0 fi @@ -28,6 +28,7 @@ scriptdir=$(readlink -e ".") # UglifyJS2 (https://github.com/mishoo/UglifyJS2) ide=true +url=false platform=$2 # presentation mode @@ -40,9 +41,9 @@ if [ $ide == false ] then if [ -f "$3" ] then - content=$(cat $3) + content="'$(cat $3)'" else - ide=true + url=true fi fi @@ -63,16 +64,23 @@ then sed -i '/cloud\.js"/d' snap.html sed -i 's/gui\.js"/binary\.js"/' snap.html - # load custom project from file - sed -i '/sha512\.js"/a\ - <script type="text/javascript" src="code.js"></script> ' snap.html + # load custom project from file or url + if [ $url == false ] + then + sed -i '/sha512\.js"/a\ + <script type="text/javascript" src="code.js"></script> ' snap.html + + echo "var code =" > code.js + echo "$content" >> code.js + echo ";" >> code.js - echo "var code =" > code.js - echo "'$content'" >> code.js - echo ";" >> code.js + sed -i "/ide\.openIn/a\ + ide.droppedText(code); " snap.html + else + sed -i "/ide\.openIn/a\ + ide.droppedText(ide.getURL('$3')); " snap.html + fi - sed -i "/ide\.openIn/a\ - ide.droppedText(code); " snap.html else rm binary.js fi |
