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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1307e1d94d361acbb2e3dff98d646982d7b437e8d0998c18ce8b4c8d69ae1e66
4
- data.tar.gz: f56e068dd9463f21a02a587f2c69a9e105dc3194c3db267953a2f51f2676c3ae
3
+ metadata.gz: 867e24853effdac2308b2bae362ec4f1da52763bd0468b777c3ad4520239c87a
4
+ data.tar.gz: 720213486daf6a332cf24f42c1448a25d15e32b8fb72f39c16c1b93688a1a683
5
5
  SHA512:
6
- metadata.gz: 4f02722dce5f2e2be856200bc0162af50f873927432e53f82b45887d1c20f80209659f85b73113480f15bdf434d86c620c0886c8d5e8cbe75a613da709507b00
7
- data.tar.gz: bd9b842b364b540c4ef7da32dbb22038c2f01ce887c084f43bd892ddc6224b49623851528bf22a945f1cc32e974fc2ec3de504a675ac1e83cdbcb9cf412425e8
6
+ metadata.gz: 3a60eac2b8439a95db2563bde3b85076c8cd5039b4a64cf0b4b336f016b3aed61826bc86d3a2bed9750c3a49abf65a20d7e957702f289c1a9a8d1d54794ac82d
7
+ data.tar.gz: 5748ce48dcb6b199cdf7538bfcdfa43dcc4c942f90469388124e7e054d7e08e7fb405f5277405cc09da8d42533e484ef6014c966803f73b489d9d0db8ad97e5b
@@ -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 | Hash with `'nodeTyoe' => RendererClass` pairs determining overrides for the [`RichTextRenderer` library](https://github.com/contentful/rich-text-renderer.rb) configuration.
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.size > 0
38
- ContentfulMiddleman::VersionHash.source_root = self.class.source_root
39
- ContentfulMiddleman::LocalData::Store.base_path = MIDDLEMAN_LOCAL_DATA_FOLDER
40
- ContentfulMiddleman::LocalData::File.thor = self
41
-
42
- hash_local_data_changed = contentful_instances.reduce(false) do |changes, instance|
43
- import_task = create_import_task(instance)
44
- import_task.run
45
-
46
- changes || import_task.changed_local_data?
47
- end
48
-
49
- Middleman::Cli::Build.new.build if hash_local_data_changed && options[:rebuild]
50
- logger.info 'Contentful Import: Done!'
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
@@ -1,3 +1,3 @@
1
1
  module ContentfulMiddleman
2
- VERSION = "4.1.0"
2
+ VERSION = "4.2.0"
3
3
  end
@@ -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.1.0
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-15 00:00:00.000000000 Z
12
+ date: 2018-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core