Cannot run installed "mono" gems (ie: fastlane)
lkraider opened this issue · 6 comments
Installing works:
brew gem install fastlane --homebrew-ruby
==> Fetching fastlane from gem source
Fetching: fastlane-2.9.0.gem (100%)
Downloaded fastlane-2.9.0
Warning: Cannot verify integrity of fastlane-2.9.0.gem
A checksum was not provided for this resource
For your reference the SHA256 is: 5dbede0e3f03daa846d3f075777632989aaabd267b3ea3be3ddf37a9dc7f9503
==> /usr/local/bin/gem install ~/Library/Caches/Homebrew/fastlane-2.9.0.gem --no-ri --no-rdoc --no-wrapper --n
🍺 /usr/local/Cellar/gem-fastlane/2.9.0: 4,004 files, 62.8M, built in 1 minute 25 seconds
But executing the binary fails:
$ fastlane init
/usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fastlane/cli_tools_distributor (LoadError)
from /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/gem-fastlane/2.9.0/gems/fastlane-2.9.0/bin/fastlane:4:in `<top (required)>'
from /usr/local/bin/fastlane:5:in `load'
from /usr/local/bin/fastlane:5:in `<main>'
seems like a bug in how fastlane's require works.
This is a non-standard way to load gems for a binary in ruby:
https://github.com/fastlane/fastlane/blob/master/bin/fastlane#L2
The standard way is to require the gem itself.
I am not familiar with the gem require machinery. Created an issue over there to maybe get some helpful input.
@KrauseFx responded:
We don't use any non-standard things as far as I know.
Anyway, if it works with regular gem install shouldn't brew gem support it too?
No it wont. On a normal gem install the binary location doesn't change. With brew-gem we symlink it and it's used for /usr/local/bin
ruby automatically loads the lib directory when you require a gem so there's no need to use $LOAD_PATH. I was suggesting requiring the gem in the binary like this
https://github.com/sportngin/opsicle/blob/master/bin/opsicle#L1-L6
specifically for fastlane something like:
#!/usr/bin/env ruby
require 'rubygems'
require 'fastlane'
....
Well, fastlane is not changing their code (they closed the issue), so I guess brew gem will not be compatible then.