Auto fix missing template.

This commit is contained in:
BoHung Chiu 2021-05-19 22:40:22 +08:00
parent f51e054c33
commit 9e53640351
1 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,21 @@ $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "universal_table/version"
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
if bundle_update_flag
env_pwd = ENV['PWD']
app_path = File.expand_path(__dir__)
template_path = env_pwd + '/app/templates'
all_template = Dir.glob(template_path+'/*/')
all_template.each do |folder|
if !folder.include?('mobile')
moudle_path = "#{folder}modules/universal_table/"
if !Dir.exist?(moudle_path) && Dir.exist?(File.dirname(moudle_path))
Bundler.with_clean_env{system ('cp -r '+ app_path + '/modules/ ' + folder)}
end
end
end
end
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "universal_table"