Permalink
Browse files

Now committer will be the police user

  • Loading branch information...
1 parent b65d886 commit 6b7f8169f2e80858af5079930796805c47562e53 @pksunkara committed Jan 19, 2012
Showing with 38 additions and 33 deletions.
  1. +1 −1 lib/police/ask.js
  2. +37 −32 lib/police/github.js
View
@@ -186,7 +186,7 @@ ask.fields = function (pkg, fields, callback) {
pkg.licenses = [{type: pkg.licenses, url: ask.gh.repo.html_url + '/raw/master/LICENSE'}];
}
- police.github.write(JSON.stringify(ask.sort(pkg), null, 2), callback);
+ police.github.write(JSON.stringify(ask.sort(pkg), null, 2) + '\n', callback);
});
});
}
View
@@ -119,42 +119,47 @@ github.singleModule = function (name, callback) {
* Commit with updated package.json
*/
github.write = function (data, callback) {
- police.winston.info(' Updating ' + 'blob'.magenta);
- github.post('/repos/' + police.ask.gh.name + '/git/blobs', {content: data, encoding: 'utf-8'}, function (body) {
- police.winston.info(' Updating ' + 'tree'.magenta);
- github.post('/repos/' + police.ask.gh.name + '/git/trees', {
- base_tree: police.ask.gh.tree,
- tree: [
- {
- path: 'package.json',
- mode: police.ask.gh.mode,
- type: 'blob',
- sha: body.sha
- }
- ]
- }, function (body) {
+ github.get('/user', function (body) {
+ police.ask.gh.puser = body;
- police.winston.info(' Updating ' + 'commit'.magenta);
- github.post('/repos/' + police.ask.gh.name + '/git/commits', {
- message: 'Updated `package.json` using `police`',
- author: {
- name: 'Pavan Kumar Sunkara',
- email: 'pavan.sss1991@gmail.com',
- date: moment(new Date()).format('YYYY-MM-DDTHH:mm:ssZ')
- },
- committer: {
- name: police.ask.gh.user.name,
- email: police.ask.gh.user.email,
- date: moment(new Date()).format('YYYY-MM-DDTHH:mm:ssZ')
- },
- parents: [ police.ask.gh.commit ],
- tree: body.sha
+ police.winston.info(' Updating ' + 'blob'.magenta);
+ github.post('/repos/' + police.ask.gh.name + '/git/blobs', {content: data, encoding: 'utf-8'}, function (body) {
+
+ police.winston.info(' Updating ' + 'tree'.magenta);
+ github.post('/repos/' + police.ask.gh.name + '/git/trees', {
+ base_tree: police.ask.gh.tree,
+ tree: [
+ {
+ path: 'package.json',
+ mode: police.ask.gh.mode,
+ type: 'blob',
+ sha: body.sha
+ }
+ ]
}, function (body) {
- police.winston.info(' Updating ' + 'master'.magenta);
- github.put('/repos/' + police.ask.gh.name + '/git/refs/heads/master', {sha: body.sha}, function (body) {
- callback();
+ police.winston.info(' Updating ' + 'commit'.magenta);
+ github.post('/repos/' + police.ask.gh.name + '/git/commits', {
+ message: 'Updated `package.json` using `police`',
+ author: {
+ name: 'Pavan Kumar Sunkara',
+ email: 'pavan.sss1991@gmail.com',
+ date: moment(new Date()).format('YYYY-MM-DDTHH:mm:ssZ')
+ },
+ committer: {
+ name: police.ask.gh.puser.name,
+ email: police.ask.gh.puser.email,
+ date: moment(new Date()).format('YYYY-MM-DDTHH:mm:ssZ')
+ },
+ parents: [ police.ask.gh.commit ],
+ tree: body.sha
+ }, function (body) {
+
+ police.winston.info(' Updating ' + 'master'.magenta);
+ github.put('/repos/' + police.ask.gh.name + '/git/refs/heads/master', {sha: body.sha}, function (body) {
+ callback();
+ });
});
});
});

0 comments on commit 6b7f816

Please sign in to comment.