| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
60 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,10 @@ | |||
| 1 | 1 | var nodegit = require("../"); | |
| 2 | 2 | var path = require("path"); | |
| 3 | - var promisify = require("promisify-node"); | ||
| 4 | - var fse = promisify(require("fs-extra")); | ||
| 3 | + var promisify = require("thenify-all"); | ||
| 4 | + var fse = promisify(require("fs-extra"), ["ensureDir", "writeFile"]); | ||
| 5 | 5 | var fileName = "newfile.txt"; | |
| 6 | 6 | var fileContent = "hello world"; | |
| 7 | 7 | var directoryName = "salad/toast/strangerinastrangeland/theresnowaythisexists"; | |
| 8 | - // ensureDir is an alias to mkdirp, which has the callback with a weird name | ||
| 9 | - // and in the 3rd position of 4 (the 4th being used for recursion). We have to | ||
| 10 | - // force promisify it, because promisify-node won't detect it on its | ||
| 11 | - // own and assumes sync | ||
| 12 | - fse.ensureDir = promisify(fse.ensureDir); | ||
| 13 | 8 | ||
| 14 | 9 | /** | |
| 15 | 10 | * This example creates a certain file `newfile.txt`, adds it to the git | |
@@ -71,6 +66,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 71 | 66 | ||
| 72 | 67 | return repo.createCommit("HEAD", author, committer, "message", oid, [parent]); | |
| 73 | 68 | }) | |
| 74 | - .done(function(commitId) { | ||
| 69 | + .then(function(commitId) { | ||
| 75 | 70 | console.log("New Commit: ", commitId); | |
| 76 | 71 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | var nodegit = require("../"); | |
| 2 | - var promisify = require("promisify-node"); | ||
| 3 | - var fse = promisify(require("fs-extra")); | ||
| 2 | + var promisify = require("thenify-all"); | ||
| 3 | + var fse = promisify(require("fs-extra"), ["remove"]); | ||
| 4 | 4 | var path = "/tmp/nodegit-clone-demo"; | |
| 5 | 5 | ||
| 6 | 6 | fse.remove(path).then(function() { | |
@@ -28,7 +28,7 @@ fse.remove(path).then(function() { | |||
| 28 | 28 | entry = entryResult; | |
| 29 | 29 | return entry.getBlob(); | |
| 30 | 30 | }) | |
| 31 | - .done(function(blob) { | ||
| 31 | + .then(function(blob) { | ||
| 32 | 32 | console.log(entry.filename(), entry.sha(), blob.rawsize() + "b"); | |
| 33 | 33 | console.log("========================================================\n\n"); | |
| 34 | 34 | var firstTenLines = blob.toString().split("\n").slice(0, 10).join("\n"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | var nodegit = require("../"); | |
| 2 | - var promisify = require("promisify-node"); | ||
| 3 | - var fse = promisify(require("fs-extra")); | ||
| 2 | + var promisify = require("thenify-all"); | ||
| 3 | + var fse = promisify(require("fs-extra"), ["remove"]); | ||
| 4 | 4 | var path = "/tmp/nodegit-github-2factor-demo"; | |
| 5 | 5 | ||
| 6 | 6 | var token = "{Your GitHub user token}"; | |
@@ -35,7 +35,7 @@ var opts = { | |||
| 35 | 35 | ||
| 36 | 36 | fse.remove(path).then(function() { | |
| 37 | 37 | nodegit.Clone(repoUrl, path, opts) | |
| 38 | - .done(function(repo) { | ||
| 38 | + .then(function(repo) { | ||
| 39 | 39 | if (repo instanceof nodegit.Repository) { | |
| 40 | 40 | console.info("We cloned the repo!"); | |
| 41 | 41 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 13 | 13 | repo.defaultSignature(), | |
| 14 | 14 | "Created new-branch on HEAD"); | |
| 15 | 15 | }); | |
| 16 | - }).done(function() { | ||
| 16 | + }).then(function() { | ||
| 17 | 17 | console.log("All done!"); | |
| 18 | 18 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,13 +1,11 @@ | |||
| 1 | 1 | var nodegit = require("../"); | |
| 2 | 2 | var path = require("path"); | |
| 3 | - var promisify = require("promisify-node"); | ||
| 4 | - var fse = promisify(require("fs-extra")); | ||
| 3 | + var promisify = require("thenify-all"); | ||
| 4 | + var fse = promisify(require("fs-extra"), ["ensureDir", "writeFile"]); | ||
| 5 | 5 | var fileName = "newfile.txt"; | |
| 6 | 6 | var fileContent = "hello world"; | |
| 7 | 7 | var repoDir = "../../newRepo"; | |
| 8 | 8 | ||
| 9 | - fse.ensureDir = promisify(fse.ensureDir); | ||
| 10 | - | ||
| 11 | 9 | var repository; | |
| 12 | 10 | var index; | |
| 13 | 11 | ||
@@ -45,6 +43,6 @@ fse.ensureDir(path.resolve(__dirname, repoDir)) | |||
| 45 | 43 | // normal we don't get the head either, because there isn't one yet. | |
| 46 | 44 | return repository.createCommit("HEAD", author, committer, "message", oid, []); | |
| 47 | 45 | }) | |
| 48 | - .done(function(commitId) { | ||
| 46 | + .then(function(commitId) { | ||
| 49 | 47 | console.log("New Commit: ", commitId); | |
| 50 | 48 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 24 | 24 | }); | |
| 25 | 25 | }); | |
| 26 | 26 | }) | |
| 27 | - .done(function() { | ||
| 27 | + .then(function() { | ||
| 28 | 28 | console.log("Done!"); | |
| 29 | 29 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 18 | 18 | ||
| 19 | 19 | return commit.getDiff(); | |
| 20 | 20 | }) | |
| 21 | - .done(function(diffList) { | ||
| 21 | + .then(function(diffList) { | ||
| 22 | 22 | diffList.forEach(function(diff) { | |
| 23 | 23 | diff.patches().then(function(patches) { | |
| 24 | 24 | patches.forEach(function(patch) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 8 | 8 | return nodegit.Cred.sshKeyFromAgent(userName); | |
| 9 | 9 | } | |
| 10 | 10 | }); | |
| 11 | - }).done(function() { | ||
| 11 | + }).then(function() { | ||
| 12 | 12 | console.log("It worked!"); | |
| 13 | 13 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | var nodegit = require("../"); | |
| 2 | 2 | var path = require("path"); | |
| 3 | - var Promise = require("nodegit-promise"); | ||
| 3 | + var Promise = require("bluebird"); | ||
| 4 | 4 | var oid; | |
| 5 | 5 | var odb; | |
| 6 | 6 | var repo; | |
@@ -362,6 +362,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 362 | 362 | return Promise.all(promises); | |
| 363 | 363 | }) | |
| 364 | 364 | ||
| 365 | - .done(function() { | ||
| 365 | + .then(function() { | ||
| 366 | 366 | console.log("Done!"); | |
| 367 | 367 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,8 @@ | |||
| 1 | 1 | var nodegit = require("../"); | |
| 2 | 2 | var path = require("path"); | |
| 3 | - var Promise = require("nodegit-promise"); | ||
| 4 | - var promisify = require("promisify-node"); | ||
| 5 | - var fse = promisify(require("fs-extra")); | ||
| 3 | + var Promise = require("bluebird"); | ||
| 4 | + var promisify = require("thenify-all"); | ||
| 5 | + var fse = promisify(require("fs-extra"), ["writeFile"]); | ||
| 6 | 6 | ||
| 7 | 7 | nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |
| 8 | 8 | .then(function(repo) { | |
@@ -129,6 +129,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git")) | |||
| 129 | 129 | console.log("New files in index: " + newFiles.length); | |
| 130 | 130 | }); | |
| 131 | 131 | }); | |
| 132 | - }).done(function() { | ||
| 132 | + }).then(function() { | ||
| 133 | 133 | console.log("All done!"); | |
| 134 | 134 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments