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

[snapshot] Improve SnapshotHelper.swift handling if file doesn't exist #13038

Closed
janpio opened this issue Aug 6, 2018 · 1 comment · Fixed by #13205
Closed

[snapshot] Improve SnapshotHelper.swift handling if file doesn't exist #13038

janpio opened this issue Aug 6, 2018 · 1 comment · Fixed by #13205

Comments

@janpio
Copy link
Member

janpio commented Aug 6, 2018

Feature Request

Motivation Behind Feature

Running fastlane snapshot handles outdated SnapshotHelper.swift (either too old version or empty file), but not a completely missing file:

Old SnapshotHelper.swift:

MacBook-Pro:FastlaneDemoIonic sujan$ fastlane snapshot
[✔] 🚀 
[13:27:13]: Successfully loaded '/Users/sujan/fastlane-demo/ionic/FastlaneDemoIonic/fastlane/Snapfile' 📄

+---------+-----------------------------------------+
|    Detected Values from './fastlane/Snapfile'     |
+---------+-----------------------------------------+
| project | platforms/ios/FastlaneDemoIonic.xcodep  |
|         | roj                                     |
+---------+-----------------------------------------+

[13:27:13]: $ xcodebuild -showBuildSettings -scheme FastlaneDemoIonic -project platforms/ios/FastlaneDemoIonic.xcodeproj
[13:27:20]: Your './fastlane/SnapshotHelper.swift' is outdated, please run `fastlane snapshot update`
[13:27:20]: to update your Helper file

[!] Please update your Snapshot Helper file using `fastlane snapshot update`

Empty SnapshotHelper.swift:

MacBook-Pro:FastlaneDemoIonic sujan$ fastlane snapshot
[✔] 🚀 
[13:27:13]: Successfully loaded '/Users/sujan/fastlane-demo/ionic/FastlaneDemoIonic/fastlane/Snapfile' 📄

+---------+-----------------------------------------+
|    Detected Values from './fastlane/Snapfile'     |
+---------+-----------------------------------------+
| project | platforms/ios/FastlaneDemoIonic.xcodep  |
|         | roj                                     |
+---------+-----------------------------------------+

[13:27:13]: $ xcodebuild -showBuildSettings -scheme FastlaneDemoIonic -project platforms/ios/FastlaneDemoIonic.xcodeproj
[13:27:20]: Your './fastlane/SnapshotHelper.swift' is outdated, please run `fastlane snapshot update`
[13:27:20]: to update your Helper file

[!] Please update your Snapshot Helper file using `fastlane snapshot update`

Missing SnapshotHelper.swift:

MacBook-Pro:FastlaneDemoIonic sujan$ fastlane snapshot
[✔] 🚀 
[13:40:03]: Successfully loaded '/Users/sujan/fastlane-demo/ionic/FastlaneDemoIonic/fastlane/Snapfile' 📄

+---------+-----------------------------------------+
|    Detected Values from './fastlane/Snapfile'     |
+---------+-----------------------------------------+
| project | platforms/ios/FastlaneDemoIonic.xcodep  |
|         | roj                                     |
+---------+-----------------------------------------+

[13:40:03]: $ xcodebuild -showBuildSettings -scheme FastlaneDemoIonic -project platforms/ios/FastlaneDemoIonic.xcodeproj

+----------------------------+-----------------------------------------+
|                     Summary for snapshot 2.101.1                     |
+----------------------------+-----------------------------------------+
| scheme                     | FastlaneDemoIonic                       |
| devices                    | ["iPhone 7", "iPhone 7 Plus", "iPhone   |
|                            | 8", "iPhone 8 Plus", "iPhone X", "iPad  |
|                            | (5th generation)", "iPad Pro            |
|                            | (9.7-inch)", "iPad Pro (12.9-inch)",    |
|                            | "iPad Pro (10.5-inch)"]                 |
| output_directory           | /Users/sujan/fastlane-demo/ionic/Fastl  |
|                            | aneDemoIonic/fastlane/screenshots       |
| project                    | platforms/ios/FastlaneDemoIonic.xcodep  |
|                            | roj                                     |
| languages                  | ["en-US"]                               |
| launch_arguments           | [""]                                    |
| output_simulator_logs      | false                                   |
| skip_open_summary          | false                                   |
| skip_helper_version_check  | false                                   |
| clear_previous_screenshots | false                                   |
| reinstall_app              | false                                   |
| erase_simulator            | false                                   |
| localize_simulator         | false                                   |
| buildlog_path              | ~/Library/Logs/snapshot                 |
| clean                      | false                                   |
| number_of_retries          | 1                                       |
| stop_after_first_error     | false                                   |
| result_bundle              | false                                   |
| concurrent_simulators      | true                                    |
...

Feature Description

Improve or rework the verify_helper_is_current method to also check if the file exists at all and output an appropriate error message if it does not.

def verify_helper_is_current
return if Snapshot.config[:skip_helper_version_check]
current_version = version_of_bundled_helper
UI.verbose("Checking that helper files contain #{current_version}")
helper_files = Update.find_helper
helper_files.each do |path|
content = File.read(path)
unless content.include?(current_version)
UI.error("Your '#{path}' is outdated, please run `fastlane snapshot update`")
UI.error("to update your Helper file")
UI.user_error!("Please update your Snapshot Helper file using `fastlane snapshot update`")
end
end
end

Alternatives or Workarounds

@joshdholtz joshdholtz changed the title [snapshot] Improve SnapshotHelper.swift handling [snapshot] Improve SnapshotHelper.swift handling if file doesn't exist Aug 6, 2018
@fastlane fastlane deleted a comment from fastlane-bot Aug 7, 2018
@fastlane-bot

This comment has been minimized.

joshdholtz pushed a commit that referenced this issue Aug 28, 2018
)

* [snapshot] added check for missing Snapshot Helper File (#13038)

* [snapshot] added link to snapshot quick setup in error message (#13038)

* [snapshot] UI formatting (#13038)
janpio pushed a commit to janpio/fastlane that referenced this issue Sep 11, 2018
…) (fastlane#13205)

* [snapshot] added check for missing Snapshot Helper File (fastlane#13038)

* [snapshot] added link to snapshot quick setup in error message (fastlane#13038)

* [snapshot] UI formatting (fastlane#13038)
@fastlane fastlane locked and limited conversation to collaborators Oct 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants