seminar2/seminar.gemspec

97 lines
11 KiB
Ruby
Raw Normal View History

# -*- encoding: utf-8 -*-
# stub: seminar 0.0.1 ruby lib
2021-08-22 08:08:34 +00:00
begin
require "yaml"
require "erb"
data = File.open(File.join(File.dirname(__FILE__), 'config', 'list.yml')).read
$seminar_list = YAML.safe_load(ERB.new(data).result(binding)).map{|k,v| [k.to_sym,v]}.to_h
rescue => e
puts [e.to_s,e.backtrace]
end
require "json"
env_pwd = ENV['PWD']
app_path = File.expand_path(__dir__)
template_path = env_pwd + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
default_seminar_widget_info = JSON.parse(File.read("#{app_path}/modules/seminar/info.json"))["widgets"].sort_by{|h| h["filename"].to_i} rescue []
all_template.each do |folder|
if !folder.include?('mobile')
info_json_file = "#{folder}modules/seminar/info.json"
if File.exist?(info_json_file)
2021-11-18 11:11:49 +00:00
#Bundler.with_clean_env{system ('cp -f '+ app_path + '/modules/seminar/show.html.erb ' + "#{folder}modules/seminar/.")}
begin
file_text = File.read(info_json_file) rescue ""
encode_file_text = file_text.encode("UTF-8", "UTF-8", invalid: :replace, replace: "???")
next if (encode_file_text.include?("???") rescue true)
info = JSON.parse(encode_file_text) rescue {}
flag = (info.count != 0 rescue false)
if flag
puts "Checking seminar widgets"
widget_info = info["widgets"].sort_by{|h| h["filename"].to_i} rescue []
update_flag = false
last_index = widget_info[-1]["filename"].match(/\d+/)[0].to_i rescue nil
if !last_index.nil?
idx_regex = /^(\d+[\. \t]*)|[ \t]+$/
default_seminar_widget_info.each do |h|
name_without_index = h["name"]["zh_tw"].gsub(idx_regex,'')
widget_info_index = (widget_info.index{|hh| hh["name"]["zh_tw"].gsub(idx_regex,'') == name_without_index}||-1 rescue -1)
if widget_info_index == -1
update_flag = true
copy_h = h.dup
h.delete("force_cover")
last_index = last_index + 1
copy_h["filename"] = copy_h["filename"].sub(/\d+/){|ff| last_index.to_s}
copy_h["name"].keys.each do |locale|
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/seminar/_#{h["filename"]}.html.erb #{folder}modules/seminar/_#{copy_h["filename"]}.html.erb]}
elsif h["force_cover"] == "true"
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/seminar/_#{h["filename"]}.html.erb #{folder}modules/seminar/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
end
end
if update_flag
info["widgets"] = widget_info
puts "Writing json #{info["widgets"].count} in #{info_json_file}"
begin
info_json = JSON.pretty_generate(info).gsub(":[",":[\n").gsub(":{",":{\n")
rescue
info_json = info.to_s.gsub("=>",": \n")
end
File.open(info_json_file,"w+"){|f| f.write(info_json)}
end
end
end
rescue => e
puts e
puts "There has some error when checking seminar widgets"
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)}
end
end
end
end
2016-06-29 06:57:45 +00:00
Gem::Specification.new do |s|
s.name = "seminar"
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 = ["Rulingcom"]
s.date = "2019-11-19"
s.description = "Seminar plugin."
s.email = ["orbit@rulingcom.com"]
s.files = ["MIT-LICENSE", "README.rdoc", "Rakefile", "app/assets/javascripts/check_seminar_set_items.js.erb", "app/assets/javascripts/field-forms.js", "app/assets/javascripts/seminar.js.coffee", "app/assets/javascripts/seminar_sets.js", "app/assets/stylesheets/seminar.css.scss", "app/assets/stylesheets/seminar_sets.css", "app/controllers/admin/seminar_agreements_controller.rb", "app/controllers/admin/seminar_item_contents_controller.rb", "app/controllers/admin/seminar_items_controller.rb", "app/controllers/admin/seminar_signups_controller.rb", "app/controllers/admin/seminars_controller.rb", "app/controllers/seminars_controller.rb", "app/helpers/admin/seminars_field_helper.rb", "app/helpers/admin/seminars_helper.rb", "app/helpers/admin/seminars_values_helper.rb", "app/models/seminar_agreement.rb", "app/models/seminar_file.rb", "app/models/seminar_item.rb", "app/models/seminar_item_content.rb", "app/models/seminar_link.rb", "app/models/seminar_main.rb", "app/models/seminar_review.rb", "app/models/seminar_signup.rb", "app/models/seminar_signup_contribute.rb", "app/models/seminar_signup_field.rb", "app/models/seminar_signup_value.rb", "app/views/admin/seminar_agreements", "app/views/admin/seminar_agreements/index.html.erb", "app/views/admin/seminar_item_contents", "app/views/admin/seminar_item_contents/_form.html.erb", "app/views/admin/seminar_item_contents/edit.html.erb", "app/views/admin/seminar_item_contents/index.html.erb", "app/views/admin/seminar_item_contents/new.html.erb", "app/views/admin/seminar_items", "app/views/admin/seminar_items/_delete_modal.html.erb", "app/views/admin/seminar_items/_form.html.erb", "app/views/admin/seminar_items/_index.html.erb", "app/views/admin/seminar_items/_item.html.erb", "app/views/admin/seminar_items/index.html.erb", "app/views/admin/seminar_items/index.js.erb", "app/views/admin/seminar_signups", "app/views/admin/seminar_signups/edit.html.erb", "app/views/admin/seminars", "app/views/admin/seminars/_attribute_field.html.erb", "app/views/admin/seminars/_form.html.erb", "app/views/admin/seminars/_form_file.html.erb", "app/views/admin/seminars/_form_link.html.erb", "app/views/admin/seminars/_index.html.erb", "app/views/admin/seminars/_support_member_form_js.erb", "app/views/admin/seminars/edit.html.erb", "app/views/admin/seminars/export.xlsx.axlsx", "app/views/admin/seminars/index.html.erb", "app/views/admin/seminars/new.html.erb", "app/views/admin/seminars/seminar_item_content.html.erb", "app/views/admin/seminars/seminar_signup.html.erb", "app/views/admin/seminars/seminar_signup_field.html.erb", "app/views/seminars", "app/views/seminars/add_file.html.erb", "app/views/seminars/check_availability.html.erb", "app/views/seminars/check_email.html.erb", "app/views/seminars/con_login.html.erb", "app/views/seminars/con_logout.html.erb", "app/views/seminars/con_upload.html.erb", "app/views/seminars/edit_file.html.erb", "app/views/seminars/index.html.erb", "app/views/seminars/show.html.erb", "app/views/seminars/show_data.html.erb", "app/views/seminars/show_privacy.html.erb", "app/views/seminars/signup_ok.html.erb", "app/views/simple_captcha", "app/views/simple_captcha/_simple_captcha.erb", "config/locales/en.yml", "config/locales/zh_tw.yml", "config/routes.rb", "lib/seminar", "lib/seminar.rb", "lib/seminar/engine.rb", "lib/seminar/version.rb", "lib/tasks/seminar_tasks.rake", "test/controllers/seminar_controller_test.rb", "test/dummy", "test/dummy/README.rdoc", "test/dummy/Rakefile", "test/dummy/app", "test/dummy/app/assets", "test/dummy/app/assets/images", "test/dummy/app/assets/javascripts", "test/dummy/app/assets/javascripts/application.js", "test/dummy/app/assets/stylesheets", "test/dummy/app/assets/stylesheets/application.css", "test/dummy/app/controllers", "test/dummy/app/controllers/application_controller.rb", "test/dummy/app/controllers/concerns", "test/dummy/app/helpers", "test/dummy/app/helpers/application_helper.rb", "test/dummy/app/mailers", "test/dummy/app/models", "test/dummy/app/models/concerns", "test/dummy/app/views", "test/dummy/app/views/layouts", "test/dummy/app/views/layouts
s.homepage = "http://www.rulingcom.com"
s.licenses = ["MIT"]
s.rubygems_version = "2.2.2"
s.summary = "Seminar plugin."
s.test_files = ["test/dummy", "test/dummy/app", "test/dummy/app/assets", "test/dummy/app/assets/javascripts", "test/dummy/app/assets/javascripts/application.js", "test/dummy/app/assets/images", "test/dummy/app/assets/stylesheets", "test/dummy/app/assets/stylesheets/application.css", "test/dummy/app/models", "test/dummy/app/models/concerns", "test/dummy/app/helpers", "test/dummy/app/helpers/application_helper.rb", "test/dummy/app/mailers", "test/dummy/app/views", "test/dummy/app/views/layouts", "test/dummy/app/views/layouts/application.html.erb", "test/dummy/app/controllers", "test/dummy/app/controllers/concerns", "test/dummy/app/controllers/application_controller.rb", "test/dummy/config", "test/dummy/config/routes.rb", "test/dummy/config/environments", "test/dummy/config/environments/test.rb", "test/dummy/config/environments/development.rb", "test/dummy/config/environments/production.rb", "test/dummy/config/initializers", "test/dummy/config/initializers/assets.rb", "test/dummy/config/initializers/session_store.rb", "test/dummy/config/initializers/wrap_parameters.rb", "test/dummy/config/initializers/filter_parameter_logging.rb", "test/dummy/config/initializers/inflections.rb", "test/dummy/config/initializers/mime_types.rb", "test/dummy/config/initializers/backtrace_silencers.rb", "test/dummy/config/initializers/cookies_serializer.rb", "test/dummy/config/secrets.yml", "test/dummy/config/boot.rb", "test/dummy/config/environment.rb", "test/dummy/config/database.yml", "test/dummy/config/application.rb", "test/dummy/config/locales", "test/dummy/config/locales/en.yml", "test/dummy/public", "test/dummy/public/500.html", "test/dummy/public/422.html", "test/dummy/public/404.html", "test/dummy/public/favicon.ico", "test/dummy/bin", "test/dummy/bin/rake", "test/dummy/bin/rails", "test/dummy/bin/bundle", "test/dummy/lib", "test/dummy/lib/assets", "test/dummy/config.ru", "test/dummy/Rakefile", "test/dummy/README.rdoc", "test/dummy/log", "test/seminar_test.rb", "test/helpers/seminar_helper_test.rb", "test/test_helper.rb", "test/controllers/seminar_controller_test.rb"]
2016-06-29 06:57:45 +00:00
s.installed_by_version = "2.2.2" if s.respond_to? :installed_by_version
s.add_dependency "custom_announcement"
s.add_dependency "custom_gallery"
2016-06-29 06:57:45 +00:00
end