From 9e469cc83ed0c7ef778c57e6ce20b83697522b6c Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 22 Mar 2018 10:43:29 -0400 Subject: [PATCH] Initial commit for graphviz functionality - Added required packages - Added command to cmd.js - Created graph.js to contain graph logic --- lib/cmd.js | 15 +++++++++++++++ lib/cmds/graph.js | 17 +++++++++++++++++ lib/index.js | 7 +++++++ package.json | 3 +++ 4 files changed, 42 insertions(+) create mode 100644 lib/cmds/graph.js diff --git a/lib/cmd.js b/lib/cmd.js index ab76482a..2977d69e 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -18,6 +18,7 @@ class Cmd { this.simulator(); this.test(); this.reset(); + this.graph(); this.upload(); this.versionCmd(); this.otherCommands(); @@ -171,6 +172,19 @@ class Cmd { }); } + graph() { + program + .command('graph [environment]') + .description('generates documentation based on the smart contracts configured') + .action(function (env, options) { + embark.initConfig(env || 'development', { + embarkConfig: 'embark.json', + interceptLogs: false + }); + embark.graph(); + }); + } + reset() { program .command('reset') @@ -206,6 +220,7 @@ class Cmd { process.exit(0); }); } + } diff --git a/lib/cmds/graph.js b/lib/cmds/graph.js new file mode 100644 index 00000000..dba9c2aa --- /dev/null +++ b/lib/cmds/graph.js @@ -0,0 +1,17 @@ +const fs = require("fs"); +const klaw = require('klaw'); +const path = require('path'); +const SolidityParser = require("solidity-parser"); +const Viz = require('viz.js'); + +class GraphGenerator { + constructor(config) { + this.config = config; + } + + generate() { + console.log("TODO"); + } +} + +module.exports = GraphGenerator; diff --git a/lib/index.js b/lib/index.js index e08870ae..14a78911 100644 --- a/lib/index.js +++ b/lib/index.js @@ -185,6 +185,13 @@ class Embark { return new Test(options); } + graph() { + const GraphGenerator = new require('./cmds/graph.js'); + console.log(this.config); + let graphGen = new GraphGenerator(this.config); + graphGen.generate(); + } + reset() { let resetCmd = require('./cmds/reset.js'); resetCmd(); diff --git a/package.json b/package.json index 9de8bab9..7807007d 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "globule": "^1.1.0", "http-shutdown": "^1.2.0", "ipfs-api": "17.2.4", + "klaw": "^2.1.1", "merge": "^1.2.0", "mocha": "^2.2.5", "orbit-db": "^0.17.3", @@ -51,12 +52,14 @@ "serve-static": "^1.11.1", "shelljs": "^0.5.0", "solc": "0.4.17", + "solidity-parser": "^0.4.0", "style-loader": "^0.19.0", "tar": "^3.1.5", "toposort": "^1.0.0", "underscore": "^1.8.3", "underscore.string": "^3.3.4", "url-loader": "^0.6.2", + "viz.js": "^1.8.1", "web3": "1.0.0-beta.27", "webpack": "^3.10.0", "window-size": "^1.1.0"