upgraded jekyll and bundle
This commit is contained in:
parent
8b0d19ab35
commit
36bfce14b4
127 changed files with 4647 additions and 4225 deletions
|
|
@ -1,6 +1,7 @@
|
|||
require 'uri'
|
||||
require 'faraday'
|
||||
require 'yaml'
|
||||
require 'date'
|
||||
require 'mini_magick'
|
||||
|
||||
class Localizer
|
||||
|
|
@ -49,14 +50,17 @@ class Localizer
|
|||
|
||||
# helper to make sure that we can follow redirects, which can be important for
|
||||
# many of the cloud file sharing services out there.
|
||||
def download_file_helper(connection, url)
|
||||
response = connection.get do |req|
|
||||
req.url(url)
|
||||
end
|
||||
def download_file_helper(connection, url, redirect_limit = 5)
|
||||
raise "Too many redirects while downloading #{url}" if redirect_limit <= 0
|
||||
|
||||
response = connection.get(url)
|
||||
|
||||
case response.status
|
||||
when 302
|
||||
download_file_helper(connection, response['Location'])
|
||||
when 301, 302, 303, 307, 308
|
||||
location = response.headers['location']
|
||||
raise "Redirect received without Location header for #{url}" unless location
|
||||
|
||||
download_file_helper(connection, location, redirect_limit - 1)
|
||||
when 200
|
||||
response
|
||||
else
|
||||
|
|
@ -70,7 +74,7 @@ class Localizer
|
|||
contents = File.read(file, encoding: 'UTF-8')
|
||||
|
||||
# Step 1: get all the images that must be downloaded
|
||||
yaml = YAML.load(contents)
|
||||
yaml = YAML.safe_load(contents, permitted_classes: [Date], aliases: true)
|
||||
|
||||
yaml['talks'].each do |talk|
|
||||
IMAGE_FIELDS.each do |image_field|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue