Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Add success messages for each command that needs one #57

Merged
merged 1 commit into from
Aug 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions bin/idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,14 @@ function init(cb) {
serviceName: pascalCase(name)
});

fs.writeFile(filePath, contents, 'utf8', cb);
fs.writeFile(filePath, contents, 'utf8', done);

function done(err) {
if (err) {
return cb(err);
}
cb(null, 'Created thrift file: ' + filePath);
}
}
}

Expand Down Expand Up @@ -591,7 +598,18 @@ function fetch(service, cb) {
if (err) {
return cb(err);
}
series(dependencies.map(makeFetcher), cb);
series(dependencies.map(makeFetcher), done);
}

function done(err) {
if (err) {
return cb(err);
}
cb(null, 'Fetched to ' + path.join(
self.cwd,
self.idlDirectory,
service
));
}

function makeFetcher(dependency) {
Expand Down Expand Up @@ -758,12 +776,19 @@ function publish(cb) {
timestamp: self.meta.time(),
cwd: self.repoCacheLocation,
logger: self.logger
}, cb);
}, done);

function getFilepath(filename) {
return path.join(destination, filename);
}
}

function done(err) {
if (err) {
return cb(err);
}
cb(null, 'Published ' + source);
}
}

function update(cb) {
Expand All @@ -785,14 +810,21 @@ function update(cb) {
}

var remotes = Object.keys(clientMetaFile.toJSON().remotes);
series(remotes.map(function buildThunk(remote) {
series(remotes.map(buildThunk), onResults);

function buildThunk(remote) {
return self.fetch.bind(self, remote);
}), function onResults(updateErr, results) {
}

function onResults(updateErr, results) {
if (updateErr) {
return cb(updateErr);
}
cb();
});
cb(null, 'Updated all IDL files in ' + path.join(
self.cwd,
self.idlDirectory
));
}
}
}

Expand Down