dato 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +42 -5
  3. data/.travis.yml +1 -0
  4. data/Gemfile +1 -1
  5. data/Rakefile +2 -2
  6. data/bin/console +3 -3
  7. data/bin/rspec +6 -6
  8. data/dato.gemspec +1 -1
  9. data/exe/dato +3 -3
  10. data/lib/dato.rb +8 -8
  11. data/lib/dato/account/client.rb +2 -2
  12. data/lib/dato/api_client.rb +39 -43
  13. data/lib/dato/api_error.rb +10 -13
  14. data/lib/dato/cli.rb +18 -18
  15. data/lib/dato/dump/dsl/add_to_data_file.rb +1 -1
  16. data/lib/dato/dump/dsl/create_data_file.rb +1 -1
  17. data/lib/dato/dump/dsl/create_post.rb +1 -1
  18. data/lib/dato/dump/dsl/directory.rb +4 -4
  19. data/lib/dato/dump/dsl/root.rb +7 -7
  20. data/lib/dato/dump/format.rb +3 -3
  21. data/lib/dato/dump/format/json.rb +1 -1
  22. data/lib/dato/dump/format/toml.rb +6 -6
  23. data/lib/dato/dump/format/yaml.rb +3 -3
  24. data/lib/dato/dump/operation/add_to_data_file.rb +4 -4
  25. data/lib/dato/dump/operation/create_data_file.rb +3 -3
  26. data/lib/dato/dump/operation/create_post.rb +5 -6
  27. data/lib/dato/dump/operation/directory.rb +1 -1
  28. data/lib/dato/dump/runner.rb +5 -5
  29. data/lib/dato/dump/ssg_detector.rb +18 -20
  30. data/lib/dato/json_api_deserializer.rb +15 -16
  31. data/lib/dato/json_api_serializer.rb +30 -21
  32. data/lib/dato/json_schema_relationships.rb +19 -23
  33. data/lib/dato/json_schema_type.rb +47 -0
  34. data/lib/dato/local/entities_repo.rb +3 -3
  35. data/lib/dato/local/field_type/color.rb +11 -7
  36. data/lib/dato/local/field_type/file.rb +18 -24
  37. data/lib/dato/local/field_type/gallery.rb +1 -1
  38. data/lib/dato/local/field_type/global_seo.rb +4 -7
  39. data/lib/dato/local/field_type/lat_lon.rb +1 -1
  40. data/lib/dato/local/field_type/seo.rb +1 -1
  41. data/lib/dato/local/field_type/structured_text.rb +4 -10
  42. data/lib/dato/local/field_type/theme.rb +2 -2
  43. data/lib/dato/local/field_type/upload_id.rb +5 -5
  44. data/lib/dato/local/field_type/video.rb +9 -15
  45. data/lib/dato/local/item.rb +13 -12
  46. data/lib/dato/local/items_repo.rb +12 -18
  47. data/lib/dato/local/json_api_entity.rb +4 -3
  48. data/lib/dato/local/loader.rb +30 -31
  49. data/lib/dato/local/site.rb +5 -4
  50. data/lib/dato/paginator.rb +4 -4
  51. data/lib/dato/repo.rb +23 -30
  52. data/lib/dato/site/client.rb +5 -5
  53. data/lib/dato/upload/create_upload_path.rb +7 -10
  54. data/lib/dato/upload/file.rb +3 -3
  55. data/lib/dato/upload/image.rb +1 -1
  56. data/lib/dato/utils/build_modular_block.rb +4 -4
  57. data/lib/dato/utils/favicon_tags_builder.rb +10 -10
  58. data/lib/dato/utils/locale_value.rb +1 -1
  59. data/lib/dato/utils/meta_tags/article_modified_time.rb +3 -3
  60. data/lib/dato/utils/meta_tags/article_publisher.rb +2 -2
  61. data/lib/dato/utils/meta_tags/base.rb +6 -6
  62. data/lib/dato/utils/meta_tags/description.rb +4 -4
  63. data/lib/dato/utils/meta_tags/image.rb +4 -5
  64. data/lib/dato/utils/meta_tags/og_locale.rb +2 -2
  65. data/lib/dato/utils/meta_tags/og_site_name.rb +2 -2
  66. data/lib/dato/utils/meta_tags/og_type.rb +3 -3
  67. data/lib/dato/utils/meta_tags/robots.rb +2 -2
  68. data/lib/dato/utils/meta_tags/title.rb +6 -6
  69. data/lib/dato/utils/meta_tags/twitter_card.rb +2 -2
  70. data/lib/dato/utils/meta_tags/twitter_site.rb +2 -2
  71. data/lib/dato/utils/seo_tags_builder.rb +12 -12
  72. data/lib/dato/version.rb +1 -1
  73. metadata +7 -6
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
@@ -8,7 +8,7 @@ module Dato
8
8
  class OgLocale < Base
9
9
  def build
10
10
  locale = I18n.locale
11
- og_tag('og:locale', "#{locale}_#{locale.upcase}")
11
+ og_tag("og:locale", "#{locale}_#{locale.upcase}")
12
12
  end
13
13
  end
14
14
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
7
7
  module MetaTags
8
8
  class OgSiteName < Base
9
9
  def build
10
- og_tag('og:site_name', site_name) if site_name
10
+ og_tag("og:site_name", site_name) if site_name
11
11
  end
12
12
 
13
13
  def site_name
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
@@ -8,9 +8,9 @@ module Dato
8
8
  class OgType < Base
9
9
  def build
10
10
  if !item || item.singleton?
11
- og_tag('og:type', 'website')
11
+ og_tag("og:type", "website")
12
12
  else
13
- og_tag('og:type', 'article')
13
+ og_tag("og:type", "article")
14
14
  end
15
15
  end
16
16
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
7
7
  module MetaTags
8
8
  class Robots < Base
9
9
  def build
10
- meta_tag('robots', 'noindex') if site.no_index
10
+ meta_tag("robots", "noindex") if site.no_index
11
11
  end
12
12
  end
13
13
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
@@ -10,9 +10,9 @@ module Dato
10
10
  return unless item_title
11
11
 
12
12
  [
13
- content_tag('title', item_title_with_suffix),
14
- og_tag('og:title', item_title),
15
- card_tag('twitter:title', item_title)
13
+ content_tag("title", item_title_with_suffix),
14
+ og_tag("og:title", item_title),
15
+ card_tag("twitter:title", item_title),
16
16
  ]
17
17
  end
18
18
 
@@ -23,12 +23,12 @@ module Dato
23
23
  def item_title
24
24
  @item_title ||= seo_field_with_fallback(
25
25
  :title,
26
- title_field && item[title_field.api_key]
26
+ title_field && item[title_field.api_key],
27
27
  )
28
28
  end
29
29
 
30
30
  def suffix
31
- (site.global_seo && site.global_seo.title_suffix) || ''
31
+ (site.global_seo && site.global_seo.title_suffix) || ""
32
32
  end
33
33
 
34
34
  def item_title_with_suffix
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
7
7
  module MetaTags
8
8
  class TwitterCard < Base
9
9
  def build
10
- card_tag('twitter:card', seo_field_with_fallback(:twitter_card, nil) || 'summary')
10
+ card_tag("twitter:card", seo_field_with_fallback(:twitter_card, nil) || "summary")
11
11
  end
12
12
  end
13
13
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/base'
3
+ require "dato/utils/meta_tags/base"
4
4
 
5
5
  module Dato
6
6
  module Utils
7
7
  module MetaTags
8
8
  class TwitterSite < Base
9
9
  def build
10
- card_tag('twitter:site', twitter_account) if twitter_account
10
+ card_tag("twitter:site", twitter_account) if twitter_account
11
11
  end
12
12
 
13
13
  def twitter_account
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/utils/meta_tags/title'
4
- require 'dato/utils/meta_tags/description'
5
- require 'dato/utils/meta_tags/image'
6
- require 'dato/utils/meta_tags/robots'
7
- require 'dato/utils/meta_tags/og_locale'
8
- require 'dato/utils/meta_tags/og_type'
9
- require 'dato/utils/meta_tags/og_site_name'
10
- require 'dato/utils/meta_tags/article_modified_time'
11
- require 'dato/utils/meta_tags/article_publisher'
12
- require 'dato/utils/meta_tags/twitter_card'
13
- require 'dato/utils/meta_tags/twitter_site'
3
+ require "dato/utils/meta_tags/title"
4
+ require "dato/utils/meta_tags/description"
5
+ require "dato/utils/meta_tags/image"
6
+ require "dato/utils/meta_tags/robots"
7
+ require "dato/utils/meta_tags/og_locale"
8
+ require "dato/utils/meta_tags/og_type"
9
+ require "dato/utils/meta_tags/og_site_name"
10
+ require "dato/utils/meta_tags/article_modified_time"
11
+ require "dato/utils/meta_tags/article_publisher"
12
+ require "dato/utils/meta_tags/twitter_card"
13
+ require "dato/utils/meta_tags/twitter_site"
14
14
 
15
15
  module Dato
16
16
  module Utils
@@ -26,7 +26,7 @@ module Dato
26
26
  MetaTags::ArticleModifiedTime,
27
27
  MetaTags::ArticlePublisher,
28
28
  MetaTags::TwitterCard,
29
- MetaTags::TwitterSite
29
+ MetaTags::TwitterSite,
30
30
  ].freeze
31
31
 
32
32
  attr_reader :site, :item
data/lib/dato/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dato
4
- VERSION = '0.8.0'
4
+ VERSION = "0.8.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.17.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.17.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: vcr
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -410,6 +410,7 @@ files:
410
410
  - lib/dato/json_api_deserializer.rb
411
411
  - lib/dato/json_api_serializer.rb
412
412
  - lib/dato/json_schema_relationships.rb
413
+ - lib/dato/json_schema_type.rb
413
414
  - lib/dato/local/entities_repo.rb
414
415
  - lib/dato/local/field_type/boolean.rb
415
416
  - lib/dato/local/field_type/color.rb