修復require zip錯誤
This commit is contained in:
parent
b4859dfaa4
commit
8341365785
|
@ -4,6 +4,21 @@ $:.push File.expand_path("../lib", __FILE__)
|
|||
require "ad_banner/version"
|
||||
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||
if bundle_update_flag
|
||||
env_pwd = ENV['PWD']
|
||||
begin
|
||||
require ::File.expand_path('app/helpers/bundler_helper.rb', env_pwd)
|
||||
extend BundlerHelper
|
||||
rescue LoadError
|
||||
def bundler_with_clean_env(&block)
|
||||
if block_given?
|
||||
if Bundler.respond_to?(:with_unbundled_env)
|
||||
Bundler.with_unbundled_env(&block)
|
||||
else
|
||||
Bundler.with_clean_env(&block)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
require "fileutils"
|
||||
app_path = File.expand_path(__dir__)
|
||||
template_path = ENV['PWD'] + '/app/templates'
|
||||
|
@ -40,7 +55,11 @@ if bundle_update_flag
|
|||
end
|
||||
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
|
||||
IO.copy_stream(download, save_zip_name)
|
||||
begin
|
||||
require 'zip'
|
||||
rescue LoadError
|
||||
bundler_with_clean_env{system("gem install zip-zip")}
|
||||
end
|
||||
FileUtils.mkdir_p(destination)
|
||||
Zip::File.open(save_zip_name) do |zip_file|
|
||||
zip_file.each do |f|
|
||||
|
|
Loading…
Reference in New Issue