Last active
October 6, 2015 16:18
-
-
Save orian/3020213 to your computer and use it in GitHub Desktop.
Quick and dirty script to automagically download and unpack Dart editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# just add copy&paste to your .bashrc | |
# require wget, unzip | |
DART_PKG_NAME="darteditor-linux-64.zip" | |
#If variable is not defined, set variable. | |
check-env-var() { | |
X=$1 | |
if [ -z "${!X}" ]; then | |
export $X=$2 | |
echo "export $X=${!X}" | |
return | |
fi | |
echo "$X already set." | |
} | |
check-env-var WORKDIR $HOME/workspace # user workspace | |
check-env-var DART_WORKDIR $WORKDIR/dart # user workspace for dart | |
check-env-var DART_DIR $HOME/dart # dart main dir, dart editor will be in subdir | |
check-env-var DART_SDK_DIR $DART_DIR/dart/dart-sdk | |
dart-editor-update() { | |
pushd $DART_DIR | |
rm -Rf dart | |
wget "https://gsdview.appspot.com/dart-editor-archive-integration/latest/$DART_PKG_NAME" | |
unzip $DART_PKG_NAME | |
popd ; | |
} | |
dart-editor-get() { | |
mkdir $DART_DIR | |
dart-editor-update | |
} | |
dart-editor() { | |
$DART_DIR/dart/DartEditor | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to add some file hash validation.
Maybe download just a https://gsdview.appspot.com/dart-editor-archive-integration/latest/changelog.hml, hash and compare with previous one and download whole package only if changed.