mirror of
https://git.coop/cotech/website.git
synced 2025-12-21 16:17:33 +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:
1
Gemfile
1
Gemfile
@ -1,4 +1,3 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'jekyll'
|
gem 'jekyll'
|
||||||
gem 'geocoder'
|
|
||||||
|
|||||||
@ -24,9 +24,6 @@ GEM
|
|||||||
ffi (1.17.2-x86_64-linux-gnu)
|
ffi (1.17.2-x86_64-linux-gnu)
|
||||||
ffi (1.17.2-x86_64-linux-musl)
|
ffi (1.17.2-x86_64-linux-musl)
|
||||||
forwardable-extended (2.6.0)
|
forwardable-extended (2.6.0)
|
||||||
geocoder (1.8.5)
|
|
||||||
base64 (>= 0.1.0)
|
|
||||||
csv (>= 3.0.0)
|
|
||||||
google-protobuf (4.31.1)
|
google-protobuf (4.31.1)
|
||||||
bigdecimal
|
bigdecimal
|
||||||
rake (>= 13)
|
rake (>= 13)
|
||||||
@ -158,7 +155,6 @@ PLATFORMS
|
|||||||
x86_64-linux-musl
|
x86_64-linux-musl
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
geocoder
|
|
||||||
jekyll
|
jekyll
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
|||||||
@ -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
|
|
||||||
Reference in New Issue
Block a user