Skip to content

Run cocoapods test on darwin #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
let projectPodFileContent = this.$fs.readText(this.projectPodFilePath).wait();
let contentToRemove= this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent);
projectPodFileContent = helpers.stringReplaceAll(projectPodFileContent, contentToRemove, "");
if(_.isEmpty(projectPodFileContent)) {
if(projectPodFileContent.trim() === "use_frameworks!") {
this.$fs.deleteFile(this.projectPodFilePath).wait();
} else {
this.$fs.writeFile(this.projectPodFilePath, projectPodFileContent).wait();
Expand Down
15 changes: 9 additions & 6 deletions test/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ function createTestInjector(projectPath: string, projectName: string): IInjector
});
testInjector.register("projectHelper", {});
testInjector.register("staticConfig", ConfigLib.StaticConfig);
testInjector.register("projectDataService", {});

return testInjector;
}

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

let iOSProjectService = testInjector.resolve("iOSProjectService");
iOSProjectService.prepareDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
return Future.fromResult();
};

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

let actualProjectPodfileContent = fs.readText(projectPodfilePath).wait();
let expectedProjectPodfileContent = [`# Begin Podfile - ${pluginPodfilePath} `,
let expectedProjectPodfileContent = ["use_frameworks!",
`# Begin Podfile - ${pluginPodfilePath} `,
` ${pluginPodfileContent} `,
" # End Podfile \n"]
.join("\n");
Expand Down Expand Up @@ -119,10 +121,10 @@ describe("Cocoapods support", () => {
fs.createDirectory(platformsFolderPath).wait();

let iOSProjectService = testInjector.resolve("iOSProjectService");
iOSProjectService.prepareDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
iOSProjectService.prepareFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
return Future.fromResult();
};
iOSProjectService.removeDynamicFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
iOSProjectService.removeFrameworks = (pluginPlatformsFolderPath: string, pluginData: IPluginData): IFuture<void> => {
return Future.fromResult();
};

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

let actualProjectPodfileContent = fs.readText(projectPodfilePath).wait();
let expectedProjectPodfileContent = [`# Begin Podfile - ${pluginPodfilePath} `,
let expectedProjectPodfileContent = ["use_frameworks!",
`# Begin Podfile - ${pluginPodfilePath} `,
` ${pluginPodfileContent} `,
" # End Podfile \n"]
.join("\n");
Expand Down