57 lines
1.9 KiB
Ruby
57 lines
1.9 KiB
Ruby
|
# -*- encoding: utf-8 -*-
|
||
|
# stub: hnc_cancer_predict 0.0.1 ruby lib
|
||
|
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||
|
if bundle_update_flag
|
||
|
insert_flag = 0
|
||
|
app_path = File.expand_path(__dir__)
|
||
|
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.include?('mobile')
|
||
|
begin
|
||
|
if folder.split('/')[-1] != 'mobile'
|
||
|
begin
|
||
|
system ('cp -r '+ app_path + '/modules/. ' + folder+'/modules/.')
|
||
|
puts "finish copy module hnc_cancer_predict to #{folder}"
|
||
|
rescue
|
||
|
puts 'error copy'
|
||
|
end
|
||
|
end
|
||
|
texts = File.read(folder+'partial/_head.html.erb')
|
||
|
insert_flag = 0
|
||
|
if texts.include?(check_texts)
|
||
|
texts = texts.gsub(check_texts,edit_texts)
|
||
|
insert_flag = 1
|
||
|
end
|
||
|
if insert_flag == 1
|
||
|
puts 'editing _head.html.erb'
|
||
|
f = File.open(folder+'partial/_head.html.erb','w')
|
||
|
f.write(texts)
|
||
|
f.close
|
||
|
end
|
||
|
rescue
|
||
|
puts "not found _head.html.erb in #{folder}"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
Gem::Specification.new do |s|
|
||
|
s.name = "hnc_cancer_predict"
|
||
|
s.version = "0.0.1"
|
||
|
|
||
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||
|
s.require_paths = ["lib"]
|
||
|
s.authors = ["Pohung Chiu"]
|
||
|
s.date = "2024-08-22"
|
||
|
s.description = "Predict Head and Neck Cancer Tool for Orbit"
|
||
|
s.email = ["bohung@rulingcom.com"]
|
||
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||
|
s.homepage = "http://www.rulingcom.com"
|
||
|
s.licenses = ["MIT"]
|
||
|
s.summary = "Predict Head and Neck Cancer Tool for Orbit"
|
||
|
s.test_files = Dir["test/**/*"]
|
||
|
end
|