Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit b0cf781

Browse files
liamnicholsm-ruhl
authored andcommitted
Update XcodegenAction to include :executable config argument and test behaviour
1 parent a67cce9 commit b0cf781

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

lib/fastlane/plugin/xcodegen/actions/xcodegen_action.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def self.run(params)
1212

1313
Actions::BrewAction.run(command: "tap yonaskolb/XcodeGen https://github.com/yonaskolb/XcodeGen.git")
1414
Actions::BrewAction.run(command: "install XcodeGen")
15-
end)
15+
end) unless params[:executable]
1616

17-
cmd = ["xcodegen"]
17+
cmd = [params[:executable] || "xcodegen"]
1818
cmd += ["--spec", File.expand_path(params[:spec])] if params[:spec]
1919
cmd += ["--project", File.expand_path(params[:project])] if params[:project]
2020
cmd << "--quiet" if params[:quiet]
@@ -42,6 +42,10 @@ def self.details
4242

4343
def self.available_options
4444
[
45+
FastlaneCore::ConfigItem.new(key: :executable,
46+
env_name: "XCODEGEN_EXECUTABLE",
47+
description: "The path to the `xcodegen` executable",
48+
optional: true),
4549
FastlaneCore::ConfigItem.new(key: :spec,
4650
env_name: "XCODEGEN_SPEC",
4751
description: "The path to the project spec file",

spec/xcodegen_action_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@
7575
xcodegen
7676
end").runner.execute(:test)
7777
end
78+
it "supports a custom executable" do
79+
expect(Fastlane::Actions).to_not receive(:sh).with("which xcodegen", anything)
80+
expect(Fastlane::Actions::BrewAction).to_not receive(:run)
81+
expect(Fastlane::Actions).to receive(:sh).with("./bin/xcodegen", "--quiet")
82+
83+
Fastlane::FastFile.new.parse("lane :test do
84+
xcodegen(executable: './bin/xcodegen', quiet: true)
85+
end").runner.execute(:test)
86+
end
7887
end
7988
end
8089
end

0 commit comments

Comments
 (0)