- type: command
command: |
IDE_HUMAN_NAME="RubyMine"
IDE_NAME="rubymine"
PRODUCT_CODE="RM"
VMOPTIONS_FILE="rubymine64.vmoptions"
if [ -d "/opt/ide/jetbrains/$IDE_NAME" ]; then
print "$("Directory for $IDE_HUMAN_NAME exists, not taking any action")"
exit 0
fi
wget --quiet --output-document="/tmp/$IDE_NAME.tar.gz" "https://download.jetbrains.com/product?code=$PRODUCT_CODE&latest&distribution=linux"
rm -rf /opt/ide/jetbrains/"$IDE_NAME"*
mkdir -p "/opt/ide/jetbrains/$IDE_NAME"
tar --strip-components=1 -xzf "/tmp/$IDE_NAME.tar.gz" -C "/opt/ide/jetbrains/$IDE_NAME"
sed -i -E s/-Xmx.+/-Xmx8g/ "/opt/ide/jetbrains/$IDE_NAME/bin/$VMOPTIONS_FILE"
sed -i -E s/-Xms.+/-Xms512m/ "/opt/ide/jetbrains/$IDE_NAME/bin/$VMOPTIONS_FILE"
chmod g+w /etc/environment
if ! grep -Fq "REMOTE_DEV_TRUST_PROJECTS" /etc/environment; then
printf '\nREMOTE_DEV_TRUST_PROJECTS=1' | tee -a /etc/environment
fi
if ! grep -Fq "REMOTE_DEV_NON_INTERACTIVE" /etc/environment; then
printf '\nREMOTE_DEV_NON_INTERACTIVE=1' | tee -a /etc/environment
fi
if id "devzero" &>/dev/null; then
## If the IDE is already installed this command echoes a message and returns exit code 1
bash -c "sudo su devzero bash -c \"/opt/ide/jetbrains/$IDE_NAME/bin/remote-dev-server.sh registerBackendLocationForGateway\" || true "
fi
rm -rf "/tmp/$IDE_NAME.tar.gz"
user: root