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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f513bf4ba639954cb4e2a7dc33c0178929e70164
|
4
|
+
data.tar.gz: 9a966a8b8d5f7993680eb2de411c43d4bfd13b91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54b15aa840aad18463fde399758f7bc48de50be91cb293bcd95f97b386d2cdb3dbb85b855935ea7c618d18210c5b41676086adaabf61b830e516b4e0e3369263
|
7
|
+
data.tar.gz: 66dfbc53fb58a80af071770ad9f724eee25d16074f7c1f6ea714b85885502670b390a364777206e6844247dcb50580751a612061b12d5eec47c1d07fc8969ef0
|
data/CHANGELOG.md
CHANGED
@@ -12,9 +12,14 @@ module Jekyll
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def serialize
|
15
|
-
|
16
|
-
|
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
|
@@ -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
|
-
|
45
|
-
|
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
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
|
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-
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|