dato 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dato/dump/runner.rb +6 -1
- data/lib/dato/local/item.rb +5 -2
- data/lib/dato/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d19bd62270b624d91f38544d04319a34d914ab
|
4
|
+
data.tar.gz: 4c99031a7e1bf7eed753396cc476a428c9c77607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbf799effc6214f297c357e9757dae68fd80c3525968eece23dd25560a2d3d12a10332da1bd3b57f4113947e2492391b540fce1a81c3fbad8c6a693dc7f0ad9d
|
7
|
+
data.tar.gz: 3a6fecfe6a5fe18a20ac8172242477e072da25969aa8ba1e71274435ab0d030edb483340f789feb1dabb4405f536b57fa6a17aae678f23896636a2090d1984bf
|
data/lib/dato/dump/runner.rb
CHANGED
@@ -16,16 +16,21 @@ module Dato
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run
|
19
|
+
print "Fetching content from DatoCMS... "
|
20
|
+
|
19
21
|
loader.load
|
20
22
|
|
23
|
+
I18n.available_locales = loader.items_repo.available_locales
|
24
|
+
|
21
25
|
Dsl::Root.new(
|
22
26
|
File.read(config_path),
|
23
27
|
loader.items_repo,
|
24
28
|
operation
|
25
29
|
)
|
26
30
|
|
27
|
-
I18n.available_locales = loader.items_repo.available_locales
|
28
31
|
operation.perform
|
32
|
+
|
33
|
+
puts "\e[32m✓\e[0m Done!"
|
29
34
|
end
|
30
35
|
|
31
36
|
def operation
|
data/lib/dato/local/item.rb
CHANGED
@@ -25,6 +25,9 @@ module Dato
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def slug(prefix_with_id: true)
|
28
|
+
slug_field = fields.find { |f| f.api_key.to_sym == :slug }
|
29
|
+
|
30
|
+
return read_attribute(:slug, slug_field) if slug_field
|
28
31
|
return item_type.api_key.humanize.parameterize if singleton?
|
29
32
|
return id.to_s unless title_field_api_key
|
30
33
|
|
@@ -60,7 +63,7 @@ module Dato
|
|
60
63
|
end
|
61
64
|
|
62
65
|
def attributes
|
63
|
-
|
66
|
+
fields.each_with_object(
|
64
67
|
ActiveSupport::HashWithIndifferentAccess.new
|
65
68
|
) do |field, acc|
|
66
69
|
acc[field.api_key.to_sym] = send(field.api_key)
|
@@ -92,7 +95,7 @@ module Dato
|
|
92
95
|
|
93
96
|
base[:position] = position if item_type.sortable
|
94
97
|
|
95
|
-
|
98
|
+
fields.each_with_object(base) do |field, result|
|
96
99
|
value = send(field.api_key)
|
97
100
|
|
98
101
|
result[field.api_key.to_sym] = if value.respond_to?(:to_hash)
|
data/lib/dato/version.rb
CHANGED