From 885ff90f62c98004e89e133d6619b7d7f9e0b4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Fri, 10 Aug 2018 11:40:20 -0700 Subject: [PATCH] Revert "Disable the Git plugin (#628)" (#633) This reverts commit 8c70f03122ed0de24ce7382dcb5fd098f199a9dd. Context: This introduced a serious bug (#631), so we're reverting it to get the codebase back in a working state. Meanwhile, I'll develop a principled solution. Test plan: I rebuilt the backend, re-loaded a graph, and loaded it in the frontend. PageRank, the cred explorer, and the weight config all work. Opening a pull request does not trigger a crash. --- sharness/test_build_static_site.t | 2 +- src/app/defaultPlugins.js | 3 ++- src/cli/commands/load.js | 10 ++++------ src/cli/common.js | 4 ---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/sharness/test_build_static_site.t b/sharness/test_build_static_site.t index 6e7ffb8..5f6ebb8 100755 --- a/sharness/test_build_static_site.t +++ b/sharness/test_build_static_site.t @@ -191,7 +191,7 @@ test_expect_success TWO_REPOS \ test_expect_success TWO_REPOS \ "TWO_REPOS: should have data for the two repositories" ' for repo in sourcecred/example-git sourcecred/example-github; do - for file in github/view.json; do + for file in git/graph.json github/view.json; do test -s "${data_dir}/${repo}/${file}" || return done done diff --git a/src/app/defaultPlugins.js b/src/app/defaultPlugins.js index c44c5e0..af00f28 100644 --- a/src/app/defaultPlugins.js +++ b/src/app/defaultPlugins.js @@ -1,8 +1,9 @@ // @flow import type {StaticPluginAdapter} from "./pluginAdapter"; +import {StaticPluginAdapter as GitAdapter} from "../plugins/git/pluginAdapter"; import {StaticPluginAdapter as GithubAdapter} from "../plugins/github/pluginAdapter"; export function defaultStaticAdapters(): $ReadOnlyArray { - return [new GithubAdapter()]; + return [new GitAdapter(), new GithubAdapter()]; } diff --git a/src/cli/commands/load.js b/src/cli/commands/load.js index ed6f384..e283436 100644 --- a/src/cli/commands/load.js +++ b/src/cli/commands/load.js @@ -10,7 +10,6 @@ import {loadGithubData} from "../../plugins/github/loadGithubData"; import {loadGitData} from "../../plugins/git/loadGitData"; import { pluginNames, - defaultPlugins, nodeMaxOldSpaceSizeFlag, sourcecredDirectoryFlag, } from "../common"; @@ -40,8 +39,7 @@ export default class PluginGraphCommand extends Command { static flags = { plugin: flags.string({ - description: - "plugin whose data to load (loads default plugins if not set)", + description: "plugin whose data to load (loads all plugins if not set)", required: false, options: pluginNames(), }), @@ -68,7 +66,7 @@ export default class PluginGraphCommand extends Command { } = this.parse(PluginGraphCommand); const repo = stringToRepo(args.repo); if (!plugin) { - loadDefaultPlugins({ + loadAllPlugins({ basedir, plugin, repo, @@ -81,7 +79,7 @@ export default class PluginGraphCommand extends Command { } } -function loadDefaultPlugins({basedir, repo, githubToken, maxOldSpaceSize}) { +function loadAllPlugins({basedir, repo, githubToken, maxOldSpaceSize}) { if (githubToken == null) { // TODO: This check should be abstracted so that plugins can // specify their argument dependencies and get nicely @@ -91,7 +89,7 @@ function loadDefaultPlugins({basedir, repo, githubToken, maxOldSpaceSize}) { return; } const tasks = [ - ...defaultPlugins().map((pluginName) => ({ + ...pluginNames().map((pluginName) => ({ id: `load-${pluginName}`, cmd: [ "node", diff --git a/src/cli/common.js b/src/cli/common.js index 4d4c87c..6fe081e 100644 --- a/src/cli/common.js +++ b/src/cli/common.js @@ -9,10 +9,6 @@ export function pluginNames(): PluginName[] { return ["github", "git"]; } -export function defaultPlugins(): PluginName[] { - return ["github"]; -} - function defaultStorageDirectory() { return path.join(os.tmpdir(), "sourcecred"); }