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

Add lane to fetch/update dev certificates #16

Merged
merged 9 commits into from
Jul 5, 2024
Merged

Conversation

mokagio
Copy link
Collaborator

@mokagio mokagio commented Jul 2, 2024

@@ -37,6 +37,8 @@ USER_ENV_FILE_PATH = File.join(Dir.home, '.a8c-apps', ENV_FILE_NAME)
import 'lib/helpers.rb'

before_all do
setup_ci if runner.current_platform == :ios
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As far as I know, we are only using iOS at the moment.

But given the app is built with React Native, this will save us a warning/error if we'll ever run with platform :android

@mokagio mokagio requested a review from spencertransier July 2, 2024 23:21
@mokagio mokagio force-pushed the mokagio/dev-cert branch from d0cfb6d to f84d787 Compare July 2, 2024 23:37
Copy link
Collaborator

@spencertransier spencertransier left a comment

Choose a reason for hiding this comment

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

I tested the signing lanes and they worked as expected 👍

I just had one curiosity question about the naming of the methods.

_set_up_code_signing(type: 'development', readonly: readonly)
end

def _set_up_code_signing(type:, readonly: true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the underscore meant to signify that this method shouldn't be called directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually... 🤔 My original intention was do distinguish the name of the method from the name of the lane, but there is no set_up_code_signing lane so this approach is redundant.

Prefixing names with underscore is a convention in some environments to mark the prefixed thing as private, e.g. https://stackoverflow.com/a/15072306/809944

But your question made me wonder whether my assumption that a lane and a method with the same name cannot coexist is correct. Turns out it isn't. I created a set_up_code_signing lane to verify it, see 2bfad90, which is also handy to regenerate all certs and profiles if need be.

Clearly the Fastlane DSL parser can distinguish between lanes and methods 😅

Furthermore, I added this to Fastfile

+
+lane :test_lane do
+  puts 'hi'
+  test_lane
+end
+
+def test_lane
+  puts 'hello'
+end

And I got this output

[20:49:06]: ------------------------------
[20:49:06]: --- Step: default_platform ---
[20:49:06]: ------------------------------
[20:49:06]: Driving the lane 'test_lane' 🚀
[20:49:06]: hi
[20:49:06]: hello
[20:49:06]: fastlane.tools finished successfully 🎉

Finally, it looks like Fastlane will give precedence to methods when running into a name clash

lane :other do
  test_lane # which will it call? the method or the lane?
end
[20:52:18]: ------------------------------
[20:52:18]: --- Step: default_platform ---
[20:52:18]: ------------------------------
[20:52:18]: Driving the lane 'other' 🚀
[20:52:18]: hello
[20:52:18]: fastlane.tools finished successfully 🎉

@mokagio mokagio merged commit 64ffd29 into main Jul 5, 2024
2 checks passed
@mokagio mokagio deleted the mokagio/dev-cert branch July 5, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants