From 61635a14a748a8ed9ffe885e89b2caa0fc046e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Mon, 7 May 2018 16:15:00 -0700 Subject: [PATCH] Remove redundant scripts (#225) Our SourceCred CLI tool now ipmlements printCombinedGraph and cloneAndPrintGitGraph, but with more principled implementations and interfaces :) Test plan: `yarn travis --full` passes, so I didn't delete any needed test infra. --- config/paths.js | 4 -- src/plugins/git/bin/cloneAndPrintGitGraph.js | 36 ----------------- src/tools/bin/printCombinedGraph.js | 42 -------------------- 3 files changed, 82 deletions(-) delete mode 100644 src/plugins/git/bin/cloneAndPrintGitGraph.js delete mode 100644 src/tools/bin/printCombinedGraph.js diff --git a/config/paths.js b/config/paths.js index 3f4ed8b..4b509d4 100644 --- a/config/paths.js +++ b/config/paths.js @@ -65,10 +65,6 @@ module.exports = { "src/plugins/github/bin/fetchAndPrintGithubRepo.js" ), createExampleRepo: resolveApp("src/plugins/git/bin/createExampleRepo.js"), - cloneAndPrintGitGraph: resolveApp( - "src/plugins/git/bin/cloneAndPrintGitGraph.js" - ), - printCombinedGraph: resolveApp("src/tools/bin/printCombinedGraph.js"), loadAndPrintGitRepository: resolveApp( "src/plugins/git/bin/loadAndPrintRepository.js" ), diff --git a/src/plugins/git/bin/cloneAndPrintGitGraph.js b/src/plugins/git/bin/cloneAndPrintGitGraph.js deleted file mode 100644 index 140314e..0000000 --- a/src/plugins/git/bin/cloneAndPrintGitGraph.js +++ /dev/null @@ -1,36 +0,0 @@ -// @flow - -/* - * Command-line utility to load Git data using the API in - * ../cloneGitGraph, and print it to stdout. Useful for testing or - * saving some data to disk. - * - * Usage: - * - * node bin/cloneAndPrintGitGraph.js REPO_OWNER REPO_NAME - * - */ - -import cloneGitGraph from "../cloneGitGraph"; -import stringify from "json-stable-stringify"; - -function parseArgs() { - const argv = process.argv.slice(2); - const fail = () => { - const invocation = process.argv.slice(0, 2).join(" "); - throw new Error(`Usage: ${invocation} REPO_OWNER REPO_NAME`); - }; - if (argv.length !== 2) { - fail(); - } - const [repoOwner, repoName] = argv; - return {repoOwner, repoName}; -} - -function main() { - const {repoOwner, repoName} = parseArgs(); - const graph = cloneGitGraph(repoOwner, repoName); - console.log(stringify(graph, {space: 4})); -} - -main(); diff --git a/src/tools/bin/printCombinedGraph.js b/src/tools/bin/printCombinedGraph.js deleted file mode 100644 index f8fb137..0000000 --- a/src/tools/bin/printCombinedGraph.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Command-line utility to fetch data for multiple plugins and print a combined - * graph. Currently imports data from the Git and GitHub plugins. - * - * Usage: - * - * node bin/printCombinedGraph.js REPO_OWNER REPO_NAME TOKEN - * - * where TOKEN is a GitHub authentication token, as generated from - * https://github.com/settings/tokens/new. - */ - -import stringify from "json-stable-stringify"; -import {loadCombinedGraph} from "../loadCombinedGraph"; - -function parseArgs() { - const argv = process.argv.slice(2); - const fail = () => { - const invocation = process.argv.slice(0, 2).join(" "); - throw new Error(`Usage: ${invocation} REPO_OWNER REPO_NAME TOKEN`); - }; - if (argv.length !== 3) { - fail(); - } - const [repoOwner, repoName, token] = argv; - return {repoOwner, repoName, token}; -} - -function main() { - const {repoOwner, repoName, token} = parseArgs(); - loadCombinedGraph(repoOwner, repoName, token) - .then((data) => { - console.log(stringify(data, {space: 4})); - }) - .catch((errors) => { - console.error("Errors processing the result:"); - console.error(errors); - process.exit(1); - }); -} - -main();