Skip to content

Commit

Permalink
[jgitflow-maven-plugin] merging 'release/1.1.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Mar 22, 2016
2 parents 828af3c + a9e92d9 commit cd0ef72
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 131 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<img src="http://wcm.io/images/[email protected]"/> Maven NodeJS Proxy
======
[![Build Status](https://travis-ci.org/wcm-io-devops/maven-nodejs-proxy.png?branch=develop)](https://travis-ci.org/wcm-io-devops/maven-nodejs-proxy)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.maven/io.wcm.devops.maven.nodejs-proxy/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.maven/io.wcm.devops.maven.nodejs-proxy)

Maven proxy to download NodeJS binaries as Maven artifacts.

Expand Down
10 changes: 10 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.1.0" date="2016-03-22">
<action type="update" dev="sseifert" issue="WDEVOP-1">
Binary File Structre changed in NPM Versions > 0.x and support for SHA-256 checksums.
Please update your configuration file, some parameters needed to be changed.
</action>
<action type="update" dev="sseifert">
Update to dropwizard 0.9.2.
</action>
</release>

<release version="1.0.0" date="2015-09-03">
<action type="add" dev="sseifert">
Initial release.
Expand Down
16 changes: 12 additions & 4 deletions maven-nodejs-proxy/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This is a Dropwizard-based Microservice
# See https://dropwizard.github.io/dropwizard/manual/configuration.html

# Group Id to publish artifacts to
groupId: org.nodejs.dist

Expand All @@ -12,12 +15,17 @@ nodeJsBinariesRootUrl: "https://nodejs.org/dist"

# Url parts to download the different artifacts
nodeJsBinariesUrl: "/v${version}/node-v${version}-${os}-${arch}.${type}"
nodeJsBinariesUrlWindows: "/v${version}/${arch}/node.${type}"
nodeJsBinariesUrlWindowsX86: "/v${version}/node.${type}"
nodeJsBinariesUrlWindows: "/v${version}/win-${arch}/node.${type}"
nodeJsBinariesUrlWindowsX86Legacy: "/v${version}/node.${type}"
nodeJsBinariesUrlWindowsX64Legacy: "/v${version}/${arch}/node.${type}"
npmBinariesUrl: "/npm/npm-${version}.${type}"

# SHA-1 checksums file
nodeJsChecksumUrl: "/v${version}/SHASUMS.txt"
# SHA-256 checksums file
nodeJsChecksumUrl: "/v${version}/SHASUMS256.txt"

# Sample versions for index page
nodeJsSampleVersion: 4.4.0
npmSampleVersion: 1.4.9

# HTTP Client settings
httpClient:
Expand Down
30 changes: 26 additions & 4 deletions maven-nodejs-proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
<parent>
<groupId>io.wcm.devops</groupId>
<artifactId>io.wcm.devops.parent_toplevel</artifactId>
<version>1.0.0</version>
<version>1.0.2</version>
<relativePath />
</parent>

<groupId>io.wcm.devops.maven</groupId>
<artifactId>io.wcm.devops.maven.nodejs-proxy</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>Maven NodeJS Proxy</name>
<description>Maven proxy to download NodeJS binaries as Maven artifacts.</description>

<properties>
<dropwizard.version>0.9.0-rc4</dropwizard.version>
<dropwizard.version>0.9.2</dropwizard.version>
</properties>

<dependencies>
Expand All @@ -55,6 +55,12 @@
<version>${dropwizard.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>${dropwizard.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
Expand All @@ -70,6 +76,13 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.3.9</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand All @@ -78,7 +91,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
Expand Down Expand Up @@ -122,6 +134,16 @@
</configuration>
</plugin>

<!-- Disable parallel Unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>none</parallel>
<threadCount>0</threadCount>
</configuration>
</plugin>

</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
*/
package io.wcm.devops.maven.nodejsproxy;

import io.dropwizard.Configuration;
import io.dropwizard.client.HttpClientConfiguration;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.dropwizard.Configuration;
import io.dropwizard.client.HttpClientConfiguration;

/**
* Configuration for Maven NodeJS Proxy.
*/
Expand All @@ -47,11 +47,17 @@ public class MavenProxyConfiguration extends Configuration {
@NotEmpty
private String nodeJsBinariesUrlWindows;
@NotEmpty
private String nodeJsBinariesUrlWindowsX86;
private String nodeJsBinariesUrlWindowsX86Legacy;
@NotEmpty
private String nodeJsBinariesUrlWindowsX64Legacy;
@NotEmpty
private String npmBinariesUrl;
@NotEmpty
private String nodeJsChecksumUrl;
@NotEmpty
private String nodeJsSampleVersion;
@NotEmpty
private String npmSampleVersion;

@Valid
@NotNull
Expand Down Expand Up @@ -88,8 +94,13 @@ public String getNodeJsBinariesUrlWindows() {
}

@JsonProperty
public String getNodeJsBinariesUrlWindowsX86() {
return this.nodeJsBinariesUrlWindowsX86;
public String getNodeJsBinariesUrlWindowsX86Legacy() {
return this.nodeJsBinariesUrlWindowsX86Legacy;
}

@JsonProperty
public String getNodeJsBinariesUrlWindowsX64Legacy() {
return this.nodeJsBinariesUrlWindowsX64Legacy;
}

@JsonProperty
Expand All @@ -102,6 +113,16 @@ public String getNodeJsChecksumUrl() {
return this.nodeJsChecksumUrl;
}

@JsonProperty
public String getNodeJsSampleVersion() {
return this.nodeJsSampleVersion;
}

@JsonProperty
public String getNpmSampleVersion() {
return this.npmSampleVersion;
}

@JsonProperty("httpClient")
public HttpClientConfiguration getHttpClient() {
return httpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ public class Checksums {
private final Map<String, String> checksums = new HashMap<>();

private static final Pattern LEVEL_1_RELATIVE_NAME = Pattern.compile("^.*/([^/]+)$");
private static final Pattern LEVEL_2_RELATIVE_NAME = Pattern.compile("^.*/([^/]+/[^/]+)$");;
private static final Pattern LEVEL_2_RELATIVE_NAME = Pattern.compile("^.*/([^/]+/[^/]+)$");

/**
* @param data Checksums file content
*/
public Checksums(String data) {
String[] lines = StringUtils.split(data, "\n");
for (String line : lines) {
String sha1 = StringUtils.substringBefore(line, " ");
String checksum = StringUtils.substringBefore(line, " ");
String filename = StringUtils.substringAfter(line, " ");
if (StringUtils.isNoneBlank(sha1, filename)) {
checksums.put(filename, sha1);
if (StringUtils.isNoneBlank(checksum, filename)) {
checksums.put(filename, checksum);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,24 @@
*/
package io.wcm.devops.maven.nodejsproxy.resource;

import io.wcm.devops.maven.nodejsproxy.MavenProxyConfiguration;

import org.apache.commons.lang3.StringUtils;

import io.wcm.devops.maven.nodejsproxy.MavenProxyConfiguration;

/**
* Builds HTML index page
*/
public final class IndexPageBuilder {

private static final String[] EXAMPLE_URLS = new String[] {
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0.pom",
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-windows-x86.exe",
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-windows-x64.exe",
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-linux-x86.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-linux-x64.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-darwin-x86.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/0.12.0/${nodeJsArtifactId}-0.12.0-darwin-x64.tar.gz",
"${groupIdPath}/${npmArtifactId}/1.4.9/${npmArtifactId}-1.4.9.pom",
"${groupIdPath}/${npmArtifactId}/1.4.9/${npmArtifactId}-1.4.9.tgz"
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}.pom",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-windows-x86.exe",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-windows-x64.exe",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-linux-x86.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-linux-x64.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-darwin-x64.tar.gz",
"${groupIdPath}/${npmArtifactId}/${npmSampleVersion}/${npmArtifactId}-${npmSampleVersion}.pom",
"${groupIdPath}/${npmArtifactId}/${npmSampleVersion}/${npmArtifactId}-${npmSampleVersion}.tgz"
};

private IndexPageBuilder() {
Expand All @@ -54,22 +53,27 @@ public static String build(MavenProxyConfiguration config) {
url = StringUtils.replace(url, "${groupIdPath}", StringUtils.replace(config.getGroupId(), ".", "/"));
url = StringUtils.replace(url, "${nodeJsArtifactId}", config.getNodeJsArtifactId());
url = StringUtils.replace(url, "${npmArtifactId}", config.getNpmArtifactId());
url = StringUtils.replace(url, "${nodeJsSampleVersion}", config.getNodeJsSampleVersion());
url = StringUtils.replace(url, "${npmSampleVersion}", config.getNpmSampleVersion());
exampleUrlsMarkup.append("<li><a href=\"").append(url).append("\">").append(url).append("</a></li>");

}

String serviceVersion = IndexPageBuilder.class.getPackage().getImplementationVersion();

return "<html>"
+ "<head><title>Maven NodeJS Proxy</title></head>"
return "<!DOCTYPE html>\n<html>"
+ "<head>"
+ "<title>Maven NodeJS Proxy</title>"
+ "<style>body { font-family: sans-serif; }</style>"
+ "</head>"
+ "<body>"
+ "<h1>Maven NodeJS Proxy</h1>"
+ "<p>This is a Maven Artifact Proxy for NodeJS binaries located at: "
+ "<a href=\"" + config.getNodeJsBinariesRootUrl() + "\">" + config.getNodeJsBinariesRootUrl() + "</a></p>"
+ "<p>Every call to this repository is routed directly to this URL.</p>"
+ "<p><strong>Please never use this Maven repository directly in your maven builds, but only via an Repository Manager "
+ "which caches the resolved artifacts.</strong></p>"
+ "<p>If you want to setup your own proxy get the source code:"
+ "<p>If you want to setup your own proxy get the source code: "
+ "<a href=\"https://github.com/wcm-io-devops/maven-nodejs-proxy\">https://github.com/wcm-io-devops/maven-nodejs-proxy</a></p>"
+ "<hr/>"
+ "<p>Examples:</p>"
Expand Down
Loading

0 comments on commit cd0ef72

Please sign in to comment.