Skip to content

Commit 6a8db42

Browse files
Fatme Havaluovafealebenpae
authored andcommitted
Refactor options
1 parent 3b9e6ff commit 6a8db42

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/services/ios-debug-service.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import options = require("./../common/options");
21
import iOSProxyServices = require("./../common/mobile/ios/ios-proxy-services");
32
import iOSDevice = require("./../common/mobile/ios/ios-device");
43
import net = require("net");
@@ -54,28 +53,29 @@ class IOSDebugService implements IDebugService {
5453
private $fs: IFileSystem,
5554
private $errors: IErrors,
5655
private $injector: IInjector,
57-
private $npm: INodePackageManager) {
56+
private $npm: INodePackageManager,
57+
private $options: IOptions) {
5858
}
5959

6060
get platform(): string {
6161
return "ios";
6262
}
6363

6464
public debug(): IFuture<void> {
65-
if ((!options.debugBrk && !options.start) || (options.debugBrk && options.start)) {
65+
if ((!this.$options.debugBrk && !this.$options.start) || (this.$options.debugBrk && this.$options.start)) {
6666
this.$errors.failWithoutHelp("Expected exactly one of the --debug-brk or --start options.");
6767
}
6868

69-
if (options.emulator) {
70-
if (options.debugBrk) {
69+
if (this.$options.emulator) {
70+
if (this.$options.debugBrk) {
7171
return this.emulatorDebugBrk();
72-
} else if (options.start) {
72+
} else if (this.$options.start) {
7373
return this.emulatorStart();
7474
}
7575
} else {
76-
if (options.debugBrk) {
76+
if (this.$options.debugBrk) {
7777
return this.deviceDebugBrk();
78-
} else if (options.start) {
78+
} else if (this.$options.start) {
7979
return this.deviceStart();
8080
}
8181
}
@@ -107,7 +107,7 @@ class IOSDebugService implements IDebugService {
107107

108108
private deviceDebugBrk(): IFuture<void> {
109109
return (() => {
110-
this.$devicesServices.initialize({ platform: this.platform, deviceId: options.device }).wait();
110+
this.$devicesServices.initialize({ platform: this.platform, deviceId: this.$options.device }).wait();
111111
this.$devicesServices.execute(device => (() => {
112112
this.$platformService.deployOnDevice(this.platform).wait();
113113

@@ -121,7 +121,7 @@ class IOSDebugService implements IDebugService {
121121

122122
private deviceStart(): IFuture<void> {
123123
return (() => {
124-
this.$devicesServices.initialize({ platform: this.platform, deviceId: options.device }).wait();
124+
this.$devicesServices.initialize({ platform: this.platform, deviceId: this.$options.device }).wait();
125125
this.$devicesServices.execute(device => (() => {
126126
var iosDevice = <iOSDevice.IOSDevice>device;
127127
createWebSocketProxy(this.$logger, (callback) => connectEventually(() => iosDevice.connectToPort(InspectorBackendPort), callback));
@@ -131,7 +131,7 @@ class IOSDebugService implements IDebugService {
131131
}
132132

133133
public executeOpenDebuggerClient(): IFuture<void> {
134-
if (options.client === false) {
134+
if (this.$options.client === false) {
135135
// NOTE: The --no-client has been specified. Otherwise its either false or undefined.
136136
return (() => {
137137
this.$logger.info("Supressing debugging client.");
@@ -151,11 +151,11 @@ class IOSDebugService implements IDebugService {
151151
private getSafariPath(): IFuture<string> {
152152
return (() => {
153153
var tnsIosPackage = "";
154-
if (options.frameworkPath) {
155-
if (this.$fs.getFsStats(options.frameworkPath).wait().isFile()) {
154+
if (this.$options.frameworkPath) {
155+
if (this.$fs.getFsStats(this.$options.frameworkPath).wait().isFile()) {
156156
this.$errors.failWithoutHelp("frameworkPath option must be path to directory which contains tns-ios framework");
157157
}
158-
tnsIosPackage = path.resolve(options.frameworkPath);
158+
tnsIosPackage = path.resolve(this.$options.frameworkPath);
159159
} else {
160160
var platformData = this.$platformsData.getPlatformData(this.platform);
161161
tnsIosPackage = this.$npm.install(platformData.frameworkPackageName).wait();

0 commit comments

Comments
 (0)