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
fastlaneis 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.gemspecfile. - After completing all the steps above, the following changes will occur:
- A
Pluginfileis created inside thefastlanefolder, and the plugin dependency is added to this file. - The following two lines are added to the
Gemfilein the project root:plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') eval_gemfile(plugins_path) if File.exist?(plugins_path)
- A
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
Pluginfileinside thefastlanefolder as shown above. If thePluginfiledoes 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
Gemfilein 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"
Leave a comment