Skip to content

Commit

Permalink
Add --ignore-dependencies to make it work on hosted images
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-lobanov committed Nov 6, 2022
1 parent 45da512 commit c39cc02
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("CocoapodsInstaller", () => {
it("replace existing version", async () => {
CocoapodsInstaller["getInstalledVersion"] = jest.fn().mockReturnValue("1.8.5");
await CocoapodsInstaller.install("1.9.1");
expect(execCommandSpy).toHaveBeenCalledWith("gem", ["uninstall", "cocoapods", expect.any(String), expect.any(String)]);
expect(execCommandSpy).toHaveBeenCalledWith("gem", ["uninstall", "cocoapods", expect.any(String), expect.any(String), expect.any(String)]);
expect(execCommandSpy).toHaveBeenCalledWith("gem", ["install", "cocoapods", expect.any(String), expect.any(String), expect.any(String)]);
});

Expand Down
14 changes: 7 additions & 7 deletions __tests__/podfile-parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ describe("getVersionFromPodfile", () => {
["Podfile.lock", "1.5.3"],
["Podfile2.lock", "1.9.3"],
["Podfile3.lock", "1.10.0.rc.1"],
["Podfile4.lock", "1.9.0.beta.2"],
["Podfile5.lock", null]
["Podfile4.lock", "1.9.0.beta.2"]
])("test case %#", (input: string, expected: string | null) => {
const testCasePath = path.resolve(path.join(__dirname, "podfile-example", input));
if (expected) {
expect(getVersionFromPodfile(testCasePath)).toBe(expected);
} else {
expect(() => getVersionFromPodfile(testCasePath)).toThrow();
}
expect(getVersionFromPodfile(testCasePath)).toBe(expected);
});

it("fails on invalid podfile", () => {
const testCasePath = path.resolve(path.join(__dirname, "podfile-example", "Podfile5.lock"));
expect(() => getVersionFromPodfile(testCasePath)).toThrow();
});
});

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CocoapodsInstaller {
return;
}
// Remove pre-installed version of Cocoapods
exec.exec("gem", ["uninstall", "cocoapods", "--all", "--executables"]);
exec.exec("gem", ["uninstall", "cocoapods", "--all", "--executables", "--ignore-dependencies"]);
// Install new version of Cocoapods
const versionArguments = (versionSpec === "latest") ? [] : ["-v", versionSpec];
await exec.exec("gem", ["install", "cocoapods", ...versionArguments, "--no-document"]);
Expand Down
2 changes: 1 addition & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class CocoapodsInstaller {
}

// Remove pre-installed version of Cocoapods
exec.exec("gem", ["uninstall", "cocoapods", "--all", "--executables"]);
exec.exec("gem", ["uninstall", "cocoapods", "--all", "--executables", "--ignore-dependencies"]);

// Install new version of Cocoapods
const versionArguments = (versionSpec === "latest") ? [] : ["-v", versionSpec];
Expand Down

0 comments on commit c39cc02

Please sign in to comment.