From 8bf121655b60d559c2a939b941d5a763cf72efe4 Mon Sep 17 00:00:00 2001 From: bohung Date: Fri, 4 Nov 2022 15:15:14 +0800 Subject: [PATCH] Fix bug. --- patchfile.gemspec | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/patchfile.gemspec b/patchfile.gemspec index 7be7161..3dfdd55 100644 --- a/patchfile.gemspec +++ b/patchfile.gemspec @@ -76,15 +76,20 @@ if bundle_update_flag require 'nokogiri' rescue ScriptError => e if RUBY_VERSION.to_f <= 2.1 - system('gem install nokogiri -v 1.7.0.1') + nokogiri_version = '1.7.0.1' else - system('gem install nokogiri -v 1.8.5') + nokogiri_version = '1.8.5' end - gem_home = ENV["GEM_HOME"] - if !gem_home.nil? - $LOAD_PATH << "#{gem_home}/gems/nokogiri-1.7.0.1/lib" - $LOAD_PATH << "#{gem_home}/extensions/#{RUBY_PLATFORM}/#{RUBY_VERSION}/nokogiri-1.7.0.1" - require 'nokogiri' + flag = system("gem install nokogiri -v #{nokogiri_version}") + if flag + gem_home = ENV["GEM_HOME"] + if !gem_home.nil? + $LOAD_PATH << "#{gem_home}/gems/nokogiri-#{nokogiri_version}/lib" + $LOAD_PATH << "#{gem_home}/extensions/#{RUBY_PLATFORM}/#{RUBY_VERSION}/nokogiri-#{nokogiri_version}" + require 'nokogiri' + end + else + next end end puts "changing header.html.erb in #{folder}/home/header.html.erb"