Skip to content

Instantly share code, notes, and snippets.

@orian
Last active October 6, 2015 16:18
Show Gist options
  • Save orian/3020213 to your computer and use it in GitHub Desktop.
Save orian/3020213 to your computer and use it in GitHub Desktop.
Quick and dirty script to automagically download and unpack Dart editor.
# 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
}
@orian
Copy link
Author

orian commented Jun 29, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment