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

#637: Option to disable updates #765

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7af9fc5
#765: Fix typos in DoD asciidoc
Oct 2, 2024
aeae1dd
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 17, 2024
e520d16
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 25, 2024
29403d3
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 25, 2024
5bff5eb
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 28, 2024
890c107
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 29, 2024
c55af62
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 31, 2024
5224bf9
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 7, 2024
d925977
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 8, 2024
4a8f60b
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 12, 2024
1a6cdb8
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 13, 2024
43c0953
#637: Added option --skipUpdates
KianRolf Nov 14, 2024
f79c030
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 14, 2024
6e8cced
Merge branch 'main' into test/no-updates
KianRolf Nov 14, 2024
4df3da6
#637: Changelog
KianRolf Nov 14, 2024
a263f80
Merge branch 'main' into test/no-updates
KianRolf Nov 14, 2024
a5bef25
Merge branch 'main' into test/no-updates
KianRolf Nov 14, 2024
4778abc
#637: fix test
KianRolf Nov 15, 2024
e276dc2
Merge branch 'test/no-updates' of https://github.com/KianRolf/IDEasy …
KianRolf Nov 15, 2024
f30396c
Merge branch 'main' into test/no-updates
KianRolf Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/637[#637]: Option to disable updates

The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/16?closed=1[milestone 2024.12.001].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class ContextCommandlet extends Commandlet {

private final FlagProperty offline;

private final FlagProperty skipUpdates;

private final LocaleProperty locale;

private IdeStartContextImpl startContext;
Expand All @@ -41,6 +43,7 @@ public ContextCommandlet() {
this.debug = add(new FlagProperty("--debug", false, "-d"));
this.quiet = add(new FlagProperty("--quiet", false, "-q"));
this.offline = add(new FlagProperty("--offline", false, "-o"));
this.skipUpdates = add(new FlagProperty("--skipUpdates", false, "-s"));
this.locale = add(new LocaleProperty("--locale", false, null));
}

Expand Down Expand Up @@ -71,6 +74,7 @@ public void run() {
this.startContext.setForceMode(this.force.isTrue());
this.startContext.setQuietMode(this.quiet.isTrue());
this.startContext.setOfflineMode(this.offline.isTrue());
this.startContext.setSkipUpdatesMode(this.skipUpdates.isTrue());
this.startContext.setLocale(this.locale.getValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ public boolean isOfflineMode() {
return this.startContext.isOfflineMode();
}

@Override
public boolean isSkipUpdatesMode() {
return this.startContext.isSkipUpdatesMode();
}

@Override
public boolean isOnline() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public interface IdeStartContext extends IdeLogger {
*/
boolean isOfflineMode();

/**
* @return {@code true} if quickStart mode is activated (-s/--quickStart), {@code false} otherwise.
*/
boolean isSkipUpdatesMode();

/**
* @return the current {@link Locale}. Either configured via command-line option or {@link Locale#getDefault() default}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class IdeStartContextImpl implements IdeStartContext {

private final IdeSubLogger[] loggers;

private boolean skipUpdatesMode;

private boolean offlineMode;

private boolean forceMode;
Expand Down Expand Up @@ -131,6 +133,20 @@ public void setOfflineMode(boolean offlineMode) {
this.offlineMode = offlineMode;
}

@Override
public boolean isSkipUpdatesMode() {

return this.skipUpdatesMode;
}

/**
* @param skipUpdatesMode new value of {@link #isSkipUpdatesMode()} ()}.
*/
public void setSkipUpdatesMode(boolean skipUpdatesMode) {

this.skipUpdatesMode = skipUpdatesMode;
}

@Override
public Locale getLocale() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public final boolean install(boolean silent, EnvironmentContext environmentConte
// TODO https://github.com/devonfw/IDEasy/issues/664
boolean enableOptimization = false;
// performance: avoid calling installTool if already up-to-date
if (enableOptimization & configuredVersion.equals(installedVersion)) { // here we can add https://github.com/devonfw/IDEasy/issues/637
if (enableOptimization & configuredVersion.equals(installedVersion)
|| configuredVersion.matches(installedVersion) & context.isSkipUpdatesMode()) {
return toolAlreadyInstalled(silent, installedVersion, step);
}
// install configured version of our tool in the software repository if not already installed
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/nls/Help.properties
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ opt.--offline=enable offline mode (skip updates or git pull, fail downloads or g
opt.--quiet=disable info logging (only log success, warning or error).
opt.--skip-repositories=skip the setup of repositories.
opt.--skip-tools=skip the installation/update of tools.
opt.--skipUpdates=disables updates for tool if the configured version matches the installed version.
opt.--trace=enable trace logging.
opt.--version=Print the IDE version and exit.
options=Options:
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/nls/Help_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ opt.--offline=Aktiviert den Offline-Modus (Überspringt Aktualisierungen oder gi
opt.--quiet=Deaktiviert Info Logging ( nur success, warning und error).
opt.--skip-repositories=Überspringt die Einrichtung der Repositories.
opt.--skip-tools=Überspringt die Installation/Aktualisierung der Tools.
opt.--skipUpdates=Deaktiviert Aktualisierung des Tools wen die installierte Version mit der konfigurierten Version übereinstimmt.
opt.--trace=Aktiviert Trace-Ausgaben (detaillierte Fehleranalyse).
opt.--version=Zeigt die IDE Version an und beendet das Programm.
options=Optionen:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void testCompleteShortOptsCombined() {
// act
List<CompletionCandidate> candidates = context.complete(args, true);
// assert
assertThat(candidates.stream().map(CompletionCandidate::text)).containsExactly("-f", "-fb", "-fd", "-fo", "-fq",
assertThat(candidates.stream().map(CompletionCandidate::text)).containsExactly("-f", "-fb", "-fd", "-fo", "-fq", "-fs",
"-ft", "-fv");
}

Expand All @@ -85,11 +85,11 @@ public void testCompleteShortOptsCombinedAllButVersion() {

// arrange
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("-fbdoqt");
CliArguments args = CliArguments.ofCompletion("-fbdoqts");
// act
List<CompletionCandidate> candidates = context.complete(args, true);
// assert
assertThat(candidates.stream().map(CompletionCandidate::text)).containsExactly("-fbdoqt", "-fbdoqtv");
assertThat(candidates.stream().map(CompletionCandidate::text)).containsExactly("-fbdoqts", "-fbdoqtsv");
}

/** Test of {@link AbstractIdeContext#complete(CliArguments, boolean) auto-completion} for input "help", "". */
Expand Down
Loading