consyncful 0.9.0 → 1.0.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
2
  SHA256:
3
- metadata.gz: 0ba8337492a23b2e64415655bbf40d173a242cab785100a8f63c1aaa9c9c66d3
4
- data.tar.gz: aa802f57a1d04f013440bda7b81d9780226942d779f8031e51c60c4dcc822be2
3
+ metadata.gz: 4b9c4fef8bbf34bd564d13689dafc4bad203d3acfc542ecb99ee9c29b2abc490
4
+ data.tar.gz: b863ad7cfcc5039c84bf742fd42159ba5edfc0bb6f121d3350fbaeb0f505a9a1
5
5
  SHA512:
6
- metadata.gz: 0cdcba4664eb12afb0b1a4ca1d6a8a302605d9334ec2342aa5f699d3e71926815e271f701f32fa7f2c3cc73f085fecbd4c4261dedf3b0300cd0641b195dceb47
7
- data.tar.gz: 7cb9d7289b6524c2e2ff95fe547fd2cbf6614601e2177aff275ce21ab9b467afdf039f4cfff566c2095bc3fce44b15020b7d0beaa7556b6c1312b384ac64833b
6
+ metadata.gz: 4c84d7cc4d4fc0a3242ffe9305d78965373306c43b28d219ea1456741698673c1b124e763cde4f1893b0473edddaf60e743483e8a0aa099f2bf0f753092da426
7
+ data.tar.gz: cc55690d0e1a9bf0a48382b01b77f7c61a4ccb461dc4893151becdff9d283067fe1e55d71e7ac6bec56fd62208061647c89b8c594d32c0cca1d55a84edaa5daf
data/Gemfile.lock CHANGED
@@ -1,34 +1,43 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- consyncful (0.9.0)
4
+ consyncful (1.0.0)
5
5
  contentful (>= 2.11.1, < 3.0.0)
6
6
  hooks (>= 0.4.1)
7
- mongoid (>= 7.0.2, < 9.0.0)
7
+ mongoid (= 9.0.0)
8
8
  rainbow
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (7.0.4.2)
14
- activesupport (= 7.0.4.2)
15
- activesupport (7.0.4.2)
13
+ activemodel (7.1.3.4)
14
+ activesupport (= 7.1.3.4)
15
+ activesupport (7.1.3.4)
16
+ base64
17
+ bigdecimal
16
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ connection_pool (>= 2.2.5)
20
+ drb
17
21
  i18n (>= 1.6, < 2)
18
22
  minitest (>= 5.1)
23
+ mutex_m
19
24
  tzinfo (~> 2.0)
20
25
  addressable (2.8.1)
21
26
  public_suffix (>= 2.0.2, < 6.0)
22
27
  ast (2.4.2)
23
- bson (4.15.0)
24
- concurrent-ruby (1.2.0)
28
+ base64 (0.2.0)
29
+ bigdecimal (3.1.8)
30
+ bson (5.0.1)
31
+ concurrent-ruby (1.3.4)
32
+ connection_pool (2.4.1)
25
33
  contentful (2.16.3)
26
34
  http (> 0.8, < 5.0)
27
35
  multi_json (~> 1)
28
36
  database_cleaner (1.8.3)
29
- diff-lcs (1.3)
37
+ diff-lcs (1.5.1)
30
38
  domain_name (0.5.20190701)
31
39
  unf (>= 0.0.5, < 1.0.0)
40
+ drb (2.2.1)
32
41
  ffi (1.15.5)
33
42
  ffi-compiler (1.0.1)
34
43
  ffi (>= 1.0.0)
@@ -45,16 +54,17 @@ GEM
45
54
  http-form_data (2.3.0)
46
55
  http-parser (1.2.3)
47
56
  ffi-compiler (>= 1.0, < 2.0)
48
- i18n (1.12.0)
57
+ i18n (1.14.5)
49
58
  concurrent-ruby (~> 1.0)
50
- minitest (5.17.0)
51
- mongo (2.18.2)
52
- bson (>= 4.14.1, < 5.0.0)
53
- mongoid (8.0.3)
54
- activemodel (>= 5.1, < 7.1, != 7.0.0)
59
+ minitest (5.25.1)
60
+ mongo (2.20.1)
61
+ bson (>= 4.14.1, < 6.0.0)
62
+ mongoid (9.0.0)
63
+ activemodel (>= 5.1, < 7.2, != 7.0.0)
64
+ concurrent-ruby (>= 1.0.5, < 2.0)
55
65
  mongo (>= 2.18.0, < 3.0.0)
56
- ruby2_keywords (~> 0.0.5)
57
66
  multi_json (1.15.0)
67
+ mutex_m (0.2.0)
58
68
  parallel (1.22.1)
59
69
  parser (3.1.2.0)
60
70
  ast (~> 2.4.1)
@@ -63,19 +73,19 @@ GEM
63
73
  rake (13.0.1)
64
74
  regexp_parser (2.3.1)
65
75
  rexml (3.2.5)
66
- rspec (3.9.0)
67
- rspec-core (~> 3.9.0)
68
- rspec-expectations (~> 3.9.0)
69
- rspec-mocks (~> 3.9.0)
70
- rspec-core (3.9.1)
71
- rspec-support (~> 3.9.1)
72
- rspec-expectations (3.9.0)
76
+ rspec (3.13.0)
77
+ rspec-core (~> 3.13.0)
78
+ rspec-expectations (~> 3.13.0)
79
+ rspec-mocks (~> 3.13.0)
80
+ rspec-core (3.13.0)
81
+ rspec-support (~> 3.13.0)
82
+ rspec-expectations (3.13.2)
73
83
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.9.0)
75
- rspec-mocks (3.9.1)
84
+ rspec-support (~> 3.13.0)
85
+ rspec-mocks (3.13.1)
76
86
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.9.0)
78
- rspec-support (3.9.2)
87
+ rspec-support (~> 3.13.0)
88
+ rspec-support (3.13.1)
79
89
  rubocop (1.28.2)
80
90
  parallel (~> 1.10)
81
91
  parser (>= 3.1.0.0)
@@ -92,7 +102,6 @@ GEM
92
102
  rubocop-rspec (2.10.0)
93
103
  rubocop (~> 1.19)
94
104
  ruby-progressbar (1.11.0)
95
- ruby2_keywords (0.0.5)
96
105
  tzinfo (2.0.6)
97
106
  concurrent-ruby (~> 1.0)
98
107
  uber (0.0.15)
data/consyncful.gemspec CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
 
42
42
  spec.add_dependency 'contentful', ['>=2.11.1', '<3.0.0']
43
43
  spec.add_dependency 'hooks', '>=0.4.1'
44
- spec.add_dependency 'mongoid', ['>=7.0.2', '<9.0.0']
44
+ spec.add_dependency 'mongoid', ['9.0.0']
45
45
  spec.add_dependency 'rainbow'
46
46
  spec.metadata['rubygems_mfa_required'] = 'true'
47
47
  end
@@ -10,8 +10,8 @@ module Consyncful
10
10
 
11
11
  cattr_accessor :model_map
12
12
 
13
- store_in collection: -> { Consyncful.configuration.mongo_collection },
14
- client: -> { Consyncful.configuration.mongo_client }
13
+ store_in collection: Consyncful.configuration.mongo_collection.to_s,
14
+ client: Consyncful.configuration.mongo_client.to_s
15
15
 
16
16
  def self.contentful_model_name(name)
17
17
  self.model_map ||= {}
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Handles Rails configurations for Consyncful
4
+ module Consyncful
5
+ ##
6
+ class Configuration
7
+ attr_accessor :contentful_client_options,
8
+ :contentful_sync_options,
9
+ :locale,
10
+ :mongo_client,
11
+ :mongo_collection,
12
+ :content_tags,
13
+ :ignore_content_tags,
14
+ :preserve_contentful_timestamps
15
+
16
+ def initialize
17
+ @contentful_client_options = {}
18
+ @contentful_sync_options = {}
19
+ @locale = 'en-NZ'
20
+ @mongo_client = :default
21
+ @mongo_collection = 'contentful_models'
22
+ @content_tags = []
23
+ @ignore_content_tags = []
24
+ @preserve_contentful_timestamps = false
25
+ end
26
+
27
+ def initial_sync_options
28
+ options = { initial: true }
29
+ options = options.reverse_merge(@contentful_sync_options)
30
+ options.reverse_merge(DEFAULT_SYNC_OPTIONS)
31
+ end
32
+
33
+ def client_options
34
+ options = @contentful_client_options
35
+ options.reverse_merge!(DEFAULT_CLIENT_OPTIONS)
36
+ end
37
+ end
38
+
39
+ DEFAULT_CLIENT_OPTIONS = {
40
+ reuse_entries: true,
41
+ api_url: 'cdn.contentful.com'
42
+ }.freeze
43
+
44
+ # see https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/synchronization
45
+ DEFAULT_SYNC_OPTIONS = {
46
+ limit: 100,
47
+ type: 'all'
48
+ }.freeze
49
+
50
+ class << self
51
+ def configuration
52
+ @configuration ||= Configuration.new
53
+ end
54
+
55
+ def configure
56
+ yield configuration
57
+ end
58
+
59
+ def client
60
+ @client ||= Contentful::Client.new(Consyncful.configuration.client_options)
61
+ end
62
+ end
63
+ end
@@ -19,7 +19,7 @@ module Consyncful
19
19
  include Mongoid::Document
20
20
  include Hooks
21
21
 
22
- store_in client: -> { Consyncful.configuration.mongo_client }
22
+ store_in client: Consyncful.configuration.mongo_client.to_s
23
23
 
24
24
  define_hook :before_run
25
25
  define_hook :after_run
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Consyncful
4
- VERSION = '0.9.0'
4
+ VERSION = '1.0.0'
5
5
  end
data/lib/consyncful.rb CHANGED
@@ -3,67 +3,7 @@
3
3
  require 'consyncful/version'
4
4
  require 'mongoid'
5
5
  require 'contentful'
6
+ require 'consyncful/configuration'
6
7
  require 'consyncful/base'
7
8
  require 'consyncful/sync'
8
9
  require 'consyncful/railtie' if defined?(Rails)
9
-
10
- module Consyncful
11
- # Handles Rails configurations for Consynful
12
- class Configuration
13
- attr_accessor :contentful_client_options,
14
- :contentful_sync_options,
15
- :locale,
16
- :mongo_client,
17
- :mongo_collection,
18
- :content_tags,
19
- :ignore_content_tags,
20
- :preserve_contentful_timestamps
21
-
22
- def initialize
23
- @contentful_client_options = {}
24
- @contentful_sync_options = {}
25
- @locale = 'en-NZ'
26
- @mongo_client = :default
27
- @mongo_collection = 'contentful_models'
28
- @content_tags = []
29
- @ignore_content_tags = []
30
- @preserve_contentful_timestamps = false
31
- end
32
-
33
- def initial_sync_options
34
- options = { initial: true }
35
- options = options.reverse_merge(@contentful_sync_options)
36
- options.reverse_merge(DEFAULT_SYNC_OPTIONS)
37
- end
38
-
39
- def client_options
40
- options = @contentful_client_options
41
- options.reverse_merge!(DEFAULT_CLIENT_OPTIONS)
42
- end
43
- end
44
-
45
- DEFAULT_CLIENT_OPTIONS = {
46
- reuse_entries: true,
47
- api_url: 'cdn.contentful.com'
48
- }.freeze
49
-
50
- # see https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/synchronization
51
- DEFAULT_SYNC_OPTIONS = {
52
- limit: 100,
53
- type: 'all'
54
- }.freeze
55
-
56
- class << self
57
- def configuration
58
- @configuration ||= Configuration.new
59
- end
60
-
61
- def configure
62
- yield configuration
63
- end
64
-
65
- def client
66
- @client ||= Contentful::Client.new(Consyncful.configuration.client_options)
67
- end
68
- end
69
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consyncful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Anastasiadis-Gray
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-03 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -146,20 +146,14 @@ dependencies:
146
146
  name: mongoid
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: 7.0.2
152
- - - "<"
149
+ - - '='
153
150
  - !ruby/object:Gem::Version
154
151
  version: 9.0.0
155
152
  type: :runtime
156
153
  prerelease: false
157
154
  version_requirements: !ruby/object:Gem::Requirement
158
155
  requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- version: 7.0.2
162
- - - "<"
156
+ - - '='
163
157
  - !ruby/object:Gem::Version
164
158
  version: 9.0.0
165
159
  - !ruby/object:Gem::Dependency
@@ -201,6 +195,7 @@ files:
201
195
  - docker-compose.yml
202
196
  - lib/consyncful.rb
203
197
  - lib/consyncful/base.rb
198
+ - lib/consyncful/configuration.rb
204
199
  - lib/consyncful/item_mapper.rb
205
200
  - lib/consyncful/persisted_item.rb
206
201
  - lib/consyncful/railtie.rb