Skip to content

#739: removed "not inside an IDE installation message" #753

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
339598f
#739: removed "not inside an IDE installation message"
leonrohne27 Nov 12, 2024
5ac4553
Merge branch 'main' into fix/739-replace-ide-installation-message
jan-vcapgemini Nov 18, 2024
c4084e9
#739: removed getMessageIdeHome()
leonrohne27 Nov 19, 2024
cb51b9b
Merge branch 'main' into fix/739-replace-ide-installation-message
leonrohne27 Nov 19, 2024
a08a986
#739: undo changes, updated EnvironmentCommandlet
leonrohne27 Nov 21, 2024
84e0250
#739: created new exception and added statement
leonrohne27 Nov 22, 2024
790bf65
#759: adjusted EnvironmentCommandletTest
leonrohne27 Nov 22, 2024
3c3a194
Merge branch 'main' into fix/739-replace-ide-installation-message
leonrohne27 Nov 22, 2024
c7500e1
Merge branch 'main' into fix/739-replace-ide-installation-message
jan-vcapgemini Nov 22, 2024
5c9c6e2
Update cli/src/main/java/com/devonfw/tools/ide/commandlet/Environment…
leonrohne27 Nov 26, 2024
b4a4212
#739: Renamed Exception and defined exit code
leonrohne27 Nov 26, 2024
6986360
Merge branch 'fix/739-replace-ide-installation-message' of https://gi…
leonrohne27 Nov 26, 2024
a01f486
Merge branch 'main' into fix/739-replace-ide-installation-message
leonrohne27 Nov 26, 2024
839a3a8
Merge branch 'main' into fix/739-replace-ide-installation-message
hohwille Nov 29, 2024
2ec51fb
#739: Added changelog entry
leonrohne27 Nov 29, 2024
b4b7157
Merge branch 'fix/739-replace-ide-installation-message' of https://gi…
leonrohne27 Nov 29, 2024
4202950
Merge branch 'main' into fix/739-replace-ide-installation-message
hohwille Nov 29, 2024
c63bd48
Update CHANGELOG.adoc
hohwille Nov 29, 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 @@ -24,6 +24,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/737[#737]: Adds cd command to ide shell
* https://github.com/devonfw/IDEasy/issues/758[#758]: Create status commandlet
* https://github.com/devonfw/IDEasy/issues/754[#754]: Again messages break processable command output
* https://github.com/devonfw/IDEasy/issues/737[#739]: Improved error handling to show 'You are not inside an IDE installation' only when relevant.

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
17 changes: 17 additions & 0 deletions cli/src/main/java/com/devonfw/tools/ide/cli/CliExitException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.devonfw.tools.ide.cli;

import com.devonfw.tools.ide.process.ProcessResult;

/**
* {@link CliException} Empty exception that is thrown when a required variable is not set.
*/
public class CliExitException extends CliException {

/**
* The constructor.
*/
public CliExitException() {

super("", ProcessResult.EXIT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;
import java.util.stream.Collectors;

import com.devonfw.tools.ide.cli.CliExitException;
import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
Expand Down Expand Up @@ -42,7 +43,7 @@ public String getName() {
@Override
public boolean isIdeHomeRequired() {

return true;
return false;
}

@Override
Expand All @@ -53,7 +54,9 @@ public boolean isProcessableOutput() {

@Override
public void run() {

if (context.getIdeHome() == null) {
throw new CliExitException();
}
boolean winCmd = false;
WindowsPathSyntax pathSyntax = null;
IdeSubLogger logger = this.context.level(IdeLogLevel.PROCESSABLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,6 @@ private String getMessageIdeRootNotFound() {
}
}

/**
* @return the status message about the {@link #getIdeHome() IDE_HOME} detection and environment variable initialization.
*/
public String getMessageIdeHome() {

if (this.ideHome == null) {
return getMessageIdeHomeNotFound();
}
return getMessageIdeHomeFound();
}

/**
* @return {@code true} if this is a test context for JUnits, {@code false} otherwise.
*/
Expand All @@ -301,6 +290,7 @@ protected SystemPath computeSystemPath() {
return new SystemPath(this);
}


private boolean isIdeHome(Path dir) {

if (!Files.isDirectory(dir.resolve("workspaces"))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public interface ProcessResult {
/** Return code if tool was requested that is not installed. */
int TOOL_NOT_INSTALLED = 4;

/** Return code to exit if condition not met */
int EXIT = 17;

/**
* Return code to abort gracefully.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.log.IdeLogEntry;
import com.devonfw.tools.ide.log.IdeLogLevel;
import com.devonfw.tools.ide.os.SystemInfoMock;
Expand Down Expand Up @@ -127,18 +126,6 @@ public void testRunInfoLogging() {
);
}

/**
* Test that {@link EnvironmentCommandlet} requires home.
*/
@Test
public void testThatHomeIsRequired() {

// arrange
EnvironmentCommandlet env = new EnvironmentCommandlet(IdeTestContextMock.get());
// act & assert
assertThat(env.isIdeHomeRequired()).isTrue();
}

private String normalize(Path path) {

return path.toString().replace('\\', '/');
Expand Down