nist-pubid 0.1.3 → 0.1.7

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: 48d1d54a6499cb679c33cfa2a7cc2a682b6b41e9c66aab0c301375c5df28e3f3
4
- data.tar.gz: 64fa186792b6564f8afc4f2388f4e2859b04dbcdca5f7cd00e40b192c7f9fc4a
3
+ metadata.gz: 1f6379a8019bfb88a5197b581ff3e479f76e4bc9d3c5c7305b8875c88aee54de
4
+ data.tar.gz: 8f6be1a669a2f215b846360fd7d475872a0ae084ba39b251e1a264636c2afc8c
5
5
  SHA512:
6
- metadata.gz: 25197a16bbaa8b4799d0279cf19303de616da1e34452997df576be22cb459aa3b00f538af680d9fa37330d6c7358587d56173ab2bc10f57755774537185c205e
7
- data.tar.gz: 3e6ae4db9939f1f415ae56ec5aba095a41706157143740a6412d78b560cf850854a779104b22edbc278234fc657ed3289aaf1ab832ef909d58b9d465ec86170b
6
+ metadata.gz: a3f46dfe0b0123faccd91f54133870800da21671b1487858e4121187eb15785d567303ab1e3883e6dc4f94e40b4b54ac8900745987c0c8c6ac79b4b6a8c294c8
7
+ data.tar.gz: 87c323d372da641c4d1ba4c1a8c7c7b7c15324b1a84ca8b31ca419b6debfe611f924d73f7299184ce55abf1f90a9b35baeedd62354f55b8319024975c9f9eac1
@@ -16,7 +16,7 @@ jobs:
16
16
  release:
17
17
  runs-on: ubuntu-18.04
18
18
  steps:
19
- - uses: actions/checkout@v1
19
+ - uses: actions/checkout@v2
20
20
 
21
21
  - uses: ruby/setup-ruby@v1
22
22
  with:
data/README.adoc CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  NIST publications are numbered according to an identification scheme.
6
6
 
7
- This gem implements a mechanism to parse and utilize NIST publication identifers
7
+ This gem implements a mechanism to parse and utilize NIST publication identifiers
8
8
  provided in the https://github.com/usnistgov/NIST-Tech-Pubs[NIST-Tech-Pubs]
9
9
  repository.
10
10
 
@@ -296,9 +296,10 @@ A "Part" can also be indicated by an appended alphabetic character to the end.
296
296
  | Section | Sec. | `sec`
297
297
  | Supplement | Suppl. | `sup`
298
298
  | Index | Index | `indx`
299
- | Addendum | Add. | `add` (TBD with NIST)
299
+ | Addendum | Add. | `add` (TBC with NIST)
300
300
  | Insert | Ins. | `ins` (TBC with NIST)
301
301
  | Errata | Err. | `err` (TBC with NIST)
302
+ | Appendix | App. | `app` (TBC with NIST)
302
303
 
303
304
  |===
304
305
 
data/exe/nist-pubid ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+ require_relative "../lib/nist_pubid"
6
+ require "thor"
7
+ require "csv"
8
+
9
+ class NistPubidCLI < Thor
10
+ desc "report", "Create report for NIST Tech Pubs database (fetches from GitHub)"
11
+ option :csv, type: :boolean, desc: "Export to CSV format"
12
+ def report
13
+ heading = %w(
14
+ ID\ changed?
15
+ New\ PubID
16
+ Document\ ID
17
+ DOI\ changed?
18
+ New\ PubID-MR
19
+ DOI
20
+ Title
21
+ )
22
+ if options[:csv]
23
+ puts heading.to_csv
24
+
25
+ NistPubid::NistTechPubs.status.each do |doc|
26
+ puts [
27
+ doc[:finalPubId] == doc[:id] ? false : true,
28
+ doc[:finalPubId],
29
+ doc[:id],
30
+ doc[:mr] == doc[:doi] ? false : true,
31
+ doc[:mr],
32
+ doc[:doi],
33
+ doc[:title]
34
+ ].to_csv
35
+ end
36
+ else
37
+ puts heading.join(' | ')
38
+
39
+ NistPubid::NistTechPubs.status.each do |doc|
40
+ puts [
41
+ doc[:finalPubId] == doc[:id] ? ' -' : '✅',
42
+ doc[:finalPubId],
43
+ doc[:id],
44
+ doc[:mr] == doc[:doi] ? ' -' : '✅',
45
+ doc[:mr],
46
+ doc[:doi],
47
+ doc[:title]
48
+ ].join(' | ')
49
+ end
50
+ end
51
+ end
52
+
53
+ desc "convert", "Convert legacy NIST Tech Pubs ID to NIST PubID"
54
+ option :style, aliases: "-s", type: :string,
55
+ desc: "Convert to PubID style (short|long|mr|abbrev)",
56
+ default: "short"
57
+ option :format, aliases: "-f", type: :string,
58
+ desc: "Render in format (json|string)",
59
+ default: "string"
60
+ def convert(code)
61
+ unless %w[mr long short abbrev].include?(options[:style].downcase)
62
+ raise "Invalid PubID style"
63
+ end
64
+
65
+ raise "Invalid render format" unless %w[string json].include? options[:format].downcase
66
+
67
+ unless code.empty?
68
+ if options[:format] == "string"
69
+ puts NistPubid::Document.parse(code).to_s(options[:style].to_sym)
70
+ else
71
+ puts NistPubid::Document.parse(code).to_json
72
+ end
73
+ end
74
+ rescue NistPubid::Errors::ParseError
75
+ puts "[Error] This does not seem to be a valid NIST Tech Pubs legacy identifier"
76
+ end
77
+ end
78
+
79
+ NistPubidCLI.start(ARGV)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require "json"
2
3
 
3
4
  REVISION_DESC = {
4
5
  long: ", Revision ",
@@ -35,10 +36,54 @@ EDITION_DESC = {
35
36
  mr: "e",
36
37
  }.freeze
37
38
 
39
+ SUPPLEMENT_DESC = {
40
+ long: " Supplement ",
41
+ abbrev: " Suppl. ",
42
+ short: "sup",
43
+ mr: "sup",
44
+ }.freeze
45
+
46
+ SECTION_DESC = {
47
+ long: " Section ",
48
+ abbrev: " Sec. ",
49
+ short: "sec",
50
+ mr: "sec",
51
+ }.freeze
52
+
53
+ APPENDIX_DESC = {
54
+ long: " Appendix ",
55
+ abbrev: " App. ",
56
+ short: "app",
57
+ mr: "app",
58
+ }.freeze
59
+
60
+ ERRATA_DESC = {
61
+ long: " Errata ",
62
+ abbrev: " Err. ",
63
+ short: "err",
64
+ mr: "err",
65
+ }.freeze
66
+
67
+ INDEX_DESC = {
68
+ long: " Index ",
69
+ abbrev: " Index. ",
70
+ short: "indx",
71
+ mr: "indx",
72
+ }.freeze
73
+
74
+ INSERT_DESC = {
75
+ long: " Insert ",
76
+ abbrev: " Ins. ",
77
+ short: "ins",
78
+ mr: "ins",
79
+ }.freeze
80
+
38
81
  module NistPubid
39
82
  class Document
40
83
  attr_accessor :serie, :code, :revision, :publisher, :version, :volume,
41
- :part, :addendum, :stage, :translation, :update, :edition
84
+ :part, :addendum, :stage, :translation, :update_number,
85
+ :edition, :supplement, :update_year, :section, :appendix,
86
+ :errata, :index, :insert
42
87
 
43
88
  def initialize(publisher:, serie:, docnumber:, **opts)
44
89
  @publisher = Publisher.new(publisher: publisher)
@@ -47,37 +92,143 @@ module NistPubid
47
92
  opts.each { |key, value| send("#{key}=", value) }
48
93
  end
49
94
 
95
+ # returns weight based on amount of defined attributes
96
+ def weight
97
+ instance_variables.inject(0) do |sum, var|
98
+ sum + (instance_variable_get(var).nil? ? 0 : 1)
99
+ end
100
+ end
101
+
102
+ def merge(document)
103
+ instance_variables.each do |var|
104
+ val = document.instance_variable_get(var)
105
+ instance_variable_set(var, val) unless val.nil?
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ def self.update_old_code(code)
112
+ code = code.gsub("FIPS", "FIPS PUB") unless code.include?("FIPS PUB")
113
+ code.gsub("NBS MONO", "NBS MN").gsub("NIST MONO", "NIST MN")
114
+ .gsub("NIST MP", "NBS MP")
115
+ .gsub("NIST SP 304a-2017", "NIST SP 304A-2017")
116
+ .gsub("NIST SP 260-162 2006ed.", "NIST SP 260-162e2006")
117
+ .gsub("NBS CIRC 154suprev", "NBS CIRC 154r1sup")
118
+ .gsub("NIST SP 260-126 rev 2013", "NIST SP 260-126r2013")
119
+ .gsub("NIST CSWP", "NIST CSRC White Paper")
120
+ .gsub("NIST.CSWP.01162020pt", "NIST.CSWP.01162020(por)")
121
+ .gsub(/(?<=NBS MP )(\d+)\((\d+)\)/, '\1e\2')
122
+ .gsub(/(?<=\d)es/, "(spa)")
123
+ .gsub(/(?<=\d)chi/, "(zho)")
124
+ .gsub(/(?<=\d)viet/, "(vie)")
125
+ .gsub(/(?<=\d)port/, "(por)")
126
+ # .gsub(/^LCIRC/, "NBS LC")
127
+ end
128
+
50
129
  def self.parse(code)
130
+ code = update_old_code(code)
51
131
  matches = {
52
132
  publisher: match(Publisher.regexp, code) || "NIST",
53
- serie: match(Serie.regexp, code)&.gsub(/\./, " "),
133
+ serie: match(Serie.regexp, code),
54
134
  stage: Stage.parse(code),
55
- docnumber: match(/(?<=\.|\s)[0-9-]{3,}[A-Z]?/, code),
56
- part: /(?<=(\.))?pt(?(1)-)([A-Z\d]+)/.match(code)&.[](2),
57
- volume: /(?<=(\.))?v(?(1)-)(\d+)/.match(code)&.[](2),
58
- version: match(/(?<=(\.))?ver(?(1)[-\d]|[.\d])+/, code)&.gsub(/-/, "."),
59
- revision: /(?<=[^a-z])(?<=(\.))?(?:r(?(1)-)|Rev\.\s)(\d+)/
60
- .match(code)&.[](2),
61
- addendum: match(/(?<=(\.))?(add(?(1)-)\d+|Addendum)/, code),
62
- update: match(/(?<=Upd\s)([\d:]+)/, code),
63
- edition: /(?<=[^a-z])(?<=(\.))?(?:e(?(1)-)|Ed\.\s)(\d+)/
135
+ part: /(?<=(\.))?(?<![a-z])+(?:pt|Pt|p)(?(1)-)([A-Z\d]+)/.match(code)
136
+ &.[](2),
137
+ version:
138
+ /(?<=\.)?(?:(?:ver)((?(1)[-\d]|[.\d])+|\d+)|(?:v)(\d+\.[.\d]+))/
139
+ .match(code).to_a[1..-1]&.compact&.first&.gsub(/-/, "."),
140
+ revision: /[\da](?:r|Rev\.\s|([0-9]+[A-Za-z]*-[0-9]+[A-Za-z]*-))([\da]+)/
64
141
  .match(code)&.[](2),
142
+ addendum: match(/(?<=(\.))?(add(?:-\d+)?|Addendum)/, code),
143
+ edition: /(?<=[^a-z])(?<=\.)?(?:e(?(1)-)|Ed\.\s)(\d+)|
144
+ NBS\sFIPS\sPUB\s[0-9]+[A-Za-z]*-[0-9]+[A-Za-z]*-([A-Za-z\d]+)
145
+ /x.match(code)&.captures&.join,
146
+ section: /(?<=sec)\d+/.match(code)&.to_s,
147
+ appendix: /\d+app/.match(code)&.to_s,
148
+ errata: /-errata|\d+err(?:ata)?/.match(code)&.to_s,
149
+ index: /\d+index|\d+indx/.match(code)&.to_s,
150
+ insert: /\d+ins(?:ert)?/.match(code)&.to_s
65
151
  }
66
- code = code.gsub(matches[:stage].original_code, "") unless matches[:stage].nil?
152
+ supplement = /(?:(?:supp?)-?(\d*)|Supplement|Suppl.)/
153
+ .match(code)
154
+ unless supplement.nil?
155
+ matches[:supplement] = supplement[1].nil? ? "" : supplement[1]
156
+ end
157
+
158
+ update = code.scan(/((?<=Upd)\s?[\d:]+|-upd)-?(\d*)/).first
159
+
160
+ (matches[:update_number], matches[:update_year]) = update if update
161
+
162
+ unless matches[:serie]
163
+ raise Errors::ParseError.new("failed to parse serie for #{code}")
164
+ end
165
+
166
+ unless matches[:stage].nil?
167
+ code = code.gsub(matches[:stage].original_code, "")
168
+ end
169
+
170
+ unless ["NBS CSM", "NBS CS"].include?(matches[:serie])
171
+ matches[:volume] = /(?<=(\.))?v(?(1)-)(\d+)(?!\.\d+)/.match(code)&.[](2)
172
+ end
173
+
174
+ matches[:revision] = nil if matches[:addendum]
175
+
176
+ matches[:docnumber] = parse_docnumber(matches[:serie], code)
177
+
178
+ matches[:serie] = SERIES["mr"].invert[matches[:serie]] || matches[:serie]
179
+ # matches[:serie].gsub!(/\./, " ")
67
180
  matches[:translation] = match(/(?<=\()\w{3}(?=\))/, code)
68
181
 
69
182
  new(**matches)
70
183
  end
71
184
 
185
+ def self.parse_docnumber(serie, code)
186
+ localities = "[Pp]t\\d+|r(?:\\d+|[A-Za-z]?)|e\\d+|p|v|sec\\d+|inde?x|err(?:ata)?|ins(?:ert)?"
187
+ excluded_parts = "(?!#{localities}|supp?)"
188
+
189
+ if ["NBS CSM", "NBS CS"].include?(serie)
190
+ docnumber = /v(\d+)n(\d+)/.match(code).to_a[1..-1]&.join("-")
191
+ else
192
+ # match docnumbers with localities in the first part, like NBS CIRC 11e2-1915
193
+ docnumber =
194
+ /(?:#{serie.gsub(" ", "\s|\.")})(?:\s|\.)?([0-9]+)(?:#{localities})(-[0-9]+)?/
195
+ .match(code)&.captures&.join
196
+
197
+ docnumber ||=
198
+ /(?:#{serie.gsub(" ", "\s|\.")})(?:\s|\.)? # match serie
199
+ ([0-9]+ # first part of report number
200
+ (?:#{excluded_parts}[A-Za-z]+)? # with letter but without localities
201
+ (?:-m)? # for NBS CRPL 4-m-5
202
+ (?:-[A-Za]+)? # for NIST SP 1075-NCNR, NIST SP 1113-BFRL, NIST IR 6529-a
203
+ (?:-[0-9.]+)? # second part
204
+ (?:
205
+ (?: # only big letter
206
+ (#{excluded_parts}[A-Z]|(?![a-z]))+|#{excluded_parts}[a-z]?|#{excluded_parts}[a-z]+
207
+ )? # or small letter but without localities
208
+ )
209
+ )/x
210
+ .match(code)&.[](1)&.upcase
211
+ end
212
+
213
+ unless docnumber
214
+ raise Errors::ParseError.new(
215
+ "failed to parse document identifier for #{code}",
216
+ )
217
+ end
218
+
219
+ docnumber
220
+ end
221
+
72
222
  def self.match(regex, code)
73
223
  regex.match(code)&.to_s
74
224
  end
75
225
 
76
- def to_s(format)
226
+ def to_s(format = :short)
77
227
  result = render_serie(format)
78
228
  result += " " unless format == :short || stage.nil?
79
229
  result += "#{stage&.to_s(format)}"\
80
230
  " #{code}#{render_part(format)}#{render_edition(format)}"\
231
+ "#{render_localities(format)}"\
81
232
  "#{render_update(format)}#{render_translation(format)}"
82
233
  result = render_addendum(result, format)
83
234
 
@@ -86,14 +237,32 @@ module NistPubid
86
237
  result
87
238
  end
88
239
 
240
+ def to_json(*args)
241
+ result = {
242
+ styles: {
243
+ short: to_s(:short),
244
+ abbrev: to_s(:abbrev),
245
+ long: to_s(:long),
246
+ mr: to_s(:mr),
247
+ }
248
+ }
249
+
250
+ instance_variables.each do |var|
251
+ val = instance_variable_get(var)
252
+ result[var.to_s.gsub('@', '')] = val unless val.nil?
253
+ end
254
+ result.to_json(*args)
255
+ end
256
+
89
257
  def render_serie(format)
90
- return serie.to_s(format) if %i[mr short].include?(format)
258
+ if serie.to_s(format).include?(publisher.to_s(format))
259
+ return serie.to_s(format)
260
+ end
91
261
 
92
262
  "#{publisher.to_s(format)} #{serie.to_s(format)}"
93
263
  end
94
264
 
95
265
  def render_part(format)
96
- # TODO: Section, Supplement, Index, Insert, Errata
97
266
  result = ""
98
267
  result += "#{VOLUME_DESC[format]}#{volume}" unless volume.nil?
99
268
  result += "#{PART_DESC[format]}#{part}" unless part.nil?
@@ -102,24 +271,44 @@ module NistPubid
102
271
 
103
272
  def render_edition(format)
104
273
  result = ""
105
- result += "#{REVISION_DESC[format]}#{revision}" unless revision.nil?
274
+
275
+ result += "#{REVISION_DESC[format]}#{revision.to_s.upcase}" if revision
106
276
  result += "#{VERSION_DESC[format]}#{version}" unless version.nil?
107
277
  result += "#{EDITION_DESC[format]}#{edition}" unless edition.nil?
108
278
  result
109
279
  end
110
280
 
281
+ def render_localities(format)
282
+ result = ""
283
+ result += "#{SUPPLEMENT_DESC[format]}#{supplement}" unless supplement.nil?
284
+ result += "#{SECTION_DESC[format]}#{section}" unless section.nil?
285
+ result += "#{APPENDIX_DESC[format]}" unless appendix.nil?
286
+ result += "#{ERRATA_DESC[format]}" unless errata.nil?
287
+ result += INDEX_DESC[format] unless index.nil?
288
+ result += INSERT_DESC[format] unless insert.nil?
289
+
290
+ result
291
+ end
292
+
111
293
  def render_update(format)
112
- return "" if update.nil?
294
+ return "" if update_year.nil?
295
+
296
+ if update_number.match?(/\d+/)
297
+ update_text = update_number
298
+ update_text += "-#{update_year}" if update_year
299
+ else
300
+ update_text = "1"
301
+ end
113
302
 
114
303
  case format
115
304
  when :long
116
- " Update #{update}"
305
+ " Update #{update_text}"
117
306
  when :abbrev
118
- " Upd. #{update}"
307
+ " Upd. #{update_text}"
119
308
  when :short
120
- "/Upd #{update}"
309
+ "/Upd#{update_text}"
121
310
  when :mr
122
- ".u#{update.gsub(":", "-")}"
311
+ ".u#{update_text}"
123
312
  end
124
313
  end
125
314
 
@@ -0,0 +1,5 @@
1
+ module NistPubid
2
+ module Errors
3
+ class ParseError < StandardError; end
4
+ end
5
+ end
@@ -0,0 +1,104 @@
1
+ require "relaton_nist/data_fetcher"
2
+ require "nokogiri"
3
+ require "open-uri"
4
+
5
+ module NistPubid
6
+ class NistTechPubs
7
+ URL = "https://raw.githubusercontent.com/usnistgov/NIST-Tech-Pubs/nist-pages/xml/allrecords.xml".freeze
8
+
9
+ @converted_id = @converted_doi = {}
10
+
11
+ class << self
12
+
13
+ attr_accessor :documents, :converted_id, :converted_doi
14
+
15
+ def fetch
16
+ @documents ||= Nokogiri::XML(URI.open(URL))
17
+ .xpath("/body/query/doi_record/report-paper/report-paper_metadata")
18
+ .map { |doc| parse_docid doc }
19
+ rescue StandardError => e
20
+ warn e.message
21
+ []
22
+ end
23
+
24
+ def convert(doc)
25
+ id = @converted_id[doc[:id]] ||= NistPubid::Document.parse(doc[:id])
26
+ return id unless doc.key?(:doi)
27
+
28
+ begin
29
+ doi = @converted_doi[doc[:doi]] ||=
30
+ NistPubid::Document.parse(doc[:doi])
31
+ rescue Errors::ParseError
32
+ return id
33
+ end
34
+ # return more complete pubid
35
+ id.merge(doi)
36
+ rescue Errors::ParseError
37
+ @converted_doi[doc[:doi]] ||= NistPubid::Document.parse(doc[:doi])
38
+ end
39
+
40
+ def parse_docid(doc)
41
+ id = doc.at("publisher_item/item_number", "publisher_item/identifier")
42
+ .text.sub(%r{^/}, "")
43
+ doi = doc.at("doi_data/doi").text.gsub("10.6028/", "")
44
+ title = doc.at("titles/title").text
45
+ title += " #{doc.at('titles/subtitle').text}" if doc.at("titles/subtitle")
46
+ case doi
47
+ when "10.6028/NBS.CIRC.12e2revjune" then id.sub!("13e", "12e")
48
+ when "10.6028/NBS.CIRC.36e2" then id.sub!("46e", "36e")
49
+ when "10.6028/NBS.HB.67suppJune1967" then id.sub!("1965", "1967")
50
+ when "10.6028/NBS.HB.105-1r1990" then id.sub!("105-1-1990", "105-1r1990")
51
+ when "10.6028/NIST.HB.150-10-1995" then id.sub!(/150-10$/, "150-10-1995")
52
+ end
53
+
54
+ { id: id, doi: doi, title: title }
55
+ end
56
+
57
+ def comply_with_pubid
58
+ fetch.select do |doc|
59
+ convert(doc).to_s == doc[:id]
60
+ rescue Errors::ParseError
61
+ false
62
+ end
63
+ end
64
+
65
+ def different_with_pubid
66
+ fetch.reject do |doc|
67
+ convert(doc).to_s == doc[:id]
68
+ rescue Errors::ParseError
69
+ true
70
+ end
71
+ end
72
+
73
+ def parse_fail_with_pubid
74
+ fetch.select do |doc|
75
+ convert(doc).to_s && false
76
+ rescue Errors::ParseError
77
+ true
78
+ end
79
+ end
80
+
81
+ # returning current document id, doi, title and final PubID
82
+ def status
83
+ fetch.map do |doc|
84
+ final_doc = convert(doc)
85
+ {
86
+ id: doc[:id],
87
+ doi: doc[:doi],
88
+ title: doc[:title],
89
+ finalPubId: final_doc.to_s,
90
+ mr: final_doc.to_s(:mr),
91
+ }
92
+ rescue Errors::ParseError
93
+ {
94
+ id: doc[:id],
95
+ doi: doc[:doi],
96
+ title: doc[:title],
97
+ finalPubId: "parse error",
98
+ mr: "parse_error"
99
+ }
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -9,7 +9,7 @@ module NistPubid
9
9
  @publisher = publisher
10
10
  end
11
11
 
12
- def to_s(format)
12
+ def to_s(format = :short)
13
13
  return @publisher if %i[short mr].include?(format)
14
14
 
15
15
  PUBLISHERS[format.to_s][@publisher]
@@ -8,7 +8,7 @@ module NistPubid
8
8
  @serie = serie == "NISTIR" ? "NIST IR" : serie
9
9
  end
10
10
 
11
- def to_s(format)
11
+ def to_s(format = :short)
12
12
  return @serie if %i[short mr].include?(format)
13
13
 
14
14
  result = SERIES[format.to_s][@serie]
@@ -18,7 +18,9 @@ module NistPubid
18
18
  end
19
19
 
20
20
  def self.regexp
21
- /(#{(SERIES["long"].keys + SERIES["mr"].values + ["NISTIR"]).join('|')})(?=\.|\s|\()/
21
+ /(#{(SERIES["long"].keys + SERIES["mr"].values
22
+ .map { |v| v.gsub(".", '\.') } + ["NISTIR"])
23
+ .sort_by(&:length).reverse.join('|')})/
22
24
  end
23
25
  end
24
26
  end
@@ -1,3 +1,3 @@
1
1
  module NistPubid
2
- VERSION = "0.1.3".freeze
2
+ VERSION = "0.1.7".freeze
3
3
  end
data/lib/nist_pubid.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yaml"
4
- require "nist_pubid/document"
5
- require "nist_pubid/publisher"
6
- require "nist_pubid/serie"
7
- require "nist_pubid/stage"
4
+ require_relative "nist_pubid/document"
5
+ require_relative "nist_pubid/publisher"
6
+ require_relative "nist_pubid/serie"
7
+ require_relative "nist_pubid/stage"
8
+ require_relative "nist_pubid/errors"
9
+ require_relative "nist_pubid/nist_tech_pubs"
data/nist_pubid.gemspec CHANGED
@@ -28,4 +28,10 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency "vcr"
32
+ spec.add_development_dependency "webmock"
33
+
34
+ spec.add_dependency "relaton-nist"
35
+ spec.add_dependency "nokogiri"
36
+ spec.add_dependency "thor"
31
37
  end
data/series.yaml CHANGED
@@ -87,7 +87,7 @@ mr:
87
87
  NBS BH: NBS.BH
88
88
  NBS CRPL: NBS.CRPL
89
89
  NBS CRPL-F-A: NBS.CRPL-F-A
90
- NBS CRPL-F-B: NBS CRPL-F-B245
90
+ NBS CRPL-F-B: NBS CRPL-F-B
91
91
  NBS IP: NBS.IP
92
92
  NBS CIRC: NBS.CIRC
93
93
  NBS CIS: NBS.CIS
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nist-pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.7
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-09 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,10 +38,81 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: relaton-nist
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: thor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
41
111
  description: Library to generate, parse and manipulate NIST PubID.
42
112
  email:
43
113
  - open.source@ribose.com
44
- executables: []
114
+ executables:
115
+ - nist-pubid
45
116
  extensions: []
46
117
  extra_rdoc_files:
47
118
  - README.adoc
@@ -55,8 +126,11 @@ files:
55
126
  - LICENSE.txt
56
127
  - README.adoc
57
128
  - Rakefile
129
+ - exe/nist-pubid
58
130
  - lib/nist_pubid.rb
59
131
  - lib/nist_pubid/document.rb
132
+ - lib/nist_pubid/errors.rb
133
+ - lib/nist_pubid/nist_tech_pubs.rb
60
134
  - lib/nist_pubid/publisher.rb
61
135
  - lib/nist_pubid/serie.rb
62
136
  - lib/nist_pubid/stage.rb
@@ -84,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
158
  - !ruby/object:Gem::Version
85
159
  version: '0'
86
160
  requirements: []
87
- rubygems_version: 3.1.4
161
+ rubygems_version: 3.3.3
88
162
  signing_key:
89
163
  specification_version: 4
90
164
  summary: Library to generate, parse and manipulate NIST PubID.