-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from bonsai-rx/dev/improve-documentation
Improve documentation of IncludeWorkflows
- Loading branch information
Showing
23 changed files
with
217 additions
and
94 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#! /bin/bash | ||
|
||
SETUP_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
|
||
DEFAULT_VERSION="latest" | ||
VERSION="$DEFAULT_VERSION" | ||
|
||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--version) VERSION="$2"; shift ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
echo "Setting up Bonsai v=$VERSION environment..." | ||
|
||
if [ ! -f "$SETUP_SCRIPT_DIR/Bonsai.exe" ]; then | ||
CONFIG="$SETUP_SCRIPT_DIR/Bonsai.config" | ||
if [ -f "$CONFIG" ]; then | ||
DETECTED=$(xmllint --xpath '//PackageConfiguration/Packages/Package[@id="Bonsai"]/@version' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
echo "Version detected v=$DETECTED." | ||
RELEASE="https://github.com/bonsai-rx/bonsai/releases/download/$DETECTED/Bonsai.zip" | ||
else | ||
if [ $VERSION = "latest" ]; then | ||
RELEASE="https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip" | ||
else | ||
RELEASE="https://github.com/bonsai-rx/bonsai/releases/download/$VERSION/Bonsai.zip" | ||
fi | ||
fi | ||
echo "Download URL: $RELEASE" | ||
wget $RELEASE -O "$SETUP_SCRIPT_DIR/temp.zip" | ||
mv -f "$SETUP_SCRIPT_DIR/NuGet.config" "$SETUP_SCRIPT_DIR/temp.config" | ||
unzip -d "$SETUP_SCRIPT_DIR" -o "$SETUP_SCRIPT_DIR/temp.zip" | ||
mv -f "$SETUP_SCRIPT_DIR/temp.config" "$SETUP_SCRIPT_DIR/NuGet.config" | ||
rm -rf "$SETUP_SCRIPT_DIR/temp.zip" | ||
rm -rf "$SETUP_SCRIPT_DIR/Bonsai32.exe" | ||
fi | ||
|
||
source "$SETUP_SCRIPT_DIR/activate" | ||
source "$SETUP_SCRIPT_DIR/run" --no-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
# activate.sh | ||
if [[ -v BONSAI_EXE_PATH ]]; then | ||
echo "Error! Cannot have multiple bonsai environments activated at the same time. Please deactivate the current environment before activating the new one." | ||
return | ||
fi | ||
BONSAI_ENV_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
export BONSAI_ENV_DIR | ||
export BONSAI_EXE_PATH="$BONSAI_ENV_DIR/Bonsai.exe" | ||
export ORIGINAL_PS1="$PS1" | ||
export PS1="($(basename "$BONSAI_ENV_DIR")) $PS1" | ||
alias bonsai='source "$BONSAI_ENV_DIR"/run' | ||
alias bonsai-clean='GTK_DATA_PREFIX= source "$BONSAI_ENV_DIR"/run' | ||
alias deactivate='source "$BONSAI_ENV_DIR"/deactivate' | ||
echo "Activated bonsai environment in $BONSAI_ENV_DIR" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
unset BONSAI_EXE_PATH | ||
export PS1="$ORIGINAL_PS1" | ||
unset ORIGINAL_PS1 | ||
unalias bonsai | ||
unalias bonsai-clean | ||
unalias deactivate | ||
echo "Deactivated bonsai environment." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# run.sh | ||
|
||
SETUP_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
CONFIG="$SETUP_SCRIPT_DIR/Bonsai.config" | ||
|
||
cleanup() { | ||
update_paths_to_windows | ||
} | ||
|
||
update_paths_to_linux() { | ||
ASSEMBLYLOCATIONS=$(xmllint --xpath '//PackageConfiguration/AssemblyLocations/AssemblyLocation/@location' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
for ASSEMBLYLOCATION in $ASSEMBLYLOCATIONS; do | ||
NEWASSEMBLYLOCATION="${ASSEMBLYLOCATION//\\/\/}" | ||
xmlstarlet edit --inplace --update "/PackageConfiguration/AssemblyLocations/AssemblyLocation[@location='$ASSEMBLYLOCATION']/@location" --value "$NEWASSEMBLYLOCATION" "$CONFIG" | ||
done | ||
|
||
LIBRARYFOLDERS=$(xmllint --xpath '//PackageConfiguration/LibraryFolders/LibraryFolder/@path' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
for LIBRARYFOLDER in $LIBRARYFOLDERS; do | ||
NEWLIBRARYFOLDER="${LIBRARYFOLDER//\\/\/}" | ||
xmlstarlet edit --inplace --update "//PackageConfiguration/LibraryFolders/LibraryFolder[@path='$LIBRARYFOLDER']/@path" --value "$NEWLIBRARYFOLDER" "$CONFIG" | ||
done | ||
} | ||
|
||
update_paths_to_windows() { | ||
ASSEMBLYLOCATIONS=$(xmllint --xpath '//PackageConfiguration/AssemblyLocations/AssemblyLocation/@location' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
for ASSEMBLYLOCATION in $ASSEMBLYLOCATIONS; do | ||
NEWASSEMBLYLOCATION="${ASSEMBLYLOCATION//\//\\}" | ||
xmlstarlet edit --inplace --update "/PackageConfiguration/AssemblyLocations/AssemblyLocation[@location='$ASSEMBLYLOCATION']/@location" --value "$NEWASSEMBLYLOCATION" "$CONFIG" | ||
done | ||
|
||
LIBRARYFOLDERS=$(xmllint --xpath '//PackageConfiguration/LibraryFolders/LibraryFolder/@path' "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
for LIBRARYFOLDER in $LIBRARYFOLDERS; do | ||
NEWLIBRARYFOLDER="${LIBRARYFOLDER//\//\\}" | ||
xmlstarlet edit --inplace --update "//PackageConfiguration/LibraryFolders/LibraryFolder[@path='$LIBRARYFOLDER']/@path" --value "$NEWLIBRARYFOLDER" "$CONFIG" | ||
done | ||
} | ||
|
||
if [[ -v BONSAI_EXE_PATH ]]; then | ||
if [ ! -f "$BONSAI_EXE_PATH" ]; then | ||
bash "$BONSAI_ENV_DIR"/Setup.sh | ||
bash "$BONSAI_ENV_DIR"/run "$@" | ||
else | ||
BONSAI_VERSION=$(xmllint --xpath "//PackageConfiguration/Packages/Package[@id='Bonsai']/@version" "$CONFIG" | sed -e 's/^[^"]*"//' -e 's/"$//') | ||
if [[ -z ${BONSAI_VERSION+x} ]] && [ "$BONSAI_VERSION" \< "2.8.4" ]; then | ||
echo "Updating paths to Linux format..." | ||
trap cleanup EXIT INT TERM | ||
update_paths_to_linux | ||
mono "$BONSAI_EXE_PATH" "$@" | ||
cleanup | ||
else | ||
mono "$BONSAI_EXE_PATH" "$@" | ||
fi | ||
fi | ||
else | ||
echo "BONSAI_EXE_PATH is not set. Please set the path to the Bonsai executable." | ||
return | ||
fi |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.