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.

37 lines
744 B

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