| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 475d6e1 commit 6473261
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,13 +20,13 @@ In the guides directory, we like to keep our NodeGit relative to the project | |||
| 20 | 20 | root. | |
| 21 | 21 | ||
| 22 | 22 | ``` javascript | |
| 23 | - var Git = require('../../../'); | ||
| 23 | + var Git = require("../../../"); | ||
| 24 | 24 | ``` | |
| 25 | 25 | ||
| 26 | 26 | However, in your project you will most likely be using the following command: | |
| 27 | 27 | ||
| 28 | 28 | ``` javascript | |
| 29 | - var Git = require('nodegit'); | ||
| 29 | + var Git = require("nodegit"); | ||
| 30 | 30 | ``` | |
| 31 | 31 | ||
| 32 | 32 | ### Clone URL | |
@@ -38,7 +38,7 @@ You could easily substitute this with any valid http or https Git repository | |||
| 38 | 38 | URL. | |
| 39 | 39 | ||
| 40 | 40 | ``` javascript | |
| 41 | - var cloneURL = 'https://github.com/nodegit/test'; | ||
| 41 | + var cloneURL = "https://github.com/nodegit/test"; | ||
| 42 | 42 | ``` | |
| 43 | 43 | ||
| 44 | 44 | ### Clone path | |
@@ -52,7 +52,7 @@ current working directory in NodeGit, so you will need to normalize it first. | |||
| 52 | 52 | This is very simple in Node: | |
| 53 | 53 | ||
| 54 | 54 | ``` javascript | |
| 55 | - var localPath = require('path').join(__dirname, 'tmp'); | ||
| 55 | + var localPath = require("path").join(__dirname, "tmp"); | ||
| 56 | 56 | ``` | |
| 57 | 57 | ||
| 58 | 58 | Now this `tmp` directory will be created along side your script, no matter how | |
@@ -120,7 +120,7 @@ and work with the `Git.Repository` instance result. | |||
| 120 | 120 | cloneRepository.catch(errorAndAttemptOpen) | |
| 121 | 121 | .then(function(repository) { | |
| 122 | 122 | // Access any repository methods here. | |
| 123 | - console.log('Is the repository bare? %s', Boolean(repository.isBare())); | ||
| 123 | + console.log("Is the repository bare? %s", Boolean(repository.isBare())); | ||
| 124 | 124 | }); | |
| 125 | 125 | ``` | |
| 126 | 126 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,19 +1,19 @@ | |||
| 1 | - // Require in NodeGit, since we want to use the local copy, we're using a | ||
| 1 | + // Require in NodeGit, since we want to use the local copy, we"re using a | ||
| 2 | 2 | // relative path. In your project, you will use: | |
| 3 | 3 | // | |
| 4 | - // var NodeGit = require('nodegit'); | ||
| 5 | - var Git = require('../../../'); | ||
| 4 | + // var NodeGit = require("nodegit"); | ||
| 5 | + var Git = require("../../../"); | ||
| 6 | 6 | ||
| 7 | 7 | // To clone with two factor auth enabled, you have to use a GitHub OAuth token | |
| 8 | 8 | // over HTTPS. | |
| 9 | - var GITHUB_TOKEN = '<GH_TOKEN>'; | ||
| 9 | + var GITHUB_TOKEN = "<GH_TOKEN>"; | ||
| 10 | 10 | ||
| 11 | 11 | // Using the `clone` method from the `Git.Clone` module, bring down the NodeGit | |
| 12 | 12 | // test repository from GitHub. | |
| 13 | - var cloneURL = 'https://github.com/nodegit/private'; | ||
| 13 | + var cloneURL = "https://github.com/nodegit/private"; | ||
| 14 | 14 | ||
| 15 | 15 | // Ensure that the `tmp` directory is local to this file and not the CWD. | |
| 16 | - var localPath = require('path').join(__dirname, 'tmp'); | ||
| 16 | + var localPath = require("path").join(__dirname, "tmp"); | ||
| 17 | 17 | ||
| 18 | 18 | // Simple object to store clone options. | |
| 19 | 19 | var cloneOptions = {}; | |
@@ -23,12 +23,12 @@ var cloneOptions = {}; | |||
| 23 | 23 | cloneOptions.remoteCallbacks = { | |
| 24 | 24 | certificateCheck: function() { return 1; }, | |
| 25 | 25 | credentials: function() { | |
| 26 | - return Git.Cred.userpassPlaintextNew(GITHUB_TOKEN, 'x-oauth-basic'); | ||
| 26 | + return Git.Cred.userpassPlaintextNew(GITHUB_TOKEN, "x-oauth-basic"); | ||
| 27 | 27 | } | |
| 28 | 28 | }; | |
| 29 | 29 | ||
| 30 | 30 | // Invoke the clone operation and store the returned Promise. | |
| 31 | - var cloneRepository = Git.Clone.clone(cloneURL, localPath, cloneOptions); | ||
| 31 | + var cloneRepository = Git.Clone(cloneURL, localPath, cloneOptions); | ||
| 32 | 32 | ||
| 33 | 33 | // If the repository already exists, the clone above will fail. You can simply | |
| 34 | 34 | // open the repository in this case to continue execution. | |
@@ -41,8 +41,5 @@ var errorAndAttemptOpen = function() { | |||
| 41 | 41 | cloneRepository.catch(errorAndAttemptOpen) | |
| 42 | 42 | .then(function(repository) { | |
| 43 | 43 | // Access any repository methods here. | |
| 44 | - console.log('Is the repository bare? %s', Boolean(repository.isBare())); | ||
| 45 | - }) | ||
| 46 | - .catch(function(ex) { | ||
| 47 | - console.log(ex, ex.stack); | ||
| 44 | + console.log("Is the repository bare? %s", Boolean(repository.isBare())); | ||
| 48 | 45 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,13 +24,13 @@ In the guides directory, we like to keep our NodeGit relative to the project | |||
| 24 | 24 | root. | |
| 25 | 25 | ||
| 26 | 26 | ``` javascript | |
| 27 | - var Git = require('../../../'); | ||
| 27 | + var Git = require("../../../"); | ||
| 28 | 28 | ``` | |
| 29 | 29 | ||
| 30 | 30 | However, in your project you will most likely be using the following command: | |
| 31 | 31 | ||
| 32 | 32 | ``` javascript | |
| 33 | - var Git = require('nodegit'); | ||
| 33 | + var Git = require("nodegit"); | ||
| 34 | 34 | ``` | |
| 35 | 35 | ||
| 36 | 36 | ### Clone URL | |
@@ -42,7 +42,7 @@ You could easily substitute this with any valid http or https Git repository | |||
| 42 | 42 | URL. | |
| 43 | 43 | ||
| 44 | 44 | ``` javascript | |
| 45 | - var cloneURL = 'https://github.com/nodegit/test'; | ||
| 45 | + var cloneURL = "https://github.com/nodegit/test"; | ||
| 46 | 46 | ``` | |
| 47 | 47 | ||
| 48 | 48 | ### Clone path | |
@@ -56,7 +56,7 @@ current working directory in NodeGit, so you will need to normalize it first. | |||
| 56 | 56 | This is very simple in Node: | |
| 57 | 57 | ||
| 58 | 58 | ``` javascript | |
| 59 | - var localPath = require('path').join(__dirname, 'tmp'); | ||
| 59 | + var localPath = require("path").join(__dirname, "tmp"); | ||
| 60 | 60 | ``` | |
| 61 | 61 | ||
| 62 | 62 | Now this `tmp` directory will be created along side your script, no matter how | |
@@ -124,6 +124,6 @@ and work with the `Git.Repository` instance result. | |||
| 124 | 124 | cloneRepository.catch(errorAndAttemptOpen) | |
| 125 | 125 | .then(function(repository) { | |
| 126 | 126 | // Access any repository methods here. | |
| 127 | - console.log('Is the repository bare? %s', Boolean(repository.isBare())); | ||
| 127 | + console.log("Is the repository bare? %s", Boolean(repository.isBare())); | ||
| 128 | 128 | }); | |
| 129 | 129 | ``` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,15 @@ | |||
| 1 | - // Require in NodeGit, since we want to use the local copy, we're using a | ||
| 1 | + // Require in NodeGit, since we want to use the local copy, we"re using a | ||
| 2 | 2 | // relative path. In your project, you will use: | |
| 3 | 3 | // | |
| 4 | - // var NodeGit = require('nodegit'); | ||
| 5 | - var Git = require('../../../'); | ||
| 4 | + // var NodeGit = require("nodegit"); | ||
| 5 | + var Git = require("../../../"); | ||
| 6 | 6 | ||
| 7 | 7 | // Using the `clone` method from the `Git.Clone` module, bring down the NodeGit | |
| 8 | 8 | // test repository from GitHub. | |
| 9 | - var cloneURL = 'https://github.com/nodegit/test'; | ||
| 9 | + var cloneURL = "https://github.com/nodegit/test"; | ||
| 10 | 10 | ||
| 11 | 11 | // Ensure that the `tmp` directory is local to this file and not the CWD. | |
| 12 | - var localPath = require('path').join(__dirname, 'tmp'); | ||
| 12 | + var localPath = require("path").join(__dirname, "tmp"); | ||
| 13 | 13 | ||
| 14 | 14 | // Simple object to store clone options. | |
| 15 | 15 | var cloneOptions = {}; | |
@@ -21,7 +21,7 @@ cloneOptions.remoteCallbacks = { | |||
| 21 | 21 | }; | |
| 22 | 22 | ||
| 23 | 23 | // Invoke the clone operation and store the returned Promise. | |
| 24 | - var cloneRepository = Git.Clone.clone(cloneURL, localPath, cloneOptions); | ||
| 24 | + var cloneRepository = Git.Clone(cloneURL, localPath, cloneOptions); | ||
| 25 | 25 | ||
| 26 | 26 | // If the repository already exists, the clone above will fail. You can simply | |
| 27 | 27 | // open the repository in this case to continue execution. | |
@@ -34,5 +34,5 @@ var errorAndAttemptOpen = function() { | |||
| 34 | 34 | cloneRepository.catch(errorAndAttemptOpen) | |
| 35 | 35 | .then(function(repository) { | |
| 36 | 36 | // Access any repository methods here. | |
| 37 | - console.log('Is the repository bare? %s', Boolean(repository.isBare())); | ||
| 37 | + console.log("Is the repository bare? %s", Boolean(repository.isBare())); | ||
| 38 | 38 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments