private File generateRubyMetaStub(final GemSpecification gemspec, final MavenArtifact artifact) throws IOException { final VelocityContext context = new VelocityContext(); context.put("gemVersion", gemspec.getVersion().getVersion()); context.put("groupId", artifact.getCoordinates().getGroupId()); context.put("artifactId", artifact.getCoordinates().getArtifactId()); context.put("type", artifact.getPom().getPackaging()); context.put("version", artifact.getCoordinates().getVersion()); if (artifact.getArtifactFile() != null) { context.put( "filename", createJarfileName( artifact.getCoordinates().getGroupId(), artifact.getCoordinates().getArtifactId(), artifact.getCoordinates().getVersion())); } final List<String> packageParts = new ArrayList<String>(); for (final String part : artifact.getCoordinates().getGroupId().split("\\.")) { packageParts.add(titleize(part)); } packageParts.add(titleize(artifact.getCoordinates().getArtifactId())); context.put("packageParts", packageParts); return generateRubyFile("metafile", context, "rubyMetaStub"); }
protected String getGemFileName(final GemSpecification gemspec) { return Gem.constructGemFileName( gemspec.getName(), gemspec.getVersion().getVersion(), gemspec.getPlatform()); }
public GemSpecification createSpecification(final MavenArtifact artifact) { final GemSpecification result = new GemSpecification(); // this is fix result.setPlatform(this.PLATFORM_JAVA); // the must ones result.setName( createGemName( artifact.getCoordinates().getGroupId(), artifact.getCoordinates().getArtifactId(), artifact.getCoordinates().getVersion())); result.setVersion(new GemVersion(createGemVersion(artifact.getCoordinates().getVersion()))); // dependencies if (artifact.getPom().getDependencies().size() > 0) { for (final Dependency dependency : artifact.getPom().getDependencies()) { if (!dependency.isOptional()) { result.getDependencies().add(convertDependency(artifact, dependency)); } } } // and other stuff "nice to have" result.setDate(new Date()); // now result.setDescription( sanitizeStringValue( artifact.getPom().getDescription() != null ? artifact.getPom().getDescription() : artifact.getPom().getName())); result.setSummary(sanitizeStringValue(artifact.getPom().getName())); result.setHomepage(sanitizeStringValue(artifact.getPom().getUrl())); if (artifact.getPom().getLicenses().size() > 0) { for (final License license : artifact.getPom().getLicenses()) { result .getLicenses() .add(sanitizeStringValue(license.getName() + " (" + license.getUrl() + ")")); } } if (artifact.getPom().getDevelopers().size() > 0) { for (final Developer developer : artifact.getPom().getDevelopers()) { result .getAuthors() .add(sanitizeStringValue(developer.getName() + " (" + developer.getEmail() + ")")); } } // by default, we pack into lib/ inside gem (where is the jar and the // stub ruby) result.getRequire_paths().add("lib"); return result; }