Add script to migrate co-op logos
This commit is contained in:
parent
a453d287ce
commit
986b76fe43
@ -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
|
||||||
|
11
scripts/migrate_coop_logos.rb
Normal file
11
scripts/migrate_coop_logos.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user