jekyll-contentful-data-import 1.6.0 → 1.7.0
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 +5 -5
- data/.travis.yml +3 -8
- data/CHANGELOG.md +4 -1
- data/README.md +10 -3
- data/lib/jekyll-contentful-data-import.rb +1 -1
- data/lib/jekyll-contentful-data-import/importer.rb +4 -2
- data/lib/jekyll-contentful-data-import/mappers/base.rb +2 -1
- data/lib/jekyll-contentful-data-import/version.rb +1 -1
- data/spec/jekyll-contentful/importer_spec.rb +3 -1
- data/spec/jekyll-contentful/mappers/base_spec.rb +10 -5
- data/spec/jekyll-contentful/serializer_spec.rb +12 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 37c1c1b1bddb8164bcc950d2e370ae3e15327c44c5d4c34cbd5f7b38429414d7
|
4
|
+
data.tar.gz: c5aed758e4839abb2bc8dfe08ba883cd437d7c0c1c908b44a6362d35e84cac54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ceb1ae089f35241ff5b64a7069d5e00f0c13d890ca0608f2b63a2f0e20f110c013024893a629c4f1b1c7440169830365d234365ed76eae8535671bcdace34b4
|
7
|
+
data.tar.gz: d11c17b6f0a9479fe7e036bc424eb14b8b542764c9ce354e730db94f62859356b5feee21bdd55433c59884d27fdcf6a642c6994b81f1d32351b14917ea629015
|
data/.travis.yml
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
rvm:
|
2
|
-
- 2.
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- jruby
|
2
|
+
- 2.3.1
|
3
|
+
- 2.4.0
|
4
|
+
- 2.5.1
|
6
5
|
|
7
6
|
script: "bundle exec rake test"
|
8
7
|
|
@@ -12,7 +11,3 @@ env: TEST=true JRUBY_OPTS='--2.0'
|
|
12
11
|
notifications:
|
13
12
|
slack:
|
14
13
|
secure: MMWxqKMT4m2UhZ+Ix4wgCs1nLvu9hUFCbyV/qJWmIFif7V4GUKXi6h9krMqGqBAd3YV3pP/InPlw3QoKBUGIAIr5GzDpSnU5ACv7E61v548qViEvPBqsfhRHha2M164rUHn32tpejJnIizVUyND/hIzNviIrab+G8uOaZXUtB5I=
|
15
|
-
|
16
|
-
matrix:
|
17
|
-
allow_failures:
|
18
|
-
- rvm: jruby
|
data/CHANGELOG.md
CHANGED
@@ -2,8 +2,11 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
-
##
|
5
|
+
## v1.7.0
|
6
|
+
### Added
|
7
|
+
* Added top-level environment assignment, with support for `ENV_` access [#61](https://github.com/contentful/jekyll-contentful-data-import/issues/61)
|
6
8
|
|
9
|
+
## v1.6.0
|
7
10
|
### Added
|
8
11
|
* Independent file per entry [#45](https://github.com/contentful/jekyll-contentful-data-import/pull/45) [#10](https://github.com/contentful/jekyll-contentful-data-import/issues/10) [#23](https://github.com/contentful/jekyll-contentful-data-import/pull/23) [#25](https://github.com/contentful/jekyll-contentful-data-import/issues/25)
|
9
12
|
* Added User Agent Integration Headers
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/contentful/jekyll-contentful-data-import)
|
4
4
|
|
5
|
-
|
5
|
+
[Contentful](https://www.contentful.com) provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.
|
6
|
+
|
7
|
+
Jekyll-Contentful-Data-Import is a [Jekyll](http://jekyllrb.com/) extension to use the Jekyll static site generator together with [Contentful](https://www.contentful.com). It is powered by the [Contentful Ruby Gem](https://github.com/contentful/contentful.rb).
|
6
8
|
|
7
9
|
Experience the power of Jekyll while staying sane as a developer by letting end-users edit content in a web-based interface.
|
8
10
|
|
@@ -44,6 +46,7 @@ contentful:
|
|
44
46
|
- example: # Jekyll _data folder identifier - Required
|
45
47
|
space: cfexampleapi # Required
|
46
48
|
access_token: b4c0n73n7fu1 # Required
|
49
|
+
environment: master # Optional
|
47
50
|
cda_query: # Optional
|
48
51
|
include: 2
|
49
52
|
limit: 100
|
@@ -53,6 +56,7 @@ contentful:
|
|
53
56
|
cat: MyCoolMapper
|
54
57
|
client_options: # Optional
|
55
58
|
api_url: 'preview.contentful.com' # Defaults to 'api.contentful.com' which is Production
|
59
|
+
max_include_resolution_depth: 5 # Optional - Defaults to 20, maximum amount of levels to resolve includes
|
56
60
|
base_path: app_path # Optional - Defaults to Current directory
|
57
61
|
destination: destination_in_data # Optional - Defaults to _data/contentful/spaces
|
58
62
|
individual_entry_files: true # Optional - Defaults to false
|
@@ -62,6 +66,7 @@ Parameter | Description
|
|
62
66
|
---------- | ------------
|
63
67
|
space | Contentful Space ID
|
64
68
|
access_token | Contentful Delivery API access token
|
69
|
+
environment | Space environment, defaults to `master`
|
65
70
|
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.
|
66
71
|
all_entries | Boolean, if true will run multiple queries to the API until it fetches all entries for the space
|
67
72
|
all_entries_page_size | Integer, the amount of maximum entries per CDA Request when fetching :all_entries
|
@@ -135,15 +140,17 @@ therefore you can do the following:
|
|
135
140
|
- example:
|
136
141
|
space: ENV_CONTENTFUL_SPACE_ID
|
137
142
|
access_token: ENV_CONTENTFUL_ACCESS_TOKEN
|
143
|
+
environment: ENV_CONTENTFUL_ENVIRONMENT
|
138
144
|
```
|
139
145
|
|
140
|
-
(Your Space ID will be looked upon on `ENV['CONTENTFUL_SPACE_ID']
|
146
|
+
(Your Space ID will be looked upon on `ENV['CONTENTFUL_SPACE_ID']`, your Access Token on `ENV['CONTENTFUL_ACCESS_TOKEN']` and your environment on `ENV['CONTENTFUL_ENVIRONMENT']`.)
|
141
147
|
|
142
148
|
3. Either add the following variables to your shell's configuration file (.bashrc or .bash_profile, for example):
|
143
149
|
|
144
150
|
```bash
|
145
151
|
export CONTENTFUL_ACCESS_TOKEN=abc123
|
146
152
|
export CONTENTFUL_SPACE_ID=abc123
|
153
|
+
export CONTENTFUL_ENVIRONMENT=master
|
147
154
|
```
|
148
155
|
|
149
156
|
(And run `source ~/.bashrc` or open new terminal to enable changes.)
|
@@ -151,7 +158,7 @@ therefore you can do the following:
|
|
151
158
|
Or specify them on the command line:
|
152
159
|
|
153
160
|
```bash
|
154
|
-
CONTENTFUL_ACCESS_TOKEN=abc123 CONTENTFUL_SPACE_ID=abc123 jekyll contentful
|
161
|
+
CONTENTFUL_ACCESS_TOKEN=abc123 CONTENTFUL_SPACE_ID=abc123 CONTENTFUL_ENVIRONMENT=master jekyll contentful
|
155
162
|
```
|
156
163
|
|
157
164
|
4. Party.
|
@@ -19,6 +19,7 @@ module Jekyll
|
|
19
19
|
space_client = client(
|
20
20
|
value_for(options, 'space'),
|
21
21
|
value_for(options, 'access_token'),
|
22
|
+
value_for(options, 'environment'),
|
22
23
|
client_options(options.fetch('client_options', {}))
|
23
24
|
)
|
24
25
|
|
@@ -62,7 +63,7 @@ module Jekyll
|
|
62
63
|
|
63
64
|
def value_for(options, key)
|
64
65
|
potential_value = options[key]
|
65
|
-
return ENV[potential_value.gsub('ENV_', '')] if potential_value.start_with?('ENV_')
|
66
|
+
return ENV[potential_value.gsub('ENV_', '')] if !potential_value.nil? && potential_value.start_with?('ENV_')
|
66
67
|
potential_value
|
67
68
|
end
|
68
69
|
|
@@ -90,10 +91,11 @@ module Jekyll
|
|
90
91
|
all
|
91
92
|
end
|
92
93
|
|
93
|
-
def client(space, access_token, options = {})
|
94
|
+
def client(space, access_token, environment = nil, options = {})
|
94
95
|
options = {
|
95
96
|
space: space,
|
96
97
|
access_token: access_token,
|
98
|
+
environment: environment || 'master',
|
97
99
|
dynamic_entries: :auto,
|
98
100
|
raise_errors: true,
|
99
101
|
integration_name: 'jekyll',
|
@@ -33,7 +33,8 @@ module Jekyll
|
|
33
33
|
'id' => entry.sys.fetch(:id, nil),
|
34
34
|
'created_at' => entry.sys.fetch(:created_at, nil),
|
35
35
|
'updated_at' => entry.sys.fetch(:updated_at, nil),
|
36
|
-
'content_type_id' => content_type.nil? ? nil : content_type.id
|
36
|
+
'content_type_id' => content_type.nil? ? nil : content_type.id,
|
37
|
+
'revision' => entry.sys.fetch(:revision, nil)
|
37
38
|
}
|
38
39
|
end
|
39
40
|
|
@@ -45,6 +45,7 @@ describe Jekyll::Contentful::Importer do
|
|
45
45
|
expect(::Contentful::Client).to receive(:new).with(
|
46
46
|
space: 'foo',
|
47
47
|
access_token: 'foobar',
|
48
|
+
environment: 'master',
|
48
49
|
dynamic_entries: :auto,
|
49
50
|
raise_errors: true,
|
50
51
|
integration_name: 'jekyll',
|
@@ -58,13 +59,14 @@ describe Jekyll::Contentful::Importer do
|
|
58
59
|
expect(::Contentful::Client).to receive(:new).with(
|
59
60
|
space: 'foo',
|
60
61
|
access_token: 'foobar',
|
62
|
+
environment: 'master',
|
61
63
|
dynamic_entries: :auto,
|
62
64
|
raise_errors: false,
|
63
65
|
integration_name: 'jekyll',
|
64
66
|
integration_version: Jekyll::Contentful::VERSION
|
65
67
|
)
|
66
68
|
|
67
|
-
subject.client('foo', 'foobar', raise_errors: false)
|
69
|
+
subject.client('foo', 'foobar', 'master', raise_errors: false)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
@@ -83,7 +83,8 @@ describe Jekyll::Contentful::Mappers::Base do
|
|
83
83
|
'id' => 'foo',
|
84
84
|
'created_at' => nil,
|
85
85
|
'updated_at' => nil,
|
86
|
-
'content_type_id' => 'content_type'
|
86
|
+
'content_type_id' => 'content_type',
|
87
|
+
'revision' => nil
|
87
88
|
}
|
88
89
|
}
|
89
90
|
expect(subject.map).to eq expected
|
@@ -109,7 +110,8 @@ describe Jekyll::Contentful::Mappers::Base do
|
|
109
110
|
'id' => 'foo',
|
110
111
|
'created_at' => nil,
|
111
112
|
'updated_at' => nil,
|
112
|
-
'content_type_id' => 'content_type'
|
113
|
+
'content_type_id' => 'content_type',
|
114
|
+
'revision' => nil
|
113
115
|
},
|
114
116
|
'asset' => {
|
115
117
|
'sys' => {
|
@@ -133,7 +135,8 @@ describe Jekyll::Contentful::Mappers::Base do
|
|
133
135
|
'id' => 'baz',
|
134
136
|
'created_at' => nil,
|
135
137
|
'updated_at' => nil,
|
136
|
-
'content_type_id' => 'content_type'
|
138
|
+
'content_type_id' => 'content_type',
|
139
|
+
'revision' => nil
|
137
140
|
},
|
138
141
|
},
|
139
142
|
'array' => [
|
@@ -164,7 +167,8 @@ describe Jekyll::Contentful::Mappers::Base do
|
|
164
167
|
'id' => 'foo',
|
165
168
|
'created_at' => nil,
|
166
169
|
'updated_at' => nil,
|
167
|
-
'content_type_id' => 'content_type'
|
170
|
+
'content_type_id' => 'content_type',
|
171
|
+
'revision' => nil
|
168
172
|
},
|
169
173
|
'foo' => {
|
170
174
|
'en-US' => 'bar',
|
@@ -201,7 +205,8 @@ describe Jekyll::Contentful::Mappers::Base do
|
|
201
205
|
'id' => 'foo',
|
202
206
|
'created_at' => nil,
|
203
207
|
'updated_at' => nil,
|
204
|
-
'content_type_id' => 'content_type'
|
208
|
+
'content_type_id' => 'content_type',
|
209
|
+
'revision' => nil
|
205
210
|
},
|
206
211
|
'asset' => {
|
207
212
|
"en-US" => {
|
@@ -30,7 +30,8 @@ describe Jekyll::Contentful::Serializer do
|
|
30
30
|
'id' => 'foo',
|
31
31
|
'created_at' => nil,
|
32
32
|
'updated_at' => nil,
|
33
|
-
'content_type_id' => 'content_type'
|
33
|
+
'content_type_id' => 'content_type',
|
34
|
+
'revision' => nil
|
34
35
|
}
|
35
36
|
}
|
36
37
|
]
|
@@ -48,7 +49,8 @@ describe Jekyll::Contentful::Serializer do
|
|
48
49
|
'id' => 'foo',
|
49
50
|
'created_at' => nil,
|
50
51
|
'updated_at' => nil,
|
51
|
-
'content_type_id' => 'content_type'
|
52
|
+
'content_type_id' => 'content_type',
|
53
|
+
'revision' => nil
|
52
54
|
},
|
53
55
|
'foobar' => 'bar'
|
54
56
|
}
|
@@ -73,14 +75,16 @@ describe Jekyll::Contentful::Serializer do
|
|
73
75
|
'id' => 'foo',
|
74
76
|
'created_at' => nil,
|
75
77
|
'updated_at' => nil,
|
76
|
-
'content_type_id' => 'content_type'
|
78
|
+
'content_type_id' => 'content_type',
|
79
|
+
'revision' => nil
|
77
80
|
},
|
78
81
|
'foobar' => {
|
79
82
|
'sys' => {
|
80
83
|
'id' => 'foobar',
|
81
84
|
'created_at' => nil,
|
82
85
|
'updated_at' => nil,
|
83
|
-
'content_type_id' => 'content_type'
|
86
|
+
'content_type_id' => 'content_type',
|
87
|
+
'revision' => nil
|
84
88
|
},
|
85
89
|
'baz' => 1
|
86
90
|
}
|
@@ -103,7 +107,8 @@ describe Jekyll::Contentful::Serializer do
|
|
103
107
|
'id' => 'foo',
|
104
108
|
'created_at' => nil,
|
105
109
|
'updated_at' => nil,
|
106
|
-
'content_type_id' => 'content_type'
|
110
|
+
'content_type_id' => 'content_type',
|
111
|
+
'revision' => nil
|
107
112
|
},
|
108
113
|
'foobar' => 'bar'
|
109
114
|
},
|
@@ -112,7 +117,8 @@ describe Jekyll::Contentful::Serializer do
|
|
112
117
|
'id' => 'bar',
|
113
118
|
'created_at' => nil,
|
114
119
|
'updated_at' => nil,
|
115
|
-
'content_type_id' => 'content_type'
|
120
|
+
'content_type_id' => 'content_type',
|
121
|
+
'revision' => nil
|
116
122
|
},
|
117
123
|
'foobar' => 'baz'
|
118
124
|
}
|
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: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentful GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.7.6
|
274
274
|
signing_key:
|
275
275
|
specification_version: 4
|
276
276
|
summary: Include mangablable content from the Contentful CMS and API into your Jekyll
|