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

[Ruby 3.0] Switch back to the original commander gem and update dependencies #18599

Merged
merged 13 commits into from
May 3, 2021

Conversation

ainame
Copy link
Contributor

@ainame ainame commented Apr 25, 2021

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

As per #17931, I've been doing the migration to get Ruby 3.0 supported in fastlane. I recognised that highline gem is a blocker for that as it has invalid usage of Ruby 3.0. We need to update that library version to 2.x (is 1.7.2 right now). To do so, we also need to update another dependency commander-fastlane that also depends on highline. Due to historical reasons, we switch the use of the original commander to the forked one.

It tweaks its styling in the help banner specifically for how to indicate "default command" amongst subcommand options. fastlane/commander#1

For example, (* default) and * asterisk are the ones we have added to the forked one.

% bundle exec fastlane --help
[✔] 🚀
  fastlane

  CLI for 'fastlane' - The easiest way to automate beta deployments and releases for your iOS and Android apps

        Run using `fastlane [platform] [lane_name]`
        To pass values to the lanes use `fastlane [platform] [lane_name] key:value key2:value2`

  Commands: (* default)
    action                 Shows more information for a specific command
    actions                Lists all available fastlane actions
    add_plugin             Add a new plugin to your fastlane setup
    docs                   Generate a markdown based documentation based on the Fastfile
    enable_auto_complete   Enable tab auto completion
    env                    Print your fastlane environment, use this when you submit an issue on GitHub
    help                   Display global or [command] help documentation
    init                   Helps you with your initial fastlane setup
    install_plugins        Install all plugins for this project
    lanes                  Lists all available lanes and shows their description
    list                   Lists all available lanes without description
    new_action             Create a new custom action for fastlane.
    new_plugin             Create a new plugin that can be used with fastlane
    run                    Run a fastlane one-off action without a full lane
    search_plugins         Search for plugins, search query is optional
    socket_server          Starts local socket server and enables only a single local connection
    trigger              * Run a specific lane. Pass the lane name and optionally the platform first.
    update_fastlane        Update fastlane to the latest release
    update_plugins         Update all plugin dependencies

This is all the fork has. After digging through the gem, I found the official way to customise this help description injecting a custom template to be rendered to commander. That way we lose the reason to maintain the forked repo anymore. This PR ported the customisation to fastlane's codebase and stopped using the forked gem.

Description

This PR focuses on switching back to the original commander so, in the gemspec file, I locked the gem version to 4.4.4 which is equivalent to the head of the forked one. (When the version was 4.4.3, it was forked and 4.4.3 and was bumped to 4.4.6 with some warning fixes back ported fastlane/commander#6)

Next PR will focus on commander and highline to be updated to get rid of Ruby's deprecation warnings.
#18622

It turned out that there isn't really change needed to migrate commander and highline other than a minor fix for tests. So this PR also bumps the version to the latest version on both gems.

https://github.com/commander-rb/commander/blob/master/History.rdoc
JEG2/highline#248 (comment)

Testing Steps

See if bundle exec fastlane --help or bundle exec fastlane MODULE --help looks exactly the same as before.

@google-cla google-cla bot added the cla: yes label Apr 25, 2021
@ainame ainame force-pushed the fix-commander-highline-issues branch from a02613d to 1655dda Compare April 25, 2021 02:33
@ainame ainame changed the title [Ruby 3.0] Stop using forked commander and bump highline gem [Ruby 3.0] Stop using forked commander Apr 25, 2021
@ainame ainame force-pushed the fix-commander-highline-issues branch from fe04881 to 0a7b7c9 Compare April 27, 2021 09:56
@ainame
Copy link
Contributor Author

ainame commented Apr 27, 2021

I managed to replicate the same behaviour without forking but with only a few additions using the official way to customise commander gem🎉
I will add tests later.

@ainame ainame changed the title [Ruby 3.0] Stop using forked commander [Ruby 3.0] Switch back to the original commander gem Apr 27, 2021
@ainame ainame force-pushed the fix-commander-highline-issues branch 3 times, most recently from 98b39d8 to f04754d Compare April 28, 2021 06:10
@ainame ainame force-pushed the fix-commander-highline-issues branch from 0c27b66 to cbf2b61 Compare April 28, 2021 06:20
@ainame ainame force-pushed the fix-commander-highline-issues branch from cbf2b61 to d0face1 Compare April 28, 2021 06:25
@ainame ainame marked this pull request as ready for review April 28, 2021 11:32
Copy link
Collaborator

@minuscorp minuscorp left a comment

Choose a reason for hiding this comment

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

Pretty dope!! Let's see if this fixed some bugs with the forked version. Great work, as always🚀

@ainame
Copy link
Contributor Author

ainame commented Apr 29, 2021

@minuscorp Thank you for your reviews.

Let's see if this fixed some bugs with the forked version

As I mentioned, this PR's change doesn't change much in terms of its behaviour🙂 Will work on version bump change soon 🚀

@@ -0,0 +1,35 @@
<%= program :name %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@minuscorp
Copy link
Collaborator

That's right, maybe a intermediate step would be to just bump the minor version which shouldn't break compatibility to see if that solves the issue, I can try it later on when this gets merged 🚀

@ainame
Copy link
Contributor Author

ainame commented Apr 29, 2021

The thing is that commander bumped highline's version in a patch version change at 4.4.7😅 https://github.com/commander-rb/commander/blob/master/History.rdoc#447--2018-10-22-

It doesn't matter as Bundler won't try to update to 4.4.7 but feels like using the equivalent version as before would be safer for now.

@ainame ainame force-pushed the fix-commander-highline-issues branch 2 times, most recently from 371fa71 to fff41c2 Compare May 1, 2021 06:24
@ainame
Copy link
Contributor Author

ainame commented May 1, 2021

@joshdholtz @minuscorp Fixed the issue😄

@ainame ainame force-pushed the fix-commander-highline-issues branch 2 times, most recently from 3b56702 to 26082aa Compare May 1, 2021 16:38
- run:
name: debug | brew version
command: |
brew -v
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we started using orbs for shellcheck, normal testing doesn't need homebrew.

- run:
name: debug | brew version
command: |
brew -v
Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, fastlane.swift uses swiftformat installed via brew bundle. This would need this debug info.

@ainame ainame force-pushed the fix-commander-highline-issues branch from 26082aa to 5eccd33 Compare May 1, 2021 16:52
name: Setup Build
command: |
mkdir -p ~/test-reports
brew update # Needed because this lane uses "brew bundle" and CircleCI's brew install is too old for that
Copy link
Contributor Author

@ainame ainame May 1, 2021

Choose a reason for hiding this comment

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

I believe we normally don't need this brew update...
#17863

I don't know why it failed here though. If the brew version matters, using a newer macOS image might (or might not) help it🤔 Adding brew -v here would help to see if it's using the right version.
https://app.circleci.com/pipelines/github/fastlane/fastlane/2629/workflows/c48b73e5-02a7-4563-bf8f-8e19cbb6e508/jobs/66023

@@ -270,8 +265,8 @@ workflows:
ruby_version: 'fastlanetools/ci:0.3.0'
- validate_fastlane_swift_generation:
name: 'Validate Fastlane.swift generation'
xcode_version: '11.0.0'
ruby_version: '2.5'
xcode_version: '12.3.0'
Copy link
Contributor Author

@ainame ainame May 1, 2021

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

At least we're using Xcode 12.4 for latest Swift releases if you want another version bump

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bumped to 12.4 😄

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.

The subcommands now work! This is so 🔥 This looks good to me ☺️ I'll let @minuscorp tdo another view on this before I click the merge button! Thanks for getting us back on track here ❤️

Copy link
Collaborator

@minuscorp minuscorp left a comment

Choose a reason for hiding this comment

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

This is great to me. Great addition and less deprecated versions to maintain 🚀

@joshdholtz joshdholtz merged commit e9b79e4 into master May 3, 2021
@ainame ainame deleted the fix-commander-highline-issues branch May 3, 2021 10:40
@ainame
Copy link
Contributor Author

ainame commented May 3, 2021

Let's archive this 🙂 https://github.com/fastlane/commander

@fastlane-bot
Copy link

Hey @ainame 👋

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 🚀

Copy link

@fastlane-bot fastlane-bot left a comment

Choose a reason for hiding this comment

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

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

@rogerluan
Copy link
Member

Let's archive this 🙂 https://github.com/fastlane/commander

💯 ☝️

@joshdholtz I think you're the only one with permission to do so? 😊

@fastlane fastlane locked and limited conversation to collaborators Jul 28, 2021
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