return titleizedString.toString();
}
private GemDependency convertDependency(final MavenArtifact artifact,
final Dependency dependency) {
final GemDependency result = new GemDependency();
result.setName(createGemName(dependency.getGroupId(),
dependency.getArtifactId(),
dependency.getVersion()));
result.setType(RubyDependencyType.toRubyDependencyType(dependency.getScope())
.toString());
final GemRequirement requirement = new GemRequirement();
// TODO: we are adding "hard" dependencies here, but we should maybe
// support Maven ranges too
// based on
// http://blog.zenspider.com/2008/10/rubygems-howto-preventing-cata.html
final String version = createGemVersion(getDependencyVersion(artifact,
dependency));
final GemVersion gemVersion;
if (version.matches("^[^.]+\\.[^.]+\\..*")) {
// TODO maybe just takethe first two parts
gemVersion = new GemVersion(version.substring(0, version.indexOf('.')) + ".0.a");
}
else {
gemVersion = new GemVersion(version);
}
requirement.addRequirement("~>", gemVersion);
result.setVersion_requirement(requirement);
return result;
}