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

devonfw / IDEasy / 7257029760

19 Dec 2023 03:34AM UTC coverage: 46.569%. First build
7257029760

Pull #150

github

web-flow
Merge c55c4a8c2 into 1d60d9c17
Pull Request #150: #102: implement update commandlet

1031 of 2451 branches covered (0.0%)

Branch coverage included in aggregate %.

2736 of 5638 relevant lines covered (48.53%)

2.0 hits per line

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

0.0
cli/src/main/java/com/devonfw/tools/ide/commandlet/RepositoryConfig.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.io.FileInputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.nio.file.Path;
7
import java.util.Collections;
8
import java.util.Properties;
9
import java.util.Set;
10

11
/**
12
 * Represents the configuration of a repository to be used by the {@link RepositoryCommandlet}.
13
 *
14
 * @param path Path into which the project is cloned. This path is relative to the workspace.
15
 * @param workingSets The working sets associated with the repository.
16
 * @param workspace Workspace to use for checkout and import. Default is main.
17
 * @param gitUrl Git URL to use for cloning the project.
18
 * @param gitBranch Git branch to checkout. Git default branch is default.
19
 * @param buildPath The build path for the repository.
20
 * @param buildCmd The command to invoke to build the repository after clone or pull. If omitted no build is triggered.
21
 * @param imports list of IDEs where the repository will be imported to.
22
 * @param active {@code true} to setup the repository during setup, {@code false} to skip.
23
 */
24
public record RepositoryConfig(
×
25
    String path,
26
    String workingSets,
27
    String workspace,
28
    String gitUrl,
29
    String gitBranch,
30
    String buildPath,
31
    String buildCmd,
32
    Set<String> imports,
33
    boolean active) {
34
  public static RepositoryConfig loadProperties(Path filePath) {
35

36
    Properties properties = new Properties();
×
37
    try (InputStream input = new FileInputStream(filePath.toString())) {
×
38
      properties.load(input);
×
39
    } catch (IOException e) {
×
40
      throw new IllegalStateException("Failed to read file: " + filePath, e);
×
41
    }
×
42

43
    Set<String> importsSet = getImports(properties);
×
44

45
    return new RepositoryConfig(properties.getProperty("path"), properties.getProperty("workingsets"),
×
46
        properties.getProperty("workspace"), properties.getProperty("git_url"), properties.getProperty("git_branch"),
×
47
        properties.getProperty(("build_path")), properties.getProperty("build_cmd"), importsSet,
×
48
        Boolean.parseBoolean(properties.getProperty("active")));
×
49
  }
50

51
  private static Set<String> getImports(Properties properties) {
52

53
    String importProperty = properties.getProperty("import");
×
54
    if (importProperty != null && !importProperty.isEmpty()) {
×
55
      return Set.of(importProperty.split("\\s*,\\s*"));
×
56
    }
57

58
    String legacyImportProperty = properties.getProperty("eclipse");
×
59
    if ("import".equals(legacyImportProperty)) {
×
60
      return Set.of("eclipse");
×
61
    } else {
62
      return Collections.emptySet();
×
63
    }
64
  }
65
}
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