consyncful 0.9.0 → 1.0.1

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: 5fef048cde9fc6f6bccbb88e9d3cb474d72f09c09ebc0af29b8170061359392c
4
+ data.tar.gz: ef2b2ba5842d0e8f8b0413216099cd909d8558372aa63c7b830c1a3348fd0f7e
5
5
  SHA512:
6
- metadata.gz: 0cdcba4664eb12afb0b1a4ca1d6a8a302605d9334ec2342aa5f699d3e71926815e271f701f32fa7f2c3cc73f085fecbd4c4261dedf3b0300cd0641b195dceb47
7
- data.tar.gz: 7cb9d7289b6524c2e2ff95fe547fd2cbf6614601e2177aff275ce21ab9b467afdf039f4cfff566c2095bc3fce44b15020b7d0beaa7556b6c1312b384ac64833b
6
+ metadata.gz: 94710c404e50238924be677f99a2615aea6604c4ba9e9792d19c1db83dbd5d86ec8e51f14191ff804e797e69143d3b680247c05a67c4ba9f771fbd4007d145e1
7
+ data.tar.gz: 3e38a6ceb8a84db7b67bdf1c7a610f8bd4cf927bb6c4de0c915c673e65531ca21cb9cff87e546af993463e20cf32c9bb79b60e5996268a243058c6577ee9c1ea
@@ -12,13 +12,13 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  ruby:
15
- - 2.7.5
16
15
  - 3.0.3
17
16
  - 3.1.1
17
+ - 3.2.2
18
18
  mongodb:
19
- - 4.2
20
- - 4.4
21
19
  - 5.0
20
+ - 6.0
21
+ - 7.0
22
22
 
23
23
  name: Ruby ${{ matrix.ruby }} sample
24
24
 
data/Gemfile.lock CHANGED
@@ -1,81 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- consyncful (0.9.0)
4
+ consyncful (1.0.1)
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)
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.4)
14
+ activesupport (= 7.1.4)
15
+ activesupport (7.1.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
- addressable (2.8.1)
21
- public_suffix (>= 2.0.2, < 6.0)
25
+ addressable (2.8.7)
26
+ public_suffix (>= 2.0.2, < 7.0)
22
27
  ast (2.4.2)
23
- bson (4.15.0)
24
- concurrent-ruby (1.2.0)
25
- contentful (2.16.3)
26
- http (> 0.8, < 5.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)
33
+ contentful (2.17.1)
34
+ http (> 0.8, < 6.0)
27
35
  multi_json (~> 1)
28
36
  database_cleaner (1.8.3)
29
- diff-lcs (1.3)
30
- domain_name (0.5.20190701)
31
- unf (>= 0.0.5, < 1.0.0)
32
- ffi (1.15.5)
33
- ffi-compiler (1.0.1)
34
- ffi (>= 1.0.0)
37
+ diff-lcs (1.5.1)
38
+ domain_name (0.6.20240107)
39
+ drb (2.2.1)
40
+ ffi (1.17.0)
41
+ ffi-compiler (1.3.2)
42
+ ffi (>= 1.15.5)
35
43
  rake
36
44
  hooks (0.4.1)
37
45
  uber (~> 0.0.14)
38
- http (4.4.1)
39
- addressable (~> 2.3)
46
+ http (5.2.0)
47
+ addressable (~> 2.8)
48
+ base64 (~> 0.1)
40
49
  http-cookie (~> 1.0)
41
50
  http-form_data (~> 2.2)
42
- http-parser (~> 1.2.0)
43
- http-cookie (1.0.5)
51
+ llhttp-ffi (~> 0.5.0)
52
+ http-cookie (1.0.7)
44
53
  domain_name (~> 0.5)
45
54
  http-form_data (2.3.0)
46
- http-parser (1.2.3)
47
- ffi-compiler (>= 1.0, < 2.0)
48
- i18n (1.12.0)
55
+ i18n (1.14.6)
49
56
  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)
57
+ llhttp-ffi (0.5.0)
58
+ ffi-compiler (~> 1.0)
59
+ rake (~> 13.0)
60
+ minitest (5.25.1)
61
+ mongo (2.20.1)
62
+ bson (>= 4.14.1, < 6.0.0)
63
+ mongoid (9.0.1)
64
+ activemodel (>= 5.1, < 7.2, != 7.0.0)
65
+ concurrent-ruby (>= 1.0.5, < 2.0)
55
66
  mongo (>= 2.18.0, < 3.0.0)
56
- ruby2_keywords (~> 0.0.5)
57
67
  multi_json (1.15.0)
68
+ mutex_m (0.2.0)
58
69
  parallel (1.22.1)
59
70
  parser (3.1.2.0)
60
71
  ast (~> 2.4.1)
61
- public_suffix (5.0.1)
72
+ public_suffix (6.0.1)
62
73
  rainbow (3.1.1)
63
74
  rake (13.0.1)
64
75
  regexp_parser (2.3.1)
65
76
  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)
77
+ rspec (3.13.0)
78
+ rspec-core (~> 3.13.0)
79
+ rspec-expectations (~> 3.13.0)
80
+ rspec-mocks (~> 3.13.0)
81
+ rspec-core (3.13.0)
82
+ rspec-support (~> 3.13.0)
83
+ rspec-expectations (3.13.2)
73
84
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.9.0)
75
- rspec-mocks (3.9.1)
85
+ rspec-support (~> 3.13.0)
86
+ rspec-mocks (3.13.1)
76
87
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.9.0)
78
- rspec-support (3.9.2)
88
+ rspec-support (~> 3.13.0)
89
+ rspec-support (3.13.1)
79
90
  rubocop (1.28.2)
80
91
  parallel (~> 1.10)
81
92
  parser (>= 3.1.0.0)
@@ -92,13 +103,9 @@ GEM
92
103
  rubocop-rspec (2.10.0)
93
104
  rubocop (~> 1.19)
94
105
  ruby-progressbar (1.11.0)
95
- ruby2_keywords (0.0.5)
96
106
  tzinfo (2.0.6)
97
107
  concurrent-ruby (~> 1.0)
98
108
  uber (0.0.15)
99
- unf (0.1.4)
100
- unf_ext
101
- unf_ext (0.0.8.2)
102
109
  unicode-display_width (2.1.0)
103
110
 
104
111
  PLATFORMS
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'
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.1'
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.1
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-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -146,22 +146,16 @@ 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
- version: 9.0.0
151
+ version: '9'
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
- version: 9.0.0
158
+ version: '9'
165
159
  - !ruby/object:Gem::Dependency
166
160
  name: rainbow
167
161
  requirement: !ruby/object:Gem::Requirement
@@ -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