Skip to content

Commit

Permalink
Merge pull request #3 from rapatchi/master
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
suhuruli committed Jun 29, 2018
2 parents 08d6516 + 3abdcd2 commit fbd6c83
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
20 changes: 11 additions & 9 deletions src/commands/build-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function buildGradleApplication() {
let projectUri = vscode.Uri.parse(projectPath);

const terminal: vscode.Terminal = vscode.window.createTerminal('ServiceFabric');
terminal.sendText('gradle build ');
terminal.sendText('gradle ');
terminal.show();
}

Expand Down Expand Up @@ -106,14 +106,16 @@ function replaceBuildPath(filePath) {
}

async function createPublishProfile() {
var publishParams = {
ConnectionIPOrURL: '',
ConnectionPort: '19080',
ClientKey: '',
ClientCert: '',
ServerCertThumbprint: '',
ClientCertThumbprint: ''
};
var publishParams = {
ClusterConnectionParameters: {
ConnectionIPOrURL: '',
ConnectionPort: '19080',
ClientKey: '',
ClientCert: '',
ServerCertThumbprint: '',
ClientCertThumbprint: ''
}
};
var publishParamsJson = JSON.stringify(publishParams, null, 4);

var uri: vscode.Uri[] = null;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/deploy-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else{
export async function deployApplication() {
var terminal : vscode.Terminal = vscode.window.createTerminal('ServiceFabric');
if (vars._isLinux || vars._isMacintosh) {
exec('sfctl cluster select --endpoint http://localhost:10550', function (err, stdout, stderr) {
exec('sfctl cluster select --endpoint http://localhost:19080', function (err, stdout, stderr) {
if (err) {
vscode.window.showErrorMessage("Could not connect to cluster.");
console.log(err);
Expand Down
18 changes: 9 additions & 9 deletions src/commands/publish-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ async function deployToUnsecureCluster(clusterInfo) {
});
}
else if (vars._isWindows) {
terminal.sendText("Connect-ServiceFabricCluster --ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort);
terminal.sendText("Connect-ServiceFabricCluster -ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort);
terminal.show();
}
}
else {
if (vars._isLinux || vars._isMacintosh) {
exec('sfctl cluster select --endpoint http://localhost:10550', function (err, stdout, stderr) {
exec('sfctl cluster select --endpoint http://localhost:19080', function (err, stdout, stderr) {
if (err) {
vscode.window.showErrorMessage("Could not connect to cluster.");
console.log(err);
Expand All @@ -51,7 +51,7 @@ async function deployToUnsecureCluster(clusterInfo) {
terminal.show();
}
}
installApplication();
installApplication(terminal);
}

async function deployToSecureClusterCert(clusterInfo) {
Expand All @@ -66,13 +66,13 @@ async function deployToSecureClusterCert(clusterInfo) {
});
}
else if (vars._isWindows) {
terminal.sendText("Connect-ServiceFabricCluster --ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort + " -X509Credential -ServerCertThumbprint " + clusterInfo.ServerCertThumbprint + "-FindType FindByThumbprint -FindValue " + clusterInfo.ClientCertThumbprint +" -StoreLocation CurrentUser -StoreName My");
terminal.show();
terminal.sendText("Connect-ServiceFabricCluster -ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort + " -X509Credential -ServerCertThumbprint " + clusterInfo.ServerCertThumbprint + " -FindType FindByThumbprint -FindValue " + clusterInfo.ClientCertThumbprint +" -StoreLocation CurrentUser -StoreName My");
}
installApplication();
installApplication(terminal);
}

async function installApplication() {
async function installApplication(terminal:vscode.Terminal) {
console.log("Install Application");
var uri: vscode.Uri[] = null;
uri = await vscode.workspace.findFiles('**/install' + installScriptExtension);
Expand All @@ -81,7 +81,6 @@ async function installApplication() {
return;
}
const relativeInstallPath = vscode.workspace.asRelativePath(uri[0]);
const terminal: vscode.Terminal = vscode.window.createTerminal('ServiceFabric');
terminal.sendText('./' + relativeInstallPath);
terminal.show();
}
Expand All @@ -95,8 +94,9 @@ async function readCloudProfile() {
if (err) {
throw err;
}
var clusterInfo = JSON.parse(data);
if (clusterInfo.ClientCert.length > 0) {
var clusterData = JSON.parse(data);
var clusterInfo = clusterData.ClusterConnectionParameters;
if (clusterInfo.ClientCert.length > 0 || clusterInfo.ClientCertThumbprint.length > 0) {
deployToSecureClusterCert(clusterInfo);
} else {
deployToUnsecureCluster(clusterInfo);
Expand Down
10 changes: 6 additions & 4 deletions src/commands/remove-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function removeApplication() {

async function connectToCluster() {
var fs = require('fs');
var clusterData;
var clusterInfo;

const cloudProfile: vscode.Uri[] = await vscode.workspace.findFiles('**/Cloud.json');
Expand All @@ -30,7 +31,8 @@ async function connectToCluster() {
if (err) {
throw err;
}
clusterInfo = JSON.parse(data);
clusterData = JSON.parse(data);
clusterInfo = clusterData.ClusterConnectionParameters;
if (clusterInfo.ClientCert.length > 0) {
connectToSecureCluster(clusterInfo);
} else {
Expand All @@ -53,7 +55,7 @@ function connectToSecureCluster(clusterInfo) {
});
}
else if(vars._isWindows){
terminal.sendText("Connect-ServiceFabricCluster --ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort + " -X509Credential -ServerCertThumbprint " + clusterInfo.ServerCertThumbprint + "-FindType FindByThumbprint -FindValue " + clusterInfo.ClientCertThumbprint +" -StoreLocation CurrentUser -StoreName My");
terminal.sendText("Connect-ServiceFabricCluster -ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort + " -X509Credential -ServerCertThumbprint " + clusterInfo.ServerCertThumbprint + " -FindType FindByThumbprint -FindValue " + clusterInfo.ClientCertThumbprint +" -StoreLocation CurrentUser -StoreName My");
terminal.show();
}
uninstallApplication(terminal);
Expand All @@ -72,13 +74,13 @@ async function connectToUnsecureCluster(clusterInfo) {
});
}
else if (vars._isWindows) {
terminal.sendText("Connect-ServiceFabricCluster --ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort);
terminal.sendText("Connect-ServiceFabricCluster -ConnectionEndPoint "+ clusterInfo.ConnectionIPOrURL + ':' + clusterInfo.ConnectionPort);
terminal.show();
}
}
else {
if (vars._isLinux || vars._isMacintosh) {
exec('sfctl cluster select --endpoint http://localhost:10550', function (err, stdout, stderr) {
exec('sfctl cluster select --endpoint http://localhost:19080', function (err, stdout, stderr) {
if (err) {
vscode.window.showErrorMessage("Could not connect to cluster.");
console.log(err);
Expand Down
3 changes: 3 additions & 0 deletions src/yo/yo/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const getNpmPaths = function () {
// Get the npm path from the user env variables.
const paths = process.env.PATH.split(path.delimiter).map(item => path.join(item, '..', 'lib', 'node_modules'));

// Add npm path by running npm root command
paths.push(childProcess.execSync('npm root -g', {encoding: 'utf8'}).toString().trim());

// Default paths for each system
if (win32) {
paths.push(path.join(process.env.APPDATA, 'npm', 'node_modules'));
Expand Down

0 comments on commit fbd6c83

Please sign in to comment.