consyncful 0.3.0 → 0.3.1
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 +4 -4
- data/Gemfile.lock +21 -19
- data/consyncful.gemspec +3 -2
- data/lib/consyncful/stats.rb +3 -2
- data/lib/consyncful/sync.rb +6 -10
- data/lib/consyncful/tasks/consyncful.rake +2 -2
- data/lib/consyncful/version.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ad64a565666dba235e4ab3592caabd69a05d04ef5a798a96cfe67c00bfe0d91
|
|
4
|
+
data.tar.gz: 882c439d6764c88771721fa3b250579d9ee512f3ed1ac3f67b9fe89a2699e311
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5915c7aa97a89b138110c7eed85524777cb9f9fd68841ecea6b4761e0479b006dcb8ec52a58d7e0e4c747f9fea8af0cfbe87708afe6b580eb68aa6830a63c32
|
|
7
|
+
data.tar.gz: 56d5f2bd09235fbe3144851e39fc8cd9ae7ab7d0d71f1ed5b03791b60386b588b64d5c2f899f38127c2fbe815fa00563634ab0db98550aa7384c54586451860b
|
data/Gemfile.lock
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
consyncful (0.
|
|
4
|
+
consyncful (0.3.0)
|
|
5
5
|
contentful (>= 2.11.1, < 3.0.0)
|
|
6
6
|
mongoid (>= 7.0.2, < 8.0.0)
|
|
7
|
-
|
|
7
|
+
rainbow
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
activemodel (5.2.
|
|
13
|
-
activesupport (= 5.2.
|
|
14
|
-
activesupport (5.2.
|
|
12
|
+
activemodel (5.2.3)
|
|
13
|
+
activesupport (= 5.2.3)
|
|
14
|
+
activesupport (5.2.3)
|
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
16
16
|
i18n (>= 0.7, < 2)
|
|
17
17
|
minitest (~> 5.1)
|
|
18
18
|
tzinfo (~> 1.1)
|
|
19
19
|
addressable (2.6.0)
|
|
20
20
|
public_suffix (>= 2.0.2, < 4.0)
|
|
21
|
-
bson (4.
|
|
22
|
-
concurrent-ruby (1.1.
|
|
23
|
-
contentful (2.
|
|
24
|
-
http (> 0.8, <
|
|
21
|
+
bson (4.5.0)
|
|
22
|
+
concurrent-ruby (1.1.5)
|
|
23
|
+
contentful (2.13.0)
|
|
24
|
+
http (> 0.8, < 5.0)
|
|
25
25
|
multi_json (~> 1)
|
|
26
|
+
database_cleaner (1.7.0)
|
|
26
27
|
diff-lcs (1.3)
|
|
27
28
|
domain_name (0.5.20180417)
|
|
28
29
|
unf (>= 0.0.5, < 1.0.0)
|
|
29
|
-
http (
|
|
30
|
+
http (4.1.1)
|
|
30
31
|
addressable (~> 2.3)
|
|
31
32
|
http-cookie (~> 1.0)
|
|
32
33
|
http-form_data (~> 2.0)
|
|
@@ -35,16 +36,17 @@ GEM
|
|
|
35
36
|
domain_name (~> 0.5)
|
|
36
37
|
http-form_data (2.1.1)
|
|
37
38
|
http_parser.rb (0.6.0)
|
|
38
|
-
i18n (1.
|
|
39
|
+
i18n (1.6.0)
|
|
39
40
|
concurrent-ruby (~> 1.0)
|
|
40
41
|
minitest (5.11.3)
|
|
41
|
-
mongo (2.
|
|
42
|
+
mongo (2.9.0)
|
|
42
43
|
bson (>= 4.4.2, < 5.0.0)
|
|
43
|
-
mongoid (7.0.
|
|
44
|
+
mongoid (7.0.4)
|
|
44
45
|
activemodel (>= 5.1, < 6.0.0)
|
|
45
46
|
mongo (>= 2.5.1, < 3.0.0)
|
|
46
47
|
multi_json (1.13.1)
|
|
47
|
-
public_suffix (3.
|
|
48
|
+
public_suffix (3.1.1)
|
|
49
|
+
rainbow (3.0.0)
|
|
48
50
|
rake (10.5.0)
|
|
49
51
|
rspec (3.8.0)
|
|
50
52
|
rspec-core (~> 3.8.0)
|
|
@@ -59,22 +61,22 @@ GEM
|
|
|
59
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
60
62
|
rspec-support (~> 3.8.0)
|
|
61
63
|
rspec-support (3.8.0)
|
|
62
|
-
term-ansicolor (1.7.1)
|
|
63
|
-
tins (~> 1.0)
|
|
64
64
|
thread_safe (0.3.6)
|
|
65
|
-
tins (1.20.2)
|
|
66
65
|
tzinfo (1.2.5)
|
|
67
66
|
thread_safe (~> 0.1)
|
|
68
67
|
unf (0.1.4)
|
|
69
68
|
unf_ext
|
|
70
|
-
unf_ext (0.0.7.
|
|
69
|
+
unf_ext (0.0.7.6)
|
|
71
70
|
|
|
72
71
|
PLATFORMS
|
|
73
72
|
ruby
|
|
74
73
|
|
|
75
74
|
DEPENDENCIES
|
|
76
|
-
bundler (~>
|
|
75
|
+
bundler (~> 2)
|
|
77
76
|
consyncful!
|
|
77
|
+
database_cleaner
|
|
78
78
|
rake (~> 10.0)
|
|
79
79
|
rspec (~> 3.0)
|
|
80
80
|
|
|
81
|
+
BUNDLED WITH
|
|
82
|
+
2.0.2
|
data/consyncful.gemspec
CHANGED
|
@@ -30,11 +30,12 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
31
|
spec.require_paths = ['lib']
|
|
32
32
|
|
|
33
|
-
spec.add_development_dependency 'bundler', '~>
|
|
33
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
|
34
34
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
35
35
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
36
|
+
spec.add_development_dependency 'database_cleaner'
|
|
36
37
|
|
|
37
38
|
spec.add_dependency 'contentful', ['>=2.11.1', '<3.0.0']
|
|
38
39
|
spec.add_dependency 'mongoid', ['>=7.0.2', '<8.0.0']
|
|
39
|
-
spec.add_dependency '
|
|
40
|
+
spec.add_dependency 'rainbow'
|
|
40
41
|
end
|
data/lib/consyncful/stats.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
require 'rainbow'
|
|
2
3
|
|
|
3
4
|
module Consyncful
|
|
4
5
|
class Stats
|
|
@@ -23,9 +24,9 @@ module Consyncful
|
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def print_stats
|
|
26
|
-
puts "Added: #{@stats[:records_added]}, \
|
|
27
|
+
puts Rainbow("Added: #{@stats[:records_added]}, \
|
|
27
28
|
updated: #{@stats[:records_updated]}, \
|
|
28
|
-
deleted: #{@stats[:records_deleted]}".blue
|
|
29
|
+
deleted: #{@stats[:records_deleted]}").blue
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
end
|
data/lib/consyncful/sync.rb
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'rainbow'
|
|
4
4
|
require 'consyncful/item_mapper'
|
|
5
5
|
require 'consyncful/stats'
|
|
6
6
|
|
|
7
|
-
class String
|
|
8
|
-
include Term::ANSIColor
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
module Consyncful
|
|
12
8
|
class Sync
|
|
13
9
|
include Mongoid::Document
|
|
@@ -28,7 +24,7 @@ module Consyncful
|
|
|
28
24
|
|
|
29
25
|
def drop_stale
|
|
30
26
|
stale = Base.where(:sync_id.ne => id, :sync_id.exists => true)
|
|
31
|
-
puts "Dropping #{stale.count} records that haven't been touched in this sync".red
|
|
27
|
+
puts Rainbow("Dropping #{stale.count} records that haven't been touched in this sync").red
|
|
32
28
|
stale.destroy
|
|
33
29
|
end
|
|
34
30
|
|
|
@@ -58,10 +54,10 @@ module Consyncful
|
|
|
58
54
|
|
|
59
55
|
def start_sync
|
|
60
56
|
if next_url.present?
|
|
61
|
-
puts "Starting update, last update: #{last_run_at} (#{(Time.current - last_run_at).round(3)}s ago)".blue
|
|
57
|
+
puts Rainbow("Starting update, last update: #{last_run_at} (#{(Time.current - last_run_at).round(3)}s ago)").blue
|
|
62
58
|
Consyncful.client.sync(next_url)
|
|
63
59
|
else
|
|
64
|
-
puts 'Starting full refresh'.blue
|
|
60
|
+
puts Rainbow('Starting full refresh').blue
|
|
65
61
|
Consyncful.client.sync(initial: true)
|
|
66
62
|
end
|
|
67
63
|
end
|
|
@@ -75,7 +71,7 @@ module Consyncful
|
|
|
75
71
|
end
|
|
76
72
|
|
|
77
73
|
def sync_item(item, stats)
|
|
78
|
-
puts "syncing: #{item.id}".yellow
|
|
74
|
+
puts Rainbow("syncing: #{item.id}").yellow
|
|
79
75
|
if item.deletion?
|
|
80
76
|
delete_model(item.id, stats)
|
|
81
77
|
else
|
|
@@ -87,7 +83,7 @@ module Consyncful
|
|
|
87
83
|
Base.find_by(id: id).destroy
|
|
88
84
|
stats.record_deleted
|
|
89
85
|
rescue Mongoid::Errors::DocumentNotFound
|
|
90
|
-
puts "Deleted record not found: #{id}".yellow
|
|
86
|
+
puts Rainbow("Deleted record not found: #{id}").yellow
|
|
91
87
|
nil
|
|
92
88
|
end
|
|
93
89
|
|
|
@@ -20,9 +20,9 @@ namespace :consyncful do
|
|
|
20
20
|
|
|
21
21
|
task update_model_names: [:environment] do
|
|
22
22
|
Rails.application.eager_load!
|
|
23
|
-
puts 'Updating model names:'.blue
|
|
23
|
+
puts Rainbow('Updating model names:').blue
|
|
24
24
|
Consyncful::Base.model_map.each do |contentful_name, constant|
|
|
25
|
-
puts "#{contentful_name}: #{constant}".yellow
|
|
25
|
+
puts Rainbow("#{contentful_name}: #{constant}").yellow
|
|
26
26
|
Consyncful::Base.where(contentful_type: contentful_name).update_all(_type: constant.to_s)
|
|
27
27
|
end
|
|
28
28
|
Consyncful::Base.where(:contentful_type.nin => Consyncful::Base.model_map.keys).update_all(_type: 'Consyncful::Base')
|
data/lib/consyncful/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: consyncful
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Anastasiadis-Gray
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2019-07-
|
|
12
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '
|
|
20
|
+
version: '2'
|
|
21
21
|
type: :development
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '
|
|
27
|
+
version: '2'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: rake
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,6 +53,20 @@ dependencies:
|
|
|
53
53
|
- - "~>"
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '3.0'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: database_cleaner
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
56
70
|
- !ruby/object:Gem::Dependency
|
|
57
71
|
name: contentful
|
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,7 +108,7 @@ dependencies:
|
|
|
94
108
|
- !ruby/object:Gem::Version
|
|
95
109
|
version: 8.0.0
|
|
96
110
|
- !ruby/object:Gem::Dependency
|
|
97
|
-
name:
|
|
111
|
+
name: rainbow
|
|
98
112
|
requirement: !ruby/object:Gem::Requirement
|
|
99
113
|
requirements:
|
|
100
114
|
- - ">="
|