修復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"
|
require "ad_banner/version"
|
||||||
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||||
if bundle_update_flag
|
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"
|
require "fileutils"
|
||||||
app_path = File.expand_path(__dir__)
|
app_path = File.expand_path(__dir__)
|
||||||
template_path = ENV['PWD'] + '/app/templates'
|
template_path = ENV['PWD'] + '/app/templates'
|
||||||
|
@ -40,7 +55,11 @@ if bundle_update_flag
|
||||||
end
|
end
|
||||||
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
|
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
|
||||||
IO.copy_stream(download, save_zip_name)
|
IO.copy_stream(download, save_zip_name)
|
||||||
require 'zip'
|
begin
|
||||||
|
require 'zip'
|
||||||
|
rescue LoadError
|
||||||
|
bundler_with_clean_env{system("gem install zip-zip")}
|
||||||
|
end
|
||||||
FileUtils.mkdir_p(destination)
|
FileUtils.mkdir_p(destination)
|
||||||
Zip::File.open(save_zip_name) do |zip_file|
|
Zip::File.open(save_zip_name) do |zip_file|
|
||||||
zip_file.each do |f|
|
zip_file.each do |f|
|
||||||
|
|
Loading…
Reference in New Issue