5
0
mirror of https://git.coop/cotech/website.git synced 2024-11-21 22:33:05 +00:00

Add script to migrate co-op logos

This commit is contained in:
Chris Lowis 2018-11-09 21:50:57 +00:00
parent a453d287ce
commit 986b76fe43
2 changed files with 15 additions and 0 deletions

View File

@ -82,6 +82,10 @@ class Coop
doc.xpath('/html/body/div/div[2]/div/div/div[2]/section[1]').text.strip doc.xpath('/html/body/div/div[2]/div/div/div[2]/section[1]').text.strip
end end
def logo
doc.xpath('//*[@id="page-banner"]/div/div/a[1]/img/@src').text
end
def erb_binding def erb_binding
binding binding
end end

View File

@ -0,0 +1,11 @@
require_relative 'coop'
require 'fileutils'
base_dir = File.join(File.dirname(__FILE__), 'mirror', 'coops.tech.archived.website', 'co-op')
Coop.all.each do |coop|
current_fn = File.join(base_dir, coop.logo)
ext = File.extname(current_fn)
new_fn = File.join(File.dirname(__FILE__), '..', 'images', 'coops', coop.slug + ext)
FileUtils.cp(current_fn, new_fn)
end