sportngin / brew-gem

Install gems as homebrew formulas
MIT License
195 stars 21 forks source link

Fix gem exe used by RubyGemsDownloadStrategy #51

Closed nicksieger closed 6 years ago

nicksieger commented 6 years ago

What

What are you changing? Describe impact and scope.

Why

Why is this being changed? Provide some context that may help future developers understand the reasoning behind these changes. Quote and/or link to requirements, keeping in mind that JIRA/A-HA/etc links may not be available in the future.

Deploy Plan

Does Platform Operations need to know anything special about this deploy? Are migrations present?

Rollback Plan

URLs

Links to bug tickets or user stories.

QA Plan

Reference commonly used Regression test plans on the [QA Wiki]https://github.com/sportngin/qa-tests/wiki Fill in scenarios below in checklist format. Consider Regression scenarios (did we break something else related to this change) in addition to Happy Path (testing the new feature directly). Evaluate the risk level and label accordingly and ensure the QA Plan matches the risk level!

anfleene commented 6 years ago

QA Looks good :shipit:

$ bin/brew-gem install mailcatcher
==> Fetching mailcatcher from gem source
Fetching: mailcatcher-0.6.5.gem (100%)
Downloaded mailcatcher-0.6.5
Warning: Cannot verify integrity of mailcatcher-0.6.5.gem
A checksum was not provided for this resource
For your reference the SHA256 is: 7d8d5bdac5f86b8801c79ba87add11f44ba661a08a10e14231ae44142c9acf40
==> /usr/bin/gem install /Users/anfleene/Library/Caches/Homebrew/mailcatcher-0.6.5.gem --no-ri --no-rdoc --no-wrapper --no-user-install --install-dir /usr/local/Cellar/gem-mailcatcher/0.6.5 --bindir /us
🍺  /usr/local/Cellar/gem-mailcatcher/0.6.5: 1,010 files, 12.7MB, built in 26 seconds
bin/brew-gem install mailcatcher  51.64s user 27.83s system 96% cpu 1:22.54 total
production-status-check[bot] commented 6 years ago

:octocat: Has QA approval

sshaw commented 6 years ago

Does not work for me:

~/code/ruby/rack-stuff/nginx-unit-test >brew info brew-gem
brew-gem: stable 0.8.4, HEAD
Install RubyGems as Homebrew formulae
https://github.com/sportngin/brew-gem
/usr/local/Cellar/brew-gem/0.8.4 (10 files, 14.1KB) *
  Built from source on 2018-04-07 at 17:19:05
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/brew-gem.rb
~/code/ruby/homebrew-formulas >brew-gem install mailcatcher
==> Fetching mailcatcher from gem source
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /Users/sshaw/.gem/specs/rubygems.org%443/specs.4.8
==> /usr/bin/gem install /Users/sshaw/Library/Caches/Homebrew/mailcatcher-0.6.5.gem --no-ri --no-rdoc --no-wrapper
Last 15 lines from /Users/sshaw/Library/Logs/Homebrew/gem-mailcatcher/01.gem:
2018-04-07 17:23:25 -0400

/usr/bin/gem
install
/Users/sshaw/Library/Caches/Homebrew/mailcatcher-0.6.5.gem
--no-ri
--no-rdoc
--no-wrapper
--no-user-install
--install-dir
/usr/local/Cellar/gem-mailcatcher/0.6.5
--bindir
/usr/local/Cellar/gem-mailcatcher/0.6.5/bin

ERROR:  Could not find a valid gem '/Users/sshaw/Library/Caches/Homebrew/mailcatcher-0.6.5.gem' (>= 0) in any repository
...
nicksieger commented 6 years ago

@sshaw you might need to upgrade rubygems in your ruby. Only more recent versions allow overriding the directory where gem specs are downloaded/cached with an environment variable.

Or use homebrew ruby for a more modern ruby than what's installed by osx.

sshaw commented 6 years ago

@sshaw you might need to upgrade rubygems in your ruby. Only more recent versions allow overriding the directory where gem specs are downloaded/cached with an environment variable.

I possibly have every ruby version since 1.6 installed and none work.

After having a second look, the problem is it's using /usr/bin/gem, which is going to be ancient on all OS X versions that I know of.

Why not take whatever is in the path? Or, is this what's in the path given the sandboxed brew env?

Or use homebrew ruby for a more modern ruby than what's installed by osx.

Homebrew ruby is installed too (keg only though).

sshaw commented 6 years ago

After having a second look, the problem is it's using /usr/bin/gem, which is going to be ancient on all OS X versions that I know of.

Ok, I see that you default to that unless one provides the --homebrew-ruby option.

So basically use of this requires a recent system ruby or Homebrew linked ruby (as you say here 😬).

And why not take whatever is in the path?