contentful_middleman 4.1.0 → 4.2.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -1
- data/lib/contentful_middleman/commands/contentful.rb +17 -19
- data/lib/contentful_middleman/core.rb +5 -0
- data/lib/contentful_middleman/version.rb +1 -1
- data/spec/contentful_middleman/core_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 867e24853effdac2308b2bae362ec4f1da52763bd0468b777c3ad4520239c87a
|
|
4
|
+
data.tar.gz: 720213486daf6a332cf24f42c1448a25d15e32b8fb72f39c16c1b93688a1a683
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a60eac2b8439a95db2563bde3b85076c8cd5039b4a64cf0b4b336f016b3aed61826bc86d3a2bed9750c3a49abf65a20d7e957702f289c1a9a8d1d54794ac82d
|
|
7
|
+
data.tar.gz: 5748ce48dcb6b199cdf7538bfcdfa43dcc4c942f90469388124e7e054d7e08e7fb405f5277405cc09da8d42533e484ef6014c966803f73b489d9d0db8ad97e5b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
## Unreleased
|
|
3
3
|
|
|
4
|
+
## 4.2.0
|
|
5
|
+
### Added
|
|
6
|
+
* Added `base_path` and `destination` configuration options to manipulate the path to which the data files are saved to. [#89](https://github.com/contentful/contentful_middleman/issues/89)
|
|
7
|
+
|
|
4
8
|
## 4.1.0
|
|
5
9
|
### Added
|
|
6
10
|
* *This feature is currently in BETA state, changes may occur as patch fixes* Added support for RichText and added the `rich_text` view helper.
|
data/README.md
CHANGED
|
@@ -64,7 +64,9 @@ all_entries_page_size | Integer amount of items per page for `:all_entries` r
|
|
|
64
64
|
rebuild_on_webhook | Boolean to toggle Webhook server. Server will run in port 5678, and will be expecting to receive Contentful Webhook calls on `/receive`.
|
|
65
65
|
webhook_timeout | Integer (in seconds) for wait time after Webhook received for rebuilding. Only used if `:rebuild_on_webhook` is true. Defaults to 300 seconds.
|
|
66
66
|
webhook_controller | Class for handling Webhook response, defaults to `::ContentfulMiddleman::WebhookHandler`.
|
|
67
|
-
rich_text_mappings
|
|
67
|
+
rich_text_mappings | Hash with `'nodeType' => RendererClass` pairs determining overrides for the [`RichTextRenderer` library](https://github.com/contentful/rich-text-renderer.rb) configuration.
|
|
68
|
+
base_path | String with path to your Middleman Application, defaults to current directory. Path is relative to your current location.
|
|
69
|
+
destination | String with path within your base path under which to store the output yaml files. Defaults to `data`.
|
|
68
70
|
|
|
69
71
|
You can activate the extension multiple times to import entries from different spaces.
|
|
70
72
|
|
|
@@ -15,9 +15,6 @@ module Middleman
|
|
|
15
15
|
class Contentful < Thor::Group
|
|
16
16
|
include Thor::Actions
|
|
17
17
|
|
|
18
|
-
# Path where Middleman expects the local data to be stored
|
|
19
|
-
MIDDLEMAN_LOCAL_DATA_FOLDER = 'data'
|
|
20
|
-
|
|
21
18
|
check_unknown_options!
|
|
22
19
|
|
|
23
20
|
class_option "rebuild",
|
|
@@ -34,23 +31,24 @@ module Middleman
|
|
|
34
31
|
end
|
|
35
32
|
|
|
36
33
|
def contentful
|
|
37
|
-
if contentful_instances.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
else
|
|
52
|
-
raise Thor::Error.new "You need to activate the contentful extension in config.rb before you can import data from Contentful"
|
|
34
|
+
raise Thor::Error.new "You need to activate the contentful extension in config.rb before you can import data from Contentful" if contentful_instances.empty?
|
|
35
|
+
|
|
36
|
+
ContentfulMiddleman::VersionHash.source_root = self.class.source_root
|
|
37
|
+
ContentfulMiddleman::LocalData::File.thor = self
|
|
38
|
+
|
|
39
|
+
hash_local_data_changed = contentful_instances.reduce(false) do |changes, instance|
|
|
40
|
+
ContentfulMiddleman::LocalData::Store.base_path = File.join(
|
|
41
|
+
instance.options.base_path,
|
|
42
|
+
instance.options.destination
|
|
43
|
+
)
|
|
44
|
+
import_task = create_import_task(instance)
|
|
45
|
+
import_task.run
|
|
46
|
+
|
|
47
|
+
changes || import_task.changed_local_data?
|
|
53
48
|
end
|
|
49
|
+
|
|
50
|
+
Middleman::Cli::Build.new.build if hash_local_data_changed && options[:rebuild]
|
|
51
|
+
logger.info 'Contentful Import: Done!'
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
private
|
|
@@ -55,6 +55,11 @@ module ContentfulMiddleman
|
|
|
55
55
|
option :rich_text_mappings, {},
|
|
56
56
|
"Custom renderers for the RichTextRenderer library"
|
|
57
57
|
|
|
58
|
+
option :base_path, Dir.pwd,
|
|
59
|
+
"String with path to your Middleman Application. Path is relative to your current location."
|
|
60
|
+
|
|
61
|
+
option :destination, 'data',
|
|
62
|
+
"String with path within your base path under which to store the output yaml files."
|
|
58
63
|
|
|
59
64
|
helpers ContentfulMiddleman::Helpers
|
|
60
65
|
include ContentfulMiddleman::Helpers
|
|
@@ -22,6 +22,8 @@ describe ContentfulMiddleman::Core do
|
|
|
22
22
|
expect(options.rebuild_on_webhook).to eq(false)
|
|
23
23
|
expect(options.webhook_timeout).to eq(300)
|
|
24
24
|
expect(options.default_locale).to eq('en-US')
|
|
25
|
+
expect(options.base_path).to eq Dir.pwd
|
|
26
|
+
expect(options.destination).to eq 'data'
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
29
|
|
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: 4.
|
|
4
|
+
version: 4.2.0
|
|
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: 2018-10-
|
|
12
|
+
date: 2018-10-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: middleman-core
|