Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#999: add feature to check minimum require version #1034

Closed
wants to merge 1 commit into from

Conversation

Ttring
Copy link
Contributor

@Ttring Ttring commented Jan 8, 2023

To test it, DEVON_IDE_MIN_VERSION=2023.01.001 needs to be added in settings\properties.

If the current Devon version is smaller than the minimum required version, it is updated to the minimum required version.

If the current Devon version is greater than the minimum required version, it remains at the current version.

If the given minimum version is not available, the operation is terminated with code 22.

@github-actions github-actions bot added bash related to bash shell or scripts commandlet related to commandlets (scripts/command/*) scripts related to shell scripts (bash and CMD) labels Jan 8, 2023
Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ttring thanks for this PR.
I assume we will take over and do the rework from the new team.

current_devon_version="$("${DEVON_HOME_DIR}/scripts/devon.bat" -v)"
min_devon_ide_version_month=${DEVON_IDE_MIN_VERSION##${DEVON_IDE_MIN_VERSION%%.*}.}
current_devon_version_month=${current_devon_version##${current_devon_version%%.*}.}
if [[ ${DEVON_IDE_MIN_VERSION%%.*} -gt ${current_devon_version%%.*} ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use doVersionCompare for this as -gt is not suitable for comparing versions. In the worst case, we later have to change versioning schema again (see devonfw Teams discussion) and this will break and stop working.

Comment on lines +49 to +56
local update_version
if [ -z "${1}" ]
then
update_version="LATEST"
else
update_version=${1}
fi
doUpgradeMavenArtifact "${DEVON_IDE_HOME}" "${DEVON_IDE_REPO_URL}" "devonfw-ide-scripts" "${update_version}" ".tar.gz" "${devon_ide_version}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see how this relates to #999.
Here we do update to a new version while checking for a minimum required version should happen during the setup after the settings are cloned and devon.properties are read.

Comment on lines +264 to +274
read -r -p "(yes/no): " answer
if [ "${answer}" = "yes" ] || [ -z "${answer}" ]
then
doUpdateScripts "${DEVON_IDE_MIN_VERSION}"
doEcho "Version ${target_version} had been successfully downloaded. Please rerun 'devon ide setup' to complete the setup."
return 0
elif [ "${answer}" = "no" ]
then
doEcho "\nUpdate to the minimum required version is aborted.\nTo complete the setup, please run 'devon ide update scripts' then rerun 'devon ide setup'."
return 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function doAskToContinue already does this job and can be reused.

Comment on lines +276 to +312
if [ ${min_devon_ide_version_month%%.${DEVON_IDE_MIN_VERSION##*.}} -gt ${current_devon_version_month%%.${current_devon_version##*.}} ]
then
doEcho "\nYour version of devonfw-ide is currently '${current_devon_version}'"
doEcho "However, your project requires at least version '${DEVON_IDE_MIN_VERSION}'."
doEcho "Newer features will be required for your project so you need to update your devonfw-ide via the following command:"
doEcho "'devon ide update scripts'"
doEcho "Do you want to run the update now, so you can rerun 'devon ide setup' after that?"
read -r -p "(yes/no): " answer
if [ "${answer}" = "yes" ] || [ -z "${answer}" ]
then
doUpdateScripts "${DEVON_IDE_MIN_VERSION}"
doEcho "Version ${target_version} had been successfully downloaded. Please rerun 'devon ide setup' to complete the setup."
return 0
elif [ "${answer}" = "no" ]
then
doEcho "\nUpdate to the minimum required version is aborted.\nTo complete the setup, please run 'devon ide update scripts' then rerun 'devon ide setup'."
return 1
fi
fi
if [ ${DEVON_IDE_MIN_VERSION##*.} -gt ${current_devon_version##*.} ]
then
doEcho "\nYour version of devonfw-ide is currently '${current_devon_version}'"
doEcho "However, your project requires at least version '${DEVON_IDE_MIN_VERSION}'."
doEcho "Newer features will be required for your project so you need to update your devonfw-ide via the following command:"
doEcho "'devon ide update scripts'"
doEcho "Do you want to run the update now, so you can rerun 'devon ide setup' after that?"
read -r -p "(yes/no): " answer
if [ "${answer}" = "yes" ] || [ -z "${answer}" ]
then
doUpdateScripts "${DEVON_IDE_MIN_VERSION}"
doEcho "Version ${target_version} had been successfully downloaded. Please rerun 'devon ide setup' to complete the setup."
return 0
elif [ "${answer}" = "no" ]
then
doEcho "\nUpdate to the minimum required version is aborted.\nTo complete the setup, please run 'devon ide update scripts' then rerun 'devon ide setup'."
return 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is highly redundant and should be reworked.

@hohwille
Copy link
Member

This PR is replaced by #1056 so the work is not lost and the story will be completed. Hence, I can now close this PR.

@hohwille hohwille closed this Feb 13, 2023
@hohwille hohwille added this to the rejected milestone Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash related to bash shell or scripts commandlet related to commandlets (scripts/command/*) scripts related to shell scripts (bash and CMD)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants