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

devonfw / IDEasy / 11292419862

11 Oct 2024 12:34PM UTC coverage: 66.152% (-0.4%) from 66.509%
11292419862

push

github

web-flow
devonfw/ide-urls#17: fix UrlUpdater to auto-remove broken URLs and allow self-repair (#681)

2381 of 3940 branches covered (60.43%)

Branch coverage included in aggregate %.

6193 of 9021 relevant lines covered (68.65%)

3.03 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/url/UpdateInitiator.java
1
package com.devonfw.tools.ide.url;
2

3
import java.nio.file.Path;
4
import java.time.Duration;
5
import java.time.Instant;
6
import java.time.format.DateTimeParseException;
7

8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
10

11
import com.devonfw.tools.ide.url.model.report.UrlFinalReport;
12
import com.devonfw.tools.ide.url.updater.UpdateManager;
13

14
/**
15
 * This is the main program to run the updater of {@code ide-urls} repository. It is run nightly via an automated process.
16
 */
17
public class UpdateInitiator {
×
18

19
  private static final Logger logger = LoggerFactory.getLogger(UpdateInitiator.class.getName());
×
20

21
  /**
22
   * @param args the command-line arguments. arg[0] points to the {@code ide-urls} repository. arg[1] defines a timeout for GitHub actions in Duration
23
   *     string format.
24
   */
25
  public static void main(String[] args) {
26

27
    if (args.length == 0) {
×
28
      logger.error("Error: Missing path to repository as well as missing timeout as command line arguments.");
×
29
      logger.error("Usage: java UpdateInitiator <path_to_repository> <duration_string_format>");
×
30
      System.exit(1);
×
31
    }
32

33
    String pathToRepo = args[0];
×
34
    Instant expirationTime = null;
×
35
    String selectedTool = null;
×
36

37
    if (args.length < 2) {
×
38
      logger.warn("Timeout was not set, setting timeout to infinite instead.");
×
39
    } else {
40
      try {
41
        Duration duration = Duration.parse(args[1]);
×
42
        expirationTime = Instant.now().plus(duration);
×
43
        logger.info("Timeout was set to: {}.", expirationTime);
×
44
      } catch (DateTimeParseException e) {
×
45
        logger.error("Error: Provided timeout format is not valid.", e);
×
46
        System.exit(1);
×
47
      }
×
48
      if (args.length > 2) {
×
49
        selectedTool = args[2];
×
50
      }
51
    }
52

53
    Path repoPath = Path.of(pathToRepo);
×
54

55
    if (!repoPath.toFile().isDirectory()) {
×
56
      logger.error("Error: Provided path is not a valid directory.");
×
57
      System.exit(1);
×
58
    }
59

60
    UrlFinalReport urlFinalReport = new UrlFinalReport();
×
61

62
    UpdateManager updateManager = new UpdateManager(repoPath, urlFinalReport, expirationTime);
×
63
    if (selectedTool == null) {
×
64
      updateManager.updateAll();
×
65
    } else {
66
      updateManager.update(selectedTool);
×
67
    }
68

69
    logger.info(urlFinalReport.toString());
×
70
  }
×
71
}
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