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 support for specifying emulator serial #13946

Merged
merged 2 commits into from Dec 20, 2018

Conversation

raymondhoagland
Copy link
Contributor

@raymondhoagland raymondhoagland commented Dec 19, 2018

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

Description

The strip! function that was added in #13846 returns nil if the string was not altered. Ruby docs. The adb action now fails whenever a serial is specified with no implicit conversion of nil into String on line 42 (the Actions.sh call).

Since command is being set with the return value, strip should be used instead which will always return the new value, regardless of whether it was changed.

Can be easily replicated in irb

android_serial = 'emulator-5554'
adb_path = '/test'

command = 'devices'
command = [android_serial, adb_path, command].join(" ").strip!
puts command
# => nil
command = 'devices'
command = [android_serial, adb_path, command].join(" ").strip
puts command
# => emulator-5554 /test devices

The `strip!` function returns nil if the string was not altered. (https://ruby-doc.org/core-2.2.0/String.html#method-i-strip-21).  The adb action now fails whenever a serial _is_ specified with `no implicit conversion of nil into String` on line 42 (the Actions.sh call).

Since command is being set with the return value, `strip` should be used instead which will always return the new value, regardless of whether it was changed.
Add test cases to validate the expected behavior when a serial is passed.
Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for making this fix and writing new tests 😊

@joshdholtz joshdholtz merged commit 64a9e51 into fastlane:master Dec 20, 2018
@fastlane-bot
Copy link

Hey @raymondhoagland 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

@janpio
Copy link
Member

janpio commented Dec 20, 2018

Thanks fir fixing my mess @raymondhoagland 🦆

@fastlane-bot
Copy link

Congratulations! 🎉 This was released as part of fastlane 2.113.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Mar 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants