Skip to content

Commit

Permalink
Merge pull request #27 from yandex-qatools/count
Browse files Browse the repository at this point in the history
log plugins count
  • Loading branch information
lanwen committed May 23, 2016
2 parents f6169dc + 67e0ea3 commit 977aa51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static Plugin loadHPI(File file) throws IOException {
JarFile jarFile = new JarFile(file);
long timestamp = jarFile.getEntry(MANIFEST_PATH).getTime();

Plugin hpi = new HPI().from(jarFile.getManifest().getMainAttributes(), timestamp);
Plugin hpi = HPI.from(jarFile.getManifest().getMainAttributes(), timestamp);

String wiki = getWiki(file);
if (StringUtils.isNotBlank(wiki)) {
Expand All @@ -67,7 +67,7 @@ public static Plugin loadHPI(File file) throws IOException {
return hpi.withExcerpt(getExcerpt(file));
}

private Plugin from(Attributes attributes, long timestamp) throws IOException {
private static Plugin from(Attributes attributes, long timestamp) throws IOException {
return new Plugin()
.withReleaseTimestamp(releaseTimestampDateFormat().format(timestamp))
.withBuildDate(buildDateTimeFormat().format(timestamp))
Expand All @@ -90,7 +90,7 @@ private Plugin from(Attributes attributes, long timestamp) throws IOException {
.withDevelopers(getDevelopers(attributes));
}

private SimpleDateFormat releaseTimestampDateFormat() {
private static SimpleDateFormat releaseTimestampDateFormat() {
SimpleDateFormat releaseFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.00Z'", Locale.US);
releaseFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return releaseFormat;
Expand All @@ -100,7 +100,7 @@ private static SimpleDateFormat buildDateTimeFormat() {
return new SimpleDateFormat("MMM dd, yyyy", Locale.US);
}

protected List<Dependency> getDependencies(Attributes attributes) throws IOException {
protected static List<Dependency> getDependencies(Attributes attributes) throws IOException {
String deps = attributes.getValue(PLUGIN_DEPENDENCIES);
if (deps == null) {
return Collections.emptyList();
Expand All @@ -127,7 +127,7 @@ protected static Dependency parseDependencyFrom(String token) {
.withOptional(optional);
}

protected List<Developer> getDevelopers(Attributes attributes) throws IOException {
protected static List<Developer> getDevelopers(Attributes attributes) throws IOException {
String devs = attributes.getValue(PLUGIN_DEVELOPERS);
if (isBlank(devs)) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ru.lanwen.jenkins.juseppe.gen;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.lanwen.jenkins.juseppe.beans.UpdateSite;
import ru.lanwen.jenkins.juseppe.gen.source.PathPluginSource;
import ru.lanwen.jenkins.juseppe.gen.view.JsonpUpdateSite;
Expand All @@ -22,6 +24,7 @@
* @author Merkushev Kirill (github: lanwen)
*/
public class UpdateSiteGen {
private static final Logger LOG = LoggerFactory.getLogger(UpdateSiteGen.class);

private Props props;
private UpdateSite site = new UpdateSite();
Expand Down Expand Up @@ -63,15 +66,16 @@ public UpdateSiteGen withDefaults() {
}
});
}

public UpdateSite filled() {
siteConsumers.forEach(consumer -> consumer.accept(site));
return site;
}

public SavableSitesCollection toSave() {
UpdateSite filled = filled();

LOG.info("Ready to save {} plugin(s)...", filled.getPlugins().size());

List<SavableSite> files = Stream.of(
new JsonpUpdateSite(filled, props.getUcJsonName()),
new ReleaseHistoryUpdateSite(filled, props.getReleaseHistoryJsonName())
Expand Down

0 comments on commit 977aa51

Please sign in to comment.