contentful_middleman 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/contentful_middleman/mappers/base.rb +19 -4
- data/lib/contentful_middleman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e1723317b0e9be644aec1619d93323f4f22a13
|
4
|
+
data.tar.gz: d9fac5661d65115085e91f64761642d8aa8556c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e8cf404b114d806e7bb760a9eeda39ae4979470573d58d8754690d341fac14faebc07c5d6bc50468f1aa5c8da895ead3f138d4b18f26fa83464a3aa818847ee
|
7
|
+
data.tar.gz: 26f43c14a068ef369a2d506cd2c3a3d4da7af7d32424f67bc425ff870bdff63b756f3ffdc180d61168bc059277e31a7ee3694d1544de547e4717d5e49d3478dc
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -48,7 +48,7 @@ Parameter | Description
|
|
48
48
|
---------- | ------------
|
49
49
|
space | Hash with an user choosen name for the space as key and the space id as value
|
50
50
|
access_token | Contentful Delivery API access token
|
51
|
-
cda_query | Hash describing query configuration. See [contentful.rb](https://github.com/contentful/contentful.rb) for more info (look for filter options there)
|
51
|
+
cda_query | Hash describing query configuration. See [contentful.rb](https://github.com/contentful/contentful.rb) for more info (look for filter options there). Note that by default only 100 entries will be fetched, this can be configured to up to 1000 entries using the `limit` option.
|
52
52
|
content_types | Hash describing the mapping applied to entries of the imported content types
|
53
53
|
use_preview_api | Boolean to toogle the used API. Set it to `false` to use `cdn.contentful.com` (default value). Set it to `true` to use `preview.contentful.com`. More info in [the documentation](https://www.contentful.com/developers/documentation/content-delivery-api/#preview-api)
|
54
54
|
|
@@ -7,11 +7,19 @@ module ContentfulMiddleman
|
|
7
7
|
|
8
8
|
def initialize(entries)
|
9
9
|
@entries = entries
|
10
|
+
@children = {}
|
10
11
|
end
|
11
12
|
|
12
13
|
def map(context, entry)
|
13
|
-
|
14
|
-
|
14
|
+
@children = {
|
15
|
+
:queue => [{ :context => context, :entry => entry }],
|
16
|
+
:discovered => [entry.id] }
|
17
|
+
while !@children[:queue].first.nil? do
|
18
|
+
nxt = @children[:queue].pop
|
19
|
+
context = nxt[:context]
|
20
|
+
entry = nxt[:entry]
|
21
|
+
map_entry_full(entry, context)
|
22
|
+
end
|
15
23
|
end
|
16
24
|
|
17
25
|
private
|
@@ -46,11 +54,18 @@ module ContentfulMiddleman
|
|
46
54
|
context
|
47
55
|
end
|
48
56
|
|
49
|
-
def
|
50
|
-
context = Context.new
|
57
|
+
def map_entry_full(entry, context)
|
51
58
|
context.id = entry.id
|
52
59
|
entry.fields.each {|k, v| map_field context, k, v}
|
60
|
+
end
|
53
61
|
|
62
|
+
def map_entry(entry)
|
63
|
+
context = Context.new
|
64
|
+
context.id = entry.id
|
65
|
+
if !@children[:discovered].include?(entry.id)
|
66
|
+
@children[:queue].push({ :context => context, :entry => entry})
|
67
|
+
@children[:discovered].push(entry.id)
|
68
|
+
end
|
54
69
|
context
|
55
70
|
end
|
56
71
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful_middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sascha Konietzke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|