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

devonfw / IDEasy / 9907372175

12 Jul 2024 11:49AM UTC coverage: 61.142% (-0.02%) from 61.162%
9907372175

push

github

hohwille
fixed tests

1997 of 3595 branches covered (55.55%)

Branch coverage included in aggregate %.

5296 of 8333 relevant lines covered (63.55%)

2.8 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.updater.UpdateManager;
12

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

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

20
  /**
21
   * @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 string
22
   * format.
23
   */
24
  public static void main(String[] args) {
25

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

32
    String pathToRepo = args[0];
×
33
    Instant expirationTime = null;
×
34

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

48
    Path repoPath = Path.of(pathToRepo);
×
49

50
    if (!repoPath.toFile().isDirectory()) {
×
51
      logger.error("Error: Provided path is not a valid directory.");
×
52
      System.exit(1);
×
53
    }
54

55
    UpdateManager updateManager = new UpdateManager(repoPath, expirationTime);
×
56
    updateManager.updateAll();
×
57
  }
×
58
}
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