relaton-3gpp 1.14.2 → 1.14.3
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/README.adoc +2 -1
- data/lib/relaton_3gpp/data_fetcher.rb +15 -8
- data/lib/relaton_3gpp/processor.rb +4 -4
- data/lib/relaton_3gpp/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e8d98ffac2c963fb2b403b0db8d549218150a7a23cb13ed17fd65604287fd54
|
4
|
+
data.tar.gz: dafdb6e3178f868bf6b25cf1cb8fc250a4e92d694a18d7d9396b3f6df1088402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c8bc6c6460f8e11670d03abcf4d67be9855cbe46cb1770847f02e0a0674600b8dcfba2b444ae9c7a5ae7d2f58b11d6b1435a3fb80a218a327dea7967d7686d
|
7
|
+
data.tar.gz: 6bbf146a6e1b27e47e0340f50835dff409a22c647b6e63ade2c5dbc3d9ed6da326fa3b06e736d29f3dcd94d1e9bb7939d52d1fdd3ce0f34350103b3bd99911d5
|
data/README.adoc
CHANGED
@@ -132,12 +132,13 @@ There is a 3GPP dataset ftp://www.3gpp.org/Information/Databases/Spec_Status/[la
|
|
132
132
|
The method `Relaton3GPP::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the dataset and save them to the `./data` folder in YAML format.
|
133
133
|
Arguments:
|
134
134
|
|
135
|
+
- `source` - a data source name. Possible values are: `status-smg-3GPP` and `status-smg-3GPP-force`. The first one only downloads a dataset if it's updated. The second one forces this gem to download the latest dataset.
|
135
136
|
- `output` - folder to save documents (default './data').
|
136
137
|
- `format` - a format in which the documents are saved. Possible formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
|
137
138
|
|
138
139
|
[source,ruby]
|
139
140
|
----
|
140
|
-
Relaton3GPP::DataFetcher.fetch output: "data", format: "yaml"
|
141
|
+
Relaton3GPP::DataFetcher.fetch "status-smg-3GPP" output: "data", format: "yaml"
|
141
142
|
Started at: 2021-12-10 19:58:46 +0100
|
142
143
|
Stopped at: 2021-12-10 20:08:03 +0100
|
143
144
|
Done in: 557 sec.
|
@@ -22,14 +22,15 @@ module Relaton3gpp
|
|
22
22
|
#
|
23
23
|
# Initialize fetcher and run fetch
|
24
24
|
#
|
25
|
+
# @param [Strin] source source name
|
25
26
|
# @param [Strin] output directory to save files, default: "data"
|
26
27
|
# @param [Strin] format format of output files (xml, yaml, bibxml), default: yaml
|
27
28
|
#
|
28
|
-
def self.fetch(output: "data", format: "yaml")
|
29
|
+
def self.fetch(source, output: "data", format: "yaml")
|
29
30
|
t1 = Time.now
|
30
31
|
puts "Started at: #{t1}"
|
31
32
|
FileUtils.mkdir_p output
|
32
|
-
new(output, format).fetch
|
33
|
+
new(output, format).fetch(source == "status-smg-3GPP-force")
|
33
34
|
t2 = Time.now
|
34
35
|
puts "Stopped at: #{t2}"
|
35
36
|
puts "Done in: #{(t2 - t1).round} sec."
|
@@ -38,8 +39,10 @@ module Relaton3gpp
|
|
38
39
|
#
|
39
40
|
# Parse documents
|
40
41
|
#
|
41
|
-
|
42
|
-
|
42
|
+
# @param [Boolean] renewal force to update all documents
|
43
|
+
#
|
44
|
+
def fetch(renewal) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
45
|
+
file = get_file renewal
|
43
46
|
return unless file
|
44
47
|
|
45
48
|
Zip::File.open(file) do |zip_file|
|
@@ -53,7 +56,7 @@ module Relaton3gpp
|
|
53
56
|
specrels = dbs["Specs_GSM+3G_release-info"]
|
54
57
|
releases = dbs["Releases"]
|
55
58
|
tstatus = dbs["temp-status"]
|
56
|
-
FileUtils.rm_f File.join(@output, "/*") if dbs["2001-04-25_schedule"].any?
|
59
|
+
FileUtils.rm_f File.join(@output, "/*") if renewal && dbs["2001-04-25_schedule"].any?
|
57
60
|
dbs["2001-04-25_schedule"].each do |row|
|
58
61
|
fetch_doc row, specs, specrels, releases, tstatus
|
59
62
|
end
|
@@ -63,9 +66,11 @@ module Relaton3gpp
|
|
63
66
|
#
|
64
67
|
# Get file from FTP
|
65
68
|
#
|
69
|
+
# @param [Boolean] renewal force to update all documents
|
70
|
+
#
|
66
71
|
# @return [String] file name
|
67
72
|
#
|
68
|
-
def get_file # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
|
73
|
+
def get_file(renewal) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
69
74
|
@current = YAML.load_file CURRENT if File.exist? CURRENT
|
70
75
|
@current ||= {}
|
71
76
|
n = 0
|
@@ -75,8 +80,10 @@ module Relaton3gpp
|
|
75
80
|
ftp.login
|
76
81
|
ftp.chdir "/Information/Databases/Spec_Status/"
|
77
82
|
d, t, _, file = ftp.list("*.zip").first.split
|
78
|
-
|
79
|
-
|
83
|
+
unless renewal
|
84
|
+
dt = DateTime.strptime("#{d} #{t}", "%m-%d-%y %I:%M%p")
|
85
|
+
return if file == @current["file"] && dt == DateTime.parse(@current["date"])
|
86
|
+
end
|
80
87
|
|
81
88
|
ftp.getbinaryfile file
|
82
89
|
rescue Net::ReadTimeout => e
|
@@ -9,7 +9,7 @@ module Relaton3gpp
|
|
9
9
|
@prefix = "3GPP"
|
10
10
|
@defaultprefix = %r{^3GPP\s}
|
11
11
|
@idtype = "3GPP"
|
12
|
-
@datasets = %w[status-smg-3GPP]
|
12
|
+
@datasets = %w[status-smg-3GPP status-smg-3GPP-force]
|
13
13
|
end
|
14
14
|
|
15
15
|
# @param code [String]
|
@@ -23,13 +23,13 @@ module Relaton3gpp
|
|
23
23
|
#
|
24
24
|
# Fetch all the documents from http://xml2rfc.tools.ietf.org/public/rfc/bibxml-3gpp-new/
|
25
25
|
#
|
26
|
-
# @param [String]
|
26
|
+
# @param [String] source source name
|
27
27
|
# @param [Hash] opts
|
28
28
|
# @option opts [String] :output directory to output documents
|
29
29
|
# @option opts [String] :format
|
30
30
|
#
|
31
|
-
def fetch_data(
|
32
|
-
DataFetcher.fetch(**opts)
|
31
|
+
def fetch_data(source, opts)
|
32
|
+
DataFetcher.fetch(source, **opts)
|
33
33
|
end
|
34
34
|
|
35
35
|
# @param xml [String]
|
data/lib/relaton_3gpp/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-3gpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-12-06 00:00:00.000000000 Z
|
@@ -218,7 +218,7 @@ licenses:
|
|
218
218
|
- BSD-2-Clause
|
219
219
|
metadata:
|
220
220
|
homepage_uri: https://github.com/relaton/relaton-iana
|
221
|
-
post_install_message:
|
221
|
+
post_install_message:
|
222
222
|
rdoc_options: []
|
223
223
|
require_paths:
|
224
224
|
- lib
|
@@ -233,8 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
- !ruby/object:Gem::Version
|
234
234
|
version: '0'
|
235
235
|
requirements: []
|
236
|
-
rubygems_version: 3.
|
237
|
-
signing_key:
|
236
|
+
rubygems_version: 3.1.6
|
237
|
+
signing_key:
|
238
238
|
specification_version: 4
|
239
239
|
summary: 'RelatonIana: Ruby XMLDOC impementation.'
|
240
240
|
test_files: []
|