[rubygems/rubygems] Show better error when installed gemspecs are unreadable

https://github.com/rubygems/rubygems/commit/924f87c8a9
This commit is contained in:
David Rodríguez 2024-04-23 20:15:30 +02:00 коммит произвёл git
Родитель 68a1867f53
Коммит d6cb62a88f
2 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -146,6 +146,18 @@ module Gem
end
end
module BetterPermissionError
def data
Bundler::SharedHelpers.filesystem_access(loaded_from, :read) do
super
end
end
end
class StubSpecification
prepend BetterPermissionError
end
class Dependency
include ::Bundler::ForcePlatform

Просмотреть файл

@ -1024,6 +1024,29 @@ RSpec.describe "bundle install with gem sources" do
end
end
describe "when gemspecs are unreadable", :permissions do
let(:gemspec_path) { vendored_gems("specifications/rack-1.0.0.gemspec") }
before do
gemfile <<~G
source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
bundle "config path vendor/bundle"
bundle :install
expect(out).to include("Bundle complete!")
expect(err).to be_empty
FileUtils.chmod("-r", gemspec_path)
end
it "shows a good error" do
bundle :install, raise_on_error: false
expect(err).to include(gemspec_path.to_s)
expect(err).to include("grant read permissions")
end
end
context "after installing with --standalone" do
before do
install_gemfile <<-G