contentful-database-importer 0.4.0 → 0.5.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/CHANGELOG.md +4 -0
- data/README.md +4 -5
- data/contentful-database-importer.gemspec +1 -1
- data/lib/contentful/database_importer.rb +1 -0
- data/lib/contentful/database_importer/config.rb +3 -1
- data/lib/contentful/database_importer/resource.rb +1 -1
- data/lib/contentful/database_importer/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0eadd3be57ddc08bd6f494eb11163a025f554a7873e6709500f2d98f7407214f
|
4
|
+
data.tar.gz: 681bf90f7c4bd04110f758ceb3762912196c10e906f92d637ec19d984e87eca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f77d9d58adbdb9bdfe76d0475a504c7e476c690524b8a0cf8faa9905493e9bd8e9d0acea7138a394ba3cdd62637d8ce0457aa1f299328c77af7a772d06c2e00d
|
7
|
+
data.tar.gz: 86ff13d03eff0422a616422df4ea04521b6256b4598014b4541c396dc7a18e7a9d4a702ebd4749d4d52cbeeecc22e4d99c7706eae40d8d0d2da52758a6241239
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -8,9 +8,7 @@ This gem is intended to be a replacement to [`database_exporter`](https://github
|
|
8
8
|
|
9
9
|
## Contentful
|
10
10
|
|
11
|
-
[Contentful](
|
12
|
-
It allows you to create, edit and manage content in the cloud and publish it anywhere via a powerful API.
|
13
|
-
Contentful offers tools for managing editorial teams and enabling cooperation between organizations.
|
11
|
+
[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.
|
14
12
|
|
15
13
|
## What does `contentful-database-importer` do?
|
16
14
|
|
@@ -176,7 +174,7 @@ For example:
|
|
176
174
|
class Foo
|
177
175
|
field :bars, type: Bar, relationship: :many, id_field: :id, key: :foo_id
|
178
176
|
field :baz, type: Baz, relationship: :one, id_field: :id, key: :baz_id
|
179
|
-
field :quxs, type: Qux, relationship: :
|
177
|
+
field :quxs, type: Qux, relationship: :through, through: :foo_qux, primary_id_field: :id, primary_key: :foo_id, foreign_key: :qux_id, foreign_id_field: :id
|
180
178
|
end
|
181
179
|
```
|
182
180
|
|
@@ -191,7 +189,7 @@ Relationship Types:
|
|
191
189
|
In the example above, it will look for all `Bar` entries which have a `:foo_id` that match the value of `:id` for the current `Foo` entry.
|
192
190
|
- `:one`: One to One relationship, looks for the related object of the associated class that matches the value of the `:key` field in the current entry, with the value of `:id_field` in the related entry.
|
193
191
|
In the example above, it will look for the `Baz` entry which has an ID that matches the value of `:baz_id` in the current entry.
|
194
|
-
- `:
|
192
|
+
- `:through`: Many to Many relationship, looks for the related object through an intermediate lookup table, after this it behaves like `:many`.
|
195
193
|
In the example above, it will look for all `Qux` entries found in the intermediate table that match the current entry `:id` and looks it up via the `Qux`s `:id`.
|
196
194
|
|
197
195
|
**Note**: If you're using relationships, use a custom ID Generator template which includes a unique field for each entry,
|
@@ -254,6 +252,7 @@ If planning to upgrade to Sequel `v5`, use `self.query = Sequel.lit("foo = 'bar'
|
|
254
252
|
Contentful::DatabaseImporter.setup do |config|
|
255
253
|
config.space_name = 'My Cool New Space' # Required only for `::run!` - the destination space name
|
256
254
|
config.space_id = 'aAbBcC123foo' # Required only for `::update_space!` - the destination space ID
|
255
|
+
config.environment = 'master' # Optional (only for `::update_space!`) - defaults to `master`
|
257
256
|
config.database_connection = 'postgres://user:pass@host:port' # Required - the DB Connection string
|
258
257
|
config.skip_content_types = true # Optional (only for `::update_space!`) - defaults to `true` - Skips Content Type creation upon updating a space
|
259
258
|
config.locale = 'en-US' # Optional (only for `::update_space!` and `::run!`) - defaults to `'en-US'` - Defines the default locale for Space creation, and locale in which the content will be set for both creation and update
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'contentful_bootstrap', '~> 3.
|
22
|
+
spec.add_dependency 'contentful_bootstrap', '~> 3.11'
|
23
23
|
spec.add_dependency 'sequel', '~> 4.39'
|
24
24
|
spec.add_dependency 'base62-rb'
|
25
25
|
spec.add_dependency 'mimemagic'
|
@@ -57,6 +57,7 @@ module Contentful
|
|
57
57
|
def self.bootstrap_update_space!(file)
|
58
58
|
Contentful::Bootstrap::CommandRunner.new.update_space(
|
59
59
|
config.space_id,
|
60
|
+
environment: config.environment,
|
60
61
|
locale: config.locale,
|
61
62
|
json_template: file.path,
|
62
63
|
skip_content_types: config.skip_content_types
|
@@ -72,7 +72,7 @@ module Contentful
|
|
72
72
|
return transformation.call(value) if transformation.respond_to?(:call)
|
73
73
|
|
74
74
|
raise
|
75
|
-
rescue
|
75
|
+
rescue StandardError
|
76
76
|
error = 'Pre Process could not be done for '
|
77
77
|
error += "#{field_definition[:maps_to]} - #{transformation}"
|
78
78
|
raise error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful-database-importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentful GmbH (David Litvak Bruno)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contentful_bootstrap
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.11'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sequel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
249
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.6
|
250
|
+
rubygems_version: 2.7.6
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: Tool to import content from a Database to Contentful
|