relaton-3gpp 1.9.0 → 1.9.4

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: 2cb4d367d6487eb29deffcb0805e874e089ee23b296879ab64e0d0697e3d29f4
4
- data.tar.gz: 520706a92250b455c31e8ed63def3573da3c67d8d7329c027186e5ab66330cbc
3
+ metadata.gz: ac55b70bfe3aeba203ee14ae5741da783295480690d95cbcde5633464d7e2c6f
4
+ data.tar.gz: a1e1b8cdef4a740ef07311f180e2be6ee31419696acf14031b53418364ef9325
5
5
  SHA512:
6
- metadata.gz: 0350b940358a6fe6793e6c18361a61befd891b7efa814d73c88fd612123b174f7ffea185ccfdd65711873a3f75697108c60a15d85446a2d8091bf3f1c97c377a
7
- data.tar.gz: e0a8e4c26623f84b997862ebc3c66c0f2c665dfea62cef07d0db8601431b0340d2778b782ee730d6cf248411b6056f7f5073be7823580bd7e60072ce79137b91
6
+ metadata.gz: f5c76b9d2ea3aeb99cac24f01ebb5759e66c9f094d81fe8d776db9c37250535b20b54abf754da38ab865571019fafc4b6f2d9a5a223a2763d4ce8ec680509233
7
+ data.tar.gz: d66f5472441b417a1491211b9ebb00112f0b3408ba3edd6c1d7fdc1fe9d20305b6d17e8b5e89990c5953994856889b14f9fbea85b4bf4897ba809c9243a1fe5a
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
12
12
  Gemfile.lock
13
13
  .vscode/
14
+ .rspec_status
@@ -52,8 +52,9 @@ module Relaton3gpp
52
52
  specs = dbs["Specs_GSM+3G"]
53
53
  specrels = dbs["Specs_GSM+3G_release-info"]
54
54
  releases = dbs["Releases"]
55
+ tstatus = dbs["temp-status"]
55
56
  dbs["2001-04-25_schedule"].each do |row|
56
- fetch_doc row, specs, specrels, releases
57
+ fetch_doc row, specs, specrels, releases, tstatus
57
58
  end
58
59
  File.write CURRENT, @current.to_yaml, encoding: "UTF-8"
59
60
  end
@@ -63,18 +64,25 @@ module Relaton3gpp
63
64
  #
64
65
  # @return [String] file name
65
66
  #
66
- def get_file # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
67
+ def get_file # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
67
68
  @current = YAML.load_file CURRENT if File.exist? CURRENT
68
69
  @current ||= {}
69
- ftp = Net::FTP.new("www.3gpp.org")
70
- ftp.resume = true
71
- ftp.login
72
- ftp.chdir "/Information/Databases/Spec_Status/"
73
- d, t, _, file = ftp.list("*.zip").first.split
74
- dt = DateTime.strptime("#{d} #{t}", "%m-%d-%y %I:%M%p")
75
- return if file == @current["file"] && dt == DateTime.parse(@current["date"])
70
+ n = 0
71
+ begin
72
+ ftp = Net::FTP.new("www.3gpp.org")
73
+ ftp.resume = true
74
+ ftp.login
75
+ ftp.chdir "/Information/Databases/Spec_Status/"
76
+ d, t, _, file = ftp.list("*.zip").first.split
77
+ dt = DateTime.strptime("#{d} #{t}", "%m-%d-%y %I:%M%p")
78
+ return if file == @current["file"] && dt == DateTime.parse(@current["date"])
76
79
 
77
- ftp.getbinaryfile file
80
+ ftp.getbinaryfile file
81
+ rescue Net::ReadTimeout => e
82
+ n += 1
83
+ retry if n < 5
84
+ raise e
85
+ end
78
86
  @current["file"] = file
79
87
  @current["date"] = dt.to_s
80
88
  file
@@ -84,12 +92,15 @@ module Relaton3gpp
84
92
  # Fetch document
85
93
  #
86
94
  # @param [Hash] row row from mdb
87
- # @param [Mdb] dbs mdb
95
+ # @param [Array<Hash>] specs specs
96
+ # @param [Array<Hash>] specrels specrels
97
+ # @param [Array<Hash>] releases releases
98
+ # @param [Array<Hash>] tstatus tstatus
88
99
  #
89
100
  # @return [Relaton3gpp::BibliographicItem, nil] bibliographic item
90
101
  #
91
- def fetch_doc(row, specs, specrels, releases)
92
- doc = Parser.parse row, specs, specrels, releases
102
+ def fetch_doc(row, specs, specrels, releases, tstatus)
103
+ doc = Parser.parse row, specs, specrels, releases, tstatus
93
104
  save_doc doc
94
105
  rescue StandardError => e
95
106
  warn "Error: #{e.message}"
@@ -7,8 +7,9 @@ module Relaton3gpp
7
7
  # @param [Array<Hash>] specrels Spec + Release table
8
8
  # @param [Array<Hash>] relaeases Releases table
9
9
  # @param [Array<Hash>] specs Specs table
10
+ # @param [Array<Hash>] tstatus temp status-table
10
11
  #
11
- def initialize(row, specs, specrels, releases) # rubocop:disable Metrics/AbcSize
12
+ def initialize(row, specs, specrels, releases, tstatus) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
12
13
  @row = row
13
14
  @spec = specs.detect { |s| s[:Number] == row[:spec] }
14
15
  if @spec
@@ -17,6 +18,7 @@ module Relaton3gpp
17
18
  end
18
19
  @rel = releases.detect { |r| r[:Release_code] == row[:release] }
19
20
  end
21
+ @tstatus = tstatus.detect { |t| t[:Number] == row[:spec] }
20
22
  end
21
23
 
22
24
  #
@@ -26,11 +28,12 @@ module Relaton3gpp
26
28
  # @param [Array<Hash>] specrels Spec + Release table
27
29
  # @param [Array<Hash>] relaeases Releases table
28
30
  # @param [Array<Hash>] specs Specs table
31
+ # @param [Array<Hash>] tstatus temp status-table
29
32
  #
30
33
  # @return [RelatonBib:BibliographicItem, nil] bibliographic item
31
34
  #
32
- def self.parse(row, specs, specrels, relaeases)
33
- new(row, specs, specrels, relaeases).parse
35
+ def self.parse(row, specs, specrels, relaeases, tstatus)
36
+ new(row, specs, specrels, relaeases, tstatus).parse
34
37
  end
35
38
 
36
39
  #
@@ -60,7 +63,7 @@ module Relaton3gpp
60
63
  common_ims_spec: @spec[:ComIMS] == "1",
61
64
  # internal: @spec[:"For publication"] == "0",
62
65
  release: parse_release,
63
- # contributor: contributor,
66
+ contributor: parse_contributor,
64
67
  )
65
68
  end
66
69
 
@@ -103,11 +106,7 @@ module Relaton3gpp
103
106
  # @return [Arra<RelatonBib::DocumentIdentifier>] docidentifier
104
107
  #
105
108
  def parse_docid
106
- [
107
- RelatonBib::DocumentIdentifier.new(type: "3GPP", id: "3GPP #{number}"),
108
- RelatonBib::DocumentIdentifier.new(type: "rapporteurId",
109
- id: @spec[:"rapporteur id"]),
110
- ]
109
+ [RelatonBib::DocumentIdentifier.new(type: "3GPP", id: "3GPP #{number}")]
111
110
  end
112
111
 
113
112
  #
@@ -151,20 +150,22 @@ module Relaton3gpp
151
150
  #
152
151
  # @return [RelatonBib::EditorialGroup] editorialgroups
153
152
  #
154
- def parse_editorialgroup # rubocop:disable Metrics/MethodLength
155
- wgp = RelatonBib::WorkGroup.new(name: @spec[:"WG prime"], type: "prime")
156
- eg = [RelatonBib::TechnicalCommittee.new(wgp)]
157
- if @spec[:"WG other"]
158
- wgo = RelatonBib::WorkGroup.new(name: @spec[:"WG other"], type: "other")
159
- eg << RelatonBib::TechnicalCommittee.new(wgo)
153
+ def parse_editorialgroup # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
154
+ eg = [create_workgroup(@spec[:"WG prime"], "prime")]
155
+ if @spec[:"WG other"] && @spec[:"WG other"] != "-"
156
+ eg << create_workgroup(@spec[:"WG other"], "other")
160
157
  end
161
158
  if @spec[:"former WG"]
162
- wgf = RelatonBib::WorkGroup.new(name: @spec[:"former WG"], type: "former")
163
- eg << RelatonBib::TechnicalCommittee.new(wgf)
159
+ eg << create_workgroup(@spec[:"former WG"], "former")
164
160
  end
165
161
  RelatonBib::EditorialGroup.new eg
166
162
  end
167
163
 
164
+ def create_workgroup(name, type)
165
+ wgf = RelatonBib::WorkGroup.new(name: name, type: type)
166
+ RelatonBib::TechnicalCommittee.new(wgf)
167
+ end
168
+
168
169
  #
169
170
  # Parse note
170
171
  #
@@ -172,10 +173,10 @@ module Relaton3gpp
172
173
  #
173
174
  def parse_note
174
175
  n = []
175
- if @specrel && @specrel[:remarks]
176
+ if @specrel && @specrel[:remarks] && @specrel[:remarks] != "."
176
177
  n << RelatonBib::BiblioNote.new(type: "remark", content: @specrel[:remarks])
177
178
  end
178
- if @row[:comment]
179
+ if @row[:comment] && @row[:comment] != "."
179
180
  n << RelatonBib::BiblioNote.new(type: "comment", content: @row[:comment])
180
181
  end
181
182
  RelatonBib::BiblioNoteCollection.new n
@@ -207,38 +208,50 @@ module Relaton3gpp
207
208
  end
208
209
  end
209
210
 
211
+ #
212
+ # Parse release
213
+ #
214
+ # @return [Relaton3gpp::Release, nil] release
215
+ #
210
216
  def parse_release # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
211
217
  if @rel
212
218
  project_start = Date.parse(@rel[:"rel-proj-start"]).to_s if @rel[:"rel-proj-start"]
213
219
  project_end = Date.parse(@rel[:"rel-proj-end"]).to_s if @rel[:"rel-proj-end"]
220
+ Release.new(
221
+ version2g: @rel[:version_2g],
222
+ version3g: @rel[:version_3g],
223
+ defunct: @rel[:defunct] == "1",
224
+ wpm_code_2g: @rel[:wpm_code_2g],
225
+ wpm_code_3g: @rel[:wpm_code_3g],
226
+ freeze_meeting: @rel[:"freeze meeting"],
227
+ freeze_stage1_meeting: @rel[:Stage1_freeze],
228
+ freeze_stage2_meeting: @rel[:Stage2_freeze],
229
+ freeze_stage3_meeting: @rel[:Stage3_freeze],
230
+ close_meeting: @rel[:Closed],
231
+ project_start: project_start,
232
+ project_end: project_end,
233
+ )
214
234
  end
215
- Release.new(
216
- version2g: @rel[:version_2g],
217
- version3g: @rel[:version_3g],
218
- defunct: @rel[:defunct] == "1",
219
- wpm_code_2g: @rel[:wpm_code_2g],
220
- wpm_code_3g: @rel[:wpm_code_3g],
221
- freeze_meeting: @rel[:"freeze meeting"],
222
- freeze_stage1_meeting: @rel[:Stage1_freeze],
223
- freeze_stage2_meeting: @rel[:Stage2_freeze],
224
- freeze_stage3_meeting: @rel[:Stage3_freeze],
225
- close_meeting: @rel[:Closed],
226
- project_start: project_start,
227
- project_end: project_end,
228
- )
229
235
  end
230
236
 
231
237
  #
232
238
  # Create contributor
233
239
  #
234
- # @return [Array<RelatonBib::Contribution>] contributor
240
+ # @return [Array<RelatonBib::ContributionInfo>] contributor
235
241
  #
236
- # def contributor
237
- # org = RelatonBib::Organization.new(
238
- # name: "Internet Assigned Numbers Authority", abbreviation: "IANA",
239
- # )
240
- # role = { type: "publisher" }
241
- # [RelatonBib::ContributionInfo.new(entity: org, role: [role])]
242
- # end
242
+ def parse_contributor # rubocop:disable Metrics/MethodLength
243
+ return [] unless @tstatus && @tstatus[:rapporteur]
244
+
245
+ aff = []
246
+ if @tstatus[:"rapp org"]
247
+ org = RelatonBib::Organization.new(name: @tstatus[:"rapp org"])
248
+ cn = RelatonBib::LocalizedString.new @tstatus[:rapporteur], "en", "Latn"
249
+ name = RelatonBib::FullName.new(completename: cn)
250
+ aff << RelatonBib::Affiliation.new(organization: org)
251
+ end
252
+ person = RelatonBib::Person.new(name: name, affiliation: aff)
253
+ role = { type: "author" }
254
+ [RelatonBib::ContributionInfo.new(entity: person, role: [role])]
255
+ end
243
256
  end
244
257
  end
@@ -39,7 +39,7 @@ module Relaton3gpp
39
39
  builder.release do
40
40
  builder.version2G @version2g if @version2g
41
41
  builder.version3G @version3g if @version3g
42
- builder.defunct @defunct if @defunct
42
+ builder.defunct @defunct unless @defunct.nil?
43
43
  builder.send "wpm-code-2G", @wpm_code_2g if @wpm_code_2g
44
44
  builder.send "wpm-code-3G", @wpm_code_3g if @wpm_code_3g
45
45
  builder.send "freeze-meeting", @freeze_meeting if @freeze_meeting
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Relaton3gpp
4
- VERSION = "1.9.0"
4
+ VERSION = "1.9.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-3gpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-12 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml