contentful-database-importer 0.4.0 → 0.5.0

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
- SHA1:
3
- metadata.gz: d0b6c4ea7ee70693a4de5e8da44910b91419544d
4
- data.tar.gz: 82ca191561abd0c77165277532648f2986bab79c
2
+ SHA256:
3
+ metadata.gz: 0eadd3be57ddc08bd6f494eb11163a025f554a7873e6709500f2d98f7407214f
4
+ data.tar.gz: 681bf90f7c4bd04110f758ceb3762912196c10e906f92d637ec19d984e87eca3
5
5
  SHA512:
6
- metadata.gz: 16940ef8010f47ad647ea0f280547d82303047647a552694e9c2f798ade6b34beb31d45233dd73a69b073cd47a8d1bf493e3e2f6568d7c929b06e50d1f5184fc
7
- data.tar.gz: 01a4f116a6b28909f58e42ddb009f73539238bc9b637fe3e51d504d4b4372be2ce791b2b5ea2410039e39df1e238adbf8f15ef08b7b7270854732fc83f67070d
6
+ metadata.gz: f77d9d58adbdb9bdfe76d0475a504c7e476c690524b8a0cf8faa9905493e9bd8e9d0acea7138a394ba3cdd62637d8ce0457aa1f299328c77af7a772d06c2e00d
7
+ data.tar.gz: 86ff13d03eff0422a616422df4ea04521b6256b4598014b4541c396dc7a18e7a9d4a702ebd4749d4d52cbeeecc22e4d99c7706eae40d8d0d2da52758a6241239
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.5.0
6
+ ### Added
7
+ * Support for environments.
8
+
5
9
  ## 0.4.0
6
10
 
7
11
  ### Added
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](http://www.contentful.com) is a content management platform for web applications, mobile apps and connected devices.
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: :many_through, through: :foo_qux, primary_id_field: :id, primary_key: :foo_id, foreign_key: :qux_id, foreign_id_field: :id
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
- - `:many_through`: Many to Many relationship, looks for the related object through an intermediate lookup table, after this it behaves like `:many`.
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.7'
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
@@ -6,9 +6,11 @@ module Contentful
6
6
  :space_id,
7
7
  :database_connection,
8
8
  :skip_content_types,
9
- :locale
9
+ :locale,
10
+ :environment
10
11
 
11
12
  def initialize
13
+ @environment = 'master'
12
14
  @skip_content_types = true
13
15
  @locale = 'en-US'
14
16
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module DatabaseImporter
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
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.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: 2017-08-23 00:00:00.000000000 Z
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.7'
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.7'
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.11
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