add change bootstrap.js by code
This commit is contained in:
parent
4620557e72
commit
25e3ae7fde
|
@ -2,19 +2,25 @@
|
|||
# stub: cancerpredict 0.0.1 ruby lib
|
||||
routes_text = File.read(ENV['PWD']+'/config/routes.rb')
|
||||
insert_texts = ['get "cancerpredictResult",to: "cancerpredicts#calculate"','post "cancerpredictResult",to: "cancerpredicts#calculate"']
|
||||
insert_flag = 0
|
||||
insert_texts.each do |insert_text|
|
||||
if !routes_text.include?(insert_text)
|
||||
insert_index = routes_text.index('get "/admin/license_denied" => "store_api#render_license_denied"')
|
||||
routes_text.insert(insert_index,insert_text+"\n")
|
||||
insert_flag = 1
|
||||
end
|
||||
end
|
||||
app_path = File.expand_path(__dir__)
|
||||
f = File.open(ENV['PWD']+'/config/routes.rb','w')
|
||||
f.write(routes_text)
|
||||
f.close
|
||||
if insert_flag == 1
|
||||
f = File.open(ENV['PWD']+'/config/routes.rb','w')
|
||||
f.write(routes_text)
|
||||
f.close
|
||||
end
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
all_template = Dir.glob(template_path+'/*/')
|
||||
puts 'copying module'
|
||||
check_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"%>'
|
||||
edit_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%>'
|
||||
all_template.each do |folder|
|
||||
if folder.split('/')[-1] != 'mobile'
|
||||
begin
|
||||
|
@ -23,6 +29,17 @@ all_template.each do |folder|
|
|||
puts 'error copy'
|
||||
end
|
||||
end
|
||||
texts = File.read(folder+'/partial/_head.html.erb')
|
||||
insert_flag = 0
|
||||
if texts.include?(check_texts)
|
||||
texts.gsub(check_texts,edit_texts)
|
||||
insert_flag = 1
|
||||
end
|
||||
if insert_flag == 1
|
||||
f = File.open(folder+'/partial/_head.html.erb','w')
|
||||
f.write(texts)
|
||||
f.close
|
||||
end
|
||||
end
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "cancerpredict"
|
||||
|
|
Loading…
Reference in New Issue