Last active
November 14, 2019 19:26
-
-
Save monkstone/3f63792a0ace08a22bf3e857894d873f to your computer and use it in GitHub Desktop.
More
This file contains hidden or 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
#!/usr/bin/env bash | |
# JAVA_PATH="/opt/jdk13" | |
JAVA_PATH="/usr/lib/jvm/java-8-openjdk-armhf" | |
# JAVA_PATH="/usr/lib/jvm/java-11-openjdk-armhf" | |
JRUBY_VERSION="9.2.9.0" | |
MRI_RUBY="2.5.0" | |
JRUBY_PATH="/opt/jruby/${JRUBY_VERSION}" | |
GEM="${HOME}/.gem/ruby/${MRI_RUBY}" | |
function wget_jruby { | |
wget "https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz" | |
sudo "tar xzvf ${HOME}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -C /opt" | |
echo "Downloaded JRuby" | |
echo "export JAVA_HOME=${JAVA_PATH}" >> "${HOME}/.profile" | |
export JAVA_HOME="${JAVA_PATH}" | |
sudo "${JRUBY_PATH}/bin/jgem install jruby-launcher" | |
echo "Installed JRuby launcher" | |
} | |
wget_jruby | |
function create_gem_home { | |
if [[ (-p $GEM_HOME) ]] | |
then | |
echo "GEM_HOME=${GEM_HOME}" | |
else | |
mkdir -p "${GEM}" | |
commands=( | |
"GEM_HOME=${GEM}" | |
"GEM_PATH=${GEM}" | |
"PATH=\"\${GEM_PATH}/bin:\${PATH}\"" | |
) | |
for cmd in "${commands[@]}" | |
do | |
echo "export ${cmd}" >> ~/.profile | |
done | |
fi | |
} | |
create_gem_home | |
function install_jruby { | |
local commands=(jruby jgem jirb) | |
for cmd in "${commands[@]}" | |
do | |
sudo update-alternatives --install /usr/bin/"${cmd}" "${cmd}" "${JRUBY_PATH}"/bin/"${cmd}" 100 | |
done | |
} | |
install_jruby |
This file contains hidden or 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
#!/usr/bin/env bash | |
function cd_opt { | |
var PWD="$(pwd)" | |
echo "${PWD}" | |
cd /opt || exit | |
pwd | |
cd "$($PWD)" || exit | |
pwd | |
} | |
cd_opt | |
pwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment