middleman-dato 0.5.11 → 0.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -0
  3. data/lib/middleman-dato.rb +2 -2
  4. data/lib/{dato → middleman_dato}/client.rb +1 -1
  5. data/lib/{dato → middleman_dato}/entities_repo.rb +2 -2
  6. data/lib/{dato → middleman_dato}/field_type/boolean.rb +1 -1
  7. data/lib/{dato → middleman_dato}/field_type/date.rb +1 -1
  8. data/lib/{dato → middleman_dato}/field_type/date_time.rb +1 -1
  9. data/lib/{dato → middleman_dato}/field_type/file.rb +1 -1
  10. data/lib/{dato → middleman_dato}/field_type/float.rb +1 -1
  11. data/lib/{dato → middleman_dato}/field_type/image.rb +3 -3
  12. data/lib/{dato → middleman_dato}/field_type/integer.rb +1 -1
  13. data/lib/{dato → middleman_dato}/field_type/lat_lon.rb +1 -1
  14. data/lib/{dato → middleman_dato}/field_type/link.rb +1 -1
  15. data/lib/{dato → middleman_dato}/field_type/links.rb +1 -1
  16. data/lib/{dato → middleman_dato}/field_type/seo.rb +1 -1
  17. data/lib/{dato → middleman_dato}/field_type/string.rb +1 -1
  18. data/lib/{dato → middleman_dato}/field_type/text.rb +1 -1
  19. data/lib/{dato → middleman_dato}/field_type/video.rb +5 -1
  20. data/lib/{dato → middleman_dato}/json_api_entity.rb +1 -1
  21. data/lib/{dato → middleman_dato}/meta_tags/article_modified_time.rb +2 -2
  22. data/lib/{dato → middleman_dato}/meta_tags/article_publisher.rb +2 -2
  23. data/lib/{dato → middleman_dato}/meta_tags/base.rb +2 -2
  24. data/lib/{dato → middleman_dato}/meta_tags/description.rb +2 -2
  25. data/lib/{dato → middleman_dato}/meta_tags/favicon.rb +2 -2
  26. data/lib/{dato → middleman_dato}/meta_tags/image.rb +2 -2
  27. data/lib/{dato → middleman_dato}/meta_tags/og_locale.rb +2 -2
  28. data/lib/{dato → middleman_dato}/meta_tags/og_meta_tag.rb +2 -2
  29. data/lib/{dato → middleman_dato}/meta_tags/og_site_name.rb +2 -2
  30. data/lib/{dato → middleman_dato}/meta_tags/og_type.rb +2 -2
  31. data/lib/{dato → middleman_dato}/meta_tags/robots.rb +2 -2
  32. data/lib/{dato → middleman_dato}/meta_tags/title.rb +2 -2
  33. data/lib/{dato → middleman_dato}/meta_tags/twitter_card.rb +2 -2
  34. data/lib/{dato → middleman_dato}/meta_tags/twitter_meta_tag.rb +2 -2
  35. data/lib/{dato → middleman_dato}/meta_tags/twitter_site.rb +2 -2
  36. data/lib/{dato → middleman_dato}/meta_tags/url.rb +2 -2
  37. data/lib/{dato → middleman_dato}/meta_tags_builder.rb +13 -13
  38. data/lib/{dato → middleman_dato}/middleman_extension.rb +5 -5
  39. data/lib/{dato → middleman_dato}/record.rb +2 -2
  40. data/lib/{dato → middleman_dato}/records_repo.rb +2 -2
  41. data/lib/{dato → middleman_dato}/space.rb +4 -4
  42. data/lib/middleman_dato/version.rb +4 -0
  43. data/middleman-dato.gemspec +2 -2
  44. data/spec/{dato → middleman_dato}/entities_repo_spec.rb +2 -2
  45. data/spec/{dato → middleman_dato}/field_type/file_spec.rb +2 -2
  46. data/spec/{dato → middleman_dato}/field_type/image_spec.rb +1 -1
  47. data/spec/{dato → middleman_dato}/field_type/lat_lon_spec.rb +1 -1
  48. data/spec/{dato → middleman_dato}/field_type/seo_spec.rb +2 -2
  49. data/spec/{dato → middleman_dato}/field_type/video_spec.rb +3 -3
  50. data/spec/{dato → middleman_dato}/json_api_entity_spec.rb +5 -5
  51. data/spec/{dato → middleman_dato}/meta_tags/article_modified_time_spec.rb +1 -1
  52. data/spec/{dato → middleman_dato}/meta_tags/favicon_spec.rb +9 -9
  53. data/spec/{dato → middleman_dato}/meta_tags/image_spec.rb +4 -4
  54. data/spec/{dato → middleman_dato}/meta_tags/og_locale_spec.rb +1 -1
  55. data/spec/{dato → middleman_dato}/record_spec.rb +10 -10
  56. data/spec/{dato → middleman_dato}/records_repo_spec.rb +10 -10
  57. metadata +68 -67
  58. data/lib/dato/version.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 519b5e7c70abb154e4337b7e96ea0ff4d1adc8e5
4
- data.tar.gz: 871ed43fb056f16e148f18fc749069e293696fa0
3
+ metadata.gz: 847b712bcdae73ce71dfc2202f07c21a77ee0357
4
+ data.tar.gz: 5a2ccd82a4132674cee8ef7beee080d4deb4f445
5
5
  SHA512:
6
- metadata.gz: 9c2befa059eb8612172d413ba703040ab8e2cf269b7852ab9ee049fde47d555de46d081cb694db41f32362bf36ca8af1f0757a0992605072abe86dc72a8f158f
7
- data.tar.gz: 08946b373c814a4590b258ac70f906da03eb547f4c282399402aae626b55c6efa7cc498147282dfd219c8adb8666cc6e9a672fb72fb8c4c0df8eaf981f6b8f5c
6
+ metadata.gz: 23dec01ce0b72dc2223cddca7d2a21108c2775dd977b847d323afc53849d397814c0c6bbe6e42a48e9fa014cdbd87372cafffdf9815eea95a5466aa8b212e2c5
7
+ data.tar.gz: 9a1d93e32b80245ac29d292b79baa33703f42445181b185fbf359a2ef0fa22429244887023f3896730b5195c558243f08e42a7841c74af4a8dfa878d39a8ed77
data/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # middleman-dato
2
+
3
+ ## Setup
4
+
5
+ ```ruby
6
+ # config.rb
7
+
8
+ activate :dato,
9
+ domain: 'lively-smoke-1134.admin.datocms.com',
10
+ token: 'XXXYYY',
11
+ base_url: 'http://www.mywebsite.com'
12
+
13
+ # feel free to use dato from now on:
14
+ #
15
+ # dato.articles.each do |article|
16
+ # proxy "/articles/#{article.slug}.html", "/templates/article.html", locals: { article: article }
17
+ # end
18
+ ```
19
+
20
+ ## Middleman helpers
21
+
22
+ ### `dato`
23
+
24
+ Using this helper you can access to any record stored in your space by content type.
25
+ That is, if your space has a Content Type with `article` as API identifier, you can get
26
+ the complete array of records with `dato.articles` (yep, the identifier pluralized).
27
+
28
+ If a Content Type is marked as Singleton (ie. `about_page`) you don't need to pluralize and
29
+ a call to `dato.about_page` directly returns the Record (or `nil`, if still hasn't been created
30
+ within the backend).
31
+
32
+ You can query any Record field value with a method called like the field API identifier.
33
+
34
+ If a Content Type has a String field with Title appeareance, than the record responds to `.slug`,
35
+ returning a slugified version of the title itself (or the record identifier, if the title is empty).
36
+
37
+ You can use this helper within Middleman `config.rb`, as well as within your views:
38
+
39
+ ```ruby
40
+ <% dato.articles.each do |article| %>
41
+ <div class="post">
42
+ <h1><%= link_to article.title, "/articles/#{article.slug}.html" %></h1>
43
+ <div>
44
+ <%= article.main_content %>
45
+ </div>
46
+ </div>
47
+ <% end %>
48
+ ```
49
+
50
+ Complex field types (ie. images, files, videos, SEO settings, etc.) implement specific methods
51
+ you can use as well:
52
+
53
+ ```ruby
54
+ article = dato.articles.first
55
+
56
+ article.cover_image.file.width(500).fit('crop').to_url
57
+ article.video.iframe_embed(800, 600)
58
+ ```
59
+
60
+ Please [refer to the code](https://github.com/datocms/middleman-dato/tree/master/lib/middleman_dato/field_type) for more informations.
61
+
62
+ ### `dato_meta_tags`
63
+
64
+ This helper takes any record with a SEO field and generates SEO, Facebook OpenGraph and Twitter card meta tags based on it:
65
+
66
+ ```ruby
67
+ <%= dato_meta_tags(dato.homepage) %>
68
+ ```
69
+
70
+ ```html
71
+ <title>...</title>
72
+
73
+ <meta name="description" content="..."/>
74
+ <meta name="twitter:card" content="..." />
75
+ <meta name="twitter:description" content="..."/>
76
+ <meta name="twitter:image" content="..."/>
77
+ <meta name="twitter:site" content="..."/>
78
+ <meta name="twitter:title" content="..."/>
79
+ <meta name="twitter:url" content="..."/>
80
+
81
+ <meta property="og:description" content="..."/>
82
+ <meta property="og:image" content="..."/>
83
+ <meta property="og:locale" content="..." />
84
+ <meta property="og:site_name" content="..." />
85
+ <meta property="og:title" content="..."/>
86
+ <meta property="og:type" content="..." />
87
+ <meta property="og:url" content="..."/>
88
+
89
+ <link rel="canonical" href="..."/>
90
+ ```
91
+
92
+ ### `dato_favicon_meta_tags`
93
+
94
+ This helper generates meta tags based on the Favicon image specified within the Space:
95
+
96
+ ```ruby
97
+ <%= dato_favicon_meta_tags(theme_color: '#D97C5F') %>
98
+ ```
@@ -1,6 +1,6 @@
1
1
  require 'middleman-core'
2
2
 
3
3
  Middleman::Extensions.register(:dato) do
4
- require 'dato/middleman_extension'
5
- Dato::MiddlemanExtension
4
+ require 'middleman_dato/middleman_extension'
5
+ MiddlemanDato::MiddlemanExtension
6
6
  end
@@ -3,7 +3,7 @@ require 'faraday_middleware'
3
3
  require 'json'
4
4
  require 'active_support/core_ext/hash/indifferent_access'
5
5
 
6
- module Dato
6
+ module MiddlemanDato
7
7
  class Client
8
8
  def initialize(host, domain, token)
9
9
  @host = host
@@ -1,6 +1,6 @@
1
- require 'dato/json_api_entity'
1
+ require 'middleman_dato/json_api_entity'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  class EntitiesRepo
5
5
  attr_reader :entities
6
6
 
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Boolean
4
4
  def self.parse(value, _repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Date
4
4
  def self.parse(value, _repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class DateTime
4
4
  def self.parse(value, _repo)
@@ -1,6 +1,6 @@
1
1
  require 'imgix'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module FieldType
5
5
  class File
6
6
  attr_reader :path, :format, :size
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Float
4
4
  def self.parse(value, _repo)
@@ -1,8 +1,8 @@
1
- require 'dato/field_type/file'
1
+ require 'middleman_dato/field_type/file'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module FieldType
5
- class Image < Dato::FieldType::File
5
+ class Image < MiddlemanDato::FieldType::File
6
6
  attr_reader :width, :height
7
7
 
8
8
  def self.parse(value, _repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Integer
4
4
  def self.parse(value, _repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class LatLon
4
4
  attr_reader :latitude, :longitude
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Link
4
4
  def self.parse(value, repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Links
4
4
  def self.parse(ids, repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Seo
4
4
  attr_reader :title, :description
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class String
4
4
  def self.parse(value, _repo)
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  class Text
4
4
  def self.parse(value, _repo)
@@ -1,7 +1,7 @@
1
1
  require 'active_support/core_ext/hash/compact'
2
2
  require 'video_embed'
3
3
 
4
- module Dato
4
+ module MiddlemanDato
5
5
  module FieldType
6
6
  class Video
7
7
  def self.parse(value, _repo)
@@ -40,6 +40,10 @@ module Dato
40
40
  @attributes[:provider_url]
41
41
  end
42
42
 
43
+ def provider_uid
44
+ @attributes[:provider_uid]
45
+ end
46
+
43
47
  def iframe_embed(width = nil, height = nil)
44
48
  VideoEmbed.embed(url, { width: width, height: height }.compact)
45
49
  end
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  class JsonApiEntity
3
3
  attr_reader :payload, :data_source
4
4
 
@@ -1,7 +1,7 @@
1
- require 'dato/meta_tags/og_meta_tag'
1
+ require 'middleman_dato/meta_tags/og_meta_tag'
2
2
  require 'time'
3
3
 
4
- module Dato
4
+ module MiddlemanDato
5
5
  module MetaTags
6
6
  class ArticleModifiedTime < OgMetaTag
7
7
  def buildable?
@@ -1,7 +1,7 @@
1
- require 'dato/meta_tags/og_meta_tag'
1
+ require 'middleman_dato/meta_tags/og_meta_tag'
2
2
  require 'time'
3
3
 
4
- module Dato
4
+ module MiddlemanDato
5
5
  module MetaTags
6
6
  class ArticlePublisher < OgMetaTag
7
7
  def buildable?
@@ -1,7 +1,7 @@
1
1
  require 'forwardable'
2
- require 'dato/field_type/seo'
2
+ require 'middleman_dato/field_type/seo'
3
3
 
4
- module Dato
4
+ module MiddlemanDato
5
5
  module MetaTags
6
6
  class Base
7
7
  attr_reader :builder, :base_url, :space, :content_type, :record
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class Description < Base
6
6
  def build
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module MetaTags
3
3
  class Favicon
4
4
  attr_reader :builder, :theme_color, :favicon, :app_name
@@ -14,7 +14,7 @@ module Dato
14
14
  end
15
15
 
16
16
  def image
17
- Dato::FieldType::Image.parse(favicon, nil) if favicon.present?
17
+ MiddlemanDato::FieldType::Image.parse(favicon, nil) if favicon.present?
18
18
  end
19
19
 
20
20
  def url(width, height = nil)
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class Image < Base
6
6
  def build
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/og_meta_tag'
1
+ require 'middleman_dato/meta_tags/og_meta_tag'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class OgLocale < OgMetaTag
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class OgMetaTag < Base
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/og_meta_tag'
1
+ require 'middleman_dato/meta_tags/og_meta_tag'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class OgSiteName < OgMetaTag
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/og_meta_tag'
1
+ require 'middleman_dato/meta_tags/og_meta_tag'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class OgType < OgMetaTag
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class Robots < Base
6
6
  def build
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class Title < Base
6
6
  def build
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/twitter_meta_tag'
1
+ require 'middleman_dato/meta_tags/twitter_meta_tag'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class TwitterCard < TwitterMetaTag
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class TwitterMetaTag < Base
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/twitter_meta_tag'
1
+ require 'middleman_dato/meta_tags/twitter_meta_tag'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class TwitterSite < TwitterMetaTag
6
6
  def buildable?
@@ -1,6 +1,6 @@
1
- require 'dato/meta_tags/base'
1
+ require 'middleman_dato/meta_tags/base'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  class Url < Base
6
6
  def build
@@ -1,17 +1,17 @@
1
- require 'dato/meta_tags/title'
2
- require 'dato/meta_tags/description'
3
- require 'dato/meta_tags/image'
4
- require 'dato/meta_tags/url'
5
- require 'dato/meta_tags/robots'
6
- require 'dato/meta_tags/og_locale'
7
- require 'dato/meta_tags/og_type'
8
- require 'dato/meta_tags/og_site_name'
9
- require 'dato/meta_tags/article_modified_time'
10
- require 'dato/meta_tags/article_publisher'
11
- require 'dato/meta_tags/twitter_card'
12
- require 'dato/meta_tags/twitter_site'
1
+ require 'middleman_dato/meta_tags/title'
2
+ require 'middleman_dato/meta_tags/description'
3
+ require 'middleman_dato/meta_tags/image'
4
+ require 'middleman_dato/meta_tags/url'
5
+ require 'middleman_dato/meta_tags/robots'
6
+ require 'middleman_dato/meta_tags/og_locale'
7
+ require 'middleman_dato/meta_tags/og_type'
8
+ require 'middleman_dato/meta_tags/og_site_name'
9
+ require 'middleman_dato/meta_tags/article_modified_time'
10
+ require 'middleman_dato/meta_tags/article_publisher'
11
+ require 'middleman_dato/meta_tags/twitter_card'
12
+ require 'middleman_dato/meta_tags/twitter_site'
13
13
 
14
- module Dato
14
+ module MiddlemanDato
15
15
  class MetaTagsBuilder
16
16
  META_TAGS = [
17
17
  MetaTags::Title,
@@ -1,11 +1,11 @@
1
1
  require 'middleman-core'
2
2
  require 'middleman-core/version'
3
3
  require 'semantic'
4
- require 'dato/meta_tags_builder'
5
- require 'dato/space'
6
- require 'dato/meta_tags/favicon'
4
+ require 'middleman_dato/meta_tags_builder'
5
+ require 'middleman_dato/space'
6
+ require 'middleman_dato/meta_tags/favicon'
7
7
 
8
- module Dato
8
+ module MiddlemanDato
9
9
  class MiddlemanExtension < ::Middleman::Extension
10
10
  attr_reader :space
11
11
 
@@ -21,7 +21,7 @@ module Dato
21
21
  def initialize(app, options_hash = {}, &block)
22
22
  super
23
23
 
24
- @space = space = Dato::Space.new(options)
24
+ @space = space = MiddlemanDato::Space.new(options)
25
25
  @space.refresh!
26
26
 
27
27
  app.before do
@@ -6,7 +6,7 @@ Dir[File.dirname(__FILE__) + '/field_type/*.rb'].each do |file|
6
6
  require file
7
7
  end
8
8
 
9
- module Dato
9
+ module MiddlemanDato
10
10
  class Record
11
11
  extend Forwardable
12
12
 
@@ -92,7 +92,7 @@ module Dato
92
92
 
93
93
  def read_attribute(method, field)
94
94
  field_type = field.field_type
95
- type_klass_name = "::Dato::FieldType::#{field_type.camelize}"
95
+ type_klass_name = "::MiddlemanDato::FieldType::#{field_type.camelize}"
96
96
  type_klass = type_klass_name.safe_constantize
97
97
 
98
98
  if type_klass
@@ -1,7 +1,7 @@
1
1
  require 'active_support/core_ext/string'
2
- require 'dato/record'
2
+ require 'middleman_dato/record'
3
3
 
4
- module Dato
4
+ module MiddlemanDato
5
5
  class RecordsRepo
6
6
  attr_reader :entities_repo, :collections_by_type
7
7
 
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
- require 'dato/client'
3
- require 'dato/entities_repo'
4
- require 'dato/records_repo'
2
+ require 'middleman_dato/client'
3
+ require 'middleman_dato/entities_repo'
4
+ require 'middleman_dato/records_repo'
5
5
 
6
- module Dato
6
+ module MiddlemanDato
7
7
  class Space
8
8
  attr_reader :options
9
9
  attr_reader :entities_repo
@@ -0,0 +1,4 @@
1
+ module MiddlemanDato
2
+ VERSION = '0.5.12'
3
+ end
4
+
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
- require 'dato/version'
3
+ require 'middleman_dato/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'middleman-dato'
7
- s.version = Dato::VERSION
7
+ s.version = MiddlemanDato::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ['Stefano Verna']
10
10
  s.email = ['s.verna@cantierecreativo.net']
@@ -1,6 +1,6 @@
1
- require 'dato/json_api_entity'
1
+ require 'middleman_dato/json_api_entity'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  RSpec.describe EntitiesRepo do
5
5
  subject(:source) { described_class.new(payload) }
6
6
 
@@ -1,6 +1,6 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
- RSpec.describe Dato::FieldType::File do
3
+ RSpec.describe MiddlemanDato::FieldType::File do
4
4
  subject(:file) { described_class.parse(attributes, nil) }
5
5
  let(:attributes) do
6
6
  {
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  RSpec.describe Image do
4
4
  subject(:image) { described_class.parse(attributes, nil) }
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  RSpec.describe LatLon do
4
4
  subject(:latlon) { described_class.parse(attributes, nil) }
@@ -1,4 +1,4 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  RSpec.describe Seo do
4
4
  subject(:seo) { described_class.parse(attributes, nil) }
@@ -19,7 +19,7 @@ module Dato
19
19
  it 'responds to title, description and image methods' do
20
20
  expect(seo.title).to eq 'title'
21
21
  expect(seo.description).to eq 'description'
22
- expect(seo.image).to be_a Dato::FieldType::Image
22
+ expect(seo.image).to be_a MiddlemanDato::FieldType::Image
23
23
  expect(seo.image.path).to eq '/foo.png'
24
24
  expect(seo.image.format).to eq 'jpg'
25
25
  expect(seo.image.size).to eq 4000
@@ -1,11 +1,11 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  module FieldType
3
3
  RSpec.describe Video do
4
4
  subject(:video) { described_class.parse(attributes, nil) }
5
5
  let(:attributes) do
6
6
  {
7
7
  url: 'https://www.youtube.com/watch?v=oHg5SJYRHA0',
8
- provider_url: 'https://www.youtube.com',
8
+ provider_uid: '123123',
9
9
  thumbnail_url: 'http://i3.ytimg.com/vi/oHg5SJYRHA0/hqdefault.jpg',
10
10
  title: "RickRoll'D",
11
11
  width: 640,
@@ -15,7 +15,7 @@ module Dato
15
15
 
16
16
  it 'responds to path, format, size, width and height' do
17
17
  expect(video.url).to eq 'https://www.youtube.com/watch?v=oHg5SJYRHA0'
18
- expect(video.provider_url).to eq 'https://www.youtube.com'
18
+ expect(video.provider_uid).to eq '123123'
19
19
  expect(video.thumbnail_url).to eq 'http://i3.ytimg.com/vi/oHg5SJYRHA0/hqdefault.jpg'
20
20
  expect(video.title).to eq "RickRoll'D"
21
21
  expect(video.width).to eq 640
@@ -1,6 +1,6 @@
1
- require 'dato/json_api_entity'
1
+ require 'middleman_dato/json_api_entity'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  RSpec.describe JsonApiEntity do
5
5
  subject(:object) { described_class.new(payload, data_source) }
6
6
  let(:payload) do
@@ -25,7 +25,7 @@ module Dato
25
25
  end
26
26
 
27
27
  let(:data_source) do
28
- instance_double('Dato::DataSource')
28
+ instance_double('MiddlemanDato::DataSource')
29
29
  end
30
30
 
31
31
  describe '#id' do
@@ -95,8 +95,8 @@ module Dato
95
95
  end
96
96
 
97
97
  describe 'links' do
98
- let(:stewie) { instance_double('Dato::JsonApiObject') }
99
- let(:thelma) { instance_double('Dato::JsonApiObject') }
98
+ let(:stewie) { instance_double('MiddlemanDato::JsonApiObject') }
99
+ let(:thelma) { instance_double('MiddlemanDato::JsonApiObject') }
100
100
 
101
101
  before do
102
102
  allow(data_source).to receive(:find_entity).with('person', 'stewie') { stewie }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  RSpec.describe ArticleModifiedTime do
6
6
  subject(:meta_tag) { described_class.new(builder, base_url, space, record) }
@@ -3,7 +3,7 @@ require 'active_support/core_ext/hash/indifferent_access'
3
3
 
4
4
  require 'pry'
5
5
 
6
- module Dato
6
+ module MiddlemanDato
7
7
  module MetaTags
8
8
  RSpec.describe Favicon do
9
9
  subject(:meta_tag) { described_class.new(builder, entity, theme_color) }
@@ -13,7 +13,7 @@ module Dato
13
13
  let(:image_format) { 'image_format' }
14
14
  let(:entity) do
15
15
  double(
16
- 'Dato::JsonApiEntity',
16
+ 'MiddlemanDato::JsonApiEntity',
17
17
  favicon: favicon,
18
18
  global_seo: ActiveSupport::HashWithIndifferentAccess.new(
19
19
  site_name: application_name
@@ -62,12 +62,12 @@ module Dato
62
62
  end
63
63
 
64
64
  context 'else' do
65
- let(:image_obj) { double('Dato::FieldType::Image', format: image_format) }
65
+ let(:image_obj) { double('MiddlemanDato::FieldType::Image', format: image_format) }
66
66
 
67
- it 'return the image parsed with Dato::FieldType::Image' do
68
- allow(Dato::FieldType::Image).to receive(:parse).and_return(image_obj)
67
+ it 'return the image parsed with MiddlemanDato::FieldType::Image' do
68
+ allow(MiddlemanDato::FieldType::Image).to receive(:parse).and_return(image_obj)
69
69
  image = meta_tag.image
70
- expect(Dato::FieldType::Image).to have_received(:parse)
70
+ expect(MiddlemanDato::FieldType::Image).to have_received(:parse)
71
71
  .with(favicon, nil)
72
72
  expect(image).to eq image_obj
73
73
  end
@@ -75,7 +75,7 @@ module Dato
75
75
  end
76
76
 
77
77
  describe '#url' do
78
- let(:image) { instance_double('Dato::FieldType::Image', file: file) }
78
+ let(:image) { instance_double('MiddlemanDato::FieldType::Image', file: file) }
79
79
  let(:file) { instance_double('Imgix::Path') }
80
80
  let(:width) { 1 }
81
81
  let(:height) { 2 }
@@ -133,7 +133,7 @@ module Dato
133
133
 
134
134
  describe '#build_apple_icon_tags' do
135
135
  let(:result) { meta_tag.build_icon_tags }
136
- let(:image) { instance_double('Dato::FieldType::Image', format: format) }
136
+ let(:image) { instance_double('MiddlemanDato::FieldType::Image', format: format) }
137
137
  let(:format) { 'png' }
138
138
  let(:image_url) { '/path/to/image' }
139
139
 
@@ -160,7 +160,7 @@ module Dato
160
160
 
161
161
  describe '#build_application_tags' do
162
162
  let(:result) { meta_tag.build_application_tags }
163
- let(:image) { instance_double('Dato::FieldType::Image', format: format) }
163
+ let(:image) { instance_double('MiddlemanDato::FieldType::Image', format: format) }
164
164
  let(:format) { 'png' }
165
165
  let(:image_url) { '/path/to/image' }
166
166
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  RSpec.describe Image do
6
6
  subject(:meta_tag) { described_class.new(builder, base_url, space, record) }
@@ -9,8 +9,8 @@ module Dato
9
9
  let(:space) { nil }
10
10
  let(:record) do
11
11
  double(
12
- 'Dato::Record',
13
- fields: [double('Dato::JsonApiEntity', api_key: 'foo', field_type: 'image')],
12
+ 'MiddlemanDato::Record',
13
+ fields: [double('MiddlemanDato::JsonApiEntity', api_key: 'foo', field_type: 'image')],
14
14
  foo: image,
15
15
  singleton?: false
16
16
  )
@@ -22,7 +22,7 @@ module Dato
22
22
 
23
23
  let(:image) do
24
24
  double(
25
- 'Dato::JsonApiEntity',
25
+ 'MiddlemanDato::JsonApiEntity',
26
26
  width: 300,
27
27
  height: 300,
28
28
  file: double('File', format: double('Imgix', to_url: 'http://google.com'))
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  module MetaTags
5
5
  RSpec.describe OgLocale do
6
6
  subject(:meta_tag) { described_class.new(builder, base_url, space, record) }
@@ -1,9 +1,9 @@
1
- module Dato
1
+ module MiddlemanDato
2
2
  RSpec.describe Record do
3
3
  subject(:record) { described_class.new(entity, repo) }
4
4
  let(:entity) do
5
5
  double(
6
- 'Dato::JsonApiEntity(Record)',
6
+ 'MiddlemanDato::JsonApiEntity(Record)',
7
7
  id: '14',
8
8
  content_type: content_type,
9
9
  title: "My titlè with àccents",
@@ -13,11 +13,11 @@ module Dato
13
13
  )
14
14
  end
15
15
  let(:repo) do
16
- instance_double('Dato::RecordsRepo')
16
+ instance_double('MiddlemanDato::RecordsRepo')
17
17
  end
18
18
  let(:content_type) do
19
19
  double(
20
- 'Dato::JsonApiEntity(Content Type)',
20
+ 'MiddlemanDato::JsonApiEntity(Content Type)',
21
21
  singleton: is_singleton,
22
22
  api_key: 'work_item',
23
23
  fields: fields
@@ -27,7 +27,7 @@ module Dato
27
27
  let(:fields) do
28
28
  [
29
29
  double(
30
- 'Dato::JsonApiEntity(Field)',
30
+ 'MiddlemanDato::JsonApiEntity(Field)',
31
31
  position: 1,
32
32
  api_key: 'title',
33
33
  localized: false,
@@ -35,7 +35,7 @@ module Dato
35
35
  appeareance: { type: 'title' }
36
36
  ),
37
37
  double(
38
- 'Dato::JsonApiEntity(Field)',
38
+ 'MiddlemanDato::JsonApiEntity(Field)',
39
39
  position: 1,
40
40
  api_key: 'body',
41
41
  localized: false,
@@ -101,7 +101,7 @@ module Dato
101
101
  context 'localized field' do
102
102
  let(:entity) do
103
103
  double(
104
- 'Dato::JsonApiEntity(Record)',
104
+ 'MiddlemanDato::JsonApiEntity(Record)',
105
105
  id: '14',
106
106
  content_type: content_type,
107
107
  title: { it: 'Foo', en: 'Bar' }
@@ -111,7 +111,7 @@ module Dato
111
111
  let(:fields) do
112
112
  [
113
113
  double(
114
- 'Dato::JsonApiEntity(Field)',
114
+ 'MiddlemanDato::JsonApiEntity(Field)',
115
115
  position: 1,
116
116
  api_key: 'title',
117
117
  localized: true,
@@ -148,7 +148,7 @@ module Dato
148
148
  let(:fields) do
149
149
  [
150
150
  double(
151
- 'Dato::JsonApiEntity(Field)',
151
+ 'MiddlemanDato::JsonApiEntity(Field)',
152
152
  position: 1,
153
153
  api_key: 'title',
154
154
  localized: true,
@@ -169,7 +169,7 @@ module Dato
169
169
  subject(:another_record) { described_class.new(another_entity, repo) }
170
170
  let(:another_entity) do
171
171
  double(
172
- 'Dato::JsonApiEntity(Record)',
172
+ 'MiddlemanDato::JsonApiEntity(Record)',
173
173
  id: '15'
174
174
  )
175
175
  end
@@ -1,28 +1,28 @@
1
- require 'dato/records_repo'
1
+ require 'middleman_dato/records_repo'
2
2
 
3
- module Dato
3
+ module MiddlemanDato
4
4
  RSpec.describe RecordsRepo do
5
5
  subject(:repo) { described_class.new(entities_repo) }
6
6
  let(:entities_repo) do
7
- instance_double('Dato::EntitiesRepo')
7
+ instance_double('MiddlemanDato::EntitiesRepo')
8
8
  end
9
9
  let(:content_type) do
10
- double('Dato::JsonApiEntity', api_key: 'post', singleton: false)
10
+ double('MiddlemanDato::JsonApiEntity', api_key: 'post', singleton: false)
11
11
  end
12
12
  let(:singleton_content_type) do
13
- double('Dato::JsonApiEntity', api_key: 'homepage', singleton: true)
13
+ double('MiddlemanDato::JsonApiEntity', api_key: 'homepage', singleton: true)
14
14
  end
15
15
  let(:record_entity) do
16
- double('Dato::JsonApiEntity', content_type: content_type)
16
+ double('MiddlemanDato::JsonApiEntity', content_type: content_type)
17
17
  end
18
18
  let(:singleton_record_entity) do
19
- double('Dato::JsonApiEntity', content_type: singleton_content_type)
19
+ double('MiddlemanDato::JsonApiEntity', content_type: singleton_content_type)
20
20
  end
21
21
  let(:record) do
22
- instance_double('Dato::Record', id: '14')
22
+ instance_double('MiddlemanDato::Record', id: '14')
23
23
  end
24
24
  let(:singleton_record) do
25
- instance_double('Dato::Record', id: '22')
25
+ instance_double('MiddlemanDato::Record', id: '22')
26
26
  end
27
27
 
28
28
  before do
@@ -79,7 +79,7 @@ module Dato
79
79
  [foo]
80
80
  end
81
81
 
82
- let(:foo) { double('Dato::Record', id: '1', name: 'Foo') }
82
+ let(:foo) { double('MiddlemanDato::Record', id: '1', name: 'Foo') }
83
83
 
84
84
  describe '#[]' do
85
85
  it 'returns the record with the specified id or index' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -106,61 +106,62 @@ files:
106
106
  - ".rspec"
107
107
  - ".rubocop.yml"
108
108
  - Gemfile
109
+ - README.md
109
110
  - Rakefile
110
- - lib/dato/client.rb
111
- - lib/dato/entities_repo.rb
112
- - lib/dato/field_type/boolean.rb
113
- - lib/dato/field_type/date.rb
114
- - lib/dato/field_type/date_time.rb
115
- - lib/dato/field_type/file.rb
116
- - lib/dato/field_type/float.rb
117
- - lib/dato/field_type/image.rb
118
- - lib/dato/field_type/integer.rb
119
- - lib/dato/field_type/lat_lon.rb
120
- - lib/dato/field_type/link.rb
121
- - lib/dato/field_type/links.rb
122
- - lib/dato/field_type/seo.rb
123
- - lib/dato/field_type/string.rb
124
- - lib/dato/field_type/text.rb
125
- - lib/dato/field_type/video.rb
126
- - lib/dato/json_api_entity.rb
127
- - lib/dato/meta_tags/article_modified_time.rb
128
- - lib/dato/meta_tags/article_publisher.rb
129
- - lib/dato/meta_tags/base.rb
130
- - lib/dato/meta_tags/description.rb
131
- - lib/dato/meta_tags/favicon.rb
132
- - lib/dato/meta_tags/image.rb
133
- - lib/dato/meta_tags/og_locale.rb
134
- - lib/dato/meta_tags/og_meta_tag.rb
135
- - lib/dato/meta_tags/og_site_name.rb
136
- - lib/dato/meta_tags/og_type.rb
137
- - lib/dato/meta_tags/robots.rb
138
- - lib/dato/meta_tags/title.rb
139
- - lib/dato/meta_tags/twitter_card.rb
140
- - lib/dato/meta_tags/twitter_meta_tag.rb
141
- - lib/dato/meta_tags/twitter_site.rb
142
- - lib/dato/meta_tags/url.rb
143
- - lib/dato/meta_tags_builder.rb
144
- - lib/dato/middleman_extension.rb
145
- - lib/dato/record.rb
146
- - lib/dato/records_repo.rb
147
- - lib/dato/space.rb
148
- - lib/dato/version.rb
149
111
  - lib/middleman-dato.rb
112
+ - lib/middleman_dato/client.rb
113
+ - lib/middleman_dato/entities_repo.rb
114
+ - lib/middleman_dato/field_type/boolean.rb
115
+ - lib/middleman_dato/field_type/date.rb
116
+ - lib/middleman_dato/field_type/date_time.rb
117
+ - lib/middleman_dato/field_type/file.rb
118
+ - lib/middleman_dato/field_type/float.rb
119
+ - lib/middleman_dato/field_type/image.rb
120
+ - lib/middleman_dato/field_type/integer.rb
121
+ - lib/middleman_dato/field_type/lat_lon.rb
122
+ - lib/middleman_dato/field_type/link.rb
123
+ - lib/middleman_dato/field_type/links.rb
124
+ - lib/middleman_dato/field_type/seo.rb
125
+ - lib/middleman_dato/field_type/string.rb
126
+ - lib/middleman_dato/field_type/text.rb
127
+ - lib/middleman_dato/field_type/video.rb
128
+ - lib/middleman_dato/json_api_entity.rb
129
+ - lib/middleman_dato/meta_tags/article_modified_time.rb
130
+ - lib/middleman_dato/meta_tags/article_publisher.rb
131
+ - lib/middleman_dato/meta_tags/base.rb
132
+ - lib/middleman_dato/meta_tags/description.rb
133
+ - lib/middleman_dato/meta_tags/favicon.rb
134
+ - lib/middleman_dato/meta_tags/image.rb
135
+ - lib/middleman_dato/meta_tags/og_locale.rb
136
+ - lib/middleman_dato/meta_tags/og_meta_tag.rb
137
+ - lib/middleman_dato/meta_tags/og_site_name.rb
138
+ - lib/middleman_dato/meta_tags/og_type.rb
139
+ - lib/middleman_dato/meta_tags/robots.rb
140
+ - lib/middleman_dato/meta_tags/title.rb
141
+ - lib/middleman_dato/meta_tags/twitter_card.rb
142
+ - lib/middleman_dato/meta_tags/twitter_meta_tag.rb
143
+ - lib/middleman_dato/meta_tags/twitter_site.rb
144
+ - lib/middleman_dato/meta_tags/url.rb
145
+ - lib/middleman_dato/meta_tags_builder.rb
146
+ - lib/middleman_dato/middleman_extension.rb
147
+ - lib/middleman_dato/record.rb
148
+ - lib/middleman_dato/records_repo.rb
149
+ - lib/middleman_dato/space.rb
150
+ - lib/middleman_dato/version.rb
150
151
  - middleman-dato.gemspec
151
- - spec/dato/entities_repo_spec.rb
152
- - spec/dato/field_type/file_spec.rb
153
- - spec/dato/field_type/image_spec.rb
154
- - spec/dato/field_type/lat_lon_spec.rb
155
- - spec/dato/field_type/seo_spec.rb
156
- - spec/dato/field_type/video_spec.rb
157
- - spec/dato/json_api_entity_spec.rb
158
- - spec/dato/meta_tags/article_modified_time_spec.rb
159
- - spec/dato/meta_tags/favicon_spec.rb
160
- - spec/dato/meta_tags/image_spec.rb
161
- - spec/dato/meta_tags/og_locale_spec.rb
162
- - spec/dato/record_spec.rb
163
- - spec/dato/records_repo_spec.rb
152
+ - spec/middleman_dato/entities_repo_spec.rb
153
+ - spec/middleman_dato/field_type/file_spec.rb
154
+ - spec/middleman_dato/field_type/image_spec.rb
155
+ - spec/middleman_dato/field_type/lat_lon_spec.rb
156
+ - spec/middleman_dato/field_type/seo_spec.rb
157
+ - spec/middleman_dato/field_type/video_spec.rb
158
+ - spec/middleman_dato/json_api_entity_spec.rb
159
+ - spec/middleman_dato/meta_tags/article_modified_time_spec.rb
160
+ - spec/middleman_dato/meta_tags/favicon_spec.rb
161
+ - spec/middleman_dato/meta_tags/image_spec.rb
162
+ - spec/middleman_dato/meta_tags/og_locale_spec.rb
163
+ - spec/middleman_dato/record_spec.rb
164
+ - spec/middleman_dato/records_repo_spec.rb
164
165
  - spec/spec_helper.rb
165
166
  - spec/support/mock_builder.rb
166
167
  homepage: http://cantierecreativo.net
@@ -187,19 +188,19 @@ signing_key:
187
188
  specification_version: 4
188
189
  summary: Fetches data from a Dato space
189
190
  test_files:
190
- - spec/dato/entities_repo_spec.rb
191
- - spec/dato/field_type/file_spec.rb
192
- - spec/dato/field_type/image_spec.rb
193
- - spec/dato/field_type/lat_lon_spec.rb
194
- - spec/dato/field_type/seo_spec.rb
195
- - spec/dato/field_type/video_spec.rb
196
- - spec/dato/json_api_entity_spec.rb
197
- - spec/dato/meta_tags/article_modified_time_spec.rb
198
- - spec/dato/meta_tags/favicon_spec.rb
199
- - spec/dato/meta_tags/image_spec.rb
200
- - spec/dato/meta_tags/og_locale_spec.rb
201
- - spec/dato/record_spec.rb
202
- - spec/dato/records_repo_spec.rb
191
+ - spec/middleman_dato/entities_repo_spec.rb
192
+ - spec/middleman_dato/field_type/file_spec.rb
193
+ - spec/middleman_dato/field_type/image_spec.rb
194
+ - spec/middleman_dato/field_type/lat_lon_spec.rb
195
+ - spec/middleman_dato/field_type/seo_spec.rb
196
+ - spec/middleman_dato/field_type/video_spec.rb
197
+ - spec/middleman_dato/json_api_entity_spec.rb
198
+ - spec/middleman_dato/meta_tags/article_modified_time_spec.rb
199
+ - spec/middleman_dato/meta_tags/favicon_spec.rb
200
+ - spec/middleman_dato/meta_tags/image_spec.rb
201
+ - spec/middleman_dato/meta_tags/og_locale_spec.rb
202
+ - spec/middleman_dato/record_spec.rb
203
+ - spec/middleman_dato/records_repo_spec.rb
203
204
  - spec/spec_helper.rb
204
205
  - spec/support/mock_builder.rb
205
206
  has_rdoc:
data/lib/dato/version.rb DELETED
@@ -1,4 +0,0 @@
1
- module Dato
2
- VERSION = '0.5.11'
3
- end
4
-