3
0
mirror of https://git.coop/cotech/website.git synced 2025-12-21 14:27:32 +00:00

Remove geocoder and geocoding script

We no longer use geocoded addresses on the site, so this dependency
can be removed.
This commit is contained in:
Chris Lowis
2025-12-15 10:01:06 +00:00
parent 264362cd98
commit 5647b46cd0
3 changed files with 0 additions and 26 deletions

View File

@ -1,21 +0,0 @@
require 'bundler/setup'
require 'yaml'
require 'geocoder'
Geocoder.configure(lookup: :nominatim)
root_path = Pathname.new(__dir__).join('..')
Dir[root_path.join('_coops/*.md')].each do |path|
content = File.read(path)
body = content.split("\n").reverse.take_while { |l| l != "---" }.reverse.join("\n")
metadata = YAML.safe_load(content)
address = metadata['address']
latitude, longitude = Geocoder.coordinates(address, params: { region: 'uk' })
metadata['latitude'] ||= latitude
metadata['longitude'] ||= longitude
frontmatter = YAML.dump(metadata)
File.write(path, frontmatter + "---" + "\n" + body)
end