github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/controller/static/semantic/tasks/config/admin/github.js (about)

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