tasks/lib/github.js
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.password) {
			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.');
	}
}
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.password) {
			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.');
	}
}
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 . password ) { 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.' ) ; } }
/*
options: {
credentials: {
username: '...',
password: '...',
token: '...'
},
repo: 'git@github.com:user/repo.git
}
/ * options : { credentials : { username : ... password : ... token : ... } repo : git@github . com : user / repo . git }