This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dato.config.rb
97 lines (94 loc) · 2.49 KB
/
dato.config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
module YamlHelper
def YamlHelper.dato_origin(path)
"https://www.datocms-assets.com" + path
end
def YamlHelper.to_file_path(file_name)
"_data/#{file_name}.yml"
end
end
# file name and corresponding data to be fetched from dato
data = [
{
file_name: "supporters_and_funders",
data: dato.supporter_funders.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
image_alt: item.image.alt,
image_title: item.image.title,
name: item.name,
link: item.link }
}
},
{
file_name: "clients_and_supporters",
data: dato.client_supporters.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
image_alt: item.image.alt,
image_title: item.image.title,
name: item.name,
link: item.link }
}
},
{
file_name: "social_channels",
data: dato.social_channels.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
image_alt: item.image.alt,
image_title: item.image.title,
link: item.link,
name: item.name,
description: item.description }
}
},
{
file_name: "bespoke_project_orgs",
data: dato.bespoke_project_orgs.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
image_alt: item.image.alt,
image_title: item.image.title,
name: item.name,
link: item.link }
}
},
{
file_name: "fuse_alumni",
data: dato.fuse_alumnis.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
image_alt: item.image.alt,
image_title: item.image.title,
link: item.link,
name: item.name }
}
},
{
file_name: "fellowship_alumni",
data: dato.fellowship_alumnis.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
image_alt: item.image.alt,
image_title: item.image.title,
link: item.link,
name: item.name }
}
},
{
file_name: "team",
data: dato.teams.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
name: item.name,
job_title: item.job_title,
description: item.description }
}
},
{
file_name: "board",
data: dato.boards.map { |item| {
image_url: YamlHelper.dato_origin(item.image.path),
name: item.name,
description: item.description }
}
}
]
# creates yaml files for each collection of data
data.each do |collection|
file = YamlHelper.to_file_path(collection[:file_name])
create_data_file(file, :yaml, collection[:data])
end