Skip to content

Commit

Permalink
Feature/improve misc (#75)
Browse files Browse the repository at this point in the history
* #73: fix for load_properties in bash
* #68: fixed
* #61: allow "devon bash" to open bash on windows
* #61: automatically call devon initialization when bash or zsh is opened
* #69: support uninstall
* #69: fixed quotation, also support upgrade
* #43: doc update
* #64: applied fixes from PR
  • Loading branch information
hohwille authored Apr 2, 2019
1 parent 987758f commit a4d8c37
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doc
Submodule doc updated from fd06e6 to 791f99
4 changes: 2 additions & 2 deletions scripts/src/main/resources/scripts/command/eclipse
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function doSetup() {
else
#mirror="https://mirror.math.princeton.edu"
local mirror="https://ftp.osuosl.org"
local software_version=`doGetVariable ECLIPSE_VERSION 2018-12`
local software_version="${ECLIPSE_VERSION:-2018-12}"
local eclipse_edition=java
local extract_folder=
#eclipse_edition=jee
Expand Down Expand Up @@ -112,7 +112,7 @@ function doConfigureEclipse() {
function doStartEclipse() {
doConfigureEclipse
echo "launching Eclipse..."
eclipse -clean -data "${WORKSPACE_PATH}" -keyring "~/.eclipse/.keyring" -vm "${JAVA_HOME}/bin/java" -showlocation ${WORKSPACE} -vmargs ${ECLIPSE_VMARGS} &
eclipse -clean -data "${WORKSPACE_PATH}" -keyring ~/.eclipse/.keyring -vm "${JAVA_HOME}/bin/java" -showlocation ${WORKSPACE} -vmargs ${ECLIPSE_VMARGS} &
}

# CLI
Expand Down
37 changes: 37 additions & 0 deletions scripts/src/main/resources/scripts/command/ide
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ DEVON_IDE_REPO_URL="https://repo.maven.apache.org/maven2/com/devonfw/tools/ide"

function doUpdateScripts() {
doUpgradeMavenArtifact "${DEVON_IDE_HOME}" "${DEVON_IDE_REPO_URL}" "devon-ide-settings" "${target_version}" ".tar.gz" "${devon_ide_version}"
if [ "${?}" = 0 ]
then
cp "${DEVON_IDE_HOME}/scripts/devon" ~/.devon/devon
if doIsWindows
then
cp "${DEVON_IDE_HOME}/scripts/devon.bat" "${USERPROFILE}/scripts/devon.bat"
fi
fi
}

function doUpdateSettings() {
Expand Down Expand Up @@ -67,6 +75,31 @@ function doSetup() {
done
}

function doUninstall() {
echo "Uninstalling devon-ide..."
mkdir -p "${DEVON_IDE_HOME}/updates"
if [ -f ~/.bashrc ]
then
cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$' > "${DEVON_IDE_HOME}/updates/.bashrc" && mv "${DEVON_IDE_HOME}/updates/.bashrc" ~/.bashrc
fi
if [ -f ~/.zshrc ]
then
cat ~/.zshrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$' > "${DEVON_IDE_HOME}/updates/.zshrc" && mv "${DEVON_IDE_HOME}/updates/.zshrc" ~/.zshrc
fi
doRunCommand 'rm -rf ~/.devon'
if doIsWindows
then
if [ -d "${USERPROFILE}/.devon" ]
then
doRunCommand 'rm -rf "${USERPROFILE}/.devon"'
fi
if [ -f "${USERPROFILE}/scripts/devon" ]
then
doRunCommand 'rm "${USERPROFILE}/scripts/devon"'
fi
fi
}

target_version="LATEST"

# CLI
Expand All @@ -79,11 +112,15 @@ then
echo "update check for updates and install if newer version is available"
echo "update «package» [to «version»] update (or downgrade) specified package (to specified version)"
echo " packages are e.g. 'scripts' or 'settings'"
echo "uninstall uninstall devon-ide and remove all OS hooks (revert devon ide setup)"
exit
elif [ "${1}" = "setup" ]
then
shift
doSetup ${@}
elif [ "${1}" = "uninstall" ]
then
doUninstall
elif [ "${1}" = "update" ]
then
if [ -z "${2}" ]
Expand Down
1 change: 1 addition & 0 deletions scripts/src/main/resources/scripts/command/ng
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ else
fi

if [ "${setup}" != "true" ]
then
ng ${@}
fi
6 changes: 2 additions & 4 deletions scripts/src/main/resources/scripts/devon
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ then
if ! grep -q "~/.devon/devon" ~/.bashrc
then
echo "Installing devon alias to your .bashrc"
echo "" >> ~/.bashrc
echo 'alias devon="source ~/.devon/devon"' >> ~/.bashrc
echo -e '\nalias devon="source ~/.devon/devon"\ndevon' >> ~/.bashrc
fi
if [ ! -e ~/.zshrc ]
then
Expand All @@ -85,8 +84,7 @@ then
if ! grep -q "~/.devon/devon" ~/.zshrc
then
echo "Installing devon alias to your .zshrc"
echo "" >> ~/.zshrc
echo 'alias devon="source ~/.devon/devon"' >> ~/.zshrc
echo -e '\nalias devon="source ~/.devon/devon"\ndevon' >> ~/.zshrc
fi
alias devon="source ~/.devon/devon"
echo "The devon CLI script has been installed to your system."
Expand Down
6 changes: 5 additions & 1 deletion scripts/src/main/resources/scripts/devon.bat
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ if not exist "%HOME%\.devon\devon" (
"%BASH%" -c 'source devon'
popd
)
"%BASH%" -c 'source ~/.devon/devon %*'
if "%1%" == "bash" (
"%BASH%"
) else (
"%BASH%" -c 'source ~/.devon/devon %*'
)
if not "%DEVON_PATH%" == "" (
set "DEVON_OLD_PATH=%PATH%"
set "PATH=%DEVON_PATH%"
Expand Down
1 change: 0 additions & 1 deletion scripts/src/main/resources/scripts/environment-project.bat
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ set "var=!var:export =!
(
rem endlocal in () block to access local variable and "export" it
endlocal
echo "%var%=%value%"
rem use call in order to evaluate %var% inside value
call set "%var%=%value%"
)
Expand Down
7 changes: 4 additions & 3 deletions scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function doUpgradeMavenArtifact() {
then
echo "Found git repository ${1} - updating via git"
doGitPullOrClone "${1}"
return
return ${?}
fi
local download_url="${2}"
local artifact_id="${3}"
Expand All @@ -359,7 +359,7 @@ function doUpgradeMavenArtifact() {
if [ "${result}" = 0 ]
then
echo "The ${artifact_id} package is already at the latest version ${target_version}"
return
return 1
else
echo "You are using version ${current_version} of ${artifact_id} "
echo "The new version to install is ${target_version}"
Expand All @@ -368,7 +368,7 @@ function doUpgradeMavenArtifact() {
echo "You are using a newer version than the latest release version."
echo "Hence there is nothing to update."
echo "Seems as you are an active devonfw developer. Thanks for contributing!"
return
return 1
fi
fi
fi
Expand Down Expand Up @@ -410,6 +410,7 @@ function doGitPullOrClone() {
doRunCommand "git pull" "" "${1}"
else
echo "Can not update local git repository: ${1}"
return 1
fi
else
if [ -z "${2}" ]
Expand Down

0 comments on commit a4d8c37

Please sign in to comment.