jekyll-contentful-data-import 0.1.1 → 1.0.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: c3583ff47a05314cd2914810223cad4e0ab01894
4
- data.tar.gz: 21cfbb2ed72ad174e5d4613ea1aa3b101ba8ed5b
3
+ metadata.gz: f513bf4ba639954cb4e2a7dc33c0178929e70164
4
+ data.tar.gz: 9a966a8b8d5f7993680eb2de411c43d4bfd13b91
5
5
  SHA512:
6
- metadata.gz: 5ce05d4e5b0a10b60b4dd35ee9ecbc6d35f9fd9546cb1eaf0800659c6ae7dba3db265433ac74d3823b8107b12d4d4a8839664bbe43565b86e0f2d6a0570b491e
7
- data.tar.gz: 37c934537a139a0ffa9d19a6011044aa6af48cb66c7f474647fba0bbc632a477b40045a2c6386880cc2ed4eb02509f1c9dc91c4275b609ad15658dc9ffce65e5
6
+ metadata.gz: 54b15aa840aad18463fde399758f7bc48de50be91cb293bcd95f97b386d2cdb3dbb85b855935ea7c618d18210c5b41676086adaabf61b830e516b4e0e3369263
7
+ data.tar.gz: 66dfbc53fb58a80af071770ad9f724eee25d16074f7c1f6ea714b85885502670b390a364777206e6844247dcb50580751a612061b12d5eec47c1d07fc8969ef0
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## v1.0.1
5
+ ### Changed
6
+ * Content Type format is now as expected
7
+
8
+ ## v1.0.0 [YANKED]
9
+ ### Changed
10
+ * Content Types are separated in the Space YAML
11
+
4
12
  ## v0.1.1
5
13
  ### Changed
6
14
 
@@ -12,9 +12,14 @@ module Jekyll
12
12
  end
13
13
 
14
14
  def serialize
15
- entries.map do |entry|
16
- ::Jekyll::Contentful::Mappers::Base.mapper_for(entry, config).map
15
+ result = {}
16
+ entries.group_by { |entry| entry.content_type.id }.each do |content_type, entry_list|
17
+ result[content_type] = entry_list.map do |entry|
18
+ ::Jekyll::Contentful::Mappers::Base.mapper_for(entry, config).map
19
+ end
17
20
  end
21
+
22
+ result
18
23
  end
19
24
 
20
25
  def to_yaml
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Contentful
3
- VERSION = "0.1.1"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ describe Jekyll::Contentful::Serializer do
14
14
  end
15
15
 
16
16
  it 'uses specified mapper' do
17
- subject.instance_variable_set(:@config, {'content_types' => {'' => 'MapperDouble'}})
17
+ subject.instance_variable_set(:@config, {'content_types' => {'content_type' => 'MapperDouble'}})
18
18
 
19
19
  expect_any_instance_of(MapperDouble).to receive(:map)
20
20
 
@@ -23,14 +23,14 @@ describe Jekyll::Contentful::Serializer do
23
23
  end
24
24
 
25
25
  it 'serializes a single entry without fields' do
26
- expected = [{'sys' => {'id' => 'foo'}}]
26
+ expected = {'content_type' => [{'sys' => {'id' => 'foo'}}]}
27
27
  expect(subject.serialize).to eq(expected)
28
28
  end
29
29
 
30
30
  it 'serializes a single entry with fields' do
31
31
  subject.instance_variable_set(:@entries, [EntryDouble.new('foo', ContentTypeDouble.new, {'foobar' => 'bar'})])
32
32
 
33
- expected = [{'sys' => {'id' => 'foo'}, 'foobar' => 'bar'}]
33
+ expected = {'content_type' => [{'sys' => {'id' => 'foo'}, 'foobar' => 'bar'}]}
34
34
  expect(subject.serialize).to eq(expected)
35
35
  end
36
36
 
@@ -40,10 +40,12 @@ describe Jekyll::Contentful::Serializer do
40
40
  EntryDouble.new('bar', ContentTypeDouble.new, {'foobar' => 'baz'})
41
41
  ])
42
42
 
43
- expected = [
44
- {'sys' => {'id' => 'foo'}, 'foobar' => 'bar'},
45
- {'sys' => {'id' => 'bar'}, 'foobar' => 'baz'}
46
- ]
43
+ expected = {
44
+ 'content_type' => [
45
+ {'sys' => {'id' => 'foo'}, 'foobar' => 'bar'},
46
+ {'sys' => {'id' => 'bar'}, 'foobar' => 'baz'}
47
+ ]
48
+ }
47
49
  expect(subject.serialize).to match(expected)
48
50
  end
49
51
  end
data/spec/spec_helper.rb CHANGED
@@ -27,7 +27,7 @@ end
27
27
  class ContentTypeDouble
28
28
  attr_reader :id
29
29
 
30
- def initialize(id = '')
30
+ def initialize(id = 'content_type')
31
31
  @id = id
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-contentful-data-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2015-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll