copy the jars into a local repo inside the jar under the 'jars' directory
*
create 'Jars.lock' which jruby uses to load the jars
*
*
*
* setup the gems
*
*
copy the 'gems' directory to the resources
*
copy the 'specifications' directory to the resources
*
copy the 'bin' directory to the resources
*
*
* @author christian
*
*/
public abstract class AbstractGenerateMojo extends AbstractJRuby9Mojo {
protected void executeWithGems(boolean pluginDependenciesOnly) throws MojoExecutionException,
ScriptException, IOException {
JarDependencies jars = new JarDependencies(project.getBuild().getOutputDirectory(), "Jars.lock");
jars.addAll(plugin.getArtifacts(), new Filter(){
@Override
public boolean addIt(Artifact a) {
return a.getScope().equals("runtime") &&
!project.getArtifactMap().containsKey(a.getGroupId() +":" + a.getArtifactId());
}
});
if (!pluginDependenciesOnly) {
jars.addAll(project.getArtifacts());
}
jars.generateJarsLock();
jars.copyJars();
File pluginGemHome = gemHome( gemsBasePath(), plugin.getArtifactId() );
addResource(project.getResources(), createGemsResource(pluginGemHome.getAbsolutePath()));
addResource(project.getResources(), createGemsResource(gemsBasePath()));
}
// TODO pull upstream
protected Resource createGemsResource(String gemHome) {
Resource resource = new Resource();
resource.setDirectory(gemHome);
resource.addInclude("bin/*");
resource.addInclude("specifications/*");
resource.addInclude("gems/**");
resource.addExclude("gems/*/test/**");
resource.addExclude("gems/*/tests/**");
resource.addExclude("gems/*/spec/**");
resource.addExclude("gems/*/specs/**");
resource.addExclude("gems/*/features/**");
resource.addExclude("gems/**/*.java");
return resource;
}
// TODO pull upstream
protected String gemsBasePath() {
String base = this.gemsConfig.getGemHome() != null ?
this.gemsConfig.getGemHome().getAbsolutePath() :
(project.getBuild().getDirectory() + "/rubygems");
return base;
}
}
././@LongLink 0000644 0000000 0000000 00000000162 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/JRubyDirectory.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/JRubyD0000644 0000000 0000000 00000005124 12674201751 027646 0 ustar package de.saumya.mojo.jruby9;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.FileUtils;
class JRubyDirectory extends SimpleFileVisitor {
Map> dirs = new HashMap>();
private Path root;
JRubyDirectory(Path root) {
this.root = root;
}
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) throws IOException {
String name = dir.getParent().toFile().getName();
if ("jars".equals(name) || "META-INF".equals(name)) {
return FileVisitResult.SKIP_SUBTREE;
}
add(dir);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
String name = file.toFile().getName();
if(name.endsWith(".class") || name.equals(".jrubydir") || (file.getParent().equals(root) &&
("gems".equals(name) || "specifications".equals(name) ||
"jars".equals(name) || "jar-bootstrap.rb".equals(name)))) {
return FileVisitResult.CONTINUE;
}
add(file);
return FileVisitResult.CONTINUE;
}
private void add(Path file) {
String name = file.toFile().getName();
List dir = dirs.get(file.getParent());
if (dir == null) {
dir = new LinkedList();
dirs.put(file.getParent(), dir);
}
dir.add(name);
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc)
throws IOException {
File jrubyDir = dir.resolve(".jrubydir").toFile();
List names = dirs.remove(dir);
if (names != null) {
StringBuilder content = new StringBuilder(".\n");
if (!dir.equals(root)) content.append("..\n");
for(String name: names) {
content.append(name).append("\n");
}
if (jrubyDir.exists()) {
String old = FileUtils.readFileToString(jrubyDir);
if (content.equals(old)) {
return FileVisitResult.CONTINUE;
}
}
FileUtils.write(jrubyDir, content);
}
return FileVisitResult.CONTINUE;
}
} ././@LongLink 0000644 0000000 0000000 00000000167 00000000000 011607 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/AbstractProcessMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/Abstra0000644 0000000 0000000 00000001710 12674201751 027720 0 ustar package de.saumya.mojo.jruby9;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
/**
* generates ".jrubydir" files for all resource and gems to allow jruby
* to perform directory globs inside the jar.
*
* @author christian
*
*/
public abstract class AbstractProcessMojo extends AbstractMojo {
@Parameter( defaultValue = "${project.build.outputDirectory}", readonly = true )
private File outputDirectory;
@Override
public void execute() throws MojoExecutionException {
Path root = outputDirectory.toPath();
try {
Files.walkFileTree(root, new JRubyDirectory(root));
} catch (IOException e) {
throw new MojoExecutionException("could not generate .jrubydir files", e);
}
}
} ././@LongLink 0000644 0000000 0000000 00000000162 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/ArtifactHelper.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/Artifa0000644 0000000 0000000 00000007365 12674201751 027726 0 ustar package de.saumya.mojo.jruby9;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.UnArchiver;
import org.codehaus.plexus.util.FileUtils;
public class ArtifactHelper {
private final UnArchiver archiver;
private final RepositorySystem system;
private final ArtifactRepository localRepo;
private final List remoteRepos;
public ArtifactHelper(UnArchiver archiver, RepositorySystem system,
ArtifactRepository localRepo, List remoteRepos) {
this.system = system;
this.localRepo = localRepo;
this.remoteRepos = remoteRepos;
this.archiver = archiver;
}
public Set resolve(String groupId, String artifactId, String version)
throws MojoExecutionException {
return resolve(groupId, artifactId, version, null);
}
public Set resolve(String groupId, String artifactId, String version, final String exclusion)
throws MojoExecutionException {
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setResolveTransitively(true)
.setResolveRoot(true)
.setArtifact(system.createArtifact(groupId, artifactId, version, "jar"))
.setLocalRepository(this.localRepo)
.setRemoteRepositories(remoteRepos).setCollectionFilter(new ArtifactFilter() {
@Override
public boolean include(Artifact artifact) {
if (exclusion != null &&
(artifact.getGroupId() + ":" + artifact.getArtifactId()).equals(exclusion)) {
return false;
}
return artifact.getScope() == null || artifact.getScope().equals("compile") || artifact.getScope().equals("runtime");
}
});
ArtifactResolutionResult result = system.resolve(request);
// TODO error handling
return result.getArtifacts();
}
public void copy(File output, String groupId, String artifactId, String version)
throws MojoExecutionException {
copy(output, groupId, artifactId, version, null);
}
public void copy(File output, String groupId, String artifactId, String version, String exclusion)
throws MojoExecutionException {
output.mkdirs();
for(Artifact artifact: resolve(groupId, artifactId, version, exclusion)) {
try {
FileUtils.copyFile(artifact.getFile(), new File(output, artifact.getFile().getName()));
} catch (IOException e) {
throw new MojoExecutionException("could not copy: " + artifact, e);
}
}
}
public void unzip(File output, String groupId, String artifactId, String version)
throws MojoExecutionException {
output.mkdirs();
archiver.setDestDirectory(output);
for(Artifact artifact: resolve(groupId, artifactId, version)) {
archiver.setSourceFile(artifact.getFile());
try {
archiver.extract();
} catch (ArchiverException e) {
throw new MojoExecutionException("could not unzip: " + artifact, e);
}
}
}
} ././@LongLink 0000644 0000000 0000000 00000000154 00000000000 011603 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/Versions.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/src/main/java/de/saumya/mojo/jruby9/Versio0000644 0000000 0000000 00000000467 12674201751 027763 0 ustar package de.saumya.mojo.jruby9;
public final class Versions {
private Versions(){}
public final static String JRUBY = "9.0.0.0";
public final static String JRUBY_MAINS = "0.4.0";
public final static String JRUBY_RACK = "1.1.18";
public final static String JETTY = "8.1.14.v20131031";
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-common/pom.xml 0000644 0000000 0000000 00000001323 12674201751 021363 0 ustar
4.0.0jruby9de.saumya.mojo0.2.3-SNAPSHOTjruby9-commonjarJRuby9 Commonorg.apache.maven.plugin-toolsmaven-plugin-annotationsprovided
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/ 0000755 0000000 0000000 00000000000 12674201751 021750 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/ 0000755 0000000 0000000 00000000000 12674201751 022537 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/ 0000755 0000000 0000000 00000000000 12674201751 023463 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/ 0000755 0000000 0000000 00000000000 12674201751 024404 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/ 0000755 0000000 0000000 00000000000 12674201751 024774 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 026273 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/ 0000755 0000000 0000000 00000000000 12674201751 027237 5 ustar ././@LongLink 0000644 0000000 0000000 00000000151 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jruby9/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jru0000755 0000000 0000000 00000000000 12674201751 027760 5 ustar ././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jruby9/war/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jru0000755 0000000 0000000 00000000000 12674201751 027760 5 ustar ././@LongLink 0000644 0000000 0000000 00000000175 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jruby9/war/ProcessMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jru0000644 0000000 0000000 00000001032 12674201751 027756 0 ustar package de.saumya.mojo.jruby9.war;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import de.saumya.mojo.jruby9.AbstractProcessMojo;
/**
*
* generates ".jrubydir" files for all resource and gems to allow jruby
* to perform directory globs inside the jar.
*
* @author christian
*/
@Mojo( name = "process", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresProject = true,
threadSafe = true )
public class ProcessMojo extends AbstractProcessMojo {
} ././@LongLink 0000644 0000000 0000000 00000000171 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jruby9/war/WarMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jru0000644 0000000 0000000 00000021214 12674201751 027762 0 ustar package de.saumya.mojo.jruby9.war;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.shared.utils.io.IOUtil;
import org.codehaus.plexus.archiver.UnArchiver;
import de.saumya.mojo.jruby9.ArtifactHelper;
import de.saumya.mojo.jruby9.ArchiveType;
import de.saumya.mojo.jruby9.Versions;
/**
* packs a ruby application into war. it can add a launcher to it
* so it can be executed like runnable jar or it can add an embedded
* jetty to startup a webserver directly from the war.
*
*
adds jruby-complete.jar to WEB-INF/lib
*
adds jruby-rack.jar to WEB-INF/lib
*
shaded jruby-mains.jar (for the RUNNABLE case)
*
shaded jetty.jar + its dependencies (for the JETTY case)
*
all declared gems and transitive gems and jars are under WEB-INF/classes
*
all declared jars and transitive jars are under WEB-INF/classes
*
all declared resource are under WEB-INF/classes
*
adds the default resources to WEB-INF/classes
*
* the main class (for RUNNABLE) needs to extract the jruby-complete.jar into a temp directory and
* the launcher will set up the GEM_HOME, GEM_PATH and JARS_HOME pointing into the jar (classloader)
* and takes arguments for executing jruby. any bin stubs from the gem are available via '-S' or any
* script relative to jar's root can be found as the current directory is inside the jar.
*
*
*
* embedded JETTY does not take any arguments and will just start up jetty
*
*
*
* the jruby rack application uses the ClassPathLayout which is designed for this kind of packing
* the ruby application.
*
*
*
* default for typical rack application
*
*
config.ru
*
lib/**
*
app/**
*
config/**
*
public/**
*
* @author christian
*/
@Mojo( name = "war", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true,
requiresDependencyResolution = ResolutionScope.RUNTIME )
public class WarMojo extends org.apache.maven.plugin.war.WarMojo {
@Parameter( defaultValue = "archive", property = "jruby.archive.type", required = true )
private ArchiveType type;
@Parameter( required = false )
private String mainClass;
@Parameter( required = false, defaultValue = "false" )
private boolean defaultResource;
@Parameter( defaultValue = Versions.JRUBY, property = "jruby.version", required = true )
private String jrubyVersion;
@Parameter( defaultValue = Versions.JRUBY_MAINS, property = "jruby.mains.version", required = true )
private String jrubyMainsVersion;
@Parameter( defaultValue = Versions.JRUBY_RACK, property = "jruby.rack.version", required = true )
private String jrubyRackVersion;
@Parameter( defaultValue = Versions.JETTY, property = "jetty.version", required = true )
private String jettyVersion;
@Parameter( readonly = true, required = true, defaultValue="${localRepository}" )
protected ArtifactRepository localRepository;
@Component
RepositorySystem system;
@Component( hint = "zip" )
UnArchiver unzip;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
ArtifactHelper helper = new ArtifactHelper(unzip, system,
localRepository, getProject().getRemoteArtifactRepositories());
File jrubyWar = new File(getProject().getBuild().getDirectory(), "jrubyWar");
File jrubyWarLib = new File(jrubyWar, "lib");
File webXml = new File(jrubyWar, "web.xml");
File initRb = new File(jrubyWar, "init.rb");
File jrubyWarClasses = new File(jrubyWar, "classes");
switch(type) {
case jetty:
helper.unzip(jrubyWarClasses, "org.eclipse.jetty", "jetty-server", jettyVersion);
helper.unzip(jrubyWarClasses, "org.eclipse.jetty", "jetty-webapp", jettyVersion);
if (mainClass == null ) mainClass = "org.jruby.mains.JettyRunMain";
case runnable:
helper.unzip(jrubyWarClasses, "org.jruby.mains", "jruby-mains", jrubyMainsVersion);
if (mainClass == null ) mainClass = "org.jruby.mains.WarMain";
MavenArchiveConfiguration archive = getArchive();
archive.getManifest().setMainClass(mainClass);
createAndAddWebResource(jrubyWarClasses, "");
createAndAddWebResource(new File(getProject().getBuild().getOutputDirectory(), "bin"), "bin");
case archive:
default:
}
helper.copy(jrubyWarLib, "org.jruby", "jruby-complete", jrubyVersion);
helper.copy(jrubyWarLib, "org.jruby.rack", "jruby-rack", jrubyRackVersion,
"org.jruby:jruby-complete"); //exclude jruby-complete
// we bundle jar dependencies the ruby way
getProject().getArtifacts().clear();
createAndAddWebResource(jrubyWarLib, "WEB-INF/lib");
copyPluginResource(initRb);
Resource resource = new Resource();
resource.setDirectory(initRb.getParent());
resource.addInclude(initRb.getName());
resource.setTargetPath("META-INF");
addWebResource(resource);
if (defaultResource) {
addCommonRackApplicationResources();
}
if (getWebXml() == null) {
findWebXmlOrUseBuiltin(webXml);
}
super.execute();
}
private void addCommonRackApplicationResources() {
Resource resource = new Resource();
resource.setDirectory(getProject().getBasedir().getAbsolutePath());
resource.addInclude("config.ru");
getProject().addResource(resource);
createAndAddResource(new File(getProject().getBasedir(), "lib"));
createAndAddResource(new File(getProject().getBasedir(), "app"));
createAndAddResource(new File(getProject().getBasedir(), "public"));
createAndAddResource(new File(getProject().getBasedir(), "config"));
}
private void findWebXmlOrUseBuiltin(File webXml)
throws MojoExecutionException {
// TODO search web.xml
copyPluginResource(webXml);
if (getLog().isInfoEnabled()) {
getLog().info("using builtin web.xml: " +
webXml.toString().replace(getProject().getBasedir().getAbsolutePath() + File.separatorChar, ""));
}
setWebXml(webXml);
}
private void copyPluginResource(File file) throws MojoExecutionException {
String name = file.getName();
try {
IOUtil.copy(getClass().getClassLoader().getResourceAsStream(name),
new FileOutputStream(file));
} catch (IOException e) {
throw new MojoExecutionException("could not copy from plugin: " + name, e);
}
}
private void createAndAddResource(File source){
getProject().addResource(createResource(source.getAbsolutePath(), null));
}
private void createAndAddWebResource(File source, String target){
addWebResource(createResource(source.getAbsolutePath(), target));
}
private void addWebResource(Resource resource) {
Resource[] webResources = getWebResources();
if (webResources == null) {
webResources = new Resource[1];
}
else {
webResources = Arrays.copyOf(webResources, webResources.length + 1);
}
webResources[webResources.length - 1] = resource;
setWebResources(webResources);
}
protected Resource createResource(String source, String target) {
Resource resource = new Resource();
resource.setDirectory(source);
resource.addExclude("jetty*.css");
resource.addExclude("plugin.properties");
resource.addExclude("about.html");
resource.addExclude("about_files/**");
resource.addExclude("META-INF/ECLIPSE*");
resource.addExclude("META-INF/eclipse*");
resource.addExclude("META-INF/maven/**");
resource.addExclude("WEB-INF/**");
resource.addExclude("**/web.xml");
if (target != null) resource.setTargetPath(target);
return resource;
}
}
././@LongLink 0000644 0000000 0000000 00000000176 00000000000 011607 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jruby9/war/GenerateMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/java/de/saumya/mojo/jru0000644 0000000 0000000 00000001705 12674201751 027765 0 ustar package de.saumya.mojo.jruby9.war;
import java.io.IOException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.plugin.MojoExecutionException;
import de.saumya.mojo.ruby.script.ScriptException;
import de.saumya.mojo.jruby9.AbstractGenerateMojo;
/**
* add the gems and jars to resources. @see AbstractGenerateMojo
*
* @author christian
*
*/
@Mojo( name = "generate", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresProject = true,
threadSafe = true, requiresDependencyResolution = ResolutionScope.RUNTIME )
public class GenerateMojo extends AbstractGenerateMojo {
@Override
protected void executeWithGems() throws MojoExecutionException,
ScriptException, IOException {
// war files do pack all dependencies the ruby way
executeWithGems(false);
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/resources/ 0000755 0000000 0000000 00000000000 12674201751 025475 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/resources/init.rb 0000644 0000000 0000000 00000000711 12674201751 026764 0 ustar # partially copied monkey_patch.rb from jruby-mains project
# bundler includes Bundler::SharedHelpers into its runtime
# adding the included method allows to monkey patch the runtime
# the moment it is used. i.e. no need to activate the bundler gem
module Bundler
module Patch
def clean_load_path
# nothing to be done for JRuby
end
end
module SharedHelpers
def included(bundler)
bundler.send :include, Patch
end
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/main/resources/web.xml 0000644 0000000 0000000 00000001006 12674201751 026771 0 ustar jruby.rack.layout_classJRuby::Rack::ClassPathLayoutRackFilterorg.jruby.rack.RackFilterRackFilter/*org.jruby.rack.RackServletContextListener
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/ 0000755 0000000 0000000 00000000000 12674201751 023153 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/ 0000755 0000000 0000000 00000000000 12674201751 026274 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/pom.xml 0000644 0000000 0000000 00000012343 12674201751 027614 0 ustar
4.0.0de.saumya.mojo.jruby9testtestingmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgorg.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gem9.0.3.0de.saumya.mojomavengem-wagon0.1.0${basedir}test.rbspec/**maven-jar-plugin2.4default-jaromitde.saumya.mojojruby9-war-maven-plugin@project.version@${j.version}runnablejruby-wargenerateprocesswarrubygemsrspec3.3.0gemorg.slf4jslf4j-simple1.7.6org.codehaus.mojoexec-maven-plugin1.2java${project.build.directory}pathblabla${basedir}${basedir}${basedir}simpleverifyexec-jar${project.build.finalName}.war-rjars/setup-e
p JRUBY_VERSION
p $CLASSPATH.size
expected = 10
raise "expected #{expected} classpath entries but got #{$CLASSPATH.size}: #{$CLASSPATH.inspect}" if $CLASSPATH.size != expected
raise "expected jruby version ${j.version} but was #{JRUBY_VERSION}" if JRUBY_VERSION != "${j.version}"
rspecverifyexec-jar${project.build.finalName}.war-Srspectest fileverifyexec-jar${project.build.finalName}.wartest.rb
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/spec/ 0000755 0000000 0000000 00000000000 12674201751 027226 5 ustar ././@LongLink 0000644 0000000 0000000 00000000154 00000000000 011603 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/spec/one_0000644 0000000 0000000 00000000627 12674201751 030076 0 ustar require 'jar-dependencies'
describe 'something' do
it 'runs inside the right environment' do
expect(Dir.pwd).to eq 'uri:classloader://WEB-INF/classes/'
expect(__FILE__).to eq 'uri:classloader:/WEB-INF/classes/spec/one_spec.rb'
expect(Jars.home).to eq 'uri:classloader://WEB-INF/classes/jars'
expect(Gem.dir).to eq 'uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/test.rb 0000644 0000000 0000000 00000001421 12674201751 027576 0 ustar gem 'minitest'
require 'minitest/autorun'
require 'jars/setup'
describe 'something' do
it 'uses the right minitest version' do
Gem.loaded_specs['minitest'].version.to_s.must_equal '5.7.0'
end
it 'runs from the jar' do
__FILE__.must_equal 'test.rb'
Dir.pwd.must_equal 'uri:classloader://WEB-INF/classes/'
end
it 'can use logger' do
old = java.lang.System.err
bytes = StringIO.new
java.lang.System.err = java.io.PrintStream.new( bytes.to_outputstream )
begin
# TODO capture java stderr and ensure there is no warning
org.slf4j.LoggerFactory.get_logger('me').info 'hello'
java.lang.System.err.flush
bytes.string.strip.must_equal '[main] INFO me - hello'
ensure
java.lang.System.err = old
end
end
end
././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jrubyWarExample/invoker.p0000644 0000000 0000000 00000000063 12674201751 030131 0 ustar invoker.goals = verify
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/ 0000755 0000000 0000000 00000000000 12674201751 025626 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/config.ru 0000644 0000000 0000000 00000000203 12674201751 027436 0 ustar
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
require 'app/hellowarld'
map '/' do
run Sinatra::Application
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/pom.xml 0000644 0000000 0000000 00000004634 12674201751 027152 0 ustar
4.0.0de.saumya.mojo.jruby9jettytestingmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgorg.slf4jslf4j-simple1.7.6rubygemsleafy-complete0.4.0gemrubygemssinatra1.4.5gemde.saumya.mojomavengem-wagon0.1.0${basedir}config.ruapp/**maven-jar-plugin2.6default-jaromitde.saumya.mojojruby9-war-maven-plugin@project.version@jettyjruby-wargenerateprocesswar
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/invoker.prop0000644 0000000 0000000 00000000063 12674201751 030204 0 ustar invoker.goals = verify
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/app/ 0000755 0000000 0000000 00000000000 12674201751 026406 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/app/views/ 0000755 0000000 0000000 00000000000 12674201751 027543 5 ustar ././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/app/views/person.erb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/app/views/pe0000644 0000000 0000000 00000002500 12674201751 030067 0 ustar
<%= @person.firstname %> <%= @person.surname %>
person
Firstname
Surname
././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/app/hellowarld.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/src/it/jettyExample/app/hellowar0000644 0000000 0000000 00000002775 12674201751 030161 0 ustar require 'sinatra'
require 'json'
require 'ostruct'
require 'leafy/metrics'
require 'leafy/health'
require 'leafy/instrumented/instrumented'
require 'leafy/instrumented/collected_instrumented'
require 'leafy/rack/admin'
require 'leafy/rack/instrumented'
data = OpenStruct.new
data.surname = 'meier'
data.firstname = 'christian'
configure do
metrics = Leafy::Metrics::Registry.new
health = Leafy::Health::Registry.new
use( Leafy::Rack::Admin, metrics, health )
use( Leafy::Rack::Metrics, metrics )
use( Leafy::Rack::Health, health )
use( Leafy::Rack::Ping )
use( Leafy::Rack::ThreadDump )
use( Leafy::Rack::Instrumented, Leafy::Instrumented::Instrumented.new( metrics, 'webapp' ) )
use( Leafy::Rack::Instrumented, Leafy::Instrumented::CollectedInstrumented.new( metrics, 'collected' ) )
metrics.register_gauge('app.data_length' ) do
data.surname.length + data.firstname.length
end
health.register( 'app.health' ) do
if data.surname.length + data.firstname.length < 4
"stored names are too short"
end
end
set :histogram, metrics.register_histogram( 'app.name_length' )
end
get '/app' do
p @person = data
erb :person
end
get '/person' do
p @person = data
content_type 'application/json'
{ :surname => data.surname, :firstname => data.firstname }.to_json
end
patch '/person' do
payload = JSON.parse request.body.read
data.send :"#{payload.keys.first}=", payload.values.first
settings.histogram.update( data.surname.length + data.firstname.length )
status 205
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/README.md 0000644 0000000 0000000 00000007777 12674201751 023251 0 ustar # jruby jar maven plugin
it packs a ruby application as runnable jar, i.e. all the ruby code and the gems and jars (which ruby loads via require) are packed inside the jar. the jar will include jruby-complete and jruby-mains to execute the ruby application via, i.e.
java -jar my.jar -S rake
there is more compact configuration using an maven extensions: [../jruby9-jar-extension](jruby9-jar-extension)
## general command line switches
to see the java/jruby command the plugin is executing use (for example with the verify goal)
```mvn verify -Djruby.verbose```
to quickly pick another jruby version use
```mvn verify -Djruby.version=1.7.20```
or to display some help
```mvn jruby9-jar:help -Ddetail```
```mvn jruby9-jar:help -Ddetail -Dgoal=jar```
## jruby jar
it installs all the declared gems and jars from the dependencies section as well the plugin dependencies.
the complete pom for the samples below is in [src/it/jrubyJarExample/pom.xml](src/it/jrubyJarExample/pom.xml) and more details on how it can be executed.
the gem-artifacts are coming from the torquebox rubygems proxy
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
to use these gems within the depenencies of the plugin you need
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
the jar and gem artifacts for the JRuby application can be declared in the main dependencies section
org.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gem
these artifacts ALL have the default scope which gets packed into the jar.
adding ruby resources to your jar
${basedir}test.rbspec/**
the plugin declarations. first we want to omit the regular jar packing
maven-jar-plugin2.4default-jaromit
the tell the jruby-jar mojo to pack the jar
de.saumya.mojojruby9-jar-maven-plugin@project.version@${j.version}jruby-jargenerateprocessjar
now the plugin does also pack those gem declared inside the plugin sections
rubygemsrspec3.3.0gem
the main dependencies section does use leafy-rack and for its logging you need a slf4j logger.
org.slf4jslf4j-simple1.7.6
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-war-maven-plugin/pom.xml 0000644 0000000 0000000 00000002652 12674201751 023272 0 ustar
4.0.0jruby9de.saumya.mojo0.2.3-SNAPSHOTjruby9-war-maven-pluginmaven-pluginJRuby9 War Maven Mojoorg.apache.mavenmaven-coretrueorg.codehaus.plexusplexus-archiverde.saumya.mojojruby9-commonorg.apache.maven.pluginsmaven-war-pluginorg.apache.maven.plugin-toolsmaven-plugin-annotationsprovidedmaven-invoker-plugin
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/ 0000755 0000000 0000000 00000000000 12674201751 017134 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/ 0000755 0000000 0000000 00000000000 12674201751 022572 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/ 0000755 0000000 0000000 00000000000 12674201751 023361 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/ 0000755 0000000 0000000 00000000000 12674201751 024340 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/ 0000755 0000000 0000000 00000000000 12674201751 025261 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/ 0000755 0000000 0000000 00000000000 12674201751 025651 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 027150 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/0000755 0000000 0000000 00000000000 12674201751 030114 5 ustar ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/mavengem/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/0000755 0000000 0000000 00000000000 12674201751 030114 5 ustar ././@LongLink 0000644 0000000 0000000 00000000176 00000000000 011607 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/mavengem/HandlerTest.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/0000644 0000000 0000000 00000007767 12674201751 030137 0 ustar package de.saumya.mojo.mavengem;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Map;
import java.net.URL;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
public class HandlerTest {
private boolean result;
private File cacheDir;
@Before
public void setup() throws Exception {
cacheDir = new File(System.getProperty("basedir"), "target/cache4test");
result = Handler.registerMavenGemProtocol(new RubygemsFactory(cacheDir));
}
@Test
public void registerProtocol() throws Exception {
assertThat(result, is(true));
assertThat(Handler.registerMavenGemProtocol(null),
is(false));
assertThat(Handler.registerMavenGemProtocol(), is(false));
}
@Test
public void virtusPomWithAuthentication() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "http___rubygems_org/quick/Marshal.4.8/v/virtus-1.0.5.gemspec.rz");
cached.delete();
URL url = new URL("mavengem:http://me:andthecorner@rubygems.org/maven/releases/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
try (InputStream in = url.openStream()) {
// just read the file
byte[] data = new byte[in.available()];
in.read(data, 0, in.available());
}
// the cached dir does not expose the credentials
assertThat(cached.getPath(), cached.exists(), is(true));
}
@Test
public void ping() throws Exception {
URL url = new URL("mavengem:https://rubygems.org/something/maven/releases/ping");
byte[] data = new byte[4];
url.openStream().read(data, 0, 4);
String result = new String(data);
assertThat(result, is("pong"));
}
@Test
public void railsMavenMetadata() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "https___rubygems_org/api/v1/dependencies/rails.ruby");
cached.delete();
URL url = new URL("mavengem:https://rubygems.org/maven/releases/rubygems/rails/maven-metadata.xml");
try (InputStream in = url.openStream()) {
byte[] data = new byte[in.available()];
in.read(data, 0, in.available());
String result = new String(data);
assertThat(result, startsWith(""));
assertThat(result, containsString("4.2.5"));
assertThat(result, endsWith("\n"));
}
assertThat(cached.getPath(), cached.isFile(), is(true));
}
@Test
public void railsPom() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "https___rubygems_org/quick/Marshal.4.8/r/rails-4.2.5.gemspec.rz");
cached.delete();
URL url = new URL("mavengem:https://rubygems.org/maven/releases/rubygems/rails/4.2.5/rails-4.2.5.pom");
try (InputStream in = url.openStream()) {
byte[] data = new byte[in.available()];
in.read(data, 0, in.available());
String result = new String(data);
assertThat(result, startsWith(""));
assertThat(result, containsString("4.2.5"));
assertThat(result, containsString("Full-stack web application framework."));
assertThat(result, containsString("gem"));
assertThat(result, endsWith("\n"));
}
assertThat(cached.getPath(), cached.isFile(), is(true));
}
@Test(expected = FileNotFoundException.class)
public void fileNotFoundOnWrongBaseURL() throws Exception {
// this test goes online to rubygems.org
URL url = new URL("mavengem:https://rubygems.org/something/not/right/here/maven/releases/rubygems/rails/maven-metadata.xml");
url.openStream();
}
@Test(expected = FileNotFoundException.class)
public void fileNotFoundOnDirectory() throws Exception {
// this test goes online to rubygems.org
URL url = new URL("mavengem:https://rubygems.org/maven/releases/rubygems/rails");
url.openStream();
}
}
././@LongLink 0000644 0000000 0000000 00000000214 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/mavengem/MavenGemURLConnectionTest.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/0000644 0000000 0000000 00000014661 12674201751 030126 0 ustar package de.saumya.mojo.mavengem;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Map;
import java.util.HashMap;
import java.net.URL;
import java.net.URLConnection;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
public class MavenGemURLConnectionTest {
private File cacheDir;
private RubygemsFactory factory;
@Before
public void setup() throws Exception {
cacheDir = new File(System.getProperty("basedir"), "target/cache4test");
factory = new RubygemsFactory(cacheDir);
}
@Test
public void virtusPomWithAuthentication() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "http___rubygems_org/quick/Marshal.4.8/v/virtus-1.0.5.gemspec.rz");
// with the /maven/releases prefix
URLConnection url = new MavenGemURLConnection(factory, new URL("http://me:andthecorner@rubygems.org"), "/maven/releases/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
// the cached dir does not expose the credentials
assertCached(url, cached);
// without the /maven/releases prefix
url = new MavenGemURLConnection(factory, new URL("http://me:andthecorner@rubygems.org"), "/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
// the cached dir does not expose the credentials
assertCached(url, cached);
}
@Test
public void virtusPomWithMirror() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "http___rubygems_org/quick/Marshal.4.8/v/virtus-1.0.5.gemspec.rz");
RubygemsFactory factory = new RubygemsFactory(cacheDir, new URL("http://me:andthecorner@rubygems.org"));
// with the /maven/releases prefix
URLConnection url = new MavenGemURLConnection(factory, new URL("http://example.com"), "/maven/releases/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
// the cached dir does not expose the credentials
assertCached(url, cached);
// without the /maven/releases prefix
url = new MavenGemURLConnection(factory, new URL("http://example.com"), "/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
// the cached dir does not expose the credentials
assertCached(url, cached);
}
@Test
public void virtusPomWithMirrors() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "http___rubygems_org/quick/Marshal.4.8/v/virtus-1.0.5.gemspec.rz");
Map mirrors = new HashMap();
mirrors.put(new URL("http://example.com"), new URL("http://me:andthecorner@rubygems.org"));
mirrors.put(new URL("http://hans:glueck@example.org"), new URL("http://rubygems.org"));
RubygemsFactory factory = new RubygemsFactory(cacheDir, mirrors);
// with the /maven/releases prefix
URLConnection url = new MavenGemURLConnection(factory, new URL("http://example.com"), "/maven/releases/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
// the cached dir does not expose the credentials
assertCached(url, cached);
// without the /maven/releases prefix
url = new MavenGemURLConnection(factory, new URL("http://example.org"), "/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
assertCached(url, cached);
// go direct here
cached = new File(cacheDir, "https___rubygems_org/quick/Marshal.4.8/v/virtus-1.0.5.gemspec.rz");
url = new MavenGemURLConnection(factory, new URL("https://rubygems.org"), "/rubygems/virtus/1.0.5/virtus-1.0.5.pom");
assertCached(url, cached);
}
private void assertCached(URLConnection url, File cached) throws Exception {
cached.delete();
try (InputStream in = url.getInputStream()) {
// just read the file
byte[] data = new byte[in.available()];
in.read(data, 0, in.available());
}
// the cached dir does not expose the credentials
assertThat(cached.getPath(), cached.exists(), is(true));
}
@Test
public void ping() throws Exception {
URLConnection url = new MavenGemURLConnection(new URL("https://rubygems.org/something"), "/maven/releases/ping");
byte[] data = new byte[4];
url.getInputStream().read(data, 0, 4);
String result = new String(data);
assertThat(result, is("pong"));
}
@Test
public void railsMavenMetadata() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "https___rubygems_org/api/v1/dependencies/rails.ruby");
cached.delete();
URLConnection url = new MavenGemURLConnection(factory, new URL("https://rubygems.org"), "/maven/releases/rubygems/rails/maven-metadata.xml");
String result = download(url);
assertThat(result, startsWith(""));
assertThat(result, containsString("4.2.5"));
assertThat(result, endsWith("\n"));
assertThat(cached.getPath(), cached.isFile(), is(true));
}
String download(URLConnection url) throws Exception {
try (InputStream in = url.getInputStream()) {
byte[] data = new byte[in.available()];
in.read(data, 0, in.available());
return new String(data);
}
}
@Test
public void railsPom() throws Exception {
// this test goes online to rubygems.org
File cached = new File(cacheDir, "https___rubygems_org/quick/Marshal.4.8/r/rails-4.2.5.gemspec.rz");
cached.delete();
URLConnection url = new MavenGemURLConnection(factory, new URL("https://rubygems.org"), "/rubygems/rails/4.2.5/rails-4.2.5.pom");
String result = download(url);
assertThat(result, startsWith(""));
assertThat(result, containsString("4.2.5"));
assertThat(result, containsString("Full-stack web application framework."));
assertThat(result, containsString("gem"));
assertThat(result, endsWith("\n"));
assertThat(cached.getPath(), cached.isFile(), is(true));
}
@Test(expected = FileNotFoundException.class)
public void fileNotFoundOnWrongBaseURL() throws Exception {
// this test goes online to rubygems.org
URLConnection url = new MavenGemURLConnection(factory, new URL("https://rubygems.org/something/not/right/here"), "/maven/releases/rubygems/rails/maven-metadata.xml");
url.getInputStream();
}
@Test(expected = FileNotFoundException.class)
public void fileNotFoundOnDirectory() throws Exception {
// this test goes online to rubygems.org
URLConnection url = new MavenGemURLConnection(factory, new URL("https://rubygems.org"), "/maven/releases/rubygems/rails");
url.getInputStream();
}
}
././@LongLink 0000644 0000000 0000000 00000000206 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/mavengem/RubygemsFactoryTest.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/test/java/de/saumya/mojo/0000644 0000000 0000000 00000010666 12674201751 030127 0 ustar package de.saumya.mojo.mavengem;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Map;
import java.util.HashMap;
import java.net.URL;
import java.net.URLConnection;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
public class RubygemsFactoryTest {
@Test
public void defaultsOnDefaultFactory() throws Exception {
RubygemsFactory.factory = null;
System.getProperties().remove("mavengem.cachedir");
System.getProperties().remove("mavengem.mirror");
RubygemsFactory factory = RubygemsFactory.defaultFactory();
assertThat(factory.mirrors, nullValue());
assertThat(factory.catchAllMirror, is(RubygemsFactory.NO_MIRROR));
assertThat(factory.cacheDir.getName(), is(".mavengem"));
}
@Test
public void defaultFactory() throws Exception {
System.setProperty("mavengem.cachedir", "some/thing");
System.setProperty("mavengem.mirror", "https://example.org");
RubygemsFactory.factory = null;
RubygemsFactory factory = RubygemsFactory.defaultFactory();
assertThat(factory.mirrors, nullValue());
assertThat(factory.catchAllMirror, is(new URL("https://example.org")));
assertThat(factory.cacheDir, is(new File("some/thing")));
}
@Test
public void defaultsOnInstance() throws Exception {
RubygemsFactory factory = new RubygemsFactory();
assertThat(factory.mirrors, nullValue());
assertThat(factory.catchAllMirror, is(RubygemsFactory.NO_MIRROR));
assertThat(factory.cacheDir.getName(), is(".mavengem"));
}
@Test
public void cachedir() throws Exception {
RubygemsFactory factory = new RubygemsFactory(new File("some/thing"));
assertThat(factory.mirrors, nullValue());
assertThat(factory.catchAllMirror, is(RubygemsFactory.NO_MIRROR));
assertThat(factory.cacheDir, is(new File("some/thing")));
}
@Test
public void mirror() throws Exception {
RubygemsFactory factory = new RubygemsFactory(new URL("https://example.org"));
assertThat(factory.mirrors, nullValue());
assertThat(factory.catchAllMirror, is(new URL("https://example.org")));
assertThat(factory.cacheDir.getName(), is(".mavengem"));
}
@Test
public void mirrors() throws Exception {
Map mirrors = new HashMap();
RubygemsFactory factory = new RubygemsFactory(mirrors);
assertThat(factory.mirrors, is(mirrors));
assertThat(factory.catchAllMirror, is(RubygemsFactory.NO_MIRROR));
assertThat(factory.cacheDir.getName(), is(".mavengem"));
}
@Test
public void cachedirAndMirror() throws Exception {
RubygemsFactory factory = new RubygemsFactory(new File("some/thing"),
new URL("https://example.org"));
assertThat(factory.mirrors, nullValue());
assertThat(factory.catchAllMirror, is(new URL("https://example.org")));
assertThat(factory.cacheDir, is(new File("some/thing")));
}
@Test
public void cachedirAndMirrors() throws Exception {
Map mirrors = new HashMap();
RubygemsFactory factory = new RubygemsFactory(new File("some/thing"), mirrors);
assertThat(factory.mirrors, is(mirrors));
assertThat(factory.catchAllMirror, is(RubygemsFactory.NO_MIRROR));
assertThat(factory.cacheDir, is(new File("some/thing")));
}
@Test(expected = IllegalArgumentException.class)
public void cachedirAndMirrorsPrecondition() throws Exception {
Map mirrors = new HashMap();
RubygemsFactory factory = new RubygemsFactory(null, mirrors);
}
@Test(expected = IllegalArgumentException.class)
public void cachedirPrecondition() throws Exception {
RubygemsFactory factory = new RubygemsFactory((File)null);
}
@Test(expected = IllegalArgumentException.class)
public void mirrorPrecondition() throws Exception {
RubygemsFactory factory = new RubygemsFactory((URL)null);
}
@Test(expected = IllegalArgumentException.class)
public void cachedirAndMirrorPreconditionFile() throws Exception {
RubygemsFactory factory = new RubygemsFactory((File)null, new URL("https://example.com"));
}
@Test(expected = IllegalArgumentException.class)
public void cachedirAndMirrorPreconditionURL() throws Exception {
RubygemsFactory factory = new RubygemsFactory(new File("some/thing"), (URL)null);
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/ 0000755 0000000 0000000 00000000000 12674201751 024305 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/ 0000755 0000000 0000000 00000000000 12674201751 025226 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/ 0000755 0000000 0000000 00000000000 12674201751 025616 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 027115 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/0000755 0000000 0000000 00000000000 12674201751 030061 5 ustar ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/mavengem/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/0000755 0000000 0000000 00000000000 12674201751 030061 5 ustar ././@LongLink 0000644 0000000 0000000 00000000173 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/mavengem/Rubygems.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/0000644 0000000 0000000 00000003471 12674201751 030070 0 ustar package de.saumya.mojo.mavengem;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.jruby.embed.IsolatedScriptingContainer;
import org.jruby.embed.ScriptingContainer;
import org.sonatype.nexus.ruby.DefaultRubygemsGateway;
import org.sonatype.nexus.ruby.RubygemsGateway;
import org.sonatype.nexus.ruby.FileType;
import org.sonatype.nexus.ruby.GemArtifactFile;
import org.sonatype.nexus.ruby.IOUtil;
import org.sonatype.nexus.ruby.RubygemsFile;
import org.sonatype.nexus.ruby.cuba.RubygemsFileSystem;
import org.sonatype.nexus.ruby.layout.CachingProxyStorage;
import org.sonatype.nexus.ruby.layout.ProxiedRubygemsFileSystem;
import org.sonatype.nexus.ruby.layout.ProxyStorage;
public class Rubygems {
private static RubygemsGateway gateway = new DefaultRubygemsGateway(new IsolatedScriptingContainer());
private static Map facades = new HashMap();
private final ProxyStorage storage;
private final RubygemsFileSystem files;
Rubygems(URL url, File baseCacheDir) {
// we do not want to expose credentials inside the directory name
File cachedir = new File(baseCacheDir, url.toString().replaceFirst("://[^:]+:[^:]+@", "://").replaceAll("[/:.]", "_"));
this.storage = new CachingProxyStorage(cachedir, url);
this.files = new ProxiedRubygemsFileSystem(gateway, storage);
}
public InputStream getInputStream(RubygemsFile file) throws IOException {
return this.storage.getInputStream(file);
}
public RubygemsFile get(String path) {
return this.files.get(path);
}
public long getModified(RubygemsFile file) {
return this.storage.getModified(file);
}
}
././@LongLink 0000644 0000000 0000000 00000000202 00000000000 011575 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/mavengem/RubygemsFactory.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/0000644 0000000 0000000 00000010356 12674201751 030070 0 ustar package de.saumya.mojo.mavengem;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.jruby.embed.IsolatedScriptingContainer;
import org.jruby.embed.ScriptingContainer;
import org.sonatype.nexus.ruby.DefaultRubygemsGateway;
import org.sonatype.nexus.ruby.RubygemsGateway;
import org.sonatype.nexus.ruby.FileType;
import org.sonatype.nexus.ruby.GemArtifactFile;
import org.sonatype.nexus.ruby.IOUtil;
import org.sonatype.nexus.ruby.RubygemsFile;
import org.sonatype.nexus.ruby.cuba.RubygemsFileSystem;
import org.sonatype.nexus.ruby.layout.CachingProxyStorage;
import org.sonatype.nexus.ruby.layout.ProxiedRubygemsFileSystem;
import org.sonatype.nexus.ruby.layout.ProxyStorage;
public class RubygemsFactory {
private static RubygemsGateway gateway = new DefaultRubygemsGateway(new IsolatedScriptingContainer());
private static Map facades = new HashMap();
static URL NO_MIRROR;
static {
try {
NO_MIRROR = new URL("http://example.com/no_mirror");
}
catch (MalformedURLException e) {
throw new RuntimeException( "can not happen", e);
}
}
public static File DEFAULT_CACHEDIR = new File(System.getProperty("user.home"), ".mavengem");
public static final String MAVENGEM_MIRROR = "mavengem.mirror";
public static final String MAVENGEM_CACHEDIR = "mavengem.cachedir";
// keep package access for testing
final File cacheDir;
final Map mirrors;
final URL catchAllMirror;
static RubygemsFactory factory;
public static synchronized RubygemsFactory defaultFactory()
throws MalformedURLException {
if (factory == null) {
factory = new RubygemsFactory(null, null, null, false);
}
return factory;
}
public RubygemsFactory()
throws MalformedURLException {
this(DEFAULT_CACHEDIR, NO_MIRROR, null);
}
public RubygemsFactory(URL mirror)
throws MalformedURLException {
this(DEFAULT_CACHEDIR, mirror, null);
}
public RubygemsFactory(Map mirrors)
throws MalformedURLException {
this(DEFAULT_CACHEDIR, NO_MIRROR, mirrors);
}
public RubygemsFactory(File cacheDir)
throws MalformedURLException {
this(cacheDir, NO_MIRROR, null);
}
public RubygemsFactory(File cacheDir, URL mirror)
throws MalformedURLException {
this(cacheDir, mirror, null);
}
public RubygemsFactory(File cacheDir, Map mirrors)
throws MalformedURLException {
this(cacheDir, NO_MIRROR, mirrors);
}
private RubygemsFactory(File cacheDir, URL mirror, Map mirrors)
throws MalformedURLException {
this(cacheDir, mirror, mirrors, true);
}
private RubygemsFactory(File cacheDir, URL mirror, Map mirrors, boolean check)
throws MalformedURLException {
if (check) {
if (cacheDir == null) {
throw new IllegalArgumentException("cache directory can not be null");
}
if (mirror == null) {
throw new IllegalArgumentException("mirror can not be null");
}
}
if (mirror != null) {
this.catchAllMirror = mirror;
}
else {
if (System.getProperty(MAVENGEM_MIRROR) != null) {
this.catchAllMirror = new URL(System.getProperty(MAVENGEM_MIRROR));
}
else {
this.catchAllMirror = NO_MIRROR;
}
}
this.mirrors = mirrors == null ? null : new HashMap(mirrors);
if (cacheDir != null) {
this.cacheDir = cacheDir;
}
else if (System.getProperty(MAVENGEM_CACHEDIR) != null) {
this.cacheDir = new File(System.getProperty(MAVENGEM_CACHEDIR));
}
else {
this.cacheDir = DEFAULT_CACHEDIR;
}
}
public Rubygems getOrCreate(URL url)
throws MalformedURLException {
if (this.catchAllMirror != NO_MIRROR) {
url = this.catchAllMirror;
}
else if (this.mirrors != null && this.mirrors.containsKey(url)) {
url = mirrors.get(url);
}
// FIXME the cachedir when coming from the facades map
// can be different as map get shared between factories
synchronized(facades) {
Rubygems result = facades.get(url);
if (result == null) {
result = new Rubygems(url, this.cacheDir);
facades.put(url, result);
}
return result;
}
}
}
././@LongLink 0000644 0000000 0000000 00000000210 00000000000 011574 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/mavengem/MavenGemURLConnection.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/0000644 0000000 0000000 00000010271 12674201751 030064 0 ustar package de.saumya.mojo.mavengem;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.NoSuchFileException;
import org.sonatype.nexus.ruby.FileType;
import org.sonatype.nexus.ruby.GemArtifactFile;
import org.sonatype.nexus.ruby.IOUtil;
import org.sonatype.nexus.ruby.RubygemsFile;
import org.sonatype.nexus.ruby.cuba.RubygemsFileSystem;
import org.sonatype.nexus.ruby.layout.Storage;
public class MavenGemURLConnection extends URLConnection {
public static final String MAVEN_RELEASES = "/maven/releases";
public static final String PING = MAVEN_RELEASES + "/ping";
private InputStream in;
private long timestamp = -1;
// package private for testing
final URL baseurl;
final String path;
final RubygemsFactory factory;
public static MavenGemURLConnection create(String uri) throws MalformedURLException {
return create(null, uri);
}
public static MavenGemURLConnection create(RubygemsFactory factory, String uri)
throws MalformedURLException {
int index = uri.indexOf(MAVEN_RELEASES);
String path = uri.substring(index);
String baseurl = uri.substring(0, index);
return new MavenGemURLConnection(factory, new URL(baseurl), path);
}
public MavenGemURLConnection(URL baseurl, String path)
throws MalformedURLException {
this(null, baseurl, path);
}
public MavenGemURLConnection(RubygemsFactory factory, URL baseurl, String path)
throws MalformedURLException {
super(baseurl);
this.factory = factory == null ? RubygemsFactory.defaultFactory() : factory;
this.baseurl = baseurl;
this.path = path.startsWith(MAVEN_RELEASES) ? path : MAVEN_RELEASES + path;
}
@Override
synchronized public InputStream getInputStream() throws IOException {
if (in == null) {
connect();
}
return in;
}
synchronized public long getModified() throws IOException {
if (timestamp == -1) {
connect();
}
return timestamp;
}
private int counter = 12; // seconds
@Override
synchronized public void connect() throws IOException {
connect(factory.getOrCreate(baseurl));
}
private void connect(Rubygems facade) throws IOException {
RubygemsFile file = facade.get(path);
switch( file.state() )
{
case FORBIDDEN:
throw new IOException("forbidden: " + file + " on " + baseurl);
case NOT_EXISTS:
if (path.equals(PING)) {
in = new ByteArrayInputStream("pong".getBytes());
break;
}
throw new FileNotFoundException(file.toString() + " on " + baseurl);
case NO_PAYLOAD:
switch( file.type() )
{
case GEM_ARTIFACT:
// we can pass in null as dependenciesData since we have already the gem
in = new URL(baseurl + "/gems/" + ((GemArtifactFile) file ).gem( null ).filename() + ".gem" ).openStream();
case GEM:
// TODO timestamp
in = new URL(baseurl + "/" + file.remotePath()).openStream();
default:
throw new FileNotFoundException("view - not implemented. " + file + " on " + baseurl + " on " + baseurl);
}
case ERROR:
if (file.getException() instanceof NoSuchFileException) {
throw new FileNotFoundException(file.toString() + " on " + baseurl);
}
throw new IOException(file.toString() + " on " + baseurl, file.getException());
case TEMP_UNAVAILABLE:
try {
Thread.currentThread().sleep(1000);
}
catch(InterruptedException ignore) {
}
if (--counter > 0) {
connect(facade);
}
break;
case PAYLOAD:
in = facade.getInputStream(file);
timestamp = facade.getModified(file);
break;
case NEW_INSTANCE:
default:
throw new RuntimeException("BUG: should never reach here. " + file + " on " + baseurl);
}
}
}
././@LongLink 0000644 0000000 0000000 00000000172 00000000000 011603 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/mavengem/Handler.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/src/main/java/de/saumya/mojo/0000644 0000000 0000000 00000004601 12674201751 030064 0 ustar package de.saumya.mojo.mavengem;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.util.Map;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
public class Handler extends URLStreamHandler {
public static String KEY = "java.protocol.handler.pkgs";
public static String PKG = "de.saumya.mojo";
public static String PING_URL = "mavengem:https://rubygems.org" + MavenGemURLConnection.PING;
private static RubygemsFactory factory;
public synchronized static boolean isMavenGemProtocolRegistered() {
return System.getProperties().contains(KEY);
}
public synchronized static boolean registerMavenGemProtocol()
throws MalformedURLException {
return registerMavenGemProtocol(RubygemsFactory.defaultFactory());
}
public synchronized static boolean registerMavenGemProtocol(RubygemsFactory rubygemsFactory) {
if (ping()) {
// we can register the protocol only once
return false;
}
factory = rubygemsFactory;
if (System.getProperties().contains(KEY)) {
String current = System.getProperty(KEY);
if (!current.contains(PKG)) {
System.setProperty(KEY, current + "|" + PKG);
}
}
else {
System.setProperty(KEY, PKG);
}
return ping();
}
private static boolean ping() {
try {
// this url works offline as /maven/releases/ping is
// not a remote resource. but using the protocol here
// will register this instance Handler and other
// classloaders will be able to use the mavengem-protocol as well
// this does not go online see MavenGemURLConnection
URL url = new URL(PING_URL);
try (InputStream in = url.openStream()) {
byte[] data = new byte[in.available()];
in.read(data, 0, data.length);
return "pong".equals(new String(data));
}
}
catch(IOException e) {
return false;
}
}
private String uri;
@Override
protected void parseURL(URL u, String spec, int start, int end) {
uri = spec.substring(start, end);
super.parseURL(u, spec, start, end);
}
@Override
protected URLConnection openConnection(URL url) throws IOException {
return MavenGemURLConnection.create(factory, uri);
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/README.md 0000644 0000000 0000000 00000004445 12674201751 024060 0 ustar # mavengem protocol
convert a rubygems repository into a maven repository.
## usage via protocol handler
```
de.saumya.mojo.mavengem.Handler.registerMavenGemProtocol()
URL url = new
URL("mavengem:https://rubygems.org/maven/releases/rubygems/rails/maven-metadata.xml");
```
here https://rubygems.org is a rubgems repository the path
"/maven/releases/rubygems/rails/maven-metadata.xml" does not exist
there but the mavengem protocol adds it on the fly using metadata from
the rubygems repository.
for configuration pass in a ```RubygemsFactory```
```
RubygemsFactory factory = ...
Handler.registerMavenGemProtocol(factory)
```
more details belowsee below for the
configuration options.
the protocol handler can be registered only once.
## use the MavenGemURLConnection directly
```
URLConnection con = new
de.saumya.mojo.mavengem.MavenGemURLConnection(new
URL("https://rubygems.org"), "/maven/releases/rubygems/rails/maven-metadata.xml")
```
it is also possible to leave the basepath
```
MavenGemURLConnection(new
URL("https://rubygems.org", "/rubygems/rails/maven-metadata.xml")
```
for configuration again via a ```RubygemsFactory```
```
RubygemsFactory factory = ...
MavenGemURLConnection(factory, new
URL("https://rubygems.org"), "/rubygems/rails/maven-metadata.xml")
```
## configuration
when not using a explicit ```RubygemsFactory``` a default factory is
used.
### configure the default RubygemsFactory
this is done via system properties. the default cache directory is
**$HOME/.mavengem**. to change this to something else use the system
property **mavengem.cachedir**.
to change the mirror setting use the system property
**mavengem.mirror**. setting this means that **ALL** request go
through this mirror whether it is a request to rubygems.org or to any
other rubygems repository.
to have more control over the mirrors, i.e. one mirror per domain, you
need to use an explicit ```RubygemsFactory``` to configure it.
### configure RubygemsFactory
whenever you use an instance of ```RubygemsFactory``` no system
properties are used to configure it, only the constructor arguments.
here you can set the cache directory and the "catch-all-mirror" as
with the default ```RubygemsFactory``` via the system properties. and
you also can pass in a ```Map``` which can map a given rubygems
repository url to mirror.
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-protocol/pom.xml 0000644 0000000 0000000 00000001603 12674201751 024107 0 ustar
4.0.0mavengemde.saumya.mojo0.2.0-SNAPSHOTmavengem-protocoljarProtocol Handler for mavengem:org.sonatype.nexus.pluginsnexus-ruby-tools2.11.4-01junitjunit4.12test
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/pom.xml 0000644 0000000 0000000 00000003064 12674201751 020454 0 ustar
4.0.0org.sonatype.ossoss-parent9de.saumya.mojomavengem0.2.0-SNAPSHOTpomMavengem protocol and mavengem wagonmavengem-protocolmavengem-wagonmaven-invoker-plugin2.0.0${project.build.directory}/ittrueintegration-testinstallrunmaven-compiler-plugin3.31.71.7
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/ 0000755 0000000 0000000 00000000000 12674201751 022044 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/ 0000755 0000000 0000000 00000000000 12674201751 022633 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/ 0000755 0000000 0000000 00000000000 12674201751 023557 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/ 0000755 0000000 0000000 00000000000 12674201751 024500 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/ 0000755 0000000 0000000 00000000000 12674201751 025070 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 026367 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/ 0000755 0000000 0000000 00000000000 12674201751 027333 5 ustar ././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/mavengem/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/mav0000755 0000000 0000000 00000000000 12674201751 030037 5 ustar ././@LongLink 0000644 0000000 0000000 00000000161 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/mavengem/wagon/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/mav0000755 0000000 0000000 00000000000 12674201751 030037 5 ustar ././@LongLink 0000644 0000000 0000000 00000000203 00000000000 011576 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/mavengem/wagon/MavenGemWagon.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/java/de/saumya/mojo/mav0000644 0000000 0000000 00000013025 12674201751 030042 0 ustar package de.saumya.mojo.mavengem.wagon;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.SocketAddress;
import java.util.Map;
import java.util.HashMap;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.maven.wagon.StreamWagon;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.InputData;
import org.apache.maven.wagon.OutputData;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.resource.Resource;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.proxy.ProxyInfo;
import de.saumya.mojo.mavengem.RubygemsFactory;
import de.saumya.mojo.mavengem.MavenGemURLConnection;
public class MavenGemWagon extends StreamWagon {
public static final String MAVEN_GEM_PREFIX = "mavengem:";
private Proxy proxy = Proxy.NO_PROXY;
private RubygemsFactory _factory_;
// configurable via the settings.xml
private File cachedir;
private String mirror;
private void warn(String msg) {
System.err.println("WARNING: " + msg);
}
@Override
public void fillInputData(InputData inputData)
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {
Resource resource = inputData.getResource();
try {
if (proxy != Proxy.NO_PROXY) {
warn("proxy support is not implemented - ignoring proxy settings");
}
URLConnection urlConnection = newConnection(resource.getName());
InputStream is = urlConnection.getInputStream();
inputData.setInputStream(is);
resource.setLastModified(urlConnection.getLastModified());
resource.setContentLength(urlConnection.getContentLength());
}
catch(MalformedURLException e) {
throw new TransferFailedException("Invalid repository URL: " + e.getMessage(), e);
}
catch(FileNotFoundException e) {
throw new ResourceDoesNotExistException("Unable to locate resource in repository", e);
}
catch(IOException e) {
throw new TransferFailedException("Error transferring file: " + e.getMessage(), e);
}
}
private RubygemsFactory rubygemsFactory()
throws MalformedURLException {
if (_factory_ == null) {
// use the default if not set
if (cachedir == null) {
cachedir = RubygemsFactory.DEFAULT_CACHEDIR;
}
if (mirror != null) {
_factory_ = new RubygemsFactory(cachedir, withAuthentication(mirror));
}
else {
_factory_ = new RubygemsFactory(cachedir);
}
}
return _factory_;
}
public URLConnection newConnection(String resourceName)
throws MalformedURLException {
return new MavenGemURLConnection(rubygemsFactory(),
getRepositoryURL(),
"/" + resourceName);
}
@Override
public boolean resourceExists(String resourceName)
throws TransferFailedException, AuthorizationException {
try {
newConnection(resourceName).connect();
return true;
}
catch (FileNotFoundException e) {
return false;
}
catch(MalformedURLException e) {
throw new TransferFailedException("Invalid repository URL: " + e.getMessage(), e);
}
catch (IOException e) {
throw new TransferFailedException("Error transferring file: " + e.getMessage(), e);
}
}
@Override
public void fillOutputData(OutputData outputData)
throws TransferFailedException {
throw new RuntimeException("only download is provided");
}
@Override
public void closeConnection()
throws ConnectionException {
}
private URL withAuthentication(String url)
throws MalformedURLException {
if (authenticationInfo != null && authenticationInfo.getUserName() != null) {
String credentials = authenticationInfo.getUserName() + ":" + authenticationInfo.getPassword();
url = url.replaceFirst("^(https?://)(.*)$", "$1" + credentials + "@$2");
}
return new URL(url);
}
private URL getRepositoryURL() throws MalformedURLException {
String url = getRepository().getUrl().substring(MAVEN_GEM_PREFIX.length());
return withAuthentication(url);
}
private Proxy getProxy(ProxyInfo proxyInfo) {
return new Proxy(getProxyType(proxyInfo), getSocketAddress(proxyInfo));
}
private Type getProxyType(ProxyInfo proxyInfo) {
if (ProxyInfo.PROXY_SOCKS4.equals(proxyInfo.getType()) || ProxyInfo.PROXY_SOCKS5.equals(proxyInfo.getType())) {
return Type.SOCKS;
}
else {
return Type.HTTP;
}
}
private SocketAddress getSocketAddress(ProxyInfo proxyInfo) {
return InetSocketAddress.createUnresolved(proxyInfo.getHost(), proxyInfo.getPort());
}
@Override
protected void openConnectionInternal()
throws ConnectionException, AuthenticationException {
try {
final ProxyInfo proxyInfo = getProxyInfo(getRepositoryURL().getProtocol(), getRepository().getHost());
if (proxyInfo != null) {
this.proxy = getProxy( proxyInfo );
}
}
catch (MalformedURLException e) {
throw new ConnectionException("cannot create repository url", e);
}
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/resources/ 0000755 0000000 0000000 00000000000 12674201751 025571 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/resources/META-INF/ 0000755 0000000 0000000 00000000000 12674201751 026731 5 ustar ././@LongLink 0000644 0000000 0000000 00000000150 00000000000 011577 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/resources/META-INF/plexus/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/resources/META-INF/plex0000755 0000000 0000000 00000000000 12674201751 027622 5 ustar ././@LongLink 0000644 0000000 0000000 00000000166 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/resources/META-INF/plexus/components.xml ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/main/resources/META-INF/plex0000644 0000000 0000000 00000000514 12674201751 027624 0 ustar org.apache.maven.wagon.Wagonmavengemde.saumya.mojo.mavengem.wagon.MavenGemWagonper-lookup
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/ 0000755 0000000 0000000 00000000000 12674201751 023247 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/mirror/ 0000755 0000000 0000000 00000000000 12674201751 024561 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/mirror/pom.xml 0000644 0000000 0000000 00000002345 12674201751 026102 0 ustar
4.0.0mirrorde.saumya.mojo.test0.1.0rubygemsjar-dependencies0.2.6gemmavengems-with-mirrormavengem:http://rubygems.orgcentralhttp://centraltruetruede.saumya.mojomavengem-wagon@project.version@
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/mirror/postbuild.groovy 0000644 0000000 0000000 00000001505 12674201751 030036 0 ustar import java.io.*
import org.codehaus.plexus.util.FileUtils
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
[ "Downloaded: mavengem:http://rubygems.org/rubygems/jar-dependencies/0.2.6/jar-dependencies-0.2.6.pom", "Downloaded: mavengem:http://rubygems.org/rubygems/jar-dependencies/0.2.6/jar-dependencies-0.2.6.gem" ].each {
if ( !log.contains( it ) ) throw new RuntimeException( "log file does not contain '" + it + "'" );
}
[ 'target/cachedir/https___rubygems_org/api/v1/dependencies/jar-dependencies.ruby',
'target/cachedir/https___rubygems_org//gems/j/jar-dependencies-0.2.6.gem',
'target/cachedir/https___rubygems_org//quick/Marshal.4.8/j/jar-dependencies-0.2.6.gemspec.rz' ].each {
if ( !new File(basedir, it).exists() ) throw new RuntimeException( "expected file missing: '" + it + "'" );
}
true
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/mirror/prebuild.groovy 0000644 0000000 0000000 00000000076 12674201751 027641 0 ustar new File("${localRepositoryPath}/rubygems").deleteDir()
true
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/no_mirror/ 0000755 0000000 0000000 00000000000 12674201751 025255 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/no_mirror/pom.xml 0000644 0000000 0000000 00000002354 12674201751 026576 0 ustar
4.0.0no-mirrorde.saumya.mojo.test0.1.0rubygemsjar-dependencies0.2.6gemmavengems-without-mirrormavengem:https://rubygems.orgcentralhttp://centraltruetruede.saumya.mojomavengem-wagon@project.version@
././@LongLink 0000644 0000000 0000000 00000000146 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/no_mirror/postbuild.groovy ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/no_mirror/postbuild.groov0000644 0000000 0000000 00000001507 12674201751 030343 0 ustar import java.io.*
import org.codehaus.plexus.util.FileUtils
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
[ "Downloaded: mavengem:https://rubygems.org/rubygems/jar-dependencies/0.2.6/jar-dependencies-0.2.6.pom", "Downloaded: mavengem:https://rubygems.org/rubygems/jar-dependencies/0.2.6/jar-dependencies-0.2.6.gem" ].each {
if ( !log.contains( it ) ) throw new RuntimeException( "log file does not contain '" + it + "'" );
}
[ 'target/cachedir/https___rubygems_org/api/v1/dependencies/jar-dependencies.ruby',
'target/cachedir/https___rubygems_org//gems/j/jar-dependencies-0.2.6.gem',
'target/cachedir/https___rubygems_org//quick/Marshal.4.8/j/jar-dependencies-0.2.6.gemspec.rz' ].each {
if ( !new File(basedir, it).exists() ) throw new RuntimeException( "expected file missing: '" + it + "'" );
}
true
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/no_mirror/prebuild.groovy0000644 0000000 0000000 00000000076 12674201751 030335 0 ustar new File("${localRepositoryPath}/rubygems").deleteDir()
true
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/src/it/settings.xml 0000644 0000000 0000000 00000002046 12674201751 025633 0 ustar mavengems-without-mirrormy_loginmy_password${user.dir}/target/cachedirmavengems-with-mirrormy_loginmy_password${user.dir}/target/cachedirhttps://rubygems.orgit-repotruelocal.central@localRepositoryUrl@truetrue
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/README.md 0000644 0000000 0000000 00000004215 12674201751 023325 0 ustar # mavengem wagon
extend maven to use mavengem-protocol for configuring a rubygems
repository. this allows to use gem-artifacts as dependencies.
## usage
pom.xml setup
```
...
mavengemsmavengem:http://rubygems.orgde.saumya.mojomavengem-wagon0.1.0
```
the same with POM using ruby-DSL
```
repository :id => :mavengems, :url => 'mavengem:http://rubygems.org'
extension 'de.saumya.mojo:mavengem-wagon:0.1.0'
```
the wagon extension allos the use of the **mavengem:** protocol in the
repository url.
## configuration
the configuration happens inside settings.xml (default location is
$HOME/.m2/settings.xml) and uses the **id** from the repository to
allow further configurations.
### cache directory for the mavengem protocol
```
mavengems${user.home}/.cachedir
```
### username/password authentication
PENDING wating for a new release for the underlying nexus-ruby-tools
library to get this feature working
```
mavengemsmy_loginmy_password
```
### mirror
use a mirror for the configured server
```
mavengemshttps://rubygems.org
```
the usename and password in a configuration with mirror will be used
for the mirror:
```
mavengemsmy_loginmy_passwordhttps://rubygems.org
```
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/mavengem/mavengem-wagon/pom.xml 0000644 0000000 0000000 00000002217 12674201751 023363 0 ustar
4.0.0mavengemde.saumya.mojo0.2.0-SNAPSHOTmavengem-wagonMavengem Protocol Wagonde.saumya.mojomavengem-protocol${project.version}org.apache.maven.wagonwagon-provider-api2.10maven-invoker-plugin${project.build.directory}/localreposrc/it/settings.xml
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/README.md 0000644 0000000 0000000 00000003127 12674201751 016617 0 ustar # jruby maven plugins and extensions
the plugins and extensions are modeled after [jruby-gradle](http://jruby-gradle.github.io/) and uses the old jruby maven plugins under the hood but it needs jruby-1.7.19 or newer (including jruby-9.0.0.0 serie).
even though the plugin depends on the old jruby-maven-plugins it has a different version.
## general command line switches
to see the java/jruby command the plugin is executing use (for example with the verify goal)
```mvn verify -Djruby.verbose```
to quickly pick another jruby version use
```mvn verify -Djruby.version=1.7.20```
## jruby9-exec-maven-plugin
it install the gems and jars from ALL scopes and the plugin sections and can execute ruby. execution can be
* inline ruby: ```-e 'puts JRUBY_VERSION'```
* via command installed via a gem: ```-S rake -T```
* a ruby script: ```my.rb```
see more at [jruby9-exec-maven-plugin](jruby9-exec-maven-plugin)
## jruby9-jar-maven-plugin
it packs all gems and jars from the compile/runtime as well the declared resources into runnable jar. execution will with packed jar
* inline ruby: ```java -jar my.jar -e 'puts JRUBY_VERSION'```
* via command installed via a gem: ```java -jar my.jar -S rake -T```
* a ruby script: ```java -jar my.jar my.rb```
see more at [jruby9-jar-maven-plugin](jruby9-jar-maven-plugin)
## jruby9-jar-extension
it produces the same jar as with jruby9-jar-plugin but the configuration is more compact using a maven extension.
see more at [jruby9-jar-extension](jruby9-jar-extension)
# meta-fu
create an issue if something feels not right
[issues/new](issues/new)
otherwise enjoy :)
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/pom.xml 0000644 0000000 0000000 00000006631 12674201751 016660 0 ustar
4.0.0org.sonatype.ossoss-parent9de.saumya.mojojruby90.2.3-SNAPSHOTpomJRuby9 Next Generation Maven Mojomavengemjruby9-commonjruby9-exec-maven-pluginjruby9-jar-maven-pluginjruby9-war-maven-pluginjruby9-extensions${project.groupId}gem-maven-plugin1.1.3org.apache.mavenmaven-core3.3.3org.codehaus.plexusplexus-archiver3.0.1org.apache.maven.pluginsmaven-war-plugin2.6org.apache.maven.pluginsmaven-jar-plugin2.6de.saumya.mojojruby9-common${project.version}org.apache.maven.plugin-toolsmaven-plugin-annotations3.4maven-invoker-plugin2.0.0${project.build.directory}/ittrueintegration-testinstallrunmaven-compiler-plugin3.31.71.7maven-plugin-plugin3.4default-descriptorprocess-classesgenerated-helpmojohelpmojo
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/ 0000755 0000000 0000000 00000000000 12674201751 021733 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/ 0000755 0000000 0000000 00000000000 12674201751 022522 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/ 0000755 0000000 0000000 00000000000 12674201751 023446 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/ 0000755 0000000 0000000 00000000000 12674201751 024367 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/ 0000755 0000000 0000000 00000000000 12674201751 024757 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 026256 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/ 0000755 0000000 0000000 00000000000 12674201751 027222 5 ustar ././@LongLink 0000644 0000000 0000000 00000000151 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jruby9/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jru0000755 0000000 0000000 00000000000 12674201751 027743 5 ustar ././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jruby9/jar/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jru0000755 0000000 0000000 00000000000 12674201751 027743 5 ustar ././@LongLink 0000644 0000000 0000000 00000000175 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jruby9/jar/ProcessMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jru0000644 0000000 0000000 00000001027 12674201751 027745 0 ustar package de.saumya.mojo.jruby9.jar;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import de.saumya.mojo.jruby9.AbstractProcessMojo;
/**
* generates ".jrubydir" files for all resource and gems to allow jruby
* to perform directory globs inside the jar.
*
* @author christian
*
*/
@Mojo( name = "process", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresProject = true,
threadSafe = true )
public class ProcessMojo extends AbstractProcessMojo {
} ././@LongLink 0000644 0000000 0000000 00000000171 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jruby9/jar/JarMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jru0000644 0000000 0000000 00000007727 12674201751 027762 0 ustar package de.saumya.mojo.jruby9.jar;
import java.io.File;
import java.lang.reflect.Field;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.archiver.UnArchiver;
import de.saumya.mojo.jruby9.ArtifactHelper;
import de.saumya.mojo.jruby9.ArchiveType;
import de.saumya.mojo.jruby9.Versions;
/**
* packs a ruby application into runnable jar.
*
*
shaded jruby-complete.jar
*
shaded jruby-mains.jar
*
all declared gems and transitive gems and jars
*
all declared jars and transitive jars
*
all declared resource
*
* the main class sets up the GEM_HOME, GEM_PATH and JARS_HOME and takes arguments
* for executing jruby. any bin stubs from the gem are available via '-S' or any
* script relative to jar's root can be found as the current directory is inside the jar.
*
*
*
* if there is a 'jar-bootstrap.rb' in the root of the jar, then the default main class will
* execute this script and pass all the arguments to bootstrap script.
*
* @author christian
*/
@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true,
requiresDependencyResolution = ResolutionScope.RUNTIME )
public class JarMojo extends org.apache.maven.plugin.jar.JarMojo {
@Parameter( defaultValue = "runnable", property = "jruby.archive.type", required = true )
private ArchiveType type;
@Parameter( defaultValue = "org.jruby.mains.JarMain", required = false )
private String mainClass;
@Parameter( defaultValue = Versions.JRUBY, property = "jruby.version", required = true )
private String jrubyVersion;
@Parameter( defaultValue = Versions.JRUBY_MAINS, property = "jruby.mains.version", required = true )
private String jrubyMainsVersion;
@Parameter( readonly = true, defaultValue="${localRepository}" )
protected ArtifactRepository localRepository;
@Component
RepositorySystem system;
@Component( hint = "zip" )
UnArchiver unzip;
@Override
public void execute() throws MojoExecutionException {
switch(type) {
case runnable:
if (mainClass == null) {
throw new MojoExecutionException( "runnable archive need mainClass configured" );
}
MavenArchiveConfiguration archive = getArchive();
archive.getManifest().setMainClass(mainClass);
ArtifactHelper helper = new ArtifactHelper(unzip, system,
localRepository, getProject().getRemoteArtifactRepositories());
File output = new File( getProject().getBuild().getOutputDirectory());
helper.unzip(output, "org.jruby", "jruby-complete", jrubyVersion);
helper.unzip(output, "org.jruby.mains", "jruby-mains", jrubyMainsVersion);
case archive:
break;
default:
throw new MojoExecutionException("can not pack archive " + type + " with jruby-jar-plugin");
}
super.execute();
}
private MavenArchiveConfiguration getArchive() throws MojoExecutionException {
try {
Field archiveField = getClass().getSuperclass().getSuperclass().getDeclaredField("archive");
archiveField.setAccessible(true);
return (MavenArchiveConfiguration) archiveField.get(this);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new MojoExecutionException("can not use reflection", e);
}
}
}
././@LongLink 0000644 0000000 0000000 00000000176 00000000000 011607 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jruby9/jar/GenerateMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/main/java/de/saumya/mojo/jru0000644 0000000 0000000 00000004143 12674201751 027747 0 ustar package de.saumya.mojo.jruby9.jar;
import java.io.File;
import java.io.IOException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.codehaus.plexus.util.FileUtils;
import de.saumya.mojo.jruby9.ArchiveType;
import de.saumya.mojo.jruby9.AbstractGenerateMojo;
import de.saumya.mojo.ruby.script.ScriptException;
/**
* add the gems and jars to resources. @see AbstractGenerateMojo
*
*
*
* also copies the bootstrap script to the resources if set.
*
* @author christian
*/
@Mojo( name = "generate", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresProject = true,
threadSafe = true, requiresDependencyResolution = ResolutionScope.RUNTIME )
public class GenerateMojo extends AbstractGenerateMojo {
@Parameter( defaultValue = "runnable", property = "jruby.archive.type", required = true )
private ArchiveType type;
@Parameter( required = false )
private Boolean pluginDependenciesOnly;
/**
* if set this file will be copied as 'jar-bootstrap.rb' to the resources.
*/
@Parameter( property = "jruby.jar.bootstrap" )
protected File bootstrap;
@Override
protected void executeWithGems() throws MojoExecutionException,
ScriptException, IOException {
final boolean pluginDependenciesOnly;
switch(type) {
case archive:
if (this.pluginDependenciesOnly == null) {
pluginDependenciesOnly = true;
}
else {
pluginDependenciesOnly = this.pluginDependenciesOnly;
}
break;
default:
pluginDependenciesOnly = false;
}
executeWithGems(pluginDependenciesOnly);
if (bootstrap != null) {
FileUtils.copyFile(bootstrap, new File(project.getBuild().getOutputDirectory(),
"jar-bootstrap.rb"));
}
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/ 0000755 0000000 0000000 00000000000 12674201751 023136 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/ 0000755 0000000 0000000 00000000000 12674201751 026415 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/pom.xml 0000644 0000000 0000000 00000012350 12674201751 027733 0 ustar
4.0.0de.saumya.mojo.jruby9testtestingmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgorg.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gem1.7.21de.saumya.mojomavengem-wagon0.1.0${basedir}test.rbspec/**maven-jar-plugin2.4default-jaromitde.saumya.mojojruby9-jar-maven-plugin@project.version@${j.version}jruby-jargenerateprocessjarrubygemsrspec3.3.0gemorg.slf4jslf4j-simple1.7.6org.codehaus.mojoexec-maven-plugin1.2java${project.build.directory}pathblabla${basedir}${basedir}${basedir}simpleverifyexec-jar${project.build.finalName}.jar-rjars/setup-e
p JRUBY_VERSION
p $CLASSPATH.size
expected = 10
raise "expected #{expected} classpath entries but got #{$CLASSPATH.size}: #{$CLASSPATH.inspect}" if $CLASSPATH.size != expected
raise "expected jruby version ${j.version} but was #{JRUBY_VERSION}" if JRUBY_VERSION != "${j.version}"
rspecverifyexec-jar${project.build.finalName}.jar-Srspectest fileverifyexec-jar${project.build.finalName}.jartest.rb
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/spec/ 0000755 0000000 0000000 00000000000 12674201751 027347 5 ustar ././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/spec/one0000644 0000000 0000000 00000000547 12674201751 030061 0 ustar require 'jar-dependencies'
describe 'something' do
it 'runs inside the right environment' do
expect(Dir.pwd).to eq 'uri:classloader://'
expect(__FILE__).to eq 'uri:classloader:/spec/one_spec.rb'
expect(Jars.home).to eq 'uri:classloader://jars'
expect(Gem.dir).to eq 'uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/test.rb 0000644 0000000 0000000 00000001401 12674201751 027715 0 ustar gem 'minitest'
require 'minitest/autorun'
require 'jars/setup'
describe 'something' do
it 'uses the right minitest version' do
Gem.loaded_specs['minitest'].version.to_s.must_equal '5.7.0'
end
it 'runs from the jar' do
__FILE__.must_equal 'test.rb'
Dir.pwd.must_equal 'uri:classloader://'
end
it 'can use logger' do
old = java.lang.System.err
bytes = StringIO.new
java.lang.System.err = java.io.PrintStream.new( bytes.to_outputstream )
begin
# TODO capture java stderr and ensure there is no warning
org.slf4j.LoggerFactory.get_logger('me').info 'hello'
java.lang.System.err.flush
bytes.string.strip.must_equal '[main] INFO me - hello'
ensure
java.lang.System.err = old
end
end
end
././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarRunnable/invoker.0000644 0000000 0000000 00000000063 12674201751 030072 0 ustar invoker.goals = verify
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/ 0000755 0000000 0000000 00000000000 12674201751 026230 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/pom.xml 0000644 0000000 0000000 00000001100 12674201751 027535 0 ustar
4.0.0de.saumya.mojo.jruby9archive-testaggregate achive teststestingpomarchivetest-runnabletest-jar
././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/invoker.p0000644 0000000 0000000 00000000063 12674201751 030065 0 ustar invoker.goals = verify
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000151 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000163 00000000000 011603 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/java/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000166 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/java/de/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000175 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/java/de/saumya/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000202 00000000000 011575 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/java/de/saumya/mojo/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000211 00000000000 011575 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/java/de/saumya/mojo/jruby9/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000234 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/src/test/java/de/saumya/mojo/jruby9/JRuby9TestCase.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000644 0000000 0000000 00000002036 12674201751 027764 0 ustar package de.saumya.mojo.jruby9;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.IsolatedScriptingContainer;
import org.junit.Test;
import java.io.StringWriter;
import static org.junit.Assert.*;
public class JRuby9TestCase {
private final IsolatedScriptingContainer container = new IsolatedScriptingContainer(LocalContextScope.SINGLETHREAD);
{
// TODO jar-dependencies should search classloader
container.setCurrentDirectory("uri:classloader:/");
}
@Test
public void testClasspath() {
assertEquals( "10", container.parse( "require 'jars/setup';$CLASSPATH.size").run().toString() );
}
@Test
public void testScript() {
assertEquals( "true", container.parse( "load 'test.rb';Minitest.run" ).run().toString());
}
@Test
public void testWithRSpec() {
assertEquals("0", container.parse( "require 'rspec';RSpec::Core::Runner.run([ENV_JAVA['basedir'].gsub('\\\\', '/') + '/spec/one_spec.rb'], $stderr, $stdout) " ).run().toString());
}
}
././@LongLink 0000644 0000000 0000000 00000000154 00000000000 011603 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/pom.xml ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000644 0000000 0000000 00000003757 12674201751 027777 0 ustar
4.0.0de.saumya.mojo.jruby9testtestingmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgde.saumya.mojo.jruby9archivetestingorg.jrubyjruby-complete${j.version}jarjunitjunit4.11testrubygemsrspec3.3.0gem1.7.22de.saumya.mojomavengem-wagon0.1.0de.saumya.mojogem-maven-plugin1.1.3initialize
././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/spec/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000755 0000000 0000000 00000000000 12674201751 027761 5 ustar ././@LongLink 0000644 0000000 0000000 00000000165 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-jar/0000644 0000000 0000000 00000000524 12674201751 027764 0 ustar require 'jar-dependencies'
describe 'something' do
it 'runs inside the right environment' do
expect(Dir.pwd).to eq 'uri:classloader:/'
expect(__FILE__).to eq (ENV_JAVA['basedir'].gsub('\\', '/') + '/spec/one_spec.rb')
expect(Jars.home).to eq 'uri:classloader:/jars'
expect(Gem.dir).to eq 'uri:classloader:/'
end
end
././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runnable/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runn0000755 0000000 0000000 00000000000 12674201751 030110 5 ustar ././@LongLink 0000644 0000000 0000000 00000000161 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runnable/pom.xml ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runn0000644 0000000 0000000 00000012317 12674201751 030116 0 ustar
4.0.0de.saumya.mojo.jruby9test-runnabletestingmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgrubygemsjar-dependencies0.2.4gemrubygemsrspec3.3.0gemde.saumya.mojo.jruby9archivetestingorg.jrubyjruby-complete1.7.22de.saumya.mojomavengem-wagon0.1.0${basedir}spec/**maven-jar-plugin2.4default-jaromitde.saumya.mojojruby9-jar-maven-plugin@project.version@${j.version}jruby-jargenerateprocessjarorg.codehaus.mojoexec-maven-plugin1.2java${project.build.directory}pathblabla${basedir}${basedir}${basedir}simpleverifyexec-jar${project.build.finalName}.jar-rjars/setup-e
p JRUBY_VERSION
p $CLASSPATH.size
expected = 11
raise "expected #{expected} classpath entries but got #{$CLASSPATH.size}: #{$CLASSPATH.inspect}" if $CLASSPATH.size != expected
raise "expected jruby version ${j.version} but was #{JRUBY_VERSION}" if JRUBY_VERSION != "${j.version}"
rspecverifyexec-jar${project.build.finalName}.jar-Srspectest fileverifyexec-jar${project.build.finalName}.jar-e
#TODO newer jrubies have this fixed https://github.com/jruby/jruby/issues/3443
Gem::Specification.dirs = Gem::Specification.dirs +
JRuby.runtime.jruby_class_loader.get_resources('specifications').collect{ |u| p u.to_s };
load 'test.rb'
././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runnable/spec/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runn0000755 0000000 0000000 00000000000 12674201751 030110 5 ustar ././@LongLink 0000644 0000000 0000000 00000000172 00000000000 011603 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runnable/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/test-runn0000644 0000000 0000000 00000000565 12674201751 030120 0 ustar require 'jar-dependencies'
describe 'something' do
it 'runs inside the right environment' do
expect(Dir.pwd).to eq 'uri:classloader://'
expect(__FILE__).to eq 'uri:classloader:/spec/one_spec.rb'
expect(Jars.home.sub('//', '/')).to eq 'uri:classloader:/jars'
expect(Gem.dir).to eq 'uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/archive/ 0000755 0000000 0000000 00000000000 12674201751 027651 5 ustar ././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/archive/pom.xml ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/archive/p0000644 0000000 0000000 00000005564 12674201751 030045 0 ustar
4.0.0de.saumya.mojo.jruby9archivetestingmavengemsmavengem:https://rubygems.orgorg.jrubyjruby-complete${j.version}1.7.21de.saumya.mojomavengem-wagon0.1.0${basedir}test.rbspec/**maven-jar-plugin2.4default-jaromitde.saumya.mojojruby9-jar-maven-plugin@project.version@archive${j.version}jruby-jargenerateprocessjarorg.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gemorg.slf4jslf4j-simple1.7.6
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/archive/test.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/src/it/jrubyJarArchive/archive/t0000644 0000000 0000000 00000001416 12674201751 030041 0 ustar gem 'minitest'
require 'minitest/spec'
require 'jars/setup'
describe 'something' do
it 'uses the right minitest version' do
Gem.loaded_specs['minitest'].version.to_s.must_equal '5.7.0'
end
it 'runs from the jar' do
__FILE__.must_equal 'uri:classloader:/test.rb'
Dir.pwd.must_equal 'uri:classloader:/'
end
it 'can use logger' do
old = java.lang.System.err
bytes = StringIO.new
java.lang.System.err = java.io.PrintStream.new( bytes.to_outputstream )
begin
# TODO capture java stderr and ensure there is no warning
org.slf4j.LoggerFactory.get_logger('me').info 'hello'
java.lang.System.err.flush
bytes.string.strip.must_equal '[main] INFO me - hello'
ensure
java.lang.System.err = old
end
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/README.md 0000644 0000000 0000000 00000007777 12674201751 023234 0 ustar # jruby jar maven plugin
it packs a ruby application as runnable jar, i.e. all the ruby code and the gems and jars (which ruby loads via require) are packed inside the jar. the jar will include jruby-complete and jruby-mains to execute the ruby application via, i.e.
java -jar my.jar -S rake
there is more compact configuration using an maven extensions: [../jruby9-jar-extension](jruby9-jar-extension)
## general command line switches
to see the java/jruby command the plugin is executing use (for example with the verify goal)
```mvn verify -Djruby.verbose```
to quickly pick another jruby version use
```mvn verify -Djruby.version=1.7.20```
or to display some help
```mvn jruby9-jar:help -Ddetail```
```mvn jruby9-jar:help -Ddetail -Dgoal=jar```
## jruby jar
it installs all the declared gems and jars from the dependencies section as well the plugin dependencies.
the complete pom for the samples below is in [src/it/jrubyJarExample/pom.xml](src/it/jrubyJarExample/pom.xml) and more details on how it can be executed.
the gem-artifacts are coming from the torquebox rubygems proxy
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
to use these gems within the depenencies of the plugin you need
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
the jar and gem artifacts for the JRuby application can be declared in the main dependencies section
org.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gem
these artifacts ALL have the default scope which gets packed into the jar.
adding ruby resources to your jar
${basedir}test.rbspec/**
the plugin declarations. first we want to omit the regular jar packing
maven-jar-plugin2.4default-jaromit
the tell the jruby-jar mojo to pack the jar
de.saumya.mojojruby9-jar-maven-plugin@project.version@${j.version}jruby-jargenerateprocessjar
now the plugin does also pack those gem declared inside the plugin sections
rubygemsrspec3.3.0gem
the main dependencies section does use leafy-rack and for its logging you need a slf4j logger.
org.slf4jslf4j-simple1.7.6
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-jar-maven-plugin/pom.xml 0000644 0000000 0000000 00000002711 12674201751 023251 0 ustar
4.0.0jruby9de.saumya.mojo0.2.3-SNAPSHOTjruby9-jar-maven-pluginmaven-pluginJRuby9 Jar Maven Mojoorg.apache.mavenmaven-core3.3.3trueorg.codehaus.plexusplexus-archiverde.saumya.mojojruby9-commonorg.apache.maven.pluginsmaven-jar-pluginorg.apache.maven.plugin-toolsmaven-plugin-annotationsprovidedmaven-invoker-plugin
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/.gitignore 0000644 0000000 0000000 00000000011 12674201751 017315 0 ustar /target/
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/ 0000755 0000000 0000000 00000000000 12674201751 020756 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/ 0000755 0000000 0000000 00000000000 12674201751 021545 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/main/ 0000755 0000000 0000000 00000000000 12674201751 022471 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/main/resources/ 0000755 0000000 0000000 00000000000 12674201751 024503 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/main/resources/META-INF/ 0000755 0000000 0000000 00000000000 12674201751 025643 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/main/resources/META-INF/plexus/ 0000755 0000000 0000000 00000000000 12674201751 027163 5 ustar ././@LongLink 0000644 0000000 0000000 00000000160 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/main/resources/META-INF/plexus/components.xml ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/main/resources/META-INF/plexus/com0000644 0000000 0000000 00000007564 12674201751 027700 0 ustar org.apache.maven.lifecycle.mapping.LifecycleMappingjrubyJar
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
de.saumya.mojo:jruby9-jar-maven-plugin:generate
org.apache.maven.plugins:maven-resources-plugin:resources,
de.saumya.mojo:jruby9-jar-maven-plugin:process
org.apache.maven.plugins:maven-compiler-plugin:compile
org.apache.maven.plugins:maven-resources-plugin:testResources
org.apache.maven.plugins:maven-compiler-plugin:testCompile
org.apache.maven.plugins:maven-surefire-plugin:test
de.saumya.mojo:jruby9-jar-maven-plugin:jar
org.apache.maven.plugins:maven-install-plugin:install
org.apache.maven.plugins:maven-deploy-plugin:deploy
org.apache.maven.lifecycle.mapping.LifecycleMappingjrubyWar
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
de.saumya.mojo:jruby9-war-maven-plugin:generate
org.apache.maven.plugins:maven-resources-plugin:resources,
de.saumya.mojo:jruby9-war-maven-plugin:process
org.apache.maven.plugins:maven-compiler-plugin:compile
org.apache.maven.plugins:maven-resources-plugin:testResources
org.apache.maven.plugins:maven-compiler-plugin:testCompile
org.apache.maven.plugins:maven-surefire-plugin:test
de.saumya.mojo:jruby9-war-maven-plugin:war
org.apache.maven.plugins:maven-install-plugin:install
org.apache.maven.plugins:maven-deploy-plugin:deploy
org.apache.maven.artifact.handler.ArtifactHandlerjrubyJar
org.apache.maven.artifact.handler.DefaultArtifactHandler
jarjarjrubyJarjavafalsefalseorg.apache.maven.artifact.handler.ArtifactHandlerjrubyWar
org.apache.maven.artifact.handler.DefaultArtifactHandler
warwarjrubyWarjavafalsefalse
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/ 0000755 0000000 0000000 00000000000 12674201751 022161 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/ 0000755 0000000 0000000 00000000000 12674201751 025302 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/pom.xml 0000644 0000000 0000000 00000011670 12674201751 026624 0 ustar
4.0.0de.saumya.mojo.jruby9testtestingjrubyWarmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgorg.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gem9.0.3.0de.saumya.mojomavengem-wagon0.1.0de.saumya.mojojruby9-extensions@project.version@${basedir}test.rbspec/**de.saumya.mojojruby9-war-maven-plugin@project.version@${j.version}runnablerubygemsrspec3.3.0gemorg.slf4jslf4j-simple1.7.6org.codehaus.mojoexec-maven-plugin1.2java${project.build.directory}pathblabla${basedir}${basedir}${basedir}simpleverifyexec-jar${project.build.finalName}.war-rjars/setup-e
p JRUBY_VERSION
p $CLASSPATH.size
expected = 10
raise "expected #{expected} classpath entries but got #{$CLASSPATH.size}: #{$CLASSPATH.inspect}" if $CLASSPATH.size != expected
raise "expected jruby version ${j.version} but was #{JRUBY_VERSION}" if JRUBY_VERSION != "${j.version}"
rspecverifyexec-jar${project.build.finalName}.war-Srspectest fileverifyexec-jar${project.build.finalName}.wartest.rb
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/spec/ 0000755 0000000 0000000 00000000000 12674201751 026234 5 ustar ././@LongLink 0000644 0000000 0000000 00000000146 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/spec/one_spec.r0000644 0000000 0000000 00000000627 12674201751 030217 0 ustar require 'jar-dependencies'
describe 'something' do
it 'runs inside the right environment' do
expect(Dir.pwd).to eq 'uri:classloader://WEB-INF/classes/'
expect(__FILE__).to eq 'uri:classloader:/WEB-INF/classes/spec/one_spec.rb'
expect(Jars.home).to eq 'uri:classloader://WEB-INF/classes/jars'
expect(Gem.dir).to eq 'uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/test.rb 0000644 0000000 0000000 00000001421 12674201751 026604 0 ustar gem 'minitest'
require 'minitest/autorun'
require 'jars/setup'
describe 'something' do
it 'uses the right minitest version' do
Gem.loaded_specs['minitest'].version.to_s.must_equal '5.7.0'
end
it 'runs from the jar' do
__FILE__.must_equal 'test.rb'
Dir.pwd.must_equal 'uri:classloader://WEB-INF/classes/'
end
it 'can use logger' do
old = java.lang.System.err
bytes = StringIO.new
java.lang.System.err = java.io.PrintStream.new( bytes.to_outputstream )
begin
# TODO capture java stderr and ensure there is no warning
org.slf4j.LoggerFactory.get_logger('me').info 'hello'
java.lang.System.err.flush
bytes.string.strip.must_equal '[main] INFO me - hello'
ensure
java.lang.System.err = old
end
end
end
././@LongLink 0000644 0000000 0000000 00000000150 00000000000 011577 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyWarExample/invoker.propert0000644 0000000 0000000 00000000063 12674201751 030373 0 ustar invoker.goals = verify
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/ 0000755 0000000 0000000 00000000000 12674201751 025440 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/pom.xml 0000644 0000000 0000000 00000010764 12674201751 026765 0 ustar
4.0.0de.saumya.mojo.jruby9testtestingjrubyJarmavengemsmavengem:https://rubygems.orgmavengemsmavengem:https://rubygems.orgorg.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gemrubygemsrspec3.3.0gemorg.slf4jslf4j-simple1.7.61.7.21de.saumya.mojomavengem-wagon0.1.0de.saumya.mojojruby9-extensions@project.version@${basedir}test.rbspec/**org.codehaus.mojoexec-maven-plugin1.2java${project.build.directory}pathblabla${basedir}${basedir}${basedir}simpleverifyexec-jar${project.build.finalName}.jar-rjars/setup-e
p JRUBY_VERSION
p $CLASSPATH.size
expected = 10
raise "expected #{expected} classpath entries but got #{$CLASSPATH.size}: #{$CLASSPATH.inspect}" if $CLASSPATH.size != expected
raise "expected jruby version ${jruby.version} but was #{JRUBY_VERSION}" if JRUBY_VERSION != "${jruby.version}"
rspecverifyexec-jar${project.build.finalName}.jar-Srspectest fileverifyexec-jar${project.build.finalName}.jartest.rb
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/spec/ 0000755 0000000 0000000 00000000000 12674201751 026372 5 ustar ././@LongLink 0000644 0000000 0000000 00000000147 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/spec/one_spec.0000644 0000000 0000000 00000000547 12674201751 030174 0 ustar require 'jar-dependencies'
describe 'something' do
it 'runs inside the right environment' do
expect(Dir.pwd).to eq 'uri:classloader://'
expect(__FILE__).to eq 'uri:classloader:/spec/one_spec.rb'
expect(Jars.home).to eq 'uri:classloader://jars'
expect(Gem.dir).to eq 'uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/test.rb 0000644 0000000 0000000 00000001401 12674201751 026740 0 ustar gem 'minitest'
require 'minitest/autorun'
require 'jars/setup'
describe 'something' do
it 'uses the right minitest version' do
Gem.loaded_specs['minitest'].version.to_s.must_equal '5.7.0'
end
it 'runs from the jar' do
__FILE__.must_equal 'test.rb'
Dir.pwd.must_equal 'uri:classloader://'
end
it 'can use logger' do
old = java.lang.System.err
bytes = StringIO.new
java.lang.System.err = java.io.PrintStream.new( bytes.to_outputstream )
begin
# TODO capture java stderr and ensure there is no warning
org.slf4j.LoggerFactory.get_logger('me').info 'hello'
java.lang.System.err.flush
bytes.string.strip.must_equal '[main] INFO me - hello'
ensure
java.lang.System.err = old
end
end
end
././@LongLink 0000644 0000000 0000000 00000000151 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/src/it/jrubyJarRunnable/invoker.proper0000644 0000000 0000000 00000000063 12674201751 030345 0 ustar invoker.goals = verify
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/README.md 0000644 0000000 0000000 00000005527 12674201751 022246 0 ustar # jruby jar extension
it packs a ruby application as runnable jar, i.e. all the ruby code and the gems and jars (which ruby loads via require) are packed inside the jar. the jar will include jruby-complete and jruby-mains to execute the ruby application via, i.e.
java -jar my.jar -S rake
the extension uses the mojos from [../jruby9-jar-maven-plugin](jruby9-jar-maven-plugin)
## general command line switches
to see the java/jruby command the plugin is executing use (for example with the verify goal)
```mvn verify -Djruby.verbose```
to quickly pick another jruby version use
```mvn verify -Djruby.version=1.7.20```
or to display some help
```mvn jruby9-jar:help -Ddetail```
```mvn jruby9-jar:help -Ddetail -Dgoal=jar```
## jruby jar
it installs all the declared gems and jars from the dependencies section as well the plugin dependencies.
the complete pom for the samples below is in [src/it/jrubyJarExample/pom.xml](src/it/jrubyJarExample/pom.xml) and more details on how it can be executed.
the extension is used by declaring the right packaging
jrubyJar
the gem-artifacts are coming from the torquebox rubygems proxy
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
to use these gems within the depenencies of the plugin you need
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
the jar and gem artifacts for the JRuby application can be declared in the main dependencies section
org.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gem
these artifacts ALL have the default scope which gets packed into the jar.
adding ruby resources to your jar
${basedir}test.rbspec/**
and pick the extension
de.saumya.mojojruby9-jar-extension@project.version@
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-extensions/pom.xml 0000644 0000000 0000000 00000001215 12674201751 022272 0 ustar
4.0.0jruby9de.saumya.mojo0.2.3-SNAPSHOTjruby9-extensionsjarJRuby9 Extensionsmaven-invoker-plugin
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/ 0000755 0000000 0000000 00000000000 12674201751 022103 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/ 0000755 0000000 0000000 00000000000 12674201751 022672 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/ 0000755 0000000 0000000 00000000000 12674201751 023616 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/ 0000755 0000000 0000000 00000000000 12674201751 024537 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/ 0000755 0000000 0000000 00000000000 12674201751 025127 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 026426 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/ 0000755 0000000 0000000 00000000000 12674201751 027372 5 ustar ././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/jruby9/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/jr0000755 0000000 0000000 00000000000 12674201751 027726 5 ustar ././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/jruby9/exec/ ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/jr0000755 0000000 0000000 00000000000 12674201751 027726 5 ustar ././@LongLink 0000644 0000000 0000000 00000000174 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/jruby9/exec/ExecMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/main/java/de/saumya/mojo/jr0000644 0000000 0000000 00000010370 12674201751 027731 0 ustar package de.saumya.mojo.jruby9.exec;
import java.io.File;
import java.io.IOException;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import de.saumya.mojo.jruby9.AbstractJRuby9Mojo;
import de.saumya.mojo.jruby9.JarDependencies;
import de.saumya.mojo.jruby9.JarDependencies.Filter;
import de.saumya.mojo.ruby.script.Script;
import de.saumya.mojo.ruby.script.ScriptException;
/**
* executes a ruby script in context of the gems from pom. the arguments for
* jruby are build like this:
* ${jruby.args} ${exec.file} ${exec.args} ${args}
* to execute an inline script the exec parameters are ignored.
*
*/
@Mojo( name = "exec", requiresProject = true, threadSafe = true,
requiresDependencyResolution = ResolutionScope.TEST )
public class ExecMojo extends AbstractJRuby9Mojo {
/**
* ruby code from the pom configuration part which gets executed.
*/
@Parameter(property = "exec.script")
protected String script = null;
/**
* ruby file which gets executed in context of the given gems..
*/
@Parameter(property = "exec.file")
protected File file = null;
/**
* ruby file found on search path which gets executed. the search path
* includes the executable scripts which were installed via the given
* gem-artifacts.
*/
@Parameter(property = "exec.command")
protected String command = null;
/**
* output file where the standard out will be written
*/
@Parameter(property = "exec.outputFile")
protected File outputFile = null;
/**
* arguments separated by whitespaces for the ruby script given through file parameter.
* no quoting or escaping possible - if needed use execArglines instead.
*/
@Parameter(property = "exec.args")
protected String execArgs = null;
/**
* an array of arguments which can contain spaces for the ruby script given through file parameter.
*/
@Parameter
protected String[] execArgLines = null;
/**
* add project test class path to JVM classpath.
*/
/* we want the opposite default here than the superclass */
@Parameter(property = "gem.addProjectClasspath", defaultValue = "false")
protected boolean addProjectClasspath;
@Override
protected void executeWithGems() throws MojoExecutionException,
ScriptException, IOException {
JarDependencies jars = new JarDependencies(project.getBuild().getDirectory(),
"Jars_" + plugin.getGoalPrefix() + ".lock");
jars.addAll(plugin.getArtifacts(), new Filter(){
@Override
public boolean addIt(Artifact a) {
return a.getScope().equals("runtime") &&
!project.getArtifactMap().containsKey(a.getGroupId() +":" + a.getArtifactId());
}
});
jars.addAll(project.getArtifacts());
jars.generateJarsLock();
factory.addEnv("JARS_HOME", localRepository.getBasedir());
factory.addEnv("JARS_LOCK", jars.lockFilePath());
factory.addSwitch("-r", "jars/setup");
Script s;
if (this.script != null && this.script.length() > 0) {
s = this.factory.newScript(this.script);
}
else if (this.file != null) {
s = this.factory.newScript(this.file);
}
else if (this.command != null) {
s = this.factory.newScriptFromSearchPath( this.command );
}
else {
s = this.factory.newArguments();
}
if ( execArgLines != null ){
for( String arg: execArgLines ){
s.addArg( arg );
}
}
s.addArgs(this.execArgs);
s.addArgs(this.args);
if (s.isValid()) {
if(outputFile != null){
s.executeIn(launchDirectory(), outputFile);
}
else {
s.executeIn(launchDirectory());
}
}
else {
getLog().warn("no arguments given. for more details see: mvn ruby:help -Ddetail -Dgoals=exec");
}
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/ 0000755 0000000 0000000 00000000000 12674201751 023306 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/ 0000755 0000000 0000000 00000000000 12674201751 026562 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/pom.xml0000644 0000000 0000000 00000006215 12674201751 030103 0 ustar
4.0.0de.saumya.mojo.jruby9testtestingmavengemmavengem:https://rubygems.orgmavengemmavengem:https://rubygems.orgorg.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gemtest9.0.3.0de.saumya.mojomavengem-wagon0.1.0de.saumya.mojojruby9-exec-maven-plugin@project.version@simpletestexec${j.version}rspectestexecrspectest filetestexectest.rbrubygemsrspec3.3.0gemorg.slf4jslf4j-simple1.7.6
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/spec/ 0000755 0000000 0000000 00000000000 12674201751 027514 5 ustar ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/spec/one_spec.rb ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/spec/on0000644 0000000 0000000 00000000167 12674201751 030057 0 ustar describe 'something' do
it 'uses the right jruby version' do
expect(JRUBY_VERSION).to eq '9.0.0.0'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/test.rb0000644 0000000 0000000 00000001173 12674201751 030070 0 ustar gem 'minitest'
require 'minitest/autorun'
describe 'something' do
it 'uses the right minitest version' do
Gem.loaded_specs['minitest'].version.to_s.must_equal '5.7.0'
end
it 'can use logger' do
old = java.lang.System.err
bytes = StringIO.new
java.lang.System.err = java.io.PrintStream.new( bytes.to_outputstream )
begin
# TODO capture java stderr and ensure there is no warning
org.slf4j.LoggerFactory.get_logger('me').info 'hello'
java.lang.System.err.flush
bytes.string.strip.must_equal '[main] INFO me - hello'
ensure
java.lang.System.err = old
end
end
end
././@LongLink 0000644 0000000 0000000 00000000160 00000000000 011600 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/src/it/jrubyExecExample/invoker0000644 0000000 0000000 00000000061 12674201751 030157 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/README.md 0000644 0000000 0000000 00000007404 12674201751 023367 0 ustar # jruby maven plugin
the plugin is modeled after [jruby-gradle](http://jruby-gradle.github.io/) and uses the old jruby maven plugins under the hood but it needs jruby-1.7.19 or newer (including jruby-9.0.0.0 serie).
even if the plugin depends on the old jruby-maven-plugins BUT has a different version.
## general command line switches
to see the java/jruby command the plugin is executing use (for example with the verify goal)
```mvn verify -Djruby.verbose```
to quickly pick another jruby version use
```mvn verify -Djruby.version=1.7.20```
or to display some help
```mvn jruby9:help -Ddetail```
## jruby exec
it installs all the declared gems from the dependencies section as well the plugin dependencies. all jars are loaded with JRuby via ```require``` which loads them in to the JRubyClassLoader.
the complete pom for the samples below is in [src/it/jrubyExecExample/pom.xml](src/it/jrubyExecExample/pom.xml)
the gem-artifacts are coming from the torquebox rubygems proxy
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
to use these gems within the depenencies of the plugin you need
rubygems-releaseshttp://rubygems-proxy.torquebox.org/releases
the jar and gem artifacts for the JRuby application can be declared in the main dependencies section
org.slf4jslf4j-api1.7.6rubygemsleafy-rack0.4.0gemrubygemsminitest5.7.0gemtest
these artifacts can have different scope BUT the exec goal will use ALL scopes.
the plugin declaration
de.saumya.mojojruby9-maven-pluginsimplevalidateexec9.0.3.0rspectestexecrspectest filetestexectest.rb
now the plugin uses rspec and needs rpsec gems installed via
rubygemsrspec3.3.0gem
the main dependencies section does use leafy-rack and to see some of its logging you need a slf4j logger for the tests
org.slf4jslf4j-simple1.7.6
./jruby-maven-plugins-1.1.5.ds1.orig/jruby9/jruby9-exec-maven-plugin/pom.xml 0000644 0000000 0000000 00000001756 12674201751 023431 0 ustar
4.0.0jruby9de.saumya.mojo0.2.3-SNAPSHOTjruby9-exec-maven-pluginmaven-pluginJRuby9 Exec Maven Mojode.saumya.mojojruby9-commonorg.apache.maven.plugin-toolsmaven-plugin-annotationsprovidedmaven-invoker-plugin
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/ 0000755 0000000 0000000 00000000000 12674201751 017652 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/ 0000755 0000000 0000000 00000000000 12674201751 020441 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/ 0000755 0000000 0000000 00000000000 12674201751 021365 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/ 0000755 0000000 0000000 00000000000 12674201751 022306 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/ 0000755 0000000 0000000 00000000000 12674201751 022676 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/ 0000755 0000000 0000000 00000000000 12674201751 024175 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/ 0000755 0000000 0000000 00000000000 12674201751 025141 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/ 0000755 0000000 0000000 00000000000 12674201751 026302 5 ustar ././@LongLink 0000644 0000000 0000000 00000000174 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/RunitMavenTestScriptFactory.java ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/RunitMave0000644 0000000 0000000 00000003532 12674201751 030142 0 ustar package de.saumya.mojo.runit;
public class RunitMavenTestScriptFactory extends AbstractRunitMavenTestScriptFactory {
@Override
void getTestRunnerScript(StringBuilder builder) {
builder.append("require 'fileutils'\n");
builder.append("FileUtils.mkdir_p(File.dirname(REPORT_PATH))\n");
builder.append("if defined?( Test::Unit::AutoRunner ) and Test::Unit::AutoRunner.respond_to?(:setup_option)\n");
builder.append(" Test::Unit::AutoRunner.setup_option do |auto_runner, opts|\n");
builder.append(" opts.on('--output-file=FILE', String, 'Outputs to file') do |file|\n");
builder.append(" auto_runner.runner_options[:output] = Tee.open(file, 'w')\n");
builder.append(" end\n");
builder.append(" end\n");
builder.append(" ARGV << \"--output-file=#{REPORT_PATH}\"\n");
builder.append("else\n");
builder.append(" begin\n");
builder.append(" require 'minitest/autorun'\n");
builder.append(" MiniTest::Unit.output = Tee.open(REPORT_PATH, 'w') if MiniTest::Unit.respond_to? :output=\n");
builder.append(" rescue LoadError\n");
builder.append(" require 'test/unit/ui/console/testrunner'\n");
builder.append(" class Test::Unit::UI::Console::TestRunner\n");
builder.append(" extend Test::Unit::UI::TestRunnerUtilities\n");
builder.append(" alias :old_initialize :initialize\n");
builder.append(" def initialize(suite, output_level=NORMAL)\n");
builder.append(" old_initialize(suite, output_level, Tee.open(REPORT_PATH, 'w'))\n");
builder.append(" end\n");
builder.append(" end\n");
builder.append(" end\n");
builder.append("end\n");
}
@Override
protected String getScriptName() {
return "test-runner.rb";
}
}
././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/RUnitMojo.java ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/RUnitMojo0000644 0000000 0000000 00000006766 12674201751 030132 0 ustar package de.saumya.mojo.runit;
import java.io.File;
import java.io.IOException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import de.saumya.mojo.jruby.JRubyVersion;
import de.saumya.mojo.jruby.JRubyVersion.Mode;
import de.saumya.mojo.ruby.script.Script;
import de.saumya.mojo.ruby.script.ScriptException;
import de.saumya.mojo.ruby.script.ScriptFactory;
import de.saumya.mojo.tests.AbstractTestMojo;
import de.saumya.mojo.tests.JRubyRun.Result;
import de.saumya.mojo.tests.TestResultManager;
import de.saumya.mojo.tests.TestScriptFactory;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
/**
* maven wrapper around the runit/testcase command.
*/
@Mojo( name = "test", defaultPhase = LifecyclePhase.TEST, requiresDependencyResolution = ResolutionScope.TEST)
public class RUnitMojo extends AbstractTestMojo {
enum ResultEnum {
TESTS, ASSERTIONS, FAILURES, ERRORS, SKIPS
}
/**
* runit directory with glob to be used for the ruby unit command.
*/
@Parameter(property = "runit.dir", defaultValue = "test/**/*_test.rb")
private final String runitDirectory = null;
/**
* arguments for the runit command.
*/
@Parameter(property = "runit.args" )
private final String runitArgs = null;
/**
* skip the ruby unit tests
*/
@Parameter(property = "skipRunit", defaultValue = "false")
protected boolean skipRunit;
private TestResultManager resultManager;
private File outputfile;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (this.skip || this.skipTests || this.skipRunit) {
getLog().info("Skipping RUnit tests");
return;
} else {
outputfile = new File(this.project.getBuild().getDirectory()
.replace("${project.basedir}/", ""), "runit.txt");
if (outputfile.exists()){
outputfile.delete();
}
resultManager = new TestResultManager(project.getName(), "runit", testReportDirectory, summaryReport);
super.execute();
}
}
protected Result runIt(ScriptFactory factory, Mode mode, JRubyVersion version, TestScriptFactory scriptFactory)
throws IOException, ScriptException, MojoExecutionException {
scriptFactory.setOutputDir(outputfile.getParentFile());
scriptFactory.setReportPath(outputfile);
outputfile.delete();
if(runitDirectory.startsWith(launchDirectory().getAbsolutePath())){
scriptFactory.setSourceDir(new File(runitDirectory));
}
else{
scriptFactory.setSourceDir(new File(launchDirectory(), runitDirectory));
}
final Script script = factory.newScript(scriptFactory.getCoreScript());
if (this.runitArgs != null) {
script.addArgs(this.runitArgs);
}
if (this.args != null) {
script.addArgs(this.args);
}
try {
script.executeIn(launchDirectory());
} catch (Exception e) {
getLog().debug("exception in running tests", e);
}
return resultManager.generateReports(mode, version, outputfile);
}
@Override
protected TestScriptFactory newTestScriptFactory() {
return new RunitMavenTestScriptFactory();
}
}
././@LongLink 0000644 0000000 0000000 00000000204 00000000000 011577 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/AbstractRunitMavenTestScriptFactory.java ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/main/java/de/saumya/mojo/runit/AbstractR0000644 0000000 0000000 00000002354 12674201751 030116 0 ustar package de.saumya.mojo.runit;
import de.saumya.mojo.tests.AbstractMavenTestScriptFactory;
public abstract class AbstractRunitMavenTestScriptFactory extends AbstractMavenTestScriptFactory {
@Override
protected void getRunnerScript(StringBuilder builder) {
getTeeClass(builder);
getAddTestCases(builder);
getTestRunnerScript(builder);
}
abstract void getTestRunnerScript(StringBuilder builder);
@Override
protected void getResultsScript(StringBuilder builder) {
// just creates error since the tests run on exit hook
}
void getTeeClass(StringBuilder builder){
builder.append("class Tee < File\n");
builder.append(" def write(*args)\n");
builder.append(" super\n" );
builder.append(" STDOUT.write *args\n" );
builder.append(" end\n");
builder.append(" def flush(*args)\n" );
builder.append(" super\n" );
builder.append(" STDOUT.flush *args\n");
builder.append(" end\n" );
builder.append("end\n");
}
void getAddTestCases(StringBuilder builder){
builder.append( "require 'test/unit'\n");
builder.append("Dir[SOURCE_DIR].each { |f| require f if File.file? f }\n");
}
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/ 0000755 0000000 0000000 00000000000 12674201751 021055 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/ 0000755 0000000 0000000 00000000000 12674201751 024072 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/verify.bsh 0000644 0000000 0000000 00000000774 12674201751 026104 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 1 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/test.properties 0000644 0000000 0000000 00000000024 12674201751 027163 0 ustar jruby.switches=--1.9 ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/pom.xml 0000644 0000000 0000000 00000001166 12674201751 025413 0 ustar
4.0.0de.saumya.mojorunit-failuretestingde.saumya.mojorunit-maven-plugin@project.version@
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/test/ 0000755 0000000 0000000 00000000000 12674201751 025051 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/test/simple_test.rb 0000644 0000000 0000000 00000000125 12674201751 027724 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert false
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure-19/invoker.properties 0000644 0000000 0000000 00000000125 12674201751 027663 0 ustar invoker.goals = runit:test
invoker.mavenOpts = -client
invoker.buildResult = failure
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/ 0000755 0000000 0000000 00000000000 12674201751 024552 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/verify.bsh0000644 0000000 0000000 00000005002 12674201751 026551 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "jruby-1.5.6 mode 1.8: 1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-1.6.1 mode 1.8: 1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-1.6.1 mode 1.9: 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-1.7.5 mode 1.8: 1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-1.7.5 mode 1.9: 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-1.7.5 mode 2.0: 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit-1.5.6--1.8.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.6.1--1.8.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.6.1--1.9.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.5--1.8.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.5--1.9.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.5--2.0.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
././@LongLink 0000644 0000000 0000000 00000000152 00000000000 011601 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/test.properties ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/test.prope0000644 0000000 0000000 00000000070 12674201751 026575 0 ustar jruby.modes=1.8,1.9,2.0
jruby.versions=1.5.6,1.6.1,1.7.5 ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/pom.xml 0000644 0000000 0000000 00000001327 12674201751 026072 0 ustar
4.0.0de.saumya.mojorunit-pomtestingde.saumya.mojorunit-maven-plugin@project.version@test
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/test/ 0000755 0000000 0000000 00000000000 12674201751 025531 5 ustar ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/test/simple_test.rb ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/test/simpl0000644 0000000 0000000 00000000124 12674201751 026575 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert true
end
end
././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20-156_161_175/invoker.pr0000644 0000000 0000000 00000000061 12674201751 026567 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/ 0000755 0000000 0000000 00000000000 12674201751 025222 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/verify.bsh 0000644 0000000 0000000 00000001244 12674201751 027225 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/summary.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/pom.xml 0000644 0000000 0000000 00000001466 12674201751 026546 0 ustar
4.0.0de.saumya.mojorunit-pomtestingde.saumya.mojorunit-maven-plugin@project.version@test${build.directory}/summary.xml
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/test/ 0000755 0000000 0000000 00000000000 12674201751 026201 5 ustar ././@LongLink 0000644 0000000 0000000 00000000150 00000000000 011577 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/test/simple_test.rb ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/test/simple_test0000644 0000000 0000000 00000000124 12674201751 030451 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert true
end
end
././@LongLink 0000644 0000000 0000000 00000000147 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-summary-report/invoker.properti0000644 0000000 0000000 00000000061 12674201751 030462 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure/ 0000755 0000000 0000000 00000000000 12674201751 023643 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure/verify.bsh 0000644 0000000 0000000 00000000774 12674201751 025655 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 1 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure/pom.xml 0000644 0000000 0000000 00000001166 12674201751 025164 0 ustar
4.0.0de.saumya.mojorunit-failuretestingde.saumya.mojorunit-maven-plugin@project.version@
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure/test/ 0000755 0000000 0000000 00000000000 12674201751 024622 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure/test/simple_test.rb 0000644 0000000 0000000 00000000125 12674201751 027475 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert false
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-failure/invoker.properties 0000644 0000000 0000000 00000000125 12674201751 027434 0 ustar invoker.goals = runit:test
invoker.mavenOpts = -client
invoker.buildResult = failure
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/ 0000755 0000000 0000000 00000000000 12674201751 024212 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/verify.bsh 0000644 0000000 0000000 00000000774 12674201751 026224 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/pom.xml 0000644 0000000 0000000 00000001335 12674201751 025531 0 ustar
4.0.0de.saumya.mojorunit-somewheretestingde.saumya.mojorunit-maven-plugin@project.version@somewhere
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/somewhere/ 0000755 0000000 0000000 00000000000 12674201751 026210 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/somewhere/test/ 0000755 0000000 0000000 00000000000 12674201751 027167 5 ustar ././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/somewhere/test/simple_test.rb ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/somewhere/test/simple0000644 0000000 0000000 00000000124 12674201751 030400 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert true
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-somewhere/invoker.properties 0000644 0000000 0000000 00000000067 12674201751 030010 0 ustar invoker.goals = runit:test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-pom/ 0000755 0000000 0000000 00000000000 12674201751 023007 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-pom/verify.bsh 0000644 0000000 0000000 00000000774 12674201751 025021 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-pom/pom.xml 0000644 0000000 0000000 00000001327 12674201751 024327 0 ustar
4.0.0de.saumya.mojorunit-pomtestingde.saumya.mojorunit-maven-plugin@project.version@test
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-pom/test/ 0000755 0000000 0000000 00000000000 12674201751 023766 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-pom/test/simple_test.rb 0000644 0000000 0000000 00000000124 12674201751 026640 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert true
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-pom/invoker.properties 0000644 0000000 0000000 00000000061 12674201751 026577 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-env/ 0000755 0000000 0000000 00000000000 12674201751 023755 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-env/verify.bsh 0000644 0000000 0000000 00000001316 12674201751 025760 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.8--1.9.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.13--1.9.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-env/pom.xml 0000644 0000000 0000000 00000001531 12674201751 025272 0 ustar
4.0.0de.saumya.mojorunit-pomtestingde.saumya.mojorunit-maven-plugin@project.version@1231.7.8,1.7.13test
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-env/test/ 0000755 0000000 0000000 00000000000 12674201751 024734 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-env/test/simple_test.rb 0000644 0000000 0000000 00000000147 12674201751 027613 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert ENV['VERSION'] == '123'
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-env/invoker.properties 0000644 0000000 0000000 00000000061 12674201751 027545 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/ 0000755 0000000 0000000 00000000000 12674201751 026365 5 ustar ././@LongLink 0000644 0000000 0000000 00000000146 00000000000 011604 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/verify.bsh ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/verify.bs0000644 0000000 0000000 00000001654 12674201751 030225 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "1 tests, 1 assertions, 0 failures, 0 errors, 0 skips";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File f = new File( new File( new File( basedir, "target" ), "surefire-reports" ), "TEST-runit-9.0.1.0.xml" );
if ( !f.exists() )
{
throw new RuntimeException( "file does not exists: " + f );
}
f = new File( new File( new File( basedir, "target" ), "surefire-reports" ), "TEST-runit-1.7.22--1.9.xml" );
if ( !f.exists() )
{
throw new RuntimeException( "file does not exists: " + f );
}
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/test.properties ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/test.prop0000644 0000000 0000000 00000000035 12674201751 030244 0 ustar jruby.versions=1.7.22,9.0.1.0 ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/pom.xml 0000644 0000000 0000000 00000002122 12674201751 027677 0 ustar
4.0.0de.saumya.mojorunit-pomtestingrubygems-releaseshttp://rubygems-proxy.torquebox.org/releasesrubygemsleafy-complete0.6.2gemde.saumya.mojorunit-maven-plugin@project.version@test
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/test/ 0000755 0000000 0000000 00000000000 12674201751 027344 5 ustar ././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/test/simple_test.rb ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/test/simp0000644 0000000 0000000 00000000150 12674201751 030233 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert require('leafy/metrics')
end
end
././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/invoker.properties ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-with-jar-dependencies/invoker.p0000644 0000000 0000000 00000000061 12674201751 030220 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/ 0000755 0000000 0000000 00000000000 12674201751 023256 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/verify.bsh 0000644 0000000 0000000 00000002451 12674201751 025262 0 ustar import java.io.*;
import org.codehaus.plexus.util.FileUtils;
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
String expected = "mode 1.8: 1 tests, 1 assertions, 0 failures, 0 errors";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "mode 1.9: 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "mode 2.0: 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
File file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.5--1.8.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.5--1.9.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
file = new File( basedir, "target/surefire-reports/TEST-runit-1.7.5--2.0.xml");
if ( !file.exists() )
{
throw new RuntimeException( "file does not exists: '" + file.getAbsolutePath() + "'" );
}
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/test.properties 0000644 0000000 0000000 00000000116 12674201751 026351 0 ustar jruby.modes=18,19,20
# to allow the verify script to work
jruby.version=1.7.5
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/pom.xml 0000644 0000000 0000000 00000001327 12674201751 024576 0 ustar
4.0.0de.saumya.mojorunit-pomtestingde.saumya.mojorunit-maven-plugin@project.version@test
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/test/ 0000755 0000000 0000000 00000000000 12674201751 024235 5 ustar ./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/test/simple_test.rb 0000644 0000000 0000000 00000000124 12674201751 027107 0 ustar class SimpleTest < Test::Unit::TestCase
def test_it
assert true
end
end
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/runit-18_19_20/invoker.properties 0000644 0000000 0000000 00000000061 12674201751 027046 0 ustar invoker.goals = test
invoker.mavenOpts = -client
./jruby-maven-plugins-1.1.5.ds1.orig/runit-maven-plugin/src/it/settings.xml 0000644 0000000 0000000 00000002204 12674201751 023435 0 ustar
it-repotruelocal.central@localRepositoryUrl@truetruelocal.rubygems@localRepositoryUrl@truefalselocal.central@localRepositoryUrl@truetrue