All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.maxbraun.jobprofiles.SoftwareIndex Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.github.maxbraun.jobprofiles;

import java.io.IOException;
import java.io.PrintStream;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.tmatesoft.svn.core.SVNException;

import net.oneandone.pommes.model.Database;
import net.oneandone.pommes.model.Pom;
import net.oneandone.sushi.fs.Node;

public class SoftwareIndex {

    private List assets;
    public SoftwareIndex() {
        assets = new ArrayList();
    }
    public static SoftwareIndex load(Node pommesGlobal, PrintStream log) throws IOException, URISyntaxException, SVNException {
        SoftwareIndex index;
        Database database;

        database = new Database(pommesGlobal.getWorld().getTemp().createTempDirectory().join("pommes"), pommesGlobal);
        //database = Database.load(world);
        database.downloadOpt();
        index = new SoftwareIndex();


        for (Pom pom : database.search("/trunk/")) {
            if (pom.projectUrl() != null && !"".equals(pom.projectUrl())) {
                if (pom.projectUrl().contains("ssh://[email protected]")) {
                    log.println(pom.toString() + " is currently not supported.");
                    continue;
                }
                Scm scm = Scm.create(pom.projectUrl(), pommesGlobal.getWorld());
                if (!scm.exists()) {
                    log.println(pom.toString() + " has non existing scm.");
                    continue;
                }
                index.add(SoftwareAsset.withPom(pom, scm.active(), scm.category()));


            } else {
                log.println(pom.toString() + " has no scm.");
            }

        }

        log.println(index.size() + " Assets");
        return index;
    }

    private int size() {
        return assets.size();
    }
    public List assets() {
        return Collections.unmodifiableList(assets);
    }

    public void add(SoftwareAsset asset) {
        assets.add(asset);
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy