This reverts commit 8c70f03122
.
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.
This commit is contained in:
parent
bb59efbfe6
commit
885ff90f62
|
@ -191,7 +191,7 @@ test_expect_success TWO_REPOS \
|
||||||
test_expect_success TWO_REPOS \
|
test_expect_success TWO_REPOS \
|
||||||
"TWO_REPOS: should have data for the two repositories" '
|
"TWO_REPOS: should have data for the two repositories" '
|
||||||
for repo in sourcecred/example-git sourcecred/example-github; do
|
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
|
test -s "${data_dir}/${repo}/${file}" || return
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type {StaticPluginAdapter} from "./pluginAdapter";
|
import type {StaticPluginAdapter} from "./pluginAdapter";
|
||||||
|
import {StaticPluginAdapter as GitAdapter} from "../plugins/git/pluginAdapter";
|
||||||
import {StaticPluginAdapter as GithubAdapter} from "../plugins/github/pluginAdapter";
|
import {StaticPluginAdapter as GithubAdapter} from "../plugins/github/pluginAdapter";
|
||||||
|
|
||||||
export function defaultStaticAdapters(): $ReadOnlyArray<StaticPluginAdapter> {
|
export function defaultStaticAdapters(): $ReadOnlyArray<StaticPluginAdapter> {
|
||||||
return [new GithubAdapter()];
|
return [new GitAdapter(), new GithubAdapter()];
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import {loadGithubData} from "../../plugins/github/loadGithubData";
|
||||||
import {loadGitData} from "../../plugins/git/loadGitData";
|
import {loadGitData} from "../../plugins/git/loadGitData";
|
||||||
import {
|
import {
|
||||||
pluginNames,
|
pluginNames,
|
||||||
defaultPlugins,
|
|
||||||
nodeMaxOldSpaceSizeFlag,
|
nodeMaxOldSpaceSizeFlag,
|
||||||
sourcecredDirectoryFlag,
|
sourcecredDirectoryFlag,
|
||||||
} from "../common";
|
} from "../common";
|
||||||
|
@ -40,8 +39,7 @@ export default class PluginGraphCommand extends Command {
|
||||||
|
|
||||||
static flags = {
|
static flags = {
|
||||||
plugin: flags.string({
|
plugin: flags.string({
|
||||||
description:
|
description: "plugin whose data to load (loads all plugins if not set)",
|
||||||
"plugin whose data to load (loads default plugins if not set)",
|
|
||||||
required: false,
|
required: false,
|
||||||
options: pluginNames(),
|
options: pluginNames(),
|
||||||
}),
|
}),
|
||||||
|
@ -68,7 +66,7 @@ export default class PluginGraphCommand extends Command {
|
||||||
} = this.parse(PluginGraphCommand);
|
} = this.parse(PluginGraphCommand);
|
||||||
const repo = stringToRepo(args.repo);
|
const repo = stringToRepo(args.repo);
|
||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
loadDefaultPlugins({
|
loadAllPlugins({
|
||||||
basedir,
|
basedir,
|
||||||
plugin,
|
plugin,
|
||||||
repo,
|
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) {
|
if (githubToken == null) {
|
||||||
// TODO: This check should be abstracted so that plugins can
|
// TODO: This check should be abstracted so that plugins can
|
||||||
// specify their argument dependencies and get nicely
|
// specify their argument dependencies and get nicely
|
||||||
|
@ -91,7 +89,7 @@ function loadDefaultPlugins({basedir, repo, githubToken, maxOldSpaceSize}) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tasks = [
|
const tasks = [
|
||||||
...defaultPlugins().map((pluginName) => ({
|
...pluginNames().map((pluginName) => ({
|
||||||
id: `load-${pluginName}`,
|
id: `load-${pluginName}`,
|
||||||
cmd: [
|
cmd: [
|
||||||
"node",
|
"node",
|
||||||
|
|
|
@ -9,10 +9,6 @@ export function pluginNames(): PluginName[] {
|
||||||
return ["github", "git"];
|
return ["github", "git"];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function defaultPlugins(): PluginName[] {
|
|
||||||
return ["github"];
|
|
||||||
}
|
|
||||||
|
|
||||||
function defaultStorageDirectory() {
|
function defaultStorageDirectory() {
|
||||||
return path.join(os.tmpdir(), "sourcecred");
|
return path.join(os.tmpdir(), "sourcecred");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue