de.saumya.mojo.gems
Class DefaultMavenArtifactConverter

java.lang.Object
  extended by de.saumya.mojo.gems.DefaultMavenArtifactConverter
All Implemented Interfaces:
MavenArtifactConverter

@Component(role=MavenArtifactConverter.class)
public class DefaultMavenArtifactConverter
extends Object
implements MavenArtifactConverter

This is full of "workarounds" here, since for true artifact2gem conversion I would need interpolated POM!

Author:
cstamas, mkristian

Nested Class Summary
static class DefaultMavenArtifactConverter.MavenDependency
           
 
Field Summary
 
Fields inherited from interface de.saumya.mojo.gems.MavenArtifactConverter
GEMNAME_PREFIX
 
Constructor Summary
DefaultMavenArtifactConverter()
           
 
Method Summary
 boolean canConvert(MavenArtifact artifact)
          Returns is the artifact convertable safely into Gem.
 GemArtifact createGemFromArtifact(MavenArtifact artifact, File target)
          Creates a valid Ruby Gem, and returns File pointing to the result.
protected  String createGemName(String groupId, String artifactId, String version)
           
 File createGemspecFromArtifact(MavenArtifact artifact, File target)
           
 GemArtifact createGemStubFromArtifact(MavenArtifact artifact, File target)
          Creates a valid Ruby Gem, and returns File pointing to the result.
protected  String createGemVersion(String mavenVersion)
           
protected  String createJarfileName(String groupId, String artifactId, String version)
           
protected  String createLibFileName(MavenArtifact artifact, String postfix)
           
protected  String createRequireName(String groupId, String artifactId, String version)
           
 GemSpecification createSpecification(MavenArtifact artifact)
          Creates a Gem::Specification (the equivalent JavaBeans actually) filled up properly based on informaton from POM.
protected  String getGemFileName(GemSpecification gemspec)
           
 String getGemFileName(MavenArtifact artifact)
          Returns the "regular" gem filename, as it is expected this artifact to be called as Gem.
protected  String getGemFileName(String groupId, String artifactId, String version, String platform)
           
protected  String sanitizeStringValue(String val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMavenArtifactConverter

public DefaultMavenArtifactConverter()
Method Detail

canConvert

public boolean canConvert(MavenArtifact artifact)
Description copied from interface: MavenArtifactConverter
Returns is the artifact convertable safely into Gem.

Specified by:
canConvert in interface MavenArtifactConverter
Returns:
true if yes.

getGemFileName

public String getGemFileName(MavenArtifact artifact)
Description copied from interface: MavenArtifactConverter
Returns the "regular" gem filename, as it is expected this artifact to be called as Gem.

Specified by:
getGemFileName in interface MavenArtifactConverter
Returns:

createSpecification

public GemSpecification createSpecification(MavenArtifact artifact)
Description copied from interface: MavenArtifactConverter
Creates a Gem::Specification (the equivalent JavaBeans actually) filled up properly based on informaton from POM. The "better" POM is, the getter is gemspec. For best results, fed in interpolated POMs!

Specified by:
createSpecification in interface MavenArtifactConverter
Returns:

createGemStubFromArtifact

public GemArtifact createGemStubFromArtifact(MavenArtifact artifact,
                                             File target)
                                      throws IOException
Description copied from interface: MavenArtifactConverter
Creates a valid Ruby Gem, and returns File pointing to the result.

Specified by:
createGemStubFromArtifact in interface MavenArtifactConverter
Parameters:
artifact - the artifact to gemize (without data only gemspec)
target - where to save Gem file. If null, it will be created next to artifact
Returns:
Throws:
IOException

createGemFromArtifact

public GemArtifact createGemFromArtifact(MavenArtifact artifact,
                                         File target)
                                  throws IOException
Description copied from interface: MavenArtifactConverter
Creates a valid Ruby Gem, and returns File pointing to the result.

Specified by:
createGemFromArtifact in interface MavenArtifactConverter
Parameters:
artifact - the artifact to gemize
target - where to save Gem file. If null, it will be created next to artifact
Returns:
Throws:
IOException

sanitizeStringValue

protected String sanitizeStringValue(String val)

createLibFileName

protected String createLibFileName(MavenArtifact artifact,
                                   String postfix)

createRequireName

protected String createRequireName(String groupId,
                                   String artifactId,
                                   String version)

createJarfileName

protected String createJarfileName(String groupId,
                                   String artifactId,
                                   String version)

createGemName

protected String createGemName(String groupId,
                               String artifactId,
                               String version)

getGemFileName

protected String getGemFileName(String groupId,
                                String artifactId,
                                String version,
                                String platform)

getGemFileName

protected String getGemFileName(GemSpecification gemspec)

createGemVersion

protected String createGemVersion(String mavenVersion)
                           throws NullPointerException
Throws:
NullPointerException

createGemspecFromArtifact

public File createGemspecFromArtifact(MavenArtifact artifact,
                                      File target)
                               throws IOException
Specified by:
createGemspecFromArtifact in interface MavenArtifactConverter
Throws:
IOException


Copyright © 2012. All Rights Reserved.