Examples of GemSpecification


Examples of de.saumya.mojo.gems.spec.GemSpecification

        return false;
    }

    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.rb");
        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");
        final File rubyDevelopmentStubFile = generateRubyStub(gemspec,
                                                              artifact,
                                                              RubyDependencyType.DEVELOPMENT);
        gem.addFile(rubyDevelopmentStubFile, rubyDevelopmentStubPath);

        final File rubyMainStubFile = generateMainStub(artifact);
        gem.addFile(rubyMainStubFile, LIB_PATH + gemspec.getName() + ".rb" );

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

        return new GemArtifact(gemspec, gemfile);
View Full Code Here

Examples of de.saumya.mojo.gems.spec.GemSpecification

        }
    }

    public File createGemspecFromArtifact(final MavenArtifact artifact,
            final File target) throws IOException {
        final GemSpecification gemspec = createSpecification(artifact);
        final File targetFile = new File(target, getGemFileName(gemspec)
                + "spec");

        FileWriter writer = null;
        try {
View Full Code Here

Examples of de.saumya.mojo.gems.spec.GemSpecification

                              artifact.getCoordinates().getVersion(),
                              this.PLATFORM_JAVA);
    }

    public GemSpecification createSpecification(final MavenArtifact artifact) {
        final GemSpecification result = new GemSpecification();

        if( relocateIfNeeded(artifact)){
            Dependency dep = artifact.getPom().getDependencies().get(0);
            result.setPost_install_message("this gem has a new name: "
                                           + createGemName(dep.getGroupId(),
                                                           dep.getArtifactId(),
                                                           dep.getVersion()) + " version: " + dep.getVersion());
        }

        // 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;
    }
View Full Code Here

Examples of de.saumya.mojo.gems.spec.GemSpecification

        return result;
    }

    public GemArtifact createGemStubFromArtifact(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 file, where to generate Gem!");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.