How to test fork of fastlane plugin

Viewed 731

I have made a fork of a fastlane plugin and made some changes in the local clone. How do I test the changes?

In the plugin dir with my changes I have done

$ bundle install
$ rake install

I have a project that uses the plugin and have tried to change the Pluginfile from

gem "fastlane-plugin-msbuild"

to

gem "fastlane-plugin-msbuild", path: "../../github/fastlane-plugin-msbuild"

In the project dir I have then done a

$ bundle install

and the forked plugin from the local filesystem is picked up fine. This is also reflected in the Gemfile.lock

In the forked plugin I have updated the version number to be able to track it.

But when I run fastlane

$ bundle exec fastlane android beta

the section with "Used plugins" still state the old version number and I can see from execution that the original plugin is used.

What am I doing wrong? What is the normal way of testing fastlane plugins locally?

I am on macOS Sierra (10.12.6).

2 Answers

This is basically correct. A couple of notes:

rake install installs a local copy of your modified plugin under $GEM_HOME. You should be able to use your modified plugin this way without making any changes to the Pluginfile in your project. But then you have to rake install each time you make changes. Modifying the Pluginfile as you have ignores anything from $GEM_HOME, so rake install is not necessary.

You have a $ before gem in the excerpts from your Pluginfile. I assume that's just transcription, and that you're not using a $ in the Pluginfile. If you are, you should remove it.

Assuming that's all correct, you should pick up the uninstalled gem from the local fork.

Is it possible you also have the plugin gem declared somewhere else, e.g. in your Gemfile?

You can also try running bundle update, which will update all gems in your Gemfile.lock to the most recent versions, depending on the requirements in your Gemfile and Pluginfile. This will also take the gem from the local fork, but it should also work with bundle install.

The short answer to your question is that you're doing it right. I'm not sure why it's not working.

With the help of the insights from Jimmy Dee I finally tracked down the problem: fastlane had its own set of gems installed in ~/.fastlane

This seems to be the default place fastlane wants to put its stuff when using the installer. I probably have had multiple installations of fastlane. The one I thought I used was in /usr/local and that is where bundle was and where my plugin went when I did af rake install.

I simply removed the ~/.fastlane directory entirely and it worked.

Related