Skip to content

Commit 70a51ac

Browse files
FatmeFatme
authored andcommitted
Merge pull request #164 from NativeScript/fatme/sync-with-latest-common
Sync with latest common lib
2 parents fa2f973 + 4d25bde commit 70a51ac

File tree

6 files changed

+72
-35
lines changed

6 files changed

+72
-35
lines changed

lib/node-package-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class NodePackageManager implements INodePackageManager {
8383
}
8484
return options.frameworkPath;
8585
} else {
86-
var version = version || this.getLatestVersion(packageName).wait();
86+
var version: string = version || this.getLatestVersion(packageName).wait();
8787
var packagePath = path.join(npm.cache, packageName, version, "package");
8888
if (!this.isPackageCached(packagePath).wait()) {
8989
this.addToCacheCore(packageName, version).wait();

lib/services/platform-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class PlatformService implements IPlatformService {
6060
this.$logger.out("Copying template files...");
6161

6262
var packageToInstall = "";
63-
var npmOptions = {
63+
var npmOptions: IStringDictionary = {
6464
pathToSave: path.join(this.$projectData.platformsDir, platform)
6565
};
6666

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@
6262
"grunt-contrib-copy": "0.5.0",
6363
"grunt-contrib-watch": "0.5.3",
6464
"grunt-shell": "0.6.4",
65-
"grunt-ts": "1.11.2",
65+
"grunt-ts": "1.12.1",
6666
"mocha": "1.21.4",
6767
"mocha-fibers": "https://github.com/Icenium/mocha-fibers/tarball/master",
68-
"should": "4.0.4"
68+
"should": "4.0.4",
69+
"typescript": "1.3"
6970
},
7071
"license": "Apache-2.0",
7172
"engines": {

test/platform-commands.ts

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ describe('Platform Service Tests', () => {
9797
describe("#AddPlatformCommand", () => {
9898
it("is not executed when platform is not passed", () => {
9999
isCommandExecuted = false;
100-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
100+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
101101
return (() => {
102-
isCommandExecuted = true;
102+
if (commandName !== "help") {
103+
isCommandExecuted = true;
104+
}
103105
return false;
104106
}).future<boolean>()();
105107
}
@@ -110,9 +112,13 @@ describe('Platform Service Tests', () => {
110112

111113
it("is not executed when platform is not valid", () => {
112114
isCommandExecuted = false;
113-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
115+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
114116
return (() => {
115-
isCommandExecuted = true;
117+
if (commandName !== "help") {
118+
if (commandName !== "help") {
119+
isCommandExecuted = true;
120+
}
121+
}
116122
return false;
117123
}).future<boolean>()();
118124
}
@@ -123,9 +129,11 @@ describe('Platform Service Tests', () => {
123129

124130
it("is executed when platform is valid", () => {
125131
isCommandExecuted = false;
126-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
132+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
127133
return (() => {
128-
isCommandExecuted = true;
134+
if (commandName !== "help") {
135+
isCommandExecuted = true;
136+
}
129137
return false;
130138
}).future<boolean>()();
131139
}
@@ -136,9 +144,11 @@ describe('Platform Service Tests', () => {
136144

137145
it("is executed when all platforms are valid", () => {
138146
isCommandExecuted = false;
139-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
147+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
140148
return (() => {
141-
isCommandExecuted = true;
149+
if (commandName !== "help") {
150+
isCommandExecuted = true;
151+
}
142152
return false;
143153
}).future<boolean>()();
144154
}
@@ -149,9 +159,11 @@ describe('Platform Service Tests', () => {
149159

150160
it("is not executed when at least one platform is not valid", () => {
151161
isCommandExecuted = false;
152-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
162+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
153163
return (() => {
154-
isCommandExecuted = true;
164+
if (commandName !== "help") {
165+
isCommandExecuted = true;
166+
}
155167
return false;
156168
}).future<boolean>()();
157169
}
@@ -164,9 +176,11 @@ describe('Platform Service Tests', () => {
164176
describe("#RemovePlatformCommand", () => {
165177
it("is not executed when platform is not passed", () => {
166178
isCommandExecuted = false;
167-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
179+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
168180
return (() => {
169-
isCommandExecuted = true;
181+
if (commandName !== "help") {
182+
isCommandExecuted = true;
183+
}
170184
return false;
171185
}).future<boolean>()();
172186
}
@@ -177,9 +191,11 @@ describe('Platform Service Tests', () => {
177191

178192
it("is not executed when platform is not valid", () => {
179193
isCommandExecuted = false;
180-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
194+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
181195
return (() => {
182-
isCommandExecuted = true;
196+
if (commandName !== "help") {
197+
isCommandExecuted = true;
198+
}
183199
return false;
184200
}).future<boolean>()();
185201
}
@@ -190,9 +206,11 @@ describe('Platform Service Tests', () => {
190206

191207
it("is executed when platform is valid", () => {
192208
isCommandExecuted = false;
193-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
209+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
194210
return (() => {
195-
isCommandExecuted = true;
211+
if (commandName !== "help") {
212+
isCommandExecuted = true;
213+
}
196214
return false;
197215
}).future<boolean>()();
198216
}
@@ -203,9 +221,11 @@ describe('Platform Service Tests', () => {
203221

204222
it("is executed when all platforms are valid", () => {
205223
isCommandExecuted = false;
206-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
224+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
207225
return (() => {
208-
isCommandExecuted = true;
226+
if (commandName !== "help") {
227+
isCommandExecuted = true;
228+
}
209229
return false;
210230
}).future<boolean>()();
211231
}
@@ -216,9 +236,11 @@ describe('Platform Service Tests', () => {
216236

217237
it("is not executed when at least one platform is not valid", () => {
218238
isCommandExecuted = false;
219-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
239+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
220240
return (() => {
221-
isCommandExecuted = true;
241+
if (commandName !== "help") {
242+
isCommandExecuted = true;
243+
}
222244
return false;
223245
}).future<boolean>()();
224246
}
@@ -231,9 +253,11 @@ describe('Platform Service Tests', () => {
231253
describe("#UpdatePlatformCommand", () => {
232254
it("is not executed when platform is not passed", () => {
233255
isCommandExecuted = false;
234-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
256+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
235257
return (() => {
236-
isCommandExecuted = true;
258+
if (commandName !== "help") {
259+
isCommandExecuted = true;
260+
}
237261
return false;
238262
}).future<boolean>()();
239263
}
@@ -244,9 +268,11 @@ describe('Platform Service Tests', () => {
244268

245269
it("is not executed when platform is not valid", () => {
246270
isCommandExecuted = false;
247-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
271+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
248272
return (() => {
249-
isCommandExecuted = true;
273+
if (commandName !== "help") {
274+
isCommandExecuted = true;
275+
}
250276
return false;
251277
}).future<boolean>()();
252278
}
@@ -257,9 +283,11 @@ describe('Platform Service Tests', () => {
257283

258284
it("is executed when platform is valid", () => {
259285
isCommandExecuted = false;
260-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
286+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
261287
return (() => {
262-
isCommandExecuted = true;
288+
if (commandName !== "help") {
289+
isCommandExecuted = true;
290+
}
263291
return false;
264292
}).future<boolean>()();
265293
}
@@ -270,9 +298,11 @@ describe('Platform Service Tests', () => {
270298

271299
it("is executed when all platforms are valid", () => {
272300
isCommandExecuted = false;
273-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
301+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
274302
return (() => {
275-
isCommandExecuted = true;
303+
if (commandName !== "help") {
304+
isCommandExecuted = true;
305+
}
276306
return false;
277307
}).future<boolean>()();
278308
}
@@ -283,9 +313,11 @@ describe('Platform Service Tests', () => {
283313

284314
it("is not executed when at least one platform is not valid", () => {
285315
isCommandExecuted = false;
286-
commandsService.executeCommandUnchecked = (): IFuture<boolean> => {
316+
commandsService.executeCommandUnchecked = (commandName: string): IFuture<boolean> => {
287317
return (() => {
288-
isCommandExecuted = true;
318+
if (commandName !== "help") {
319+
isCommandExecuted = true;
320+
}
289321
return false;
290322
}).future<boolean>()();
291323
}

test/stubs.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export class LoggerStub implements ILogger {
2020
}
2121

2222
write(...args: string[]): void { }
23+
24+
prepare(item: any): string {
25+
return "";
26+
}
2327
}
2428

2529
export class FileSystemStub implements IFileSystem {

0 commit comments

Comments
 (0)