nl_tokens: / * options : { credentials : { username : ... password : ... token : ... } repo : git@github . com : user / repo . git }
pl_tokens: function ( options ) { this . options = options ; this . headers = { 'User-Agent' : 'request/grunt-github-release-asset' } ; var authStr ; if ( options . credentials ) { if ( options . credentials . token ) { authStr = options . credentials . token + ':' + '' ; } else if ( options . credentials . username && options . credentials . <mask> ) { authStr = options . credentials . username + ':' + options . credentials . password ; } } if ( ! authStr ) { throw new Error ( 'Please supply a token or username & password to authorize yourself.' ) ; } this . headers [ 'Authorization' ] = 'Basic ' + ( new Buffer ( authStr ) . toString ( 'base64' ) ) try { this . repoPath = options . repo . split ( ':' ) [ 1 ] . split ( '.' ) . slice ( 0 , - 1 ) . join ( '.' ) . toLowerCase ( ) ; } catch ( err ) { throw new Error ( 'Repository url isn\'t provided or isn\'t valid.' ) ; } }