This commit is contained in:
BoHung Chiu 2021-03-23 18:09:39 +08:00
parent b951999f0e
commit e31bc35d5c
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version: # Maintain your gem's version:
require "archive/version" require "archive/version"
require 'json'
env_pwd = ENV['PWD'] env_pwd = ENV['PWD']
app_path = File.expand_path(__dir__) app_path = File.expand_path(__dir__)
template_path = env_pwd + '/app/templates' template_path = env_pwd + '/app/templates'
@ -12,7 +13,7 @@ all_template.each do |folder|
next unless File.exist?("#{folder}modules/archive/info.json") next unless File.exist?("#{folder}modules/archive/info.json")
info_json_file = "#{folder}modules/archive/info.json" info_json_file = "#{folder}modules/archive/info.json"
info_json = JSON.parse(File.read(info_json_file)) info_json = JSON.parse(File.read(info_json_file))
check_files = ["archive_index7","archive_index8"] check_files = ["archive_index7.html.erb","archive_index8.html.erb"]
file_infos = [ file_infos = [
{ {
"filename" => "archive_index7", "filename" => "archive_index7",
@ -33,7 +34,7 @@ all_template.each do |folder|
] ]
flags = [] flags = []
check_files.each_with_index do |check_file,i| check_files.each_with_index do |check_file,i|
flag = (info_json["frontend"].select{|h| h["filename"] == check_file}.count == 0 rescue false) flag = (info_json["frontend"].select{|h| h["filename"] == check_file.split(".").first}.count == 0 rescue false)
if flag if flag
info_json["frontend"].push(file_infos[i]) info_json["frontend"].push(file_infos[i])
end end