Skip to content

Commit

Permalink
Change variable name settings as clashed with import of settings clas…
Browse files Browse the repository at this point in the history
…s - set fallback to CLR v4 if not set in settings JSON config file
  • Loading branch information
Warren Buckley committed Mar 31, 2017
1 parent d4ca674 commit bb93750
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/IISExpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class IIS {
this._args = args;
}

public startWebsite(settings?: settings.Isettings): process.ChildProcess{
public startWebsite(options?: settings.Isettings): process.ChildProcess{
//Need to run this command
//iisexpress /path:app-path [/port:port-number] [/clr:clr-version] [/systray:boolean]
//isexpress /path:c:\myapp\ /port:5005
Expand All @@ -41,17 +41,16 @@ export class IIS {
}

//Get IIS Port Number from config file
this._args.port = settings.port;
this._args.port = options.port;

//Folder to run as the arg
this._args.path = settings.path ? settings.path : vscode.workspace.rootPath;
this._args.path = options.path ? options.path : vscode.workspace.rootPath;

//CLR version, yes there are still people on 3.5
this._args.clr = settings.clr;
this._args.clr = options.clr ? options.clr : settings.clrVersion.v40;

//This is the magic that runs the IISExpress cmd
this._iisProcess = process.spawn(this._iisPath, [`-path:${this._args.path}`,`-port:${this._args.port}`,`-clr:${this._args.clr}`]);
console.log(`stdout: Command with Params ${this._iisPath} ${[`-path:${this._args.path}`,`-port:${this._args.port}`,`-clr:${this._args.clr}`].join(' ')}`);

//Create output channel & show it
this._output = this._output || vscode.window.createOutputChannel('IIS Express');
Expand All @@ -68,7 +67,7 @@ export class IIS {
this._statusbar.show();

//Open browser
this.openWebsite(settings);
this.openWebsite(options);

//Attach all the events & functions to iisProcess
this._iisProcess.stdout.on('data', (data) =>{
Expand Down Expand Up @@ -119,7 +118,7 @@ export class IIS {

}

public openWebsite(settings?: settings.Isettings){
public openWebsite(options?: settings.Isettings){

//If we do not have an iisProcess running
if(!this._iisProcess){
Expand All @@ -130,9 +129,9 @@ export class IIS {
}


if (settings && settings.url) {
if (options && options.url) {
//We have a starting URL set - but lets ensure we strip starting / if present
let startUrl = settings.url.startsWith('/') ? settings.url.substring(1) : settings.url;
let startUrl = options.url.startsWith('/') ? options.url.substring(1) : options.url;

//Start browser with start url
let browser = process.exec(`start http://localhost:${this._args.port}/${startUrl}`);
Expand All @@ -142,16 +141,16 @@ export class IIS {
}
}

public restartSite(settings? : settings.Isettings){
public restartSite(options? : settings.Isettings){
//If we do not have an iisProcess/website running
if(!this._iisProcess){
//Then just do a start site...
this.startWebsite(settings);
this.startWebsite(options);
}
else {
//It's already running so stop it first then, start it
this.stopWebsite();
this.startWebsite(settings);
this.startWebsite(options);
}

}
Expand Down

0 comments on commit bb93750

Please sign in to comment.