Skip to content
Browse files

Merge pull request #206 from nodegit/more_remote_methods

Added additional remote methods
  • Loading branch information...
2 parents 8de1cd5 + 1528a01 commit b8a94aefb22d0534cc0e5acf533989c13d8725dc @tbranyen tbranyen committed Jul 19, 2014
Showing with 85 additions and 7 deletions.
  1. +3 −1 .jshintrc
  2. +28 −1 generate/descriptor.json
  3. +12 −0 generate/types.json
  4. +42 −5 test/tests/remote.js
View
4 .jshintrc
@@ -18,6 +18,8 @@
"it": true,
"describe": true,
"before": true,
- "beforeEach": true
+ "beforeEach": true,
+ "after": true,
+ "afterEach": true
}
}
View
29 generate/descriptor.json
@@ -555,11 +555,38 @@
}
},
- "git_remote_load": {
+ "git_remote_create": {
"ignore": false,
"isConstructorMethod": true
},
+ "git_remote_rename": {
+ "ignore": false
+ },
+
+ "git_remote_name": {
+ "ignore": false,
+ "args": [{ "isSelf": true }]
+ },
+
+ "git_remote_pushurl": {
+ "ignore": false,
+ "args": [{ "isSelf": true }]
+ },
+
+ "git_remote_load": {
+ "ignore": false,
+ "isConstructorMethod": true,
+ "return": {
+ "copy": "git_remote_dup"
+ }
+ },
+
+ "git_remote_delete": {
+ "ignore": false,
+ "args": [{ "isReturn": false, "isSelf": true }]
+ },
+
"git_remote_url": {
"ignore": false,
"args": [{ "isSelf": true }]
View
12 generate/types.json
@@ -9055,5 +9055,17 @@
"const git_strarray **": {
"cpp": "GitStrarray",
"js": "Strarray"
+ },
+ "git_remote_delete": {
+ "cpp": "Delete",
+ "js": "delete"
+ },
+ "git_remote_delete *": {
+ "cpp": "Delete",
+ "js": "delete"
+ },
+ "const git_remote_delete *": {
+ "cpp": "Delete",
+ "js": "delete"
}
}
View
47 test/tests/remote.js
@@ -1,7 +1,7 @@
var assert = require("assert");
var path = require("path");
-describe("Repository", function() {
+describe("Remote", function() {
var reposPath = path.resolve("test/repos/workdir/.git");
var Repository = require("../../lib/repository");
@@ -12,13 +12,50 @@ describe("Repository", function() {
return Repository.open(reposPath).then(function(repository) {
test.repository = repository;
+
+ return Remote.load(repository, "origin").then(function(remote) {
+ test.remote = remote;
+ });
+ });
+ });
+
+ after(function() {
+ return Remote.load(this.repository, "origin2").then(function(remote) {
+ remote.delete();
});
});
- it("can read git remote url", function() {
- return Remote.load(this.repository, "origin").then(function(remote) {
- assert.ok(remote instanceof Remote);
- assert.equal(remote.url(), "https://github.com/nodegit/nodegit");
+ it("can load a remote", function() {
+ assert.ok(this.remote instanceof Remote);
+ });
+
+ it("can read the remote url", function() {
+ assert.equal(this.remote.url(), "https://github.com/nodegit/nodegit");
+ });
+
+ it("can read the remote name", function() {
+ assert.equal(this.remote.name(), "origin");
+ });
+
+ it("can create a new remote", function() {
+ var repository = this.repository;
+ var url = "https://github.com/nodegit/nodegit";
+
+ return Remote.create(repository, "origin2", url).then(function() {
+ return Remote.load(repository, "origin2").then(function(remote) {
+ assert(remote.url(), "https://github.com/nodegit/nodegit");
+ });
+ });
+ });
+
+ it("can delete a remote", function() {
+ var repository = this.repository;
+ var url = "https://github.com/nodegit/nodegit";
+
+ return Remote.create(repository, "origin3", url).then(function() {
+ return Remote.load(repository, "origin3").then(function(remote) {
+ remote.delete();
+ });
});
});
});

0 comments on commit b8a94ae

Please sign in to comment.
Something went wrong with that request. Please try again.