Skip to content

Commit

Permalink
Merge pull request #14 from refinedmods/release/0.2.3
Browse files Browse the repository at this point in the history
Release v0.2.3
  • Loading branch information
raoulvdberge authored Dec 24, 2023
2 parents 6eb42ae + 3769ffb commit 520370c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.3] - 2023-12-24

### Fixed

- Fixed insufficient logging.

## [0.2.2] - 2023-12-24

### Fixed
Expand Down Expand Up @@ -43,7 +49,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Initial release.

[Unreleased]: https://github.com/refinedmods/refinedsites/compare/v0.2.2...HEAD
[Unreleased]: https://github.com/refinedmods/refinedsites/compare/v0.2.3...HEAD

[0.2.3]: https://github.com/refinedmods/refinedsites/compare/v0.2.2...v0.2.3

[0.2.2]: https://github.com/refinedmods/refinedsites/compare/v0.2.1...v0.2.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class GithubComponentFactory implements ComponentFactory {
final GitHub github = GitHub.connectUsingOAuth(token);
this.repo = github.getRepository(config.getFullRepository());
final Semver minVersion = new Semver(config.getMinimumVersion());
log.info("Retrieving tags from GitHub repository");
for (final var tag : repo.listTags().toList()) {
final String tagName = tag.getName();
if (!tagName.startsWith("v")) {
Expand All @@ -46,6 +47,8 @@ class GithubComponentFactory implements ComponentFactory {
"v" + version.getValue(),
false
));
} else {
log.info("Ignoring version {}", version);
}
}
validTags.add(new Tag(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,36 @@
import com.google.gson.GsonBuilder;
import com.vdurmont.semver4j.Semver;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@AllArgsConstructor
@Slf4j
public class SiteFactory {
private static final Gson GSON = new GsonBuilder().create();

private final Path rootPath;

public Site getSite() {
try {
log.info("Loading playbook");
final Path playbookPath = rootPath.resolve("playbook.json");
final PlaybookConfig json = GSON.fromJson(Files.readString(playbookPath), PlaybookConfig.class);
log.info("Loaded playbook");
final List<Component> components = json.getComponents().stream().flatMap(component -> {
log.info("Loading component {}", component.getName());
final ComponentFactory factory = getComponentFactory(component);
return factory.getComponents();
final List<Component> result = factory.getComponents().toList();
log.info("Component config yielded {} components", result.size());
return result.stream();
}).collect(Collectors.toList());
log.info("Adding root component");
addRootComponent(components, json);
final Map<String, List<Component>> componentsByName = components.stream().collect(Collectors.groupingBy(
Component::getName
));
log.info("Retrieving releases");
final Map<String, Releases> releasesByComponentName = getReleases(json);
log.info("Site building complete");
return new Site(
json.getName(),
json.getUrl(),
Expand Down Expand Up @@ -121,9 +131,11 @@ private static String getGhToken() {

private ComponentFactory getComponentFactory(final ComponentConfig component) {
if (component.getGithub() != null) {
log.info("Loading components from GitHub for {}", component.getName());
return new GithubComponentFactory(rootPath, component.getGithub(), component.getName(), getGhToken());
}
if (component.getPath() != null) {
log.info("Loading local component {}", component.getName());
return new LocalComponentFactory(
rootPath.resolve(component.getPath()),
component.getName(),
Expand All @@ -135,6 +147,7 @@ private ComponentFactory getComponentFactory(final ComponentConfig component) {
)
);
}
log.info("Loading empty component {}", component.getName());
return () -> Stream.of(Component.builder()
.name(component.getName())
.rootPath(null)
Expand Down

0 comments on commit 520370c

Please sign in to comment.