Skip to content

Commit 96bc691

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #868 from NativeScript/fatme/cocoapods-test
Run cocoapods test on darwin
2 parents 8408324 + 0040363 commit 96bc691

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/services/ios-project-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
461461
let projectPodFileContent = this.$fs.readText(this.projectPodFilePath).wait();
462462
let contentToRemove= this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent);
463463
projectPodFileContent = helpers.stringReplaceAll(projectPodFileContent, contentToRemove, "");
464-
if(_.isEmpty(projectPodFileContent)) {
464+
if(projectPodFileContent.trim() === "use_frameworks!") {
465465
this.$fs.deleteFile(this.projectPodFilePath).wait();
466466
} else {
467467
this.$fs.writeFile(this.projectPodFilePath, projectPodFileContent).wait();

test/ios-project-service.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ function createTestInjector(projectPath: string, projectName: string): IInjector
3737
});
3838
testInjector.register("projectHelper", {});
3939
testInjector.register("staticConfig", ConfigLib.StaticConfig);
40+
testInjector.register("projectDataService", {});
4041

4142
return testInjector;
4243
}
4344

4445
describe("Cocoapods support", () => {
45-
if (require("os").platform !== "darwin") {
46+
if (require("os").platform() !== "darwin") {
4647
console.log("Skipping Cocoapods tests. They cannot work on windows");
4748
} else {
4849
it("adds plugin with Podfile", () => {
@@ -68,7 +69,7 @@ describe("Cocoapods support", () => {
6869
fs.createDirectory(platformsFolderPath).wait();
6970

7071
let iOSProjectService = testInjector.resolve("iOSProjectService");
71-
iOSProjectService.prepareDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
72+
iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
7273
return Future.fromResult();
7374
};
7475

@@ -90,7 +91,8 @@ describe("Cocoapods support", () => {
9091
assert.isTrue(fs.exists(projectPodfilePath).wait());
9192

9293
let actualProjectPodfileContent = fs.readText(projectPodfilePath).wait();
93-
let expectedProjectPodfileContent = [`# Begin Podfile - ${pluginPodfilePath} `,
94+
let expectedProjectPodfileContent = ["use_frameworks!",
95+
`# Begin Podfile - ${pluginPodfilePath} `,
9496
` ${pluginPodfileContent} `,
9597
" # End Podfile \n"]
9698
.join("\n");
@@ -119,10 +121,10 @@ describe("Cocoapods support", () => {
119121
fs.createDirectory(platformsFolderPath).wait();
120122

121123
let iOSProjectService = testInjector.resolve("iOSProjectService");
122-
iOSProjectService.prepareDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
124+
iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
123125
return Future.fromResult();
124126
};
125-
iOSProjectService.removeDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
127+
iOSProjectService.removeFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
126128
return Future.fromResult();
127129
};
128130

@@ -144,7 +146,8 @@ describe("Cocoapods support", () => {
144146
assert.isTrue(fs.exists(projectPodfilePath).wait());
145147

146148
let actualProjectPodfileContent = fs.readText(projectPodfilePath).wait();
147-
let expectedProjectPodfileContent = [`# Begin Podfile - ${pluginPodfilePath} `,
149+
let expectedProjectPodfileContent = ["use_frameworks!",
150+
`# Begin Podfile - ${pluginPodfilePath} `,
148151
` ${pluginPodfileContent} `,
149152
" # End Podfile \n"]
150153
.join("\n");

0 commit comments

Comments
 (0)