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

devonfw / IDEasy / 13327588889

14 Feb 2025 10:44AM UTC coverage: 67.947% (-0.5%) from 68.469%
13327588889

Pull #1021

github

web-flow
Merge d03159bfe into 52609dacb
Pull Request #1021: #786: support ide upgrade to automatically update to the latest version of IDEasy

2964 of 4791 branches covered (61.87%)

Branch coverage included in aggregate %.

7688 of 10886 relevant lines covered (70.62%)

3.07 hits per line

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

78.57
cli/src/main/java/com/devonfw/tools/ide/version/IdeVersion.java
1
package com.devonfw.tools.ide.version;
2

3
import java.util.jar.Attributes.Name;
4
import java.util.jar.Manifest;
5

6
/**
7
 * Class to {@link #getVersionString()} the current version of this IDE product.
8
 */
9
public final class IdeVersion {
10

11
  /** The fallback version used if the version is undefined (in local development). */
12
  public static final String VERSION_UNDEFINED = "SNAPSHOT";
13

14
  private static final IdeVersion INSTANCE = new IdeVersion();
5✔
15

16
  private final String version;
17

18
  private final VersionIdentifier versionIdentifier;
19

20
  // most simple solution would be maven filtering but that is kind of tricky for java files
21
  // http://www.mojohaus.org/templating-maven-plugin/examples/source-filtering.html
22
  // private static final String VERSION = "${project.version}";
23

24
  private IdeVersion() {
25

26
    super();
2✔
27
    String v = getClass().getPackage().getImplementationVersion();
5✔
28
    if (v == null) {
2!
29
      v = VERSION_UNDEFINED;
2✔
30
    }
31
    this.version = v;
3✔
32
    this.versionIdentifier = VersionIdentifier.of(v);
4✔
33
  }
1✔
34

35
  private String getValue(Manifest manifest, Name name) {
36

37
    return manifest.getMainAttributes().getValue(name);
×
38
  }
39

40
  /**
41
   * @return the current version of this IDE product as {@link String}.
42
   */
43
  public static String getVersionString() {
44

45
    return INSTANCE.version;
3✔
46
  }
47

48
  /**
49
   * @return the current version of this IDE product as {@link VersionIdentifier}.
50
   */
51
  public static VersionIdentifier getVersionIdentifier() {
52

53
    return INSTANCE.versionIdentifier;
×
54
  }
55

56
  /**
57
   * @return {@code true} if the {@link #getVersionString() current version} is {@link #VERSION_UNDEFINED undefined}, {@code false} otherwise.
58
   */
59
  public static boolean isUndefined() {
60

61
    return VERSION_UNDEFINED.equals(INSTANCE.version);
5✔
62
  }
63

64
}
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

© 2025 Coveralls, Inc