Skip to content
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

Fix 'fastlane env' not to crash when Xcode Version cannot be obtained #8301

Merged
merged 1 commit into from
Feb 19, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion fastlane/lib/fastlane/environment_printer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,12 @@ def self.print_system_environment

if Helper.mac?
table_content["Xcode Path"] = anonymized_path(Helper.xcode_path)
table_content["Xcode Version"] = Helper.xcode_version
begin
table_content["Xcode Version"] = Helper.xcode_version
rescue => ex
UI.error(ex)
UI.error("Could not get Xcode Version")
end
end

table = ["| Key | Value |"]
Expand Down
13 changes: 13 additions & 0 deletions fastlane/spec/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,18 @@
expect(Fastlane::EnvironmentPrinter.anonymized_path('/Users/john/', '/Users/john')).to eq('~/')
expect(Fastlane::EnvironmentPrinter.anonymized_path('/workspace/project/test', '/work')).to eq('/workspace/project/test')
end

context 'FastlaneCore::Helper.xcode_version cannot be obtained' do
before do
allow(FastlaneCore::Helper).to receive(:xcode_version).and_raise("Boom!")
end

it 'contains stack information other than Xcode Version' do
expect(env).to include("Bundler?")
expect(env).to include("Xcode Path")
expect(env).not_to include("Xcode Version")
expect(env).to include("OpenSSL")
end
end
end
end