From 4e25c36d86caafd16c1db0ddd427a63b767dd3ab Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 13 Apr 2020 16:11:38 +0530 Subject: [PATCH] Revert "Pass require path to sub-process when running `bundle install`" (#8117) * Revert "Pass require path to sub-process when running `bundle install` (#7618)" This reverts commit 43b9f13b1a6ed7b49985a855cb7889534fcb5f2e. * Revert "Update history to reflect merge of #7618 [ci skip]" This reverts commit 2c605bfeb37cc8f414b21d45bf835784cfc174b4. --- History.markdown | 1 - lib/jekyll/commands/new.rb | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/History.markdown b/History.markdown index a9f6717aa..3bce037cf 100644 --- a/History.markdown +++ b/History.markdown @@ -29,7 +29,6 @@ * Add PageDrop to provide Liquid templates with data (#7992) * Optimize `Kramdown::JekyllDocument#to_html` calls (#8041) * Reduce Jekyll::Renderer instances during a build (#7570) - * Pass require path to sub-process when running `bundle install` (#7618) ### Documentation diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index cee16687e..b8539b105 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -139,11 +139,9 @@ module Jekyll def after_install(path, options = {}) unless options["blank"] || options["skip-bundle"] begin - # 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" + require "bundler" bundle_install path - rescue Gem::MissingSpecError + rescue LoadError Jekyll.logger.info "Could not load Bundler. Bundle install skipped." end end @@ -155,10 +153,8 @@ module Jekyll def bundle_install(path) Jekyll.logger.info "Running bundle install in #{path.cyan}..." Dir.chdir(path) do - bundler_gemspec = Gem.loaded_specs["bundler"] - 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") + exe = Gem.bin_path("bundler", "bundle") + process, output = Jekyll::Utils::Exec.run("ruby", exe, "install") output.to_s.each_line do |line| Jekyll.logger.info("Bundler:".green, line.strip) unless line.to_s.empty?