diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-09 10:43:12 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-09 10:43:12 +0100 |
commit | 34fc2831e0cf0fed01c71cec28d93472d87f455b (patch) | |
tree | a803cc907c20491ba02863b5d3dd5aedf6bfed10 /bin/platform.js | |
parent | e1594cde2c32e4ff48f6c4eff3d3d461743d74e1 (diff) | |
parent | 1bf68a5aa0703b5a1815cfe4ebb731b5fb6ed9d2 (diff) | |
download | gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.zip gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.tar.gz gitbook-34fc2831e0cf0fed01c71cec28d93472d87f455b.tar.bz2 |
Merge branch 'version/2.0'
Diffstat (limited to 'bin/platform.js')
-rw-r--r-- | bin/platform.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/bin/platform.js b/bin/platform.js deleted file mode 100644 index 35d581d..0000000 --- a/bin/platform.js +++ /dev/null @@ -1,53 +0,0 @@ -var Q = require("q"); -var utils = require("./utils"); - -var publish = function(folder) { - if (!folder) { - console.log("Need a repository folder"); - return process.exit(-1); - } - - utils.gitCmd("push", ["gitbook", "master"]) - .then(function(out) { - console.log(out.stdout); - }, function(err) { - if (err.code == 128) { - console.log("No book on gitbook.com is configured with this git repository."); - console.log("Run 'gitbook git:remote username/book' to intialize this repository."); - } else { - console.log(err.message); - } - process.exit(-1); - }); -}; - -var remote = function(folder, bookId) { - if (!folder || !bookId) { - console.log("Need a repository folder and a book id"); - return process.exit(-1); - } - - var url = "https://git.gitbook.com/"+bookId+".git"; - var addRemote = function() { - return utils.gitCmd("remote", ["add", "gitbook", url]); - } - - addRemote() - .fail(function(err) { - if (err.code == 128) { - return utils.gitCmd("remote", ["rm", "gitbook"]).then(addRemote); - } - return Q.reject(err); - }) - .then(function(out) { - console.log("Book remote '"+url+"' added to the folder"); - }, function(err) { - console.log(err.message); - process.exit(-1); - }); -}; - -module.exports = { - publish: publish, - remote: remote -}; |