Search in sources :

Example 1 with InitStep

use of com.google.gerrit.pgm.init.api.InitStep in project gerrit by GerritCodeReview.

the class InitPlugins method initPlugins.

private void initPlugins() throws Exception {
    ui.message("Initializing plugins.\n");
    Collection<InitStep> initSteps = pluginLoader.getInitSteps();
    if (initSteps.isEmpty()) {
        ui.message("No plugins found with init steps.\n");
    } else {
        for (InitStep initStep : initSteps) {
            initStep.run();
        }
    }
}
Also used : InitStep(com.google.gerrit.pgm.init.api.InitStep)

Example 2 with InitStep

use of com.google.gerrit.pgm.init.api.InitStep in project gerrit by GerritCodeReview.

the class SitePathInitializer method run.

public void run() throws Exception {
    ui.header("Gerrit Code Review %s", version());
    if (site.isNew) {
        if (!ui.yesno(true, "Create '%s'", site.site_path.toAbsolutePath())) {
            throw die("aborted by user");
        }
        FileUtil.mkdirsOrDie(site.site_path, "Cannot make directory");
        flags.deleteOnFailure = true;
    }
    mkdir(site.bin_dir);
    mkdir(site.etc_dir);
    mkdir(site.lib_dir);
    mkdir(site.tmp_dir);
    mkdir(site.logs_dir);
    mkdir(site.mail_dir);
    mkdir(site.static_dir);
    mkdir(site.plugins_dir);
    mkdir(site.data_dir);
    for (InitStep step : steps) {
        if (step instanceof InitPlugins && flags.skipPlugins) {
            continue;
        }
        step.run();
    }
    saveSecureStore();
    savePublic(flags.cfg);
    extract(site.gerrit_sh, getClass(), "gerrit.sh");
    chmod(0755, site.gerrit_sh);
    extract(site.gerrit_service, getClass(), "gerrit.service");
    chmod(0755, site.gerrit_service);
    extract(site.gerrit_socket, getClass(), "gerrit.socket");
    chmod(0755, site.gerrit_socket);
    chmod(0700, site.tmp_dir);
    extractMailExample("Abandoned.soy");
    extractMailExample("AbandonedHtml.soy");
    extractMailExample("AddKey.soy");
    extractMailExample("AddKeyHtml.soy");
    extractMailExample("AddToAttentionSet.soy");
    extractMailExample("AddToAttentionSetHtml.soy");
    extractMailExample("ChangeFooter.soy");
    extractMailExample("ChangeFooterHtml.soy");
    extractMailExample("ChangeSubject.soy");
    extractMailExample("Comment.soy");
    extractMailExample("CommentHtml.soy");
    extractMailExample("CommentFooter.soy");
    extractMailExample("CommentFooterHtml.soy");
    extractMailExample("DeleteKey.soy");
    extractMailExample("DeleteKeyHtml.soy");
    extractMailExample("DeleteReviewer.soy");
    extractMailExample("DeleteReviewerHtml.soy");
    extractMailExample("DeleteVote.soy");
    extractMailExample("DeleteVoteHtml.soy");
    extractMailExample("Footer.soy");
    extractMailExample("FooterHtml.soy");
    extractMailExample("ChangeHeader.soy");
    extractMailExample("ChangeHeaderHtml.soy");
    extractMailExample("HttpPasswordUpdate.soy");
    extractMailExample("HttpPasswordUpdateHtml.soy");
    extractMailExample("InboundEmailRejection.soy");
    extractMailExample("InboundEmailRejectionHtml.soy");
    extractMailExample("Merged.soy");
    extractMailExample("MergedHtml.soy");
    extractMailExample("NewChange.soy");
    extractMailExample("NewChangeHtml.soy");
    extractMailExample("RegisterNewEmail.soy");
    extractMailExample("RegisterNewEmailHtml.soy");
    extractMailExample("RemoveFromAttentionSet.soy");
    extractMailExample("RemoveFromAttentionSetHtml.soy");
    extractMailExample("ReplacePatchSet.soy");
    extractMailExample("ReplacePatchSetHtml.soy");
    extractMailExample("Restored.soy");
    extractMailExample("RestoredHtml.soy");
    extractMailExample("Reverted.soy");
    extractMailExample("RevertedHtml.soy");
    extractMailExample("SetAssignee.soy");
    extractMailExample("SetAssigneeHtml.soy");
    if (!ui.isBatch()) {
        System.err.println();
    }
}
Also used : InitStep(com.google.gerrit.pgm.init.api.InitStep)

Example 3 with InitStep

use of com.google.gerrit.pgm.init.api.InitStep in project gerrit by GerritCodeReview.

the class SitePathInitializer method postRun.

public void postRun(Injector injector) throws Exception {
    for (InitStep step : steps) {
        if (step instanceof InitPlugins && flags.skipPlugins) {
            continue;
        }
        injector.injectMembers(step);
        step.postRun();
    }
}
Also used : InitStep(com.google.gerrit.pgm.init.api.InitStep)

Example 4 with InitStep

use of com.google.gerrit.pgm.init.api.InitStep in project gerrit by GerritCodeReview.

the class InitPluginStepsLoader method getInitSteps.

public Collection<InitStep> getInitSteps() {
    List<Path> jars = scanJarsInPluginsDirectory();
    ArrayList<InitStep> pluginsInitSteps = new ArrayList<>();
    for (Path jar : jars) {
        InitStep init = loadInitStep(jar);
        if (init != null) {
            pluginsInitSteps.add(init);
        }
    }
    return pluginsInitSteps;
}
Also used : Path(java.nio.file.Path) InitStep(com.google.gerrit.pgm.init.api.InitStep) ArrayList(java.util.ArrayList)

Example 5 with InitStep

use of com.google.gerrit.pgm.init.api.InitStep in project gerrit by GerritCodeReview.

the class InitPlugins method postInitPlugins.

private void postInitPlugins() throws Exception {
    for (InitStep initStep : pluginLoader.getInitSteps()) {
        postRunInjector.injectMembers(initStep);
        initStep.postRun();
    }
}
Also used : InitStep(com.google.gerrit.pgm.init.api.InitStep)

Aggregations

InitStep (com.google.gerrit.pgm.init.api.InitStep)6 IOException (java.io.IOException)1 URLClassLoader (java.net.URLClassLoader)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Attributes (java.util.jar.Attributes)1 JarFile (java.util.jar.JarFile)1