middleman-dato 0.7.2 → 0.8.0.pre

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: 6283b5f17bc1ce6862db2f81ad9e502a3a438561
4
- data.tar.gz: cc533e3a5b5ae735d718d22f310bf4f74d844781
3
+ metadata.gz: 3be36475cd3c9d75a01ba2530a4f5fdcef51611e
4
+ data.tar.gz: d7862f16f2c3f697cefce9d1f53272bfb9e01e37
5
5
  SHA512:
6
- metadata.gz: faa1664446c6126a0773dca0cb27df4f0eea14908aceed061e1438c249f56f3de082c12825ca469d506f8214d5380fffab7bc3d9e4fa7dbca03711d761f7f497
7
- data.tar.gz: 65f948fd992d0f1b301756b0cbd734a96c3f1943946de204bd92b33736fd824c274e9e3e364b9b7212973ea2ba1ab810a59795de78ceb9ff5fc3a5f2d3b5c98e
6
+ metadata.gz: 8e8e6e872853dcdfa1fe4cf95d0321016873324894cf24e8c338e437515a04cb3f1433b8107489142f9f3238cdfba5c13a29eb92143d30acf05edd0b1560c416
7
+ data.tar.gz: a23d0884ff531e4c322db48193b156bc232167574fcc6345e3dde79b742706ce1c7885fc90c36872b22a42e820756d6f0aa2d0abcb7990777e70173ad4ccae2d
data/README.md CHANGED
@@ -4,141 +4,11 @@
4
4
 
5
5
  Middleman Dato is a Middleman extension to use the Middleman static site generator together with the API-driven DatoCMS, a fully customizable administrative backend for your static websites.
6
6
 
7
- This gem works for Middleman v3 and v4.
7
+ This gem works for Middleman v4.
8
8
 
9
- ## Documentation and video tutorials
9
+ ## Documentation
10
10
 
11
- To learn more about DatoCMS and how you can use it with your Middleman website, head over to [our documentation](http://www.datocms.com/docs/) and [video tutorials](http://www.datocms.com/docs/tutorials/middleman_netlify/).
12
-
13
- ## Example website
14
-
15
- We've prepared a [Middleman example website](https://github.com/datocms/middleman-example) integrated with DatoCMS. The site is deployed on Netlify, and can be seen at this URL:
16
-
17
- https://datocms-middleman-example.netlify.com/
18
-
19
- ## Setup
20
-
21
- ```ruby
22
- # config.rb
23
-
24
- activate :dato,
25
- token: 'SITE_READ_ONLY_TOKEN',
26
- base_url: 'http://www.mywebsite.com'
27
-
28
- # feel free to use dato from now on:
29
- #
30
- # dato.articles.each do |article|
31
- # proxy "/articles/#{article.slug}.html", "/templates/article.html", locals: { article: article }
32
- # end
33
- ```
34
-
35
- ## Middleman helpers
36
-
37
- Using this extension you can access to any item stored in your site by item type.
38
- Let's start with a basic example: in your Middleman `source/index.html.erb` file
39
- add the following lines:
40
-
41
- ```erb
42
- <% dato.item_types.each do |item_type| %>
43
- <h1>Items of type "<%= item_type.name %>"</h1>
44
- <% dato.items_of_type(item_type).each do |item| %>
45
- <pre><%= item.to_hash %></pre>
46
- <% end %>
47
- <% end %>
48
- ```
49
-
50
- Run the server with `bundle exec middleman` and you'll see the content of every
51
- item you created on your DatoCMS site. Awesome!
52
-
53
- ### Querying items
54
-
55
- Beside dumping every content available, this extension makes it easy also to
56
- return items belonging to a specific Item Type.
57
-
58
- If your site has an Item Type with `article` as API identifier, you can get
59
- the complete array of items with `dato.articles` — yep, **the API identifier pluralized**.
60
-
61
- If a Item Type is marked as Singleton (ie. `about_page`) you don't need to pluralize and
62
- a call to `dato.about_page` directly returns the Item (or `nil`, if still hasn't been created
63
- within the backend).
64
-
65
- You can query any Item field value with a method called like the field API identifier.
66
-
67
- If a Item Type has a String field with Title appeareance, than the item responds to `.slug`,
68
- returning a slugified version of the title itself (or the item identifier, if the title is empty).
69
-
70
- You can use these methods in the Middleman `config.rb` file, as well as within your views:
71
-
72
- ```ruby
73
- <% dato.articles.each do |article| %>
74
- <div class="post">
75
- <h1><%= link_to article.title, "/articles/#{article.slug}.html" %></h1>
76
- <div>
77
- <%= article.main_content %>
78
- </div>
79
- </div>
80
- <% end %>
81
- ```
82
-
83
- ### Managing images and files
84
-
85
- Every DatoCMS plan comes with the power of Imgix image processing. Imgix makes
86
- image processing easy by allowing you to resize, crop, rotate, style, watermark
87
- images and more easily on-the-fly:
88
-
89
- ```ruby
90
- article = dato.articles.first
91
- article.cover_image.url(w: 200, h: 200, fit: 'crop', fm: 'jpg')
92
- ```
93
-
94
- To know all the parameters you can pass to the `.url()` method, please take
95
- a look at the [Imgix Image URL API reference](https://docs.imgix.com/apis/url).
96
-
97
- ### `dato_meta_tags`
98
-
99
- This helper takes any item with a SEO field and generates SEO, Facebook OpenGraph and Twitter card meta tags based on it:
100
-
101
- ```ruby
102
- <%= dato_meta_tags(dato.homepage) %>
103
- ```
104
-
105
- ```html
106
- <title>...</title>
107
-
108
- <meta name="description" content="..."/>
109
- <meta name="twitter:card" content="..." />
110
- <meta name="twitter:description" content="..."/>
111
- <meta name="twitter:image" content="..."/>
112
- <meta name="twitter:site" content="..."/>
113
- <meta name="twitter:title" content="..."/>
114
- <meta name="twitter:url" content="..."/>
115
-
116
- <meta property="og:description" content="..."/>
117
- <meta property="og:image" content="..."/>
118
- <meta property="og:locale" content="..." />
119
- <meta property="og:site_name" content="..." />
120
- <meta property="og:title" content="..."/>
121
- <meta property="og:type" content="..." />
122
- <meta property="og:url" content="..."/>
123
-
124
- <link rel="canonical" href="..."/>
125
- ```
126
-
127
- ### `dato_favicon_meta_tags`
128
-
129
- This helper generates meta tags based on the Favicon image specified within the Site:
130
-
131
- ```ruby
132
- <%= dato_favicon_meta_tags(theme_color: '#D97C5F') %>
133
- ```
134
-
135
- ## Disable reload of data at every request
136
-
137
- During the development of the website it might be useful to speed up the feedback cycle disabling the automatic reload of DatoCMS data at every page refresh:
138
-
139
- ```
140
- DISABLE_DATO_REFRESH=1 bundle exec middleman
141
- ```
11
+ To learn more about DatoCMS and how you can use it with your Middleman website, head over to [our complete documentation](https://docs.datocms.com/middleman/overview.html).
142
12
 
143
13
  ## Submitting a Pull Request
144
14
 
@@ -16,6 +16,7 @@ module MiddlemanDato
16
16
  option :token, ENV['DATO_API_TOKEN'], 'Site API token'
17
17
  option :api_base_url, 'https://site-api.datocms.com', 'Site API host'
18
18
  option :live_reload, true, 'Live reload of content coming from DatoCMS'
19
+ option :draft_mode, false, 'Show draft (unpublished) versions of your content'
19
20
 
20
21
  option :base_url, nil, 'Website base URL (deprecated)'
21
22
  option :domain, nil, 'Site domain (deprecated)'
@@ -26,7 +27,11 @@ module MiddlemanDato
26
27
  def initialize(app, options_hash = {}, &block)
27
28
  super
28
29
 
29
- @loader = loader = Dato::Local::Loader.new(client)
30
+ @loader = loader = Dato::Local::Loader.new(
31
+ client,
32
+ options_hash[:draft_mode]
33
+ )
34
+
30
35
  @loader.load
31
36
 
32
37
  app.after_configuration do
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module MiddlemanDato
3
- VERSION = '0.7.2'
3
+ VERSION = '0.8.0.pre'
4
4
  end
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.7.2
4
+ version: 0.8.0.pre
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-12-18 00:00:00.000000000 Z
11
+ date: 2018-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls
@@ -115,9 +115,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ">="
118
+ - - ">"
119
119
  - !ruby/object:Gem::Version
120
- version: '0'
120
+ version: 1.3.1
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 2.5.1
@@ -126,4 +126,3 @@ specification_version: 4
126
126
  summary: Fetches data from a Dato site
127
127
  test_files:
128
128
  - spec/spec_helper.rb
129
- has_rdoc: