-
Notifications
You must be signed in to change notification settings - Fork 34
Find and use the correct schema #57
Find and use the correct schema #57
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it!
… On 13 Dec 2018, at 3:00 pm, googlebot ***@***.***> wrote:
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
📝 Please visit https://cla.developers.google.com/ <https://cla.developers.google.com/> to sign.
Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.
What to do if you already signed the CLA
Individual signers
It's possible we don't have your GitHub username or you're using a different email address on your commit. Check your existing CLA data <https://cla.developers.google.com/clas> and verify that your email is set on your git commits <https://help.github.com/articles/setting-your-email-in-git/>.
Corporate signers
Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the Google project maintainer to go/cla#troubleshoot <http://go/cla#troubleshoot> (Public version <https://opensource.google.com/docs/cla/#troubleshoot>).
The email used to register you as an authorized contributor must be the email used for the Git commit. Check your existing CLA data <https://cla.developers.google.com/clas> and verify that your email is set on your git commits <https://help.github.com/articles/setting-your-email-in-git/>.
The email used to register you as an authorized contributor must also be attached to your GitHub account <https://github.com/settings/emails>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#57 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA88-dsoQzySsqJzDXgXiYk0GnZSpZQIks5u4dDAgaJpZM4ZQ4pW>.
|
CLAs look good, thanks! |
I didn't realise that the |
_, scheme_conf = conf.first | ||
|
||
scheme_conf = nil | ||
conf.each_key { |key| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use conf.each since you need the value as well (rather than conf[key]).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. I've updated the commit.
conf.each_key { |key| | ||
if key != '__xctestrun_metadata__' | ||
scheme_conf = conf[key] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move the line 22 logic here:
if scheme_conf.nil?
scheme_conf = value
else
UI.user_error!("The app bundle may contain only one scheme.")
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Nice. I've force-pushed an update. Check it out.
I've used your suggestion, however in the body of the if
we still need to check if the key is __xctestrun_metadata__
, otherwise that schema will be set first if it's encountered first. :)
@johnrogers thanks for the help! have some minor comments but otherwise look good! |
No problem at all @powerivq . Happy to help contribute to the development of great software. |
scheme_conf = nil | ||
conf.each do |key, value| | ||
if scheme_conf.nil? | ||
unless key == '__xctestrun_metadata__' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "unless" needs to be outside of the if block. If you got an input:
ARandomScheme
xctestrun_metadata
It will cause the one-scheme-only error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair comment.
I've re-introduced the size check and fixed this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! ✅
@johnrogers 1.0.2 is released to rubygem. |
You can see my motivation for creating this pull request here: #56
In my case,
scheme_conf = conf.first
was not sufficient enough to locate the scheme - the key-pair__xctestrun_metadata__
comes first in my xctestrun file.It seems to me, in any case, it's safer to look for the schema that's not
__xctestrun_metadata__
after performing the bundle size check?I'm not very experienced with Ruby - created this to offer a possible solution.