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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b134a6705aba81839c780fdc92ed25fd8fb2c5cc
4
- data.tar.gz: 004b727e596c14907a5e0d9b732fe20cf79dea9e
3
+ metadata.gz: 19d19bd62270b624d91f38544d04319a34d914ab
4
+ data.tar.gz: 4c99031a7e1bf7eed753396cc476a428c9c77607
5
5
  SHA512:
6
- metadata.gz: b5fe5a801dd6eb8bb68afdcfc4c3029cdacea968b5497aa5ee2bc85881168998df7ea67f8f8e008a39979c3322f23a715d307f748d4352ef4b5a965b32f2f757
7
- data.tar.gz: aa5d14134b2d40e7eb090066c1e0685e33dd1fa0c93642cc78d128a9f7fef1252623323faa5e753656991bbe2773f762dc8e7a8c1fb5456e7d9e11a78a758e98
6
+ metadata.gz: dbf799effc6214f297c357e9757dae68fd80c3525968eece23dd25560a2d3d12a10332da1bd3b57f4113947e2492391b540fce1a81c3fbad8c6a693dc7f0ad9d
7
+ data.tar.gz: 3a6fecfe6a5fe18a20ac8172242477e072da25969aa8ba1e71274435ab0d030edb483340f789feb1dabb4405f536b57fa6a17aae678f23896636a2090d1984bf
@@ -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
@@ -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
- @attributes ||= fields.each_with_object(
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
- @attributes ||= fields.each_with_object(base) do |field, result|
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dato
3
- VERSION = '0.1.26'
3
+ VERSION = '0.1.27'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna