Development CS Software Engineering CI/CD [CI/CD] Using fastlane Plugins

Overview

This post covers how to add and manage fastlane plugins.

Steps

1. Adding a Plugin Dependency

1.1. Adding via Command

fastlane add_plugin [name]
  • Navigate to the project directory where fastlane is set up and run the command above.
1. Git URL
2. Local Path
3. RubyGems.org ('fastlane-plugin-hacoma_wrapper' seems to not be available
there)
4. Other Gem Server
  • Select where the plugin file is located and enter the appropriate path or URL.
  • If you select Local Path, enter the path to the folder containing the .gemspec file.
  • After completing all the steps above, the following changes will occur:
    • A Pluginfile is created inside the fastlane folder, and the plugin dependency is added to this file.
    • The following two lines are added to the Gemfile in the project root:
        plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
        eval_gemfile(plugins_path) if File.exist?(plugins_path)
      

1.2. Adding by Editing the Pluginfile

# Fetched from RubyGems.org
gem "fastlane-plugin-name"

# Fetched from GitHub
gem "fastlane-plugin-name", git: "https://github.com/fastlane/fastlane-plugin-name"
gem "fastlane-plugin-name", git: "https://github.com/fastlane/fastlane-plugin-name", tag: '1.1.0'

# Fetched from a local directory
gem "fastlane-plugin-name", path: "../fastlane-plugin-name"

# Specify a version requirements
gem "fastlane-plugin-name", "1.1.0"
gem "fastlane-plugin-name", ">= 1.0"
  • Edit the Pluginfile inside the fastlane folder as shown above. If the Pluginfile does not exist, create a new one.
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
  • Add the two lines above to the Gemfile in the project root.

2. Installing Plugins

bundle install
bundle exec fastlane install_plugins

3. Updating Plugins

bundle install
bundle exec fastlane update_plugins

4. Removing a Plugin

  • Delete the plugin dependency line from the Pluginfile.
  • Then run the plugin install command.

4.1. Before Removal

gem "fastlane-plugin-name"
gem "fastlane-plugin-name2"

4.2. After Removal

gem "fastlane-plugin-name"

References

Leave a comment