Fix deprecated for ruby 2.7.
This commit is contained in:
parent
edec4b9a3b
commit
ff58ec537e
|
@ -7,6 +7,20 @@ bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
|||
if bundle_update_flag
|
||||
require File.expand_path("../update_event_news", __FILE__)
|
||||
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+'/*/')
|
||||
|
@ -14,14 +28,14 @@ if bundle_update_flag
|
|||
all_template.each do |folder|
|
||||
if !folder.include?('mobile')
|
||||
if Dir.exist?("#{folder}modules/event_news")
|
||||
Bundler.with_clean_env{system ("cp -rf #{folder}modules/event_news #{folder}modules/event_news_mod && rm -rf #{folder}modules/event_news")}
|
||||
bundler_with_clean_env{system ("cp -rf #{folder}modules/event_news #{folder}modules/event_news_mod && rm -rf #{folder}modules/event_news")}
|
||||
end
|
||||
if Dir.exist?("#{folder}modules/event_news_mod/event_news")
|
||||
Bundler.with_clean_env{system ("cp -rf #{folder}modules/event_news_mod/event_news/* #{folder}modules/event_news_mod/. && rm -rf #{folder}modules/event_news_mod/event_news")}
|
||||
bundler_with_clean_env{system ("cp -rf #{folder}modules/event_news_mod/event_news/* #{folder}modules/event_news_mod/. && rm -rf #{folder}modules/event_news_mod/event_news")}
|
||||
end
|
||||
info_json_file = "#{folder}modules/event_news_mod/info.json"
|
||||
if File.exist?(info_json_file)
|
||||
Bundler.with_clean_env{system ('cp -f '+ app_path + '/modules/event_news_mod/show.html.erb ' + "#{folder}modules/event_news_mod/.")}
|
||||
bundler_with_clean_env{system ('cp -f '+ app_path + '/modules/event_news_mod/show.html.erb ' + "#{folder}modules/event_news_mod/.")}
|
||||
update_event_news_template(folder)
|
||||
begin
|
||||
file_text = File.read(info_json_file) rescue ""
|
||||
|
@ -49,9 +63,9 @@ if bundle_update_flag
|
|||
copy_h["name"][locale] = copy_h["name"][locale].sub(/\d+/){|ff| last_index.to_s}
|
||||
end
|
||||
widget_info << copy_h
|
||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news_mod/_#{h["filename"]}.html.erb #{folder}modules/event_news_mod/_#{copy_h["filename"]}.html.erb]}
|
||||
bundler_with_clean_env{%x[cp -f #{app_path}/modules/event_news_mod/_#{h["filename"]}.html.erb #{folder}modules/event_news_mod/_#{copy_h["filename"]}.html.erb]}
|
||||
elsif h["force_cover"] == "true"
|
||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news_mod/_#{h["filename"]}.html.erb #{folder}modules/event_news_mod/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
|
||||
bundler_with_clean_env{%x[cp -f #{app_path}/modules/event_news_mod/_#{h["filename"]}.html.erb #{folder}modules/event_news_mod/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
|
||||
end
|
||||
end
|
||||
if update_flag
|
||||
|
@ -72,7 +86,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
|
||||
|
@ -83,7 +97,7 @@ if bundle_update_flag
|
|||
# moudle_path = "#{folder}modules/universal_table/"
|
||||
# begin
|
||||
# if Dir.exist?(File.dirname(moudle_path))
|
||||
# Bundler.with_clean_env{system ('cp -r '+ app_path + '/modules/ ' + folder)}
|
||||
# bundler_with_clean_env{system ('cp -r '+ app_path + '/modules/ ' + folder)}
|
||||
# end
|
||||
# rescue => e
|
||||
# puts "There was some error when updating event_news widget."
|
||||
|
|
Loading…
Reference in New Issue