node-gitlab
Advanced tools
Comparing version 0.4.1 to 1.0.0
1.0.0 / 2014-10-12 | ||
================== | ||
* support promise and thunk. fixed #6 | ||
* test travis use node 0.11 | ||
* mv all resources to lib/resources | ||
0.4.1 / 2014-09-18 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -1,8 +0,12 @@ | ||
/*! | ||
/**! | ||
* gitlab - lib/gitlab.js | ||
* Copyright(c) 2012 - 2013 fengmk2 <fengmk2@gmail.com> | ||
* | ||
* Copyright(c) fengmk2 and other contributors. | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* fengmk2 <fengmk2@gmail.com> (http://fengmk2.github.com) | ||
*/ | ||
"use strict"; | ||
'use strict'; | ||
@@ -14,14 +18,5 @@ /** | ||
var debug = require('debug')('gitlab'); | ||
var restful = require('restful-client'); | ||
var RESTFulClient = require('restful-client').RESTFulClient; | ||
var util = require('util'); | ||
var Milestone = require('./milestone'); | ||
var Project = require('./project'); | ||
var Member = require('./member'); | ||
var GlobalHook = require('./globalHook.js'); | ||
var Issue = require('./issue'); | ||
var User = require('./user'); | ||
var Repository = require('./repository'); | ||
var MergeRequest = require('./merge_request'); | ||
var RepositoryFile = require('./repository_file'); | ||
var Group = require('./group'); | ||
var resources = require('./resources'); | ||
@@ -40,35 +35,14 @@ module.exports = Gitlab; | ||
options.api = options.api || 'https://gitlab.com/api/v3'; | ||
restful.RESTFulClient.call(this, options); | ||
RESTFulClient.call(this, options); | ||
this.privateToken = options.privateToken; | ||
this.addResources({ | ||
projects: Project, | ||
projectMembers: { | ||
resourcePath: '/projects/:id/members', | ||
idName: 'user_id', | ||
}, | ||
repository: Repository, | ||
repositoryFiles: RepositoryFile, | ||
mergeRequests: MergeRequest, | ||
users: User, | ||
issues: Issue, | ||
globalHooks: GlobalHook, | ||
members: Member, | ||
milestones: Milestone, | ||
hooks: { | ||
resourcePath: '/projects/:id/hooks', | ||
idName: 'hook_id', | ||
}, | ||
groupMembers: { | ||
resourcePath: '/groups/:id/members', | ||
idName: 'user_id', | ||
}, | ||
groups: Group | ||
}); | ||
this.addResources(resources); | ||
// mergeRequests => merge_requests | ||
this.merge_requests = this.mergeRequests; | ||
// members => projectMembers | ||
this.members = this.projectMembers; | ||
} | ||
util.inherits(Gitlab, restful.RESTFulClient); | ||
util.inherits(Gitlab, RESTFulClient); | ||
@@ -83,1 +57,11 @@ Gitlab.prototype.setAuthentication = function (req) { | ||
}; | ||
Gitlab.createPromise = function (options) { | ||
var client = Gitlab.create(options); | ||
return require('./promisify')(client); | ||
}; | ||
Gitlab.createThunk = function (options) { | ||
var client = Gitlab.create(options); | ||
return require('./thunkify')(client); | ||
}; |
{ | ||
"name": "node-gitlab", | ||
"version": "0.4.1", | ||
"version": "1.0.0", | ||
"description": "Gitlab API nodejs client.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec -t 20000 -r should-http test/*.test.js", | ||
"test-cov": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -t 20000 -r should-http test/*.test.js", | ||
"test-travis": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- -t 20000 -r should-http test/*.test.js", | ||
"test": "mocha --harmony -R spec -r co-mocha -t 20000 test/*.test.js", | ||
"test-cov": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -r co-mocha -t 20000 test/*.test.js", | ||
"test-travis": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- -r co-mocha -t 20000 test/*.test.js", | ||
"jshint": "jshint .", | ||
"autod": "autod -w --prefix '~' && npm run cnpm", | ||
"autod": "autod -w --prefix '~'", | ||
"cnpm": "npm install --registry=https://registry.npm.taobao.org", | ||
@@ -16,14 +16,15 @@ "contributors": "contributors -f plain -o AUTHORS" | ||
"dependencies": { | ||
"debug": "~1.0.4", | ||
"restful-client": "~1.0.0" | ||
"debug": "~2.0.0", | ||
"native-or-bluebird": "~1.1.1", | ||
"restful-client": "~1.0.0", | ||
"thunkify-wrap": "~1.0.2" | ||
}, | ||
"devDependencies": { | ||
"autod": "*", | ||
"blanket": "*", | ||
"contributors": "*", | ||
"coveralls": "*", | ||
"istanbul-harmony": "*", | ||
"mocha": "*", | ||
"co-mocha": "*", | ||
"pedding": "~1.0.0", | ||
"should": "~4.0.4", | ||
"should-http": "*" | ||
"should": "~4.0.4" | ||
}, | ||
@@ -30,0 +31,0 @@ "homepage": "https://github.com/repo-utils/gitlab", |
@@ -27,6 +27,4 @@ gitlab | ||
![logo](https://raw.github.com/repo-utils/gitlab/master/logo.png) | ||
Gitlab API Node.js client | ||
Gitlab API nodejs client. | ||
* [Gitlab API document](https://github.com/gitlabhq/gitlabhq/tree/master/doc/api) | ||
@@ -49,7 +47,47 @@ | ||
}); | ||
client.milestones.list({id: 1}, function (err, milestones) { | ||
console.log(milestones); | ||
console.log(err, milestones); | ||
}); | ||
``` | ||
### Thunk way | ||
Require [co](https://github.com/visionmedia/co) and node >= `0.11.12`: | ||
```js | ||
var co = require('co'); | ||
var gitlab = require('node-gitlab'); | ||
var client = gitlab.createThunk({ | ||
api: 'https://gitlab.com/api/v3', | ||
privateToken: 'your private token' | ||
}); | ||
co(function* () { | ||
var milestones = yield client.milestones.list({id: 1}); | ||
})(); | ||
``` | ||
### Promise way | ||
Require node >= `0.11.13` or [bluebird](https://github.com/petkaantonov/bluebird): | ||
```js | ||
var gitlab = require('node-gitlab'); | ||
var client = gitlab.createPromise({ | ||
api: 'https://gitlab.com/api/v3', | ||
privateToken: 'your private token' | ||
}); | ||
client.milestones.list({id: 1}) | ||
.then(function (milestones) { | ||
console.log(milestones); | ||
}) | ||
.catch(function (err) { | ||
throw err; | ||
}); | ||
``` | ||
## Document | ||
@@ -264,3 +302,3 @@ | ||
Copyright (c) 2013 - 2014 fengmk2 <fengmk2@gmail.com> | ||
Copyright (c) 2013 - 2014 fengmk2 <fengmk2@gmail.com> | ||
@@ -267,0 +305,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25102
7
452
0
320
4
15
2
+ Addednative-or-bluebird@~1.1.1
+ Addedthunkify-wrap@~1.0.2
+ Addeddebug@2.0.0(transitive)
+ Addedenable@1.3.2(transitive)
+ Addedms@0.6.2(transitive)
+ Addednative-or-bluebird@1.1.2(transitive)
+ Addedthunkify-wrap@1.0.4(transitive)
Updateddebug@~2.0.0