[rubygems/rubygems] Show better error when installed gemspecs are unreadable
https://github.com/rubygems/rubygems/commit/924f87c8a9
This commit is contained in:
parent
68a1867f53
commit
d6cb62a88f
@ -146,6 +146,18 @@ module Gem
|
|||||||
end
|
end
|
||||||
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
|
class Dependency
|
||||||
include ::Bundler::ForcePlatform
|
include ::Bundler::ForcePlatform
|
||||||
|
|
||||||
|
@ -1024,6 +1024,29 @@ RSpec.describe "bundle install with gem sources" do
|
|||||||
end
|
end
|
||||||
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
|
context "after installing with --standalone" do
|
||||||
before do
|
before do
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
|
Loading…
x
Reference in New Issue
Block a user