• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 19651727463

24 Nov 2025 10:43PM UTC coverage: 69.156% (+0.1%) from 69.024%
19651727463

push

github

web-flow
#1144: #1145: CVE warnings and suggestions (#1593)

Co-authored-by: KianRolf <kian.loroff@capgemini.com>
Co-authored-by: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>

3613 of 5721 branches covered (63.15%)

Branch coverage included in aggregate %.

9387 of 13077 relevant lines covered (71.78%)

3.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.22
cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.nio.file.Path;
4

5
import com.devonfw.tools.ide.cli.GraalVmHelper;
6
import com.devonfw.tools.ide.context.IdeContext;
7
import com.devonfw.tools.ide.property.ToolProperty;
8
import com.devonfw.tools.ide.property.VersionProperty;
9
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
10
import com.devonfw.tools.ide.tool.ToolCommandlet;
11
import com.devonfw.tools.ide.tool.ToolInstallation;
12
import com.devonfw.tools.ide.version.VersionIdentifier;
13

14
/**
15
 * {@link Commandlet} to install a tool.
16
 *
17
 * @see ToolCommandlet#install()
18
 */
19
public class InstallCommandlet extends Commandlet {
20

21
  /** The tool to install. */
22
  public final ToolProperty tool;
23

24
  /** The optional version to set and install. */
25
  public final VersionProperty version;
26

27
  /**
28
   * The constructor.
29
   *
30
   * @param context the {@link IdeContext}.
31
   */
32
  public InstallCommandlet(IdeContext context) {
33

34
    super(context);
3✔
35
    addKeyword(getName());
4✔
36
    this.tool = add(new ToolProperty("", false, "tool"));
11✔
37
    this.version = add(new VersionProperty("", false, "version"));
11✔
38
  }
1✔
39

40
  @Override
41
  public String getName() {
42

43
    return "install";
2✔
44
  }
45

46
  @Override
47
  public boolean isIdeRootRequired() {
48

49
    return this.tool.getValueCount() > 0;
6!
50
  }
51

52
  @Override
53
  public void run() {
54

55
    if (this.tool.getValueCount() == 0) {
4!
56
      IdeasyCommandlet ideasy = new IdeasyCommandlet(this.context);
×
57
      GraalVmHelper graalVmHelper = GraalVmHelper.get();
×
58
      if (graalVmHelper.isNativeImage()) {
×
59
        this.context.debug("Detected that IDEasy is running as graalvm native image...");
×
60
      } else {
61
        this.context.debug("Detected that IDEasy is running in JVM...");
×
62
      }
63
      Path cwd = graalVmHelper.getCwd();
×
64
      this.context.info("Installing IDEasy from {}", cwd);
×
65
      if (!this.context.isForceMode()) {
×
66
        this.context.askToContinue("Sub-command install without any further arguments will perform the initial installation of IDEasy.\n"
×
67
            + "Since this is typically not to be called manually, you may have forgotten to specify the tool to install as extra argument.\n"
68
            + "The current command will install IDEasy on your computer. Are you sure?");
69
      }
70
      ideasy.installIdeasy(cwd);
×
71
      ideasy.setupWindowsTerminal();
×
72
      return;
×
73
    }
74
    ToolCommandlet commandlet = this.tool.getValue();
5✔
75
    VersionIdentifier versionIdentifier = this.version.getValue();
5✔
76
    VersionIdentifier version = versionIdentifier;
2✔
77
    if (version == null) {
2✔
78
      version = commandlet.getConfiguredVersion();
3✔
79
    }
80
    ToolInstallation installation = commandlet.install(false, version);
5✔
81
    if (versionIdentifier != null) {
2✔
82
      VersionIdentifier installedVersion = installation.resolvedVersion();
3✔
83
      if (!versionIdentifier.isPattern() || !versionIdentifier.matches(installedVersion)) {
7!
84
        versionIdentifier = installedVersion;
2✔
85
      }
86
      commandlet.setVersion(versionIdentifier, false);
4✔
87
    }
88
  }
1✔
89

90
  @Override
91
  public ToolCommandlet getToolForCompletion() {
92

93
    return this.tool.getValue();
5✔
94
  }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc