Pass require path to sub-process when running `bundle install` (#7618)
Merge pull request 7618
This commit is contained in:
parent
f82458bb15
commit
43b9f13b1a
|
@ -139,9 +139,11 @@ module Jekyll
|
||||||
def after_install(path, options = {})
|
def after_install(path, options = {})
|
||||||
unless options["blank"] || options["skip-bundle"]
|
unless options["blank"] || options["skip-bundle"]
|
||||||
begin
|
begin
|
||||||
require "bundler"
|
# Activate 'bundler' gem and puts it into the `loaded_specs`.
|
||||||
|
# For details: https://rubydocs.org/d/ruby-2-4-0/classes/Kernel.html#method-i-gem
|
||||||
|
gem "bundler"
|
||||||
bundle_install path
|
bundle_install path
|
||||||
rescue LoadError
|
rescue Gem::MissingSpecError
|
||||||
Jekyll.logger.info "Could not load Bundler. Bundle install skipped."
|
Jekyll.logger.info "Could not load Bundler. Bundle install skipped."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -153,8 +155,10 @@ module Jekyll
|
||||||
def bundle_install(path)
|
def bundle_install(path)
|
||||||
Jekyll.logger.info "Running bundle install in #{path.cyan}..."
|
Jekyll.logger.info "Running bundle install in #{path.cyan}..."
|
||||||
Dir.chdir(path) do
|
Dir.chdir(path) do
|
||||||
exe = Gem.bin_path("bundler", "bundle")
|
bundler_gemspec = Gem.loaded_specs["bundler"]
|
||||||
process, output = Jekyll::Utils::Exec.run("ruby", exe, "install")
|
exe = bundler_gemspec.bin_file "bundle"
|
||||||
|
require_paths = bundler_gemspec.full_require_paths
|
||||||
|
process, output = Jekyll::Utils::Exec.run("ruby", "-I", *require_paths, exe, "install")
|
||||||
|
|
||||||
output.to_s.each_line do |line|
|
output.to_s.each_line do |line|
|
||||||
Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty?
|
Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty?
|
||||||
|
|
Loading…
Reference in New Issue