You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
634 B

  1. /*******************************
  2. GitHub Login
  3. *******************************/
  4. /*
  5. Logs into GitHub using OAuth
  6. */
  7. var
  8. fs = require('fs'),
  9. githubAPI = require('github'),
  10. // stores oauth info for GitHub API
  11. oAuth = fs.existsSync('./oauth.js')
  12. ? require('./oauth')
  13. : false,
  14. github
  15. ;
  16. if(!oAuth) {
  17. console.error('Must add oauth token for GitHub in tasks/admin/oauth.js');
  18. return;
  19. }
  20. github = new githubAPI({
  21. version : '3.0.0',
  22. debug : true,
  23. protocol : 'https',
  24. timeout : 5000
  25. });
  26. github.authenticate({
  27. type: 'oauth',
  28. token: oAuth.token
  29. });
  30. module.exports = github;