sibu_apidae 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6636c3fe57cff4cb5f72c57bb5e19cbb75fc96fd
4
- data.tar.gz: 66acecfc2f187acfd41963043d0ddff9665431fe
2
+ SHA256:
3
+ metadata.gz: 8983707bab687f21f501cfd22611c6e4c375c47537d6428001b793e2f2e3456b
4
+ data.tar.gz: 6f60119bf825b0ce4b670e6f5dd608970d309b6f65e0388ebe7ef3dfe04b7b0b
5
5
  SHA512:
6
- metadata.gz: a48d49ccaee693b05a3bc11d6f4010564e1276d6026aa7f3df261df5b9e4b0fd6c1ce582da921819fd0808d6504fef75f19920ba814d77f2ede7af0692b984b4
7
- data.tar.gz: 69bb86d22b1e1141f3c4841e191323b8190705ede3ab37d0905f371ba088105b311c22ee4fb6f2d5f63c96663a7e268574949b3d9915eccadd1e3ff42902f49b
6
+ metadata.gz: d8cc3d9b641c7cee2f6685dc32923cf190c0c969edd0533ba60885f7e36dc3a3356328a77ac9819be4843f537601c9e3b21eb1cc52278fbd11e78ed109c108ff
7
+ data.tar.gz: 58aa1dc46d89e0391d49fa693b8b11ba8ab230f76b6d4e64e43871009c7ce4f48d18725da123a430727ee0eca09b1fa0d8d1275a019a550f1354c219e243e7bd
data/Gemfile.lock CHANGED
@@ -1,129 +1,126 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sibu_apidae (0.2.0)
4
+ sibu_apidae (0.3.1)
5
5
  apidae
6
- sibu
6
+ sibu (~> 0.7)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.2.0)
12
- actionpack (= 5.2.0)
11
+ actioncable (5.1.6.1)
12
+ actionpack (= 5.1.6.1)
13
13
  nio4r (~> 2.0)
14
- websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.0)
16
- actionpack (= 5.2.0)
17
- actionview (= 5.2.0)
18
- activejob (= 5.2.0)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.1.6.1)
16
+ actionpack (= 5.1.6.1)
17
+ actionview (= 5.1.6.1)
18
+ activejob (= 5.1.6.1)
19
19
  mail (~> 2.5, >= 2.5.4)
20
20
  rails-dom-testing (~> 2.0)
21
- actionpack (5.2.0)
22
- actionview (= 5.2.0)
23
- activesupport (= 5.2.0)
21
+ actionpack (5.1.6.1)
22
+ actionview (= 5.1.6.1)
23
+ activesupport (= 5.1.6.1)
24
24
  rack (~> 2.0)
25
25
  rack-test (>= 0.6.3)
26
26
  rails-dom-testing (~> 2.0)
27
27
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.0)
29
- activesupport (= 5.2.0)
28
+ actionview (5.1.6.1)
29
+ activesupport (= 5.1.6.1)
30
30
  builder (~> 3.1)
31
31
  erubi (~> 1.4)
32
32
  rails-dom-testing (~> 2.0)
33
33
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.0)
35
- activesupport (= 5.2.0)
34
+ activejob (5.1.6.1)
35
+ activesupport (= 5.1.6.1)
36
36
  globalid (>= 0.3.6)
37
- activemodel (5.2.0)
38
- activesupport (= 5.2.0)
39
- activerecord (5.2.0)
40
- activemodel (= 5.2.0)
41
- activesupport (= 5.2.0)
42
- arel (>= 9.0)
43
- activestorage (5.2.0)
44
- actionpack (= 5.2.0)
45
- activerecord (= 5.2.0)
46
- marcel (~> 0.3.1)
47
- activesupport (5.2.0)
37
+ activemodel (5.1.6.1)
38
+ activesupport (= 5.1.6.1)
39
+ activerecord (5.1.6.1)
40
+ activemodel (= 5.1.6.1)
41
+ activesupport (= 5.1.6.1)
42
+ arel (~> 8.0)
43
+ activesupport (5.1.6.1)
48
44
  concurrent-ruby (~> 1.0, >= 1.0.2)
49
45
  i18n (>= 0.7, < 2)
50
46
  minitest (~> 5.1)
51
47
  tzinfo (~> 1.1)
52
- apidae (0.6.0)
48
+ addressable (2.6.0)
49
+ public_suffix (>= 2.0.2, < 4.0)
50
+ apidae (0.7.3)
53
51
  jbuilder
54
- pg (~> 0.2)
55
- rails (~> 5.1)
52
+ pg (~> 0.20)
53
+ rails (~> 5.1.6)
56
54
  rubyzip (~> 1.0)
57
- arel (9.0.0)
55
+ arel (8.0.0)
58
56
  builder (3.2.3)
59
- concurrent-ruby (1.0.5)
57
+ concurrent-ruby (1.1.4)
58
+ content_disposition (1.0.0)
60
59
  crass (1.0.4)
61
- down (4.5.0)
62
- erubi (1.7.1)
63
- ffi (1.9.25)
64
- globalid (0.4.1)
60
+ down (4.8.0)
61
+ addressable (~> 2.5)
62
+ erubi (1.8.0)
63
+ ffi (1.10.0)
64
+ globalid (0.4.2)
65
65
  activesupport (>= 4.2.0)
66
- i18n (1.1.0)
66
+ i18n (1.5.1)
67
67
  concurrent-ruby (~> 1.0)
68
68
  image_processing (0.11.2)
69
- jbuilder (2.7.0)
69
+ jbuilder (2.8.0)
70
70
  activesupport (>= 4.2.0)
71
71
  multi_json (>= 1.2)
72
72
  jquery-rails (4.3.3)
73
73
  rails-dom-testing (>= 1, < 3)
74
74
  railties (>= 4.2.0)
75
75
  thor (>= 0.14, < 2.0)
76
- loofah (2.2.2)
76
+ loofah (2.2.3)
77
77
  crass (~> 1.0.2)
78
78
  nokogiri (>= 1.5.9)
79
- mail (2.7.0)
79
+ mail (2.7.1)
80
80
  mini_mime (>= 0.1.1)
81
- marcel (0.3.2)
82
- mimemagic (~> 0.3.2)
83
- method_source (0.9.0)
84
- mimemagic (0.3.2)
85
- mini_magick (4.8.0)
81
+ method_source (0.9.2)
82
+ mini_magick (4.9.2)
86
83
  mini_mime (1.0.1)
87
- mini_portile2 (2.3.0)
84
+ mini_portile2 (2.4.0)
88
85
  minitest (5.8.5)
89
86
  multi_json (1.13.1)
90
87
  nio4r (2.3.1)
91
- nokogiri (1.8.4)
92
- mini_portile2 (~> 2.3.0)
88
+ nokogiri (1.10.0)
89
+ mini_portile2 (~> 2.4.0)
93
90
  pg (0.21.0)
94
- rack (2.0.5)
91
+ public_suffix (3.0.3)
92
+ rack (2.0.6)
95
93
  rack-test (1.1.0)
96
94
  rack (>= 1.0, < 3)
97
- rails (5.2.0)
98
- actioncable (= 5.2.0)
99
- actionmailer (= 5.2.0)
100
- actionpack (= 5.2.0)
101
- actionview (= 5.2.0)
102
- activejob (= 5.2.0)
103
- activemodel (= 5.2.0)
104
- activerecord (= 5.2.0)
105
- activestorage (= 5.2.0)
106
- activesupport (= 5.2.0)
95
+ rails (5.1.6.1)
96
+ actioncable (= 5.1.6.1)
97
+ actionmailer (= 5.1.6.1)
98
+ actionpack (= 5.1.6.1)
99
+ actionview (= 5.1.6.1)
100
+ activejob (= 5.1.6.1)
101
+ activemodel (= 5.1.6.1)
102
+ activerecord (= 5.1.6.1)
103
+ activesupport (= 5.1.6.1)
107
104
  bundler (>= 1.3.0)
108
- railties (= 5.2.0)
105
+ railties (= 5.1.6.1)
109
106
  sprockets-rails (>= 2.0.0)
110
107
  rails-dom-testing (2.0.3)
111
108
  activesupport (>= 4.2.0)
112
109
  nokogiri (>= 1.6)
113
110
  rails-html-sanitizer (1.0.4)
114
111
  loofah (~> 2.2, >= 2.2.2)
115
- railties (5.2.0)
116
- actionpack (= 5.2.0)
117
- activesupport (= 5.2.0)
112
+ railties (5.1.6.1)
113
+ actionpack (= 5.1.6.1)
114
+ activesupport (= 5.1.6.1)
118
115
  method_source
119
116
  rake (>= 0.8.7)
120
117
  thor (>= 0.18.1, < 2.0)
121
118
  rake (10.4.2)
122
119
  rb-fsevent (0.10.3)
123
- rb-inotify (0.9.10)
124
- ffi (>= 0.5.0, < 2)
120
+ rb-inotify (0.10.0)
121
+ ffi (~> 1.0)
125
122
  rubyzip (1.2.2)
126
- sass (3.5.7)
123
+ sass (3.7.3)
127
124
  sass-listen (~> 4.0.0)
128
125
  sass-listen (4.0.0)
129
126
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -134,14 +131,15 @@ GEM
134
131
  sprockets (>= 2.8, < 4.0)
135
132
  sprockets-rails (>= 2.0, < 4.0)
136
133
  tilt (>= 1.1, < 3)
137
- shrine (2.12.0)
134
+ shrine (2.15.0)
135
+ content_disposition (~> 1.0)
138
136
  down (~> 4.1)
139
- sibu (0.4.0)
137
+ sibu (0.7.3)
140
138
  image_processing (~> 0.4)
141
139
  jquery-rails (~> 4.3)
142
140
  mini_magick (~> 4.3)
143
141
  pg (~> 0.2)
144
- rails (~> 5.1)
142
+ rails (~> 5.1.6)
145
143
  sass-rails (~> 5.0)
146
144
  shrine (~> 2.8)
147
145
  sprockets (3.7.2)
@@ -151,12 +149,12 @@ GEM
151
149
  actionpack (>= 4.0)
152
150
  activesupport (>= 4.0)
153
151
  sprockets (>= 3.0.0)
154
- thor (0.20.0)
152
+ thor (0.20.3)
155
153
  thread_safe (0.3.6)
156
- tilt (2.0.8)
154
+ tilt (2.0.9)
157
155
  tzinfo (1.2.5)
158
156
  thread_safe (~> 0.1)
159
- websocket-driver (0.7.0)
157
+ websocket-driver (0.6.5)
160
158
  websocket-extensions (>= 0.1.0)
161
159
  websocket-extensions (0.1.3)
162
160
 
@@ -1,3 +1,3 @@
1
1
  module SibuApidae
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
data/lib/sibu_apidae.rb CHANGED
@@ -33,11 +33,13 @@ module SibuApidae
33
33
 
34
34
  APIDAE_OBJ_SOURCE = 'Fiche Apidae'
35
35
 
36
- def self.update_pages(site_id)
36
+ def self.update_pages(site_id, obj_apidae_id = nil)
37
37
  conf = Rails.application.config.sibu_apidae
38
38
  if is_valid?(conf)
39
- Sibu::Page.where(site_id: site_id).select(:id, :site_id, :name, :path, :metadata).to_a
40
- .select {|p| p.source == APIDAE_OBJ_SOURCE}.each do |p|
39
+ apidae_pages = Sibu::Page.where(site_id: site_id).where("metadata LIKE '%\"source\":\"#{APIDAE_OBJ_SOURCE}\"%'")
40
+ .select(:id, :site_id, :metadata).to_a
41
+ apidae_pages = apidae_pages.select {|p| p.external_id == obj_apidae_id} unless obj_apidae_id.blank?
42
+ apidae_pages.each do |p|
41
43
  obj = Apidae::Obj.find_by_apidae_id(p.external_id)
42
44
  if obj
43
45
  p.update(name: obj.title, title: obj.title, description: obj.short_desc,
@@ -47,25 +49,31 @@ module SibuApidae
47
49
  p.destroy
48
50
  end
49
51
  end
52
+ Rails.logger.info("Completed sibu pages update/delete for site #{site_id}")
50
53
 
51
- Apidae::Obj.all.each do |obj|
54
+ apidae_pages = Sibu::Page.where(site_id: site_id).where("metadata LIKE '%\"source\":\"#{APIDAE_OBJ_SOURCE}\"%'")
55
+ .select(:id, :site_id, :metadata).to_a
56
+ apidae_pages = apidae_pages.select {|p| p.external_id == obj_apidae_id} unless obj_apidae_id.blank?
57
+
58
+ objs = obj_apidae_id.blank? ? Apidae::Obj.all : Apidae::Obj.where(apidae_id: obj_apidae_id)
59
+ objs.each do |obj|
52
60
  if conf[:supported_types].include?(obj.apidae_type)
53
- obj_page = Sibu::Page.where(site_id: site_id).select(:id, :metadata).to_a
54
- .find {|p| p.source == APIDAE_OBJ_SOURCE && p.external_id == obj.apidae_id}
61
+ obj_page = apidae_pages.find {|p| p.external_id == obj.apidae_id}
55
62
  unless obj_page
56
63
  p = Sibu::Page.new(name: obj.title, site_id: site_id, path: conf[:obj_path].call(obj), title: obj.title,
57
64
  description: obj.short_desc, source: APIDAE_OBJ_SOURCE,
58
65
  external_id: conf[:page_external_id].call(obj))
59
- p.sections = conf[:obj_sections].call(obj)
66
+ p.sections = conf[:obj_sections].call(obj, site_id)
60
67
  p.save!
61
68
  end
62
69
  end
63
70
  end
71
+ Rails.logger.info("Completed sibu pages creation for site #{site_id}")
64
72
  else
65
73
  Rails.logger.error "Please provide a valid configuration for the sibu_apidae gem " +
66
74
  "(:page_external_id, :obj_path, :obj_sections and :supported_types are required)"
67
75
  end
68
- 'SibuApidae pages update complete'
76
+ "SibuApidae pages update complete for site #{site_id}"
69
77
  end
70
78
 
71
79
  def self.is_valid?(conf)
data/sibu_apidae.gemspec CHANGED
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "minitest", "~> 5.0"
29
29
  spec.add_dependency "apidae"
30
- spec.add_dependency "sibu", "~> 0.7.2"
30
+ spec.add_dependency "sibu", "~> 0.7"
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibu_apidae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-01-21 00:00:00.000000000 Z
12
+ date: 2023-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: 0.7.2
76
+ version: '0.7'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: 0.7.2
83
+ version: '0.7'
84
84
  description: A set of utility classes for use with the Sibu and Apidae engines
85
85
  email:
86
86
  - jbvilain@gmail.com
@@ -119,8 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.6.13
122
+ rubygems_version: 3.1.6
124
123
  signing_key:
125
124
  specification_version: 4
126
125
  summary: A set of utility classes for use with the Sibu and Apidae engines