test
This commit is contained in:
parent
9069cac172
commit
bae12a5ac4
|
@ -77,20 +77,20 @@ change_html_old = 'html.gsub("%7B%7Blogo_url_1%7D%7D",((site.site_logo_1.url.nil
|
||||||
change_html_new = 'html.gsub("%7B%7Blogo_url_1%7D%7D",((site.site_logo_1.url.nil? ? "/assets/default-site-logo.png" : site.site_logo_1.url) rescue "/assets/default-site-logo.png"))'
|
change_html_new = 'html.gsub("%7B%7Blogo_url_1%7D%7D",((site.site_logo_1.url.nil? ? "/assets/default-site-logo.png" : site.site_logo_1.url) rescue "/assets/default-site-logo.png"))'
|
||||||
begin
|
begin
|
||||||
@file_text = File.read(ENV['PWD']+'/app/helpers/application_helper.rb')
|
@file_text = File.read(ENV['PWD']+'/app/helpers/application_helper.rb')
|
||||||
f = File.open(ENV['PWD']+'/app/helpers/application_helper.rb','w')
|
@f = File.open(ENV['PWD']+'/app/helpers/application_helper.rb','w')
|
||||||
if @file_text.include?(change_html_old)
|
if @file_text.include?(change_html_old)
|
||||||
@file_text = @file_text.gsub(change_html_old,change_html_new)
|
@file_text = @file_text.gsub(change_html_old,change_html_new)
|
||||||
f.write(@file_text)
|
@f.write(@file_text)
|
||||||
elsif !@file_text.include?(change_html_old) && !@file_text.include?(change_html_new)
|
elsif !@file_text.include?(change_html_old) && !@file_text.include?(change_html_new)
|
||||||
insert_index = @file_text.index('html.gsub("%7B%7Blogo_url%7D%7D"')
|
insert_index = @file_text.index('html.gsub("%7B%7Blogo_url%7D%7D"')
|
||||||
@file_text.insert(insert_index,change_html_new+"\n")
|
@file_text.insert(insert_index,change_html_new+"\n")
|
||||||
f.write(@file_text)
|
@f.write(@file_text)
|
||||||
end
|
end
|
||||||
f.close
|
@f.close
|
||||||
puts "finish change application_helper.rb in #{ENV['PWD']}/app/helpers/"
|
puts "finish change application_helper.rb in #{ENV['PWD']}/app/helpers/"
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "Permission denied in #{ENV['PWD']}/app/helpers/application_helper.rb"
|
puts "Permission denied in #{ENV['PWD']}/app/helpers/application_helper.rb"
|
||||||
f.close
|
@f.close
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
Site.first.update(:display_title_in_frontend=>false)
|
Site.first.update(:display_title_in_frontend=>false)
|
||||||
|
|
Loading…
Reference in New Issue