contentful_middleman 1.1.0 → 1.1.1

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: 702b32a151db22f1766007ab9037dd0f97514772
4
- data.tar.gz: a1b77abea5946045d0ec3c0d78206a947cb91a37
3
+ metadata.gz: 54e1723317b0e9be644aec1619d93323f4f22a13
4
+ data.tar.gz: d9fac5661d65115085e91f64761642d8aa8556c1
5
5
  SHA512:
6
- metadata.gz: 9347872cd447c2be6ba366e98578320239d5335957bbf41b263055fed811a4b7320493bdf4dc18a4c9928d0bdf147a593a0834bd4b3836acd73962e194dc2122
7
- data.tar.gz: b481b2f37faee22a12a9bfbc172dff6d7fa76765d3f7b022564ec42bdca689c902a7bb67832ae329b2357fd821a99a149f7f4da71a6c7610abc4a943392e9e0f
6
+ metadata.gz: 8e8cf404b114d806e7bb760a9eeda39ae4979470573d58d8754690d341fac14faebc07c5d6bc50468f1aa5c8da895ead3f138d4b18f26fa83464a3aa818847ee
7
+ data.tar.gz: 26f43c14a068ef369a2d506cd2c3a3d4da7af7d32424f67bc425ff870bdff63b756f3ffdc180d61168bc059277e31a7ee3694d1544de547e4717d5e49d3478dc
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.1.1
4
+ ### Changed
5
+ * Breadth-first search of linked entries
6
+
3
7
  ## 1.1.0
4
8
  ### Added
5
9
  * New extension option: `use_preview_api`
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
- context.id = entry.id
14
- entry.fields.each {|k, v| map_field context, k, v}
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 map_entry(entry)
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
 
@@ -1,3 +1,3 @@
1
1
  module ContentfulMiddleman
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
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.0
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-04-29 00:00:00.000000000 Z
12
+ date: 2015-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core