зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Fix installing plugins via relative paths
This affected both CLI and Gemfile installs https://github.com/rubygems/rubygems/commit/a0d101a8df
This commit is contained in:
Родитель
cd516ebd20
Коммит
c5e661b1d7
|
@ -77,7 +77,7 @@ module Bundler
|
|||
|
||||
def install_path(names, version, path)
|
||||
source_list = SourceList.new
|
||||
source = source_list.add_path_source({ "path" => path })
|
||||
source = source_list.add_path_source({ "path" => path, "root_path" => SharedHelpers.pwd })
|
||||
|
||||
install_all_sources(names, version, source_list, source)
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module Bundler
|
|||
class Installer
|
||||
class Path < Bundler::Source::Path
|
||||
def root
|
||||
Plugin.root
|
||||
SharedHelpers.in_bundle? ? Bundler.root : Plugin.root
|
||||
end
|
||||
|
||||
def generate_bin(spec, disable_extensions = false)
|
||||
|
|
|
@ -212,14 +212,42 @@ RSpec.describe "bundler plugin install" do
|
|||
end
|
||||
end
|
||||
|
||||
it "installs from a path source" do
|
||||
build_lib "path_plugin" do |s|
|
||||
s.write "plugins.rb"
|
||||
end
|
||||
bundle "plugin install path_plugin --path #{lib_path("path_plugin-1.0")}"
|
||||
context "path plugins" do
|
||||
it "installs from a path source" do
|
||||
build_lib "path_plugin" do |s|
|
||||
s.write "plugins.rb"
|
||||
end
|
||||
bundle "plugin install path_plugin --path #{lib_path("path_plugin-1.0")}"
|
||||
|
||||
expect(out).to include("Installed plugin path_plugin")
|
||||
plugin_should_be_installed("path_plugin")
|
||||
expect(out).to include("Installed plugin path_plugin")
|
||||
plugin_should_be_installed("path_plugin")
|
||||
end
|
||||
|
||||
it "installs from a relative path source" do
|
||||
build_lib "path_plugin" do |s|
|
||||
s.write "plugins.rb"
|
||||
end
|
||||
path = lib_path("path_plugin-1.0").relative_path_from(bundled_app)
|
||||
bundle "plugin install path_plugin --path #{path}"
|
||||
|
||||
expect(out).to include("Installed plugin path_plugin")
|
||||
plugin_should_be_installed("path_plugin")
|
||||
end
|
||||
|
||||
it "installs from a relative path source when inside an app" do
|
||||
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
|
||||
gemfile ""
|
||||
|
||||
build_lib "ga-plugin" do |s|
|
||||
s.write "plugins.rb"
|
||||
end
|
||||
|
||||
path = lib_path("ga-plugin-1.0").relative_path_from(bundled_app)
|
||||
bundle "plugin install ga-plugin --path #{path}"
|
||||
|
||||
plugin_should_be_installed("ga-plugin")
|
||||
expect(local_plugin_gem("foo-1.0")).not_to be_directory
|
||||
end
|
||||
end
|
||||
|
||||
context "Gemfile eval" do
|
||||
|
@ -291,6 +319,21 @@ RSpec.describe "bundler plugin install" do
|
|||
plugin_should_be_installed("ga-plugin")
|
||||
end
|
||||
|
||||
it "accepts relative path sources" do
|
||||
build_lib "ga-plugin" do |s|
|
||||
s.write "plugins.rb"
|
||||
end
|
||||
|
||||
path = lib_path("ga-plugin-1.0").relative_path_from(bundled_app)
|
||||
install_gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
plugin 'ga-plugin', :path => "#{path}"
|
||||
G
|
||||
|
||||
expect(out).to include("Installed plugin ga-plugin")
|
||||
plugin_should_be_installed("ga-plugin")
|
||||
end
|
||||
|
||||
context "in deployment mode" do
|
||||
it "installs plugins" do
|
||||
install_gemfile <<-G
|
||||
|
|
Загрузка…
Ссылка в новой задаче