Skip to content

Commit

Permalink
Merge pull request trufflesuite#132 from trufflesuite/compile-before-…
Browse files Browse the repository at this point in the history
…exec

Compile contracts before running exec
  • Loading branch information
cgewecke authored Apr 24, 2018
2 parents 6934e6f + 54360b5 commit 88a0d21
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/truffle-core/lib/commands/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ var command = {
builder: {
file: {
type: "string"
},
c: {
type: "boolean",
default: false
},
compile: {
type: "boolean",
default: false
}
},
run: function (options, done) {
var Config = require("truffle-config");
var Contracts = require("truffle-workflow-compile");
var ConfigurationError = require("../errors/configurationerror");
var Require = require("truffle-require");
var Environment = require("../environment");
Expand Down Expand Up @@ -38,6 +47,18 @@ var command = {
config.logger.log("Using network '" + config.network + "'." + OS.EOL);
}

// `--compile`
if (options.c || options.compile){
return Contracts.compile(config, function(err){
if(err) return done(err);

Require.exec(config.with({
file: file
}), done);
});
};

// Just exec
Require.exec(config.with({
file: file
}), done);
Expand Down

0 comments on commit 88a0d21

Please sign in to comment.