Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Fix issue with credentials prompting
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Rodrigues committed Oct 22, 2012
1 parent 839d92e commit 78ea532
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
62 changes: 35 additions & 27 deletions lib/cli/linkedrevisioncontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,29 +128,29 @@ function GithubClient(cli) {
util.inherits(GithubClient, LinkedRevisionControlClient);

GithubClient.prototype.authenticate = function GithubClient_prototype_authenticate__5(context, _) { var __this = this; var __frame = { name: "GithubClient_prototype_authenticate__5", line: 130 }; return __func(_, this, arguments, GithubClient_prototype_authenticate__5, 1, __frame, function __$GithubClient_prototype_authenticate__5() {
__this.ensureCredentials();
return __this.ensureCredentials(context, __cb(_, __frame, 1, 2, function __$GithubClient_prototype_authenticate__5() {

__this.client.authenticate({
type: "basic",
username: context.username,
password: context.password }); _(); });};
__this.client.authenticate({
type: "basic",
username: context.username,
password: context.password }); _(); }, true)); });};



GithubClient.prototype.authenticateAuth = function GithubClient_prototype_authenticateAuth__6(context, _) { var oauthToken, __this = this; var __frame = { name: "GithubClient_prototype_authenticateAuth__6", line: 140 }; return __func(_, this, arguments, GithubClient_prototype_authenticateAuth__6, 1, __frame, function __$GithubClient_prototype_authenticateAuth__6() {
__this.ensureCredentials();
return __this.ensureCredentials(context, __cb(_, __frame, 1, 2, function __$GithubClient_prototype_authenticateAuth__6() {

__this.client.authenticate({
type: "basic",
username: context.username,
password: context.password });
__this.client.authenticate({
type: "basic",
username: context.username,
password: context.password });



return __this.client.oauth.createAuthorization({ user: context.username }, __cb(_, __frame, 10, 19, function ___(__0, __1) { oauthToken = __1;
__this.client.authenticate({
type: "oauth",
token: oauthToken.token }); _(); }, true)); });};
return __this.client.oauth.createAuthorization({ user: context.username }, __cb(_, __frame, 10, 19, function ___(__0, __1) { oauthToken = __1;
__this.client.authenticate({
type: "oauth",
token: oauthToken.token }); _(); }, true)); }, true)); });};



Expand All @@ -169,27 +169,27 @@ GithubClient.prototype.ensureCredentials = function GithubClient_prototype_ensur


GithubClient.prototype.init = function GithubClient_prototype_init__8(context, _) { var repositories, __this = this; var __frame = { name: "GithubClient_prototype_init__8", line: 171 }; return __func(_, this, arguments, GithubClient_prototype_init__8, 1, __frame, function __$GithubClient_prototype_init__8() {
__this.authenticate(context);
return __this.authenticate(context, __cb(_, __frame, 1, 2, function __$GithubClient_prototype_init__8() {

return __this.determineIfCurrentDirectoryIsGitWorkingTree(context, __cb(_, __frame, 3, 2, function __$GithubClient_prototype_init__8() {
return __this.initGitOnCurrentDirectory(context, false, __cb(_, __frame, 4, 2, function __$GithubClient_prototype_init__8() {
return __this.determineIfCurrentDirectoryIsGitWorkingTree(context, __cb(_, __frame, 3, 2, function __$GithubClient_prototype_init__8() {
return __this.initGitOnCurrentDirectory(context, false, __cb(_, __frame, 4, 2, function __$GithubClient_prototype_init__8() {

return __this.getRepositories(context.username, __cb(_, __frame, 6, 21, function ___(__0, __1) { repositories = __1; return (function __$GithubClient_prototype_init__8(__then) {
return __this.getRepositories(context.username, __cb(_, __frame, 6, 21, function ___(__0, __1) { repositories = __1; return (function __$GithubClient_prototype_init__8(__then) {

if (!context.remoteUri) {
if (!context.remoteUri) {

return __this._getRemoteUri(__cb(_, __frame, 10, 24, function ___(__0, __2) { context.remoteUri = __2; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype_init__8() {
return __this._getRemoteUri(__cb(_, __frame, 10, 24, function ___(__0, __2) { context.remoteUri = __2; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype_init__8() {


if (context.remoteUri) {
context.repository = LinkedRevisionControlClient.getRepository(repositories, context.remoteUri); } ; return (function __$GithubClient_prototype_init__8(__then) {
if (context.remoteUri) {
context.repository = LinkedRevisionControlClient.getRepository(repositories, context.remoteUri); } ; return (function __$GithubClient_prototype_init__8(__then) {


if ((((context.flags && context.flags.forceRepositorySelection)) || !context.repository)) {
if ((((context.flags && context.flags.forceRepositorySelection)) || !context.repository)) {

__this.cli.output.help("Choose a repository");
return choose(__this.cli, repositories.map(function(repository) {
return repository.full_name; }), __cb(_, __frame, 20, 38, function ___(__0, __3) { context.repository = repositories[__3]; __then(); }, true)); } else { __then(); } ; })(_); }); }, true)); }, true)); }, true)); });};
__this.cli.output.help("Choose a repository");
return choose(__this.cli, repositories.map(function(repository) {
return repository.full_name; }), __cb(_, __frame, 20, 38, function ___(__0, __3) { context.repository = repositories[__3]; __then(); }, true)); } else { __then(); } ; })(_); }); }, true)); }, true)); }, true)); }, true)); });};



Expand Down Expand Up @@ -386,4 +386,12 @@ GithubClient.prototype._getRemote = function GithubClient_prototype__getRemote__


function choose(cli, data, callback) {
cli.choose(data, function(x) { callback(undefined, x); });};
cli.choose(data, function(x) { callback(undefined, x); });};


function prompt(label, callback) {
cli.prompt(label, function(x) { callback(undefined, x); });};


function promptPassword(label, callback) {
cli.passwordOnce(label, function(x) { callback(undefined, x); });};
8 changes: 4 additions & 4 deletions lib/cli/linkedrevisioncontrol_.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function GithubClient(cli) {
util.inherits(GithubClient, LinkedRevisionControlClient);

GithubClient.prototype.authenticate = function (context, _) {
this.ensureCredentials();
this.ensureCredentials(context, _);

this.client.authenticate({
type: "basic",
Expand All @@ -138,7 +138,7 @@ GithubClient.prototype.authenticate = function (context, _) {
};

GithubClient.prototype.authenticateAuth = function(context, _) {
this.ensureCredentials();
this.ensureCredentials(context, _);

this.client.authenticate({
type: "basic",
Expand All @@ -156,7 +156,7 @@ GithubClient.prototype.authenticateAuth = function(context, _) {

GithubClient.prototype.ensureCredentials = function (context, _) {
if (!context.username || !context.pass) {
cli.output.help('Enter your github credentials');
this.cli.output.help('Enter your github credentials');
}

if (!context.username) {
Expand All @@ -169,7 +169,7 @@ GithubClient.prototype.ensureCredentials = function (context, _) {
};

GithubClient.prototype.init = function (context, _) {
this.authenticate(context);
this.authenticate(context, _);

this.determineIfCurrentDirectoryIsGitWorkingTree(context, _);
this.initGitOnCurrentDirectory(context, false, _);
Expand Down

0 comments on commit 78ea532

Please sign in to comment.