Permalink
Browse files

fix reference

  • Loading branch information...
1 parent da7cd73 commit 2ee47c205a02ce5e36e003d0a7bc3a2842bd11fa Andre Rodrigues committed Oct 19, 2012
@@ -42,7 +42,7 @@ LinkedRevisionControlClient.prototype.determineIfCurrentDirectoryIsGitWorkingTre
__this.cli.output.silly("determineIfCurrentDirectoryIsGitWorkingTree"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$LinkedRevisionControlClient_prototype_determineIfCurrentDirectoryIsGitWorkingTree__1() {
- return exec("git rev-parse --git-dir", __cb(_, __frame, 4, 27, function ___(__0, __1) { isInsideWorkTree = __1;
+ return __this._exec("git rev-parse --git-dir", __cb(_, __frame, 4, 27, function ___(__0, __1) { isInsideWorkTree = __1;
lines = (isInsideWorkTree.stdout + isInsideWorkTree.stderr);
context.flags.isGitWorkingTree = lines.split("\n").some(function(line) {
return (line === ".git"); }); __then(); }, true)); }); })(function ___(err, __result) { __tryCatch(_, function __$LinkedRevisionControlClient_prototype_determineIfCurrentDirectoryIsGitWorkingTree__1() { if (err) {
@@ -59,7 +59,7 @@ LinkedRevisionControlClient.prototype.initGitOnCurrentDirectory = function Linke
__this.cli.output.info("Executing `git init`");
- return exec("git init", __cb(_, __frame, 7, 2, function __$LinkedRevisionControlClient_prototype_initGitOnCurrentDirectory__2() { return (function __$LinkedRevisionControlClient_prototype_initGitOnCurrentDirectory__2(__then) {
+ return __this._exec("git init", __cb(_, __frame, 7, 2, function __$LinkedRevisionControlClient_prototype_initGitOnCurrentDirectory__2() { return (function __$LinkedRevisionControlClient_prototype_initGitOnCurrentDirectory__2(__then) {
if ((scaffold && !utils.pathExistsSync(".gitignore"))) {
__this.cli.output.info("Creating default .gitignore file");
@@ -69,18 +69,27 @@ LinkedRevisionControlClient.prototype.initGitOnCurrentDirectory = function Linke
context.flags.isGitWorkingTree = true; _(); }); }, true)); });};
+LinkedRevisionControlClient.prototype._exec = function(cmd, cb) {
+ child_process.exec(cmd, function(err, stdout, stderr) {
+ cb(err, {
+ stdout: stdout,
+ stderr: stderr }); });};
+
+
+
+
function GitClient(cli) {
GitClient.super_.call(this, cli);};
util.inherits(GitClient, LinkedRevisionControlClient);
-GitClient.prototype.init = function GitClient_prototype_init__3(context, _) { var __this = this; var __frame = { name: "GitClient_prototype_init__3", line: 78 }; return __func(_, this, arguments, GitClient_prototype_init__3, 1, __frame, function __$GitClient_prototype_init__3() {
+GitClient.prototype.init = function GitClient_prototype_init__3(context, _) { var __this = this; var __frame = { name: "GitClient_prototype_init__3", line: 87 }; return __func(_, this, arguments, GitClient_prototype_init__3, 1, __frame, function __$GitClient_prototype_init__3() {
return __this.determineIfCurrentDirectoryIsGitWorkingTree(context, __cb(_, __frame, 1, 2, function __$GitClient_prototype_init__3() {
return __this.initGitOnCurrentDirectory(context, true, __cb(_, __frame, 2, 2, _, true)); }, true)); });};
-GitClient.prototype.deploy = function GitClient_prototype_deploy__4(context, _) { var __frame = { name: "GitClient_prototype_deploy__4", line: 83 }; return __func(_, this, arguments, GitClient_prototype_deploy__4, 1, __frame, _);};
+GitClient.prototype.deploy = function GitClient_prototype_deploy__4(context, _) { var __frame = { name: "GitClient_prototype_deploy__4", line: 92 }; return __func(_, this, arguments, GitClient_prototype_deploy__4, 1, __frame, _);};
@@ -100,7 +109,7 @@ GithubClient.prototype.authenticate = function(username, password) {
-GithubClient.prototype.init = function GithubClient_prototype_init__5(context, _) { var repositories, parsedRepositoryUri, pathParts, owner, name, localRepositories, __this = this; var __frame = { name: "GithubClient_prototype_init__5", line: 103 }; return __func(_, this, arguments, GithubClient_prototype_init__5, 1, __frame, function __$GithubClient_prototype_init__5() {
+GithubClient.prototype.init = function GithubClient_prototype_init__5(context, _) { var repositories, parsedRepositoryUri, pathParts, owner, name, localRepositories, __this = this; var __frame = { name: "GithubClient_prototype_init__5", line: 112 }; return __func(_, this, arguments, GithubClient_prototype_init__5, 1, __frame, function __$GithubClient_prototype_init__5() {
return __this.determineIfCurrentDirectoryIsGitWorkingTree(context, __cb(_, __frame, 1, 2, function __$GithubClient_prototype_init__5() {
return __this.initGitOnCurrentDirectory(context, false, __cb(_, __frame, 2, 2, function __$GithubClient_prototype_init__5() {
@@ -131,16 +140,13 @@ GithubClient.prototype.init = function GithubClient_prototype_init__5(context, _
-GithubClient.prototype.deploy = function GithubClient_prototype_deploy__6(context, _) { var parsedRepositoryUri, hookUrl, gitUri, __this = this; var __frame = { name: "GithubClient_prototype_deploy__6", line: 134 }; return __func(_, this, arguments, GithubClient_prototype_deploy__6, 1, __frame, function __$GithubClient_prototype_deploy__6() {
- console.log("here");
- console.log(context.repositoryUri);
-
+GithubClient.prototype.deploy = function GithubClient_prototype_deploy__6(context, _) { var parsedRepositoryUri, hookUrl, gitUri, __this = this; var __frame = { name: "GithubClient_prototype_deploy__6", line: 143 }; return __func(_, this, arguments, GithubClient_prototype_deploy__6, 1, __frame, function __$GithubClient_prototype_deploy__6() {
parsedRepositoryUri = url.parse(context.repositoryUri);
parsedRepositoryUri.auth = context.repositoryAuth;
parsedRepositoryUri.pathname = "/deploy";
hookUrl = url.format(parsedRepositoryUri);
- return context.lvcClient.createOrUpdateHook(context.repository.owner.login, context.repository.name, hookUrl, __cb(_, __frame, 9, 2, function __$GithubClient_prototype_deploy__6() { return (function __$GithubClient_prototype_deploy__6(__then) {
+ return context.lvcClient.createOrUpdateHook(context.repository.owner.login, context.repository.name, hookUrl, __cb(_, __frame, 6, 2, function __$GithubClient_prototype_deploy__6() { return (function __$GithubClient_prototype_deploy__6(__then) {
@@ -150,11 +156,11 @@ GithubClient.prototype.deploy = function GithubClient_prototype_deploy__6(contex
__this.cli.output.info((("Executing `git remote add azure " + gitUri) + "`"));
- return exec(("git remote add azure " + gitUri), __cb(_, __frame, 19, 4, __then, true)); } else { __then(); } ; })(_); }, true)); });};
+ return __this._exec(("git remote add azure " + gitUri), __cb(_, __frame, 16, 4, __then, true)); } else { __then(); } ; })(_); }, true)); });};
-GithubClient.prototype.getRepositories = function GithubClient_prototype_getRepositories__7(username, _) { var progress, userRepos, orgs, i, org, __this = this; var __frame = { name: "GithubClient_prototype_getRepositories__7", line: 157 }; return __func(_, this, arguments, GithubClient_prototype_getRepositories__7, 1, __frame, function __$GithubClient_prototype_getRepositories__7() {
+GithubClient.prototype.getRepositories = function GithubClient_prototype_getRepositories__7(username, _) { var progress, userRepos, orgs, i, org, __this = this; var __frame = { name: "GithubClient_prototype_getRepositories__7", line: 163 }; return __func(_, this, arguments, GithubClient_prototype_getRepositories__7, 1, __frame, function __$GithubClient_prototype_getRepositories__7() {
progress = __this.cli.progress("Retrieving repositories");
userRepos = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_getRepositories__7() {
@@ -180,7 +186,7 @@ GithubClient.prototype.getRepositories = function GithubClient_prototype_getRepo
return _(null, userRepos); }); }); });};
-GithubClient.prototype.createOrUpdateHook = function GithubClient_prototype_createOrUpdateHook__8(username, repository, deployUri, _) { var hook, hooks, parsedDeployUri, existingHook, __this = this; var __frame = { name: "GithubClient_prototype_createOrUpdateHook__8", line: 183 }; return __func(_, this, arguments, GithubClient_prototype_createOrUpdateHook__8, 3, __frame, function __$GithubClient_prototype_createOrUpdateHook__8() {
+GithubClient.prototype.createOrUpdateHook = function GithubClient_prototype_createOrUpdateHook__8(username, repository, deployUri, _) { var hook, hooks, parsedDeployUri, existingHook, __this = this; var __frame = { name: "GithubClient_prototype_createOrUpdateHook__8", line: 189 }; return __func(_, this, arguments, GithubClient_prototype_createOrUpdateHook__8, 3, __frame, function __$GithubClient_prototype_createOrUpdateHook__8() {
hook = {
name: "web",
user: username,
@@ -218,7 +224,7 @@ GithubClient.prototype.createOrUpdateHook = function GithubClient_prototype_crea
-GithubClient.prototype.createHook = function GithubClient_prototype_createHook__9(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_createHook__9", line: 221 }; return __func(_, this, arguments, GithubClient_prototype_createHook__9, 1, __frame, function __$GithubClient_prototype_createHook__9() {
+GithubClient.prototype.createHook = function GithubClient_prototype_createHook__9(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_createHook__9", line: 227 }; return __func(_, this, arguments, GithubClient_prototype_createHook__9, 1, __frame, function __$GithubClient_prototype_createHook__9() {
progress = __this.cli.progress("Creating new hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_createHook__9() {
@@ -228,7 +234,7 @@ GithubClient.prototype.createHook = function GithubClient_prototype_createHook__
-GithubClient.prototype.updateHook = function GithubClient_prototype_updateHook__10(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_updateHook__10", line: 231 }; return __func(_, this, arguments, GithubClient_prototype_updateHook__10, 1, __frame, function __$GithubClient_prototype_updateHook__10() {
+GithubClient.prototype.updateHook = function GithubClient_prototype_updateHook__10(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_updateHook__10", line: 237 }; return __func(_, this, arguments, GithubClient_prototype_updateHook__10, 1, __frame, function __$GithubClient_prototype_updateHook__10() {
progress = __this.cli.progress("Updating hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_updateHook__10() {
@@ -238,7 +244,7 @@ GithubClient.prototype.updateHook = function GithubClient_prototype_updateHook__
-GithubClient.prototype.getHooks = function GithubClient_prototype_getHooks__11(username, repository, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_getHooks__11", line: 241 }; return __func(_, this, arguments, GithubClient_prototype_getHooks__11, 2, __frame, function __$GithubClient_prototype_getHooks__11() {
+GithubClient.prototype.getHooks = function GithubClient_prototype_getHooks__11(username, repository, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_getHooks__11", line: 247 }; return __func(_, this, arguments, GithubClient_prototype_getHooks__11, 2, __frame, function __$GithubClient_prototype_getHooks__11() {
progress = __this.cli.progress("Retrieving website hooks"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_getHooks__11() {
@@ -251,14 +257,14 @@ GithubClient.prototype.getHooks = function GithubClient_prototype_getHooks__11(u
-GithubClient.prototype._getRemoteUri = function GithubClient_prototype__getRemoteUri__12(context, _) { var progress, originUri, __this = this; var __frame = { name: "GithubClient_prototype__getRemoteUri__12", line: 254 }; return __func(_, this, arguments, GithubClient_prototype__getRemoteUri__12, 1, __frame, function __$GithubClient_prototype__getRemoteUri__12() {
+GithubClient.prototype._getRemoteUri = function GithubClient_prototype__getRemoteUri__12(context, _) { var progress, originUri, __this = this; var __frame = { name: "GithubClient_prototype__getRemoteUri__12", line: 260 }; return __func(_, this, arguments, GithubClient_prototype__getRemoteUri__12, 1, __frame, function __$GithubClient_prototype__getRemoteUri__12() {
progress = __this.cli.progress("Retrieving local git repositories");
originUri = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
- return getRemote("azure", __cb(_, __frame, 5, 16, function ___(__0, __1) { originUri = __1; return (function __$GithubClient_prototype__getRemoteUri__12(__then) {
+ return __this._getRemote("azure", __cb(_, __frame, 5, 16, function ___(__0, __1) { originUri = __1; return (function __$GithubClient_prototype__getRemoteUri__12(__then) {
if (!originUri) {
- return getRemote("origin", __cb(_, __frame, 7, 18, function ___(__0, __2) { originUri = __2; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype__getRemoteUri__12() { _(null, null, true); }); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
+ return __this._getRemote("origin", __cb(_, __frame, 7, 18, function ___(__0, __2) { originUri = __2; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype__getRemoteUri__12() { _(null, null, true); }); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
@@ -267,21 +273,12 @@ GithubClient.prototype._getRemoteUri = function GithubClient_prototype__getRemot
return _(null, originUri); }); }); });};
-function exec(cmd, cb) {
- child_process.exec(cmd, function(err, stdout, stderr) {
- cb(err, {
- stdout: stdout,
- stderr: stderr }); });};
-
-
-
-
function choose(cli, data, callback) {
cli.choose(data, function(x) { callback(undefined, x); });};
-function getRemote(name, _) { var origin; var __frame = { name: "getRemote", line: 283 }; return __func(_, this, arguments, getRemote, 1, __frame, function __$getRemote() {
- return exec("git remote -v", __cb(_, __frame, 1, 12, function ___(__0, __1) { remotes = __1;
+GithubClient.prototype._getRemote = function GithubClient_prototype__getRemote__13(name, _) { var origin, __this = this; var __frame = { name: "GithubClient_prototype__getRemote__13", line: 280 }; return __func(_, this, arguments, GithubClient_prototype__getRemote__13, 1, __frame, function __$GithubClient_prototype__getRemote__13() {
+ return __this._exec("git remote -v", __cb(_, __frame, 1, 12, function ___(__0, __1) { remotes = __1;
origin = ((remotes.stdout + remotes.stderr)).split("\n").filter(function(item) {
return item.split(" ").some(function(it) {
return (it === name); }); });
@@ -42,7 +42,7 @@ LinkedRevisionControlClient.prototype.determineIfCurrentDirectoryIsGitWorkingTre
this.cli.output.silly('determineIfCurrentDirectoryIsGitWorkingTree');
try {
- var isInsideWorkTree = exec('git rev-parse --git-dir', _);
+ var isInsideWorkTree = this._exec('git rev-parse --git-dir', _);
var lines = isInsideWorkTree.stdout + isInsideWorkTree.stderr;
context.flags.isGitWorkingTree = lines.split('\n').some(function (line) {
return line === '.git';
@@ -59,7 +59,7 @@ LinkedRevisionControlClient.prototype.initGitOnCurrentDirectory = function (cont
}
this.cli.output.info('Executing `git init`');
- exec('git init', _);
+ this._exec('git init', _);
if (scaffold && !utils.pathExistsSync('.gitignore')) {
this.cli.output.info('Creating default .gitignore file');
@@ -69,6 +69,15 @@ LinkedRevisionControlClient.prototype.initGitOnCurrentDirectory = function (cont
context.flags.isGitWorkingTree = true;
};
+LinkedRevisionControlClient.prototype._exec = function (cmd, cb) {
+ child_process.exec(cmd, function (err, stdout, stderr) {
+ cb(err, {
+ stdout: stdout,
+ stderr: stderr
+ });
+ });
+};
+
function GitClient(cli) {
GitClient.super_.call(this, cli);
}
@@ -147,7 +156,7 @@ GithubClient.prototype.deploy = function (context, _) {
// create the remote repo locally
this.cli.output.info('Executing `git remote add azure ' + gitUri + '`');
- exec('git remote add azure ' + gitUri, _);
+ this._exec('git remote add azure ' + gitUri, _);
}
};
@@ -253,9 +262,9 @@ GithubClient.prototype._getRemoteUri = function (context, _) {
var originUri = null;
try {
- originUri = getRemote('azure', _);
+ originUri = this._getRemote('azure', _);
if (!originUri) {
- originUri = getRemote('origin', _);
+ originUri = this._getRemote('origin', _);
}
} finally {
progress.end();
@@ -264,21 +273,12 @@ GithubClient.prototype._getRemoteUri = function (context, _) {
return originUri;
};
-function exec(cmd, cb) {
- child_process.exec(cmd, function (err, stdout, stderr) {
- cb(err, {
- stdout: stdout,
- stderr: stderr
- });
- });
-}
-
function choose(cli, data, callback) {
cli.choose(data, function (x) { callback(undefined, x); });
}
-function getRemote(name, _) {
- remotes = exec('git remote -v', _);
+GithubClient.prototype._getRemote = function (name, _) {
+ remotes = this._exec('git remote -v', _);
var origin = (remotes.stdout + remotes.stderr).split('\n').filter(function (item) {
return item.split('\t').some(function (it) {
return it === name;
@@ -19,16 +19,14 @@ var capture = require('../util').capture;
suite('cli', function(){
suite('site', function() {
- suite('list', function() {
+ suite('list', function() {
test('should list no sites', function(done) {
capture(function() {
cli.parse('node cli.js site list --json'.split(' '));
- }, function (result) {
+ }, function (result) {
done();
});
- });
+ });
});
});
-});
-
-
+});
@@ -0,0 +1,43 @@
+/**
+* Copyright (c) Microsoft. All rights reserved.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+require('should');
+var sinon = require('sinon');
+var cli = require('../cli');
+var capture = require('../util').capture;
+
+var sandbox;
+
+suite('cli', function(){
+ suite('linkrevisioncontrol', function() {
+ setup(function (done) {
+ sandbox = sinon.sandbox.create();
+
+ done();
+ });
+
+ teardown(function (done) {
+ sandbox.restore();
+
+ done();
+ });
+
+ test('should list no sites', function(done) {
+
+ });
+ });
+});
+
+

0 comments on commit 2ee47c2

Please sign in to comment.