Slightly more robust extension downloader.
This commit is contained in:
parent
cb9672bd9e
commit
d4971fcfaa
@ -20,20 +20,26 @@ end
|
|||||||
|
|
||||||
|
|
||||||
if !File.exists?(extdir)
|
if !File.exists?(extdir)
|
||||||
puts "Downloading and unpacking the ninesixty plugin."
|
begin
|
||||||
FileUtils.mkdir(extdir)
|
puts "Downloading the ninesixty plugin."
|
||||||
zipfile = File.join(extdir, "ninesixty.zip")
|
FileUtils.mkdir(extdir)
|
||||||
open(zipfile, "wb") do |tgz|
|
zipfile = File.join(extdir, "ninesixty.zip")
|
||||||
tgz << fetch(download_link).body
|
open(zipfile, "wb") do |tgz|
|
||||||
|
tgz << fetch(download_link).body
|
||||||
|
end
|
||||||
|
puts "Unzipping the ninesixty plugin."
|
||||||
|
Zip::ZipFile::open(zipfile) { |zf|
|
||||||
|
zf.each { |e|
|
||||||
|
fpath = File.join(extdir, e.name)
|
||||||
|
FileUtils.mkdir_p(File.dirname(fpath))
|
||||||
|
zf.extract(e, fpath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File.unlink(zipfile)
|
||||||
|
funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0]
|
||||||
|
FileUtils.mv(funky_directory, File.join(extdir,'ninesixty'))
|
||||||
|
rescue Exception => e
|
||||||
|
FileUtils.rmdir(extdir)
|
||||||
|
raise
|
||||||
end
|
end
|
||||||
Zip::ZipFile::open(zipfile) { |zf|
|
|
||||||
zf.each { |e|
|
|
||||||
fpath = File.join(extdir, e.name)
|
|
||||||
FileUtils.mkdir_p(File.dirname(fpath))
|
|
||||||
zf.extract(e, fpath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File.unlink(zipfile)
|
|
||||||
funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0]
|
|
||||||
FileUtils.mv(funky_directory, File.join(extdir,'ninesixty'))
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user