-
Notifications
You must be signed in to change notification settings - Fork 21
/
ReadMe.java
56 lines (47 loc) · 1.52 KB
/
ReadMe.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;
import java.util.stream.Collectors;
/**
* Generate the README.md table.
*/
public final class ReadMe
{
private ReadMe()
{
}
public static void main(final String[] args)
throws IOException
{
final var path = Paths.get("");
try (var stream = Files.walk(path, 1)) {
final var directories =
stream.filter(p -> Files.isDirectory(p))
.sorted()
.collect(Collectors.toList());
System.out.println("|Module|Description|");
System.out.println("|------|-----------|");
for (final var directory : directories) {
final var moduleDirectory = directory.getFileName().toString();
if (moduleDirectory.isEmpty()) {
continue;
}
final var propertyFile = directory.resolve("gradle.properties");
if (!Files.isRegularFile(propertyFile)) {
continue;
}
final var properties = new Properties();
try (final var input = Files.newInputStream(propertyFile)) {
properties.load(input);
}
final var moduleName = properties.getProperty("POM_ARTIFACT_ID");
final var rawDescription = properties.getProperty("POM_DESCRIPTION");
var trimmed = rawDescription;
trimmed = trimmed.replace("Library Simplified (", "");
trimmed = trimmed.replace(")", "");
System.out.printf("|[%s](%s)|%s|\n", moduleName, moduleDirectory, trimmed);
}
}
}
}