Package de.saumya.mojo.gems
Class DefaultMavenArtifactConverter
java.lang.Object
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!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate GemPackagerprivate GemSpecificationIOprivate static final Stringprivate static final Stringprivate final Maven2GemVersionConverter(package private) StringThe Java platform key.private org.codehaus.plexus.velocity.VelocityComponentFields inherited from interface de.saumya.mojo.gems.MavenArtifactConverter
GEMNAME_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanConvert(MavenArtifact artifact) Returns is the artifact convertable safely into Gem.private booleancanConvert(MavenArtifact artifact, String packaging, String extension) private GemDependencyconvertDependency(MavenArtifact artifact, org.apache.maven.model.Dependency dependency) createGemFromArtifact(MavenArtifact artifact, File target) Creates a valid Ruby Gem, and returns File pointing to the result.protected StringcreateGemName(String groupId, String artifactId, String version) createGemspecFromArtifact(MavenArtifact artifact, File target) createGemStubFromArtifact(MavenArtifact artifact, File target) Creates a valid Ruby Gem, and returns File pointing to the result.protected StringcreateGemVersion(String mavenVersion) protected StringcreateJarfileName(String groupId, String artifactId, String version) protected StringcreateLibFileName(MavenArtifact artifact, String postfix) protected StringcreateRequireName(String groupId, String artifactId, String version) createSpecification(MavenArtifact artifact) Creates a Gem::Specification (the equivalent JavaBeans actually) filled up properly based on informaton from POM.private FilegenerateMainStub(MavenArtifact artifact) private FilegenerateRubyFile(String templateName, org.apache.velocity.context.Context context, String stubFilename) private FilegenerateRubyMetaStub(GemSpecification gemspec, MavenArtifact artifact) private FilegenerateRubyStub(GemSpecification gemspec, MavenArtifact artifact, DefaultMavenArtifactConverter.RubyDependencyType type) private StringgetDependencyVersion(MavenArtifact artifact, org.apache.maven.model.Dependency dependency) getGemFileName(MavenArtifact artifact) Returns the "regular" gem filename, as it is expected this artifact to be called as Gem.protected StringgetGemFileName(GemSpecification gemspec) protected StringgetGemFileName(String groupId, String artifactId, String version, String platform) private booleanprotected Stringprivate String
-
Field Details
-
LIB_PATH
- See Also:
-
LIB_MAVEN_PATH
- See Also:
-
PLATFORM_JAVA
String PLATFORM_JAVAThe Java platform key. -
gemPackager
-
velocityComponent
@Requirement private org.codehaus.plexus.velocity.VelocityComponent velocityComponent -
gemSpecificationIO
-
maven2GemVersionConverter
-
-
Constructor Details
-
DefaultMavenArtifactConverter
public DefaultMavenArtifactConverter()
-
-
Method Details
-
canConvert
Description copied from interface:MavenArtifactConverterReturns is the artifact convertable safely into Gem.- Specified by:
canConvertin interfaceMavenArtifactConverter- Returns:
- true if yes.
-
canConvert
-
getGemFileName
Description copied from interface:MavenArtifactConverterReturns the "regular" gem filename, as it is expected this artifact to be called as Gem.- Specified by:
getGemFileNamein interfaceMavenArtifactConverter- Returns:
-
createSpecification
Description copied from interface:MavenArtifactConverterCreates 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:
createSpecificationin interfaceMavenArtifactConverter- Returns:
-
createGemStubFromArtifact
public GemArtifact createGemStubFromArtifact(MavenArtifact artifact, File target) throws IOException Description copied from interface:MavenArtifactConverterCreates a valid Ruby Gem, and returns File pointing to the result.- Specified by:
createGemStubFromArtifactin interfaceMavenArtifactConverter- 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
-
relocateIfNeeded
-
createGemFromArtifact
Description copied from interface:MavenArtifactConverterCreates a valid Ruby Gem, and returns File pointing to the result.- Specified by:
createGemFromArtifactin interfaceMavenArtifactConverter- Parameters:
artifact- the artifact to gemizetarget- where to save Gem file. If null, it will be created next to artifact- Returns:
- Throws:
IOException
-
sanitizeStringValue
-
createLibFileName
-
createRequireName
-
createJarfileName
-
createGemName
-
getGemFileName
-
getGemFileName
-
createGemVersion
- Throws:
NullPointerException
-
generateMainStub
- Throws:
IOException
-
generateRubyMetaStub
private File generateRubyMetaStub(GemSpecification gemspec, MavenArtifact artifact) throws IOException - Throws:
IOException
-
generateRubyStub
private File generateRubyStub(GemSpecification gemspec, MavenArtifact artifact, DefaultMavenArtifactConverter.RubyDependencyType type) throws IOException - Throws:
IOException
-
generateRubyFile
private File generateRubyFile(String templateName, org.apache.velocity.context.Context context, String stubFilename) throws IOException - Throws:
IOException
-
titleize
-
convertDependency
private GemDependency convertDependency(MavenArtifact artifact, org.apache.maven.model.Dependency dependency) -
getDependencyVersion
private String getDependencyVersion(MavenArtifact artifact, org.apache.maven.model.Dependency dependency) -
createGemspecFromArtifact
- Specified by:
createGemspecFromArtifactin interfaceMavenArtifactConverter- Throws:
IOException
-