Fix deprecated for ruby 2.7.
This commit is contained in:
parent
f81c56e515
commit
1ab0e53a1c
20
faq.gemspec
20
faq.gemspec
|
@ -5,6 +5,20 @@ require "faq/version"
|
|||
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||
if bundle_update_flag
|
||||
env_pwd = ENV['PWD']
|
||||
begin
|
||||
require ::File.expand_path('app/helpers/bundler_helper.rb', env_pwd)
|
||||
extend BundlerHelper
|
||||
rescue LoadError
|
||||
def bundler_with_clean_env
|
||||
if block_given?
|
||||
if Bundler.respond_to?(:with_unbundled_env)
|
||||
Bundler.with_unbundled_env(&Proc.new)
|
||||
else
|
||||
Bundler.with_clean_env(&Proc.new)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
app_path = File.expand_path(__dir__)
|
||||
template_path = env_pwd + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
|
@ -38,9 +52,9 @@ if bundle_update_flag
|
|||
copy_h["name"][locale] = copy_h["name"][locale].sub(/\d+/){|ff| last_index.to_s}
|
||||
end
|
||||
frontend_info << copy_h
|
||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/faq/#{h["filename"]}.html.erb #{folder}modules/faq/#{copy_h["filename"]}.html.erb]}
|
||||
bundler_with_clean_env{%x[cp -f #{app_path}/modules/faq/#{h["filename"]}.html.erb #{folder}modules/faq/#{copy_h["filename"]}.html.erb]}
|
||||
elsif h["force_cover"] == "true"
|
||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/faq/#{h["filename"]}.html.erb #{folder}modules/faq/#{frontend_info[frontend_info_index]["filename"]}.html.erb]}
|
||||
bundler_with_clean_env{%x[cp -f #{app_path}/modules/faq/#{h["filename"]}.html.erb #{folder}modules/faq/#{frontend_info[frontend_info_index]["filename"]}.html.erb]}
|
||||
end
|
||||
end
|
||||
if update_flag
|
||||
|
@ -62,7 +76,7 @@ if bundle_update_flag
|
|||
end
|
||||
else
|
||||
if !Dir.exist?(File.dirname(info_json_file)) && Dir.exist?(File.dirname(File.dirname(info_json_file)))
|
||||
Bundler.with_clean_env{system ('cp -r '+ app_path + '/modules/ ' + folder)}
|
||||
bundler_with_clean_env{system ('cp -r '+ app_path + '/modules/ ' + folder)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue