protected String getGemFileName(
      final String groupId, final String artifactId, final String version, final String platform) {
    final String gemName = createGemName(groupId, artifactId, version);

    final String gemVersion = createGemVersion(version);

    return Gem.constructGemFileName(gemName, gemVersion, platform);
  }
  public GemArtifact createGemFromArtifact(final MavenArtifact artifact, final File target)
      throws IOException {
    final GemSpecification gemspec = createSpecification(artifact);

    if (target == null || (target.exists() && !target.isDirectory())) {
      throw new IOException("Must specify target directory, where to generate Gem!");
    }

    final Gem gem = new Gem(gemspec);

    if (artifact.getArtifactFile() != null) {
      gem.addFile(artifact.getArtifactFile(), createLibFileName(artifact, ".jar"));
    }

    // create "meta" ruby file
    final String rubyStubMetaPath = createLibFileName(artifact, "-maven-meta.rb");
    // System.err.println( rubyStubMetaPath );
    final File rubyStubMetaFile = generateRubyMetaStub(gemspec, artifact);
    gem.addFile(rubyStubMetaFile, rubyStubMetaPath);

    // create runtime ruby file
    final String rubyStubPath = createLibFileName(artifact, ".rb");

    // System.err.println( rubyStubPath );
    final File rubyStubFile = generateRubyStub(gemspec, artifact, RubyDependencyType.RUNTIME);
    gem.addFile(rubyStubFile, rubyStubPath);

    // create development ruby file
    final String rubyDevelopmentStubPath = createLibFileName(artifact, "-dev.rb");
    // System.err.println( rubyDevelopmentStubPath );
    final File rubyDevelopmentStubFile =
        generateRubyStub(gemspec, artifact, RubyDependencyType.DEVELOPMENT);
    gem.addFile(rubyDevelopmentStubFile, rubyDevelopmentStubPath);

    // write file
    final File gemfile = this.gemPackager.createGem(gem, target);

    return new GemArtifact(gemspec, gemfile);
  }
 protected String getGemFileName(final GemSpecification gemspec) {
   return Gem.constructGemFileName(
       gemspec.getName(), gemspec.getVersion().getVersion(), gemspec.getPlatform());
 }