nist-pubid 0.1.1 → 0.1.5

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: 95b5276baaa0fa40ff0f83f3e5def09f571328cef45c7dfb43c76de42da80313
4
- data.tar.gz: b12d0f41be03994096d50e3a8132c15736137210fde2e96788086c50b677fbdf
3
+ metadata.gz: 818a96e99a2e198ef626234c1b175c310104708a84198439e327e7c0bccfec8e
4
+ data.tar.gz: c2da763a9a97d5735b0d39641417f89f622620b10aa6f871f25acc4c8cf5850d
5
5
  SHA512:
6
- metadata.gz: c6a61d374eabd7e8ab5e8aa67cc7c62735ccf0c15e60697f2f8e0fe5e07d503cfed45b0265d79e633857458c8d0ed4d87ad77276e08846c8feb9a4ef3e48d3b7
7
- data.tar.gz: 8d320e322a4b9e4ed7e0dda53aa15aef7e9cb70d34cbb5ad90741d2c8cd1101bc76f618cda823ceadb9fe29b5707d7c60dbe3c8727a5a801e90490d5468b066b
6
+ metadata.gz: df7f8caaa70c6ebf7bdd4ff2e4506cac98180fe87037a2959baae6b98b7bc394ff7906a9d37e4d4420026078b263e1a8200e02c42c02e0fc2701f0cf007c027b
7
+ data.tar.gz: 7b21b01c0fbeef957e28b7a68c541c6cc7cf4e4de2eaae446493705bfa91c7a1c4bcf2ffcf0d7d0d960d0b04aa7ec5295d3f461e81dbf9b2096606d880be62d2
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -0,0 +1,46 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+ workflow_dispatch:
8
+ inputs:
9
+ next_version:
10
+ description: |
11
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
12
+ required: true
13
+ default: 'skip'
14
+
15
+ jobs:
16
+ release:
17
+ runs-on: ubuntu-18.04
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '2.6'
24
+ bundler-cache: true
25
+
26
+ - run: bundle exec rake
27
+
28
+ - run: gem install gem-release
29
+
30
+ - run: |
31
+ git config user.name github-actions
32
+ git config user.email github-actions@github.com
33
+ - if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip'
34
+ run: gem bump --version ${{ github.event.inputs.next_version }} --tag --push
35
+
36
+ - name: Publish to rubygems.org
37
+ env:
38
+ RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
39
+ run: |
40
+ gem install gem-release
41
+ cat > ~/.gem/credentials << EOF
42
+ ---
43
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
44
+ EOF
45
+ chmod 0600 ~/.gem/credentials
46
+ gem release
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in relaton_nist.gemspec
4
4
  gemspec
5
+
6
+ gem "rubocop-performance"
7
+ gem "rubocop-rake"
8
+ gem "rubocop-rspec"
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,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require_relative '../lib/nist_pubid'
6
+ require 'optparse'
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: nist_pubid [ -s | PubID ]"
10
+ opts.on("-s", "--status", "Get a NIST Tech Pubs list with final PubID") do
11
+ puts "Current document ID | DOI | Title | Final PubID"
12
+ NistPubid::NistTechPubs.status.each do |row|
13
+ puts row.join(" | ")
14
+ end
15
+ end
16
+
17
+ opts.on("-h", "--help", "Prints this help") do
18
+ puts opts
19
+ exit
20
+ end
21
+
22
+ end.parse!
23
+
24
+ code = ARGV.join(" ")
25
+ puts NistPubid::Document.parse(code).to_s(:short) unless code.empty?
@@ -35,47 +35,181 @@ EDITION_DESC = {
35
35
  mr: "e",
36
36
  }.freeze
37
37
 
38
+ SUPPLEMENT_DESC = {
39
+ long: " Supplement ",
40
+ abbrev: " Suppl. ",
41
+ short: "sup",
42
+ mr: "sup",
43
+ }.freeze
44
+
45
+ SECTION_DESC = {
46
+ long: " Section ",
47
+ abbrev: " Sec. ",
48
+ short: "sec",
49
+ mr: "sec",
50
+ }.freeze
51
+
52
+ APPENDIX_DESC = {
53
+ long: " Appendix ",
54
+ abbrev: " App. ",
55
+ short: "app",
56
+ mr: "app",
57
+ }.freeze
58
+
59
+ ERRATA_DESC = {
60
+ long: " Errata ",
61
+ abbrev: " Err. ",
62
+ short: "-err",
63
+ mr: "-err",
64
+ }.freeze
65
+
38
66
  module NistPubid
39
67
  class Document
40
68
  attr_accessor :serie, :code, :revision, :publisher, :version, :volume,
41
- :part, :addendum, :stage, :translation, :update, :edition
69
+ :part, :addendum, :stage, :translation, :update_number,
70
+ :edition, :supplement, :update_year, :section, :appendix,
71
+ :errata
42
72
 
43
- def initialize(publisher:, serie:, docnumber:, stage: nil, **opts)
73
+ def initialize(publisher:, serie:, docnumber:, **opts)
44
74
  @publisher = Publisher.new(publisher: publisher)
45
75
  @serie = Serie.new(serie: serie)
46
76
  @code = docnumber
47
- @stage = Stage.new(stage: stage)
48
77
  opts.each { |key, value| send("#{key}=", value) }
49
78
  end
50
79
 
80
+ # returns weight based on amount of defined attributes
81
+ def weight
82
+ instance_variables.inject(0) do |sum, var|
83
+ sum + (instance_variable_get(var).nil? ? 0 : 1)
84
+ end
85
+ end
86
+
87
+ def merge(document)
88
+ instance_variables.each do |var|
89
+ val = document.instance_variable_get(var)
90
+ instance_variable_set(var, val) unless val.nil?
91
+ end
92
+
93
+ self
94
+ end
95
+
96
+ def self.update_old_code(code)
97
+ code = code.gsub("FIPS", "FIPS PUB") unless code.include?("FIPS PUB")
98
+ code.gsub("NBS MONO", "NBS MN").gsub("NIST MONO", "NIST MN")
99
+ .gsub("NIST MP", "NBS MP")
100
+ .gsub("NIST SP 304a-2017", "NIST SP 304A-2017")
101
+ .gsub("NIST SP 260-162 2006ed.", "NIST SP 260-162e2006")
102
+ .gsub("NBS CIRC 154suprev", "NBS CIRC 154r1sup")
103
+ .gsub("NIST SP 260-126 rev 2013", "NIST SP 260-126r2013")
104
+ .gsub(/(?<=NBS MP )(\d+)\((\d+)\)/, '\1e\2')
105
+ .gsub(/(?<=\d)es/, "(spa)")
106
+ .gsub(/(?<=\d)chi/, "(zho)")
107
+ .gsub(/(?<=\d)viet/, "(vie)")
108
+ .gsub(/(?<=\d)port/, "(por)")
109
+ # .gsub(/^LCIRC/, "NBS LC")
110
+ end
111
+
51
112
  def self.parse(code)
113
+ code = update_old_code(code)
52
114
  matches = {
53
- publisher: match(Publisher.regexp, code),
54
- serie: match(Serie.regexp, code)&.gsub(/\./, " "),
55
- stage: match(Stage.regexp, code),
56
- docnumber: match(/(?<=\.|\s)[0-9-]{3,}[A-Z]?/, code),
57
- part: /(?<=(\.))?pt(?(1)-)([A-Z\d]+)/.match(code)&.[](2),
58
- volume: /(?<=(\.))?v(?(1)-)(\d+)/.match(code)&.[](2),
59
- version: match(/(?<=(\.))?ver(?(1)[-\d]|[.\d])+/, code)&.gsub(/-/, "."),
60
- revision: /(?<=[^a-z])(?<=(\.))?(?:r(?(1)-)|Rev\.\s)(\d+)/
115
+ publisher: match(Publisher.regexp, code) || "NIST",
116
+ serie: match(Serie.regexp, code),
117
+ stage: Stage.parse(code),
118
+ part: /(?<=(\.))?(?<![a-z])+(?:pt|Pt|p)(?(1)-)([A-Z\d]+)/.match(code)
119
+ &.[](2),
120
+ version:
121
+ /(?<=\.)?(?:(?:ver)((?(1)[-\d]|[.\d])+|\d+)|(?:v)(\d+\.[.\d]+))/
122
+ .match(code).to_a[1..-1]&.compact&.first&.gsub(/-/, "."),
123
+ revision: /[\da](?:r|Rev\.\s|([0-9]+[A-Za-z]*-[0-9]+[A-Za-z]*-))([\da]+)/
61
124
  .match(code)&.[](2),
62
- addendum: match(/(?<=(\.))?(add(?(1)-)\d+|Addendum)/, code),
63
- translation: match(/(?<=\()\w{3}(?=\))/, code),
64
- update: match(/(?<=Upd\s)([\d:]+)/, code),
125
+ addendum: match(/(?<=(\.))?(add(?:-\d+)?|Addendum)/, code),
65
126
  edition: /(?<=[^a-z])(?<=(\.))?(?:e(?(1)-)|Ed\.\s)(\d+)/
66
127
  .match(code)&.[](2),
128
+ section: /(?<=sec)\d+/.match(code)&.to_s,
129
+ appendix: /\d+app/.match(code)&.to_s,
130
+ errata: /-errata/.match(code)&.to_s
67
131
  }
132
+ supplement = /(?:(?:supp?)-?(\d*)|Supplement|Suppl.)/
133
+ .match(code)
134
+ unless supplement.nil?
135
+ matches[:supplement] = supplement[1].nil? ? "" : supplement[1]
136
+ end
137
+
138
+ update = code.scan(/((?<=Upd)\s?[\d:]+|-upd)-?(\d*)/).first
139
+
140
+ (matches[:update_number], matches[:update_year]) = update if update
141
+
142
+ unless matches[:serie]
143
+ raise Errors::ParseError.new("failed to parse serie for #{code}")
144
+ end
145
+
146
+ unless matches[:stage].nil?
147
+ code = code.gsub(matches[:stage].original_code, "")
148
+ end
149
+
150
+ unless ["NBS CSM", "NBS CS"].include?(matches[:serie])
151
+ matches[:volume] = /(?<=(\.))?v(?(1)-)(\d+)(?!\.\d+)/.match(code)&.[](2)
152
+ end
153
+
154
+ matches[:revision] = nil if matches[:addendum]
155
+
156
+ matches[:docnumber] = parse_docnumber(matches[:serie], code)
157
+
158
+ matches[:serie] = SERIES["mr"].invert[matches[:serie]] || matches[:serie]
159
+ # matches[:serie].gsub!(/\./, " ")
160
+ matches[:translation] = match(/(?<=\()\w{3}(?=\))/, code)
161
+
68
162
  new(**matches)
69
163
  end
70
164
 
165
+ def self.parse_docnumber(serie, code)
166
+ localities = "[Pp]t\\d+|r(?:\\d+|[A-Za-z]?)|e\\d+|p|v|sec\\d+"
167
+ excluded_parts = "(?!#{localities}|supp?)"
168
+
169
+ if ["NBS CSM", "NBS CS"].include?(serie)
170
+ docnumber = /v(\d+)n(\d+)/.match(code).to_a[1..-1]&.join("-")
171
+ else
172
+ # match docnumbers with localities in the first part, like NBS CIRC 11e2-1915
173
+ docnumber =
174
+ /(?:#{serie.gsub(" ", "\s|\.")})(?:\s|\.)?([0-9]+)(?:#{localities})(-[0-9]+)?/
175
+ .match(code)&.captures&.join
176
+
177
+ docnumber ||=
178
+ /(?:#{serie.gsub(" ", "\s|\.")})(?:\s|\.)? # match serie
179
+ ([0-9]+ # first part of report number
180
+ (?:#{excluded_parts}[A-Za-z]+)? # with letter but without localities
181
+ (?:-m)? # for NBS CRPL 4-m-5
182
+ (?:-[A-Z]+)? # for NIST SP 1075-NCNR, NIST SP 1113-BFRL, etc
183
+ (?:-[0-9.]+)? # second part
184
+ (?:
185
+ (?: # only big letter
186
+ (#{excluded_parts}[A-Z]|(?![a-z]))+|#{excluded_parts}[a-z]?|#{excluded_parts}[a-z]+
187
+ )? # or small letter but without localities
188
+ )
189
+ )/x
190
+ .match(code)&.[](1)&.upcase
191
+ end
192
+
193
+ unless docnumber
194
+ raise Errors::ParseError.new(
195
+ "failed to parse document identifier for #{code}",
196
+ )
197
+ end
198
+
199
+ docnumber
200
+ end
201
+
71
202
  def self.match(regex, code)
72
203
  regex.match(code)&.to_s
73
204
  end
74
205
 
75
206
  def to_s(format)
76
- result = "#{render_serie(format)}#{stage.to_s(format)}"\
77
- "#{code}#{render_part(format)}#{render_edition(format)}"\
78
- "#{render_update(format)}#{render_translation(format)}"
207
+ result = render_serie(format)
208
+ result += " " unless format == :short || stage.nil?
209
+ result += "#{stage&.to_s(format)}"\
210
+ " #{code}#{render_part(format)}#{render_edition(format)}"\
211
+ "#{render_localities(format)}"\
212
+ "#{render_update(format)}#{render_translation(format)}"
79
213
  result = render_addendum(result, format)
80
214
 
81
215
  return result.gsub(" ", ".") if format == :mr
@@ -84,13 +218,14 @@ module NistPubid
84
218
  end
85
219
 
86
220
  def render_serie(format)
87
- return "#{serie.to_s(format)} " if %i[mr short].include?(format)
221
+ if serie.to_s(format).include?(publisher.to_s(format))
222
+ return serie.to_s(format)
223
+ end
88
224
 
89
- "#{publisher.to_s(format)} #{serie.to_s(format)} "
225
+ "#{publisher.to_s(format)} #{serie.to_s(format)}"
90
226
  end
91
227
 
92
228
  def render_part(format)
93
- # TODO: Section, Supplement, Index, Insert, Errata
94
229
  result = ""
95
230
  result += "#{VOLUME_DESC[format]}#{volume}" unless volume.nil?
96
231
  result += "#{PART_DESC[format]}#{part}" unless part.nil?
@@ -99,24 +234,50 @@ module NistPubid
99
234
 
100
235
  def render_edition(format)
101
236
  result = ""
102
- result += "#{REVISION_DESC[format]}#{revision}" unless revision.nil?
237
+ if revision
238
+ result += if %i[long abbrev].include?(format) ||
239
+ [volume, part, supplement, version, edition].any?
240
+ "#{REVISION_DESC[format]}#{revision}"
241
+ else
242
+ "-#{revision}"
243
+ end
244
+ end
103
245
  result += "#{VERSION_DESC[format]}#{version}" unless version.nil?
104
246
  result += "#{EDITION_DESC[format]}#{edition}" unless edition.nil?
105
247
  result
106
248
  end
107
249
 
250
+ def render_localities(format)
251
+ # TODO: Index, Insert
252
+
253
+ result = ""
254
+ result += "#{SUPPLEMENT_DESC[format]}#{supplement}" unless supplement.nil?
255
+ result += "#{SECTION_DESC[format]}#{section}" unless section.nil?
256
+ result += "#{APPENDIX_DESC[format]}" unless appendix.nil?
257
+ result += "#{ERRATA_DESC[format]}" unless errata.nil?
258
+
259
+ result
260
+ end
261
+
108
262
  def render_update(format)
109
- return "" if update.nil?
263
+ return "" if update_year.nil?
264
+
265
+ if update_number.match?(/\d+/)
266
+ update_text = update_number
267
+ update_text += "-#{update_year}" if update_year
268
+ else
269
+ update_text = "1"
270
+ end
110
271
 
111
272
  case format
112
273
  when :long
113
- " Update #{update}"
274
+ " Update #{update_text}"
114
275
  when :abbrev
115
- " Upd. #{update}"
276
+ " Upd. #{update_text}"
116
277
  when :short
117
- "/Upd #{update}"
278
+ "/Upd#{update_text}"
118
279
  when :mr
119
- ".u#{update.gsub(":", "-")}"
280
+ ".u#{update_text}"
120
281
  end
121
282
  end
122
283
 
@@ -0,0 +1,5 @@
1
+ module NistPubid
2
+ module Errors
3
+ class ParseError < StandardError; end
4
+ end
5
+ end
@@ -0,0 +1,92 @@
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.to_s(:short) 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.to_s(:short)
33
+ end
34
+ # return more complete pubid
35
+ id.merge(doi).to_s(:short)
36
+ rescue Errors::ParseError
37
+ @converted_doi[doc[:doi]] ||= NistPubid::Document.parse(doc[:doi])
38
+ .to_s(:short)
39
+ end
40
+
41
+ def parse_docid(doc)
42
+ id = doc.at("publisher_item/item_number", "publisher_item/identifier")
43
+ .text.sub(%r{^/}, "")
44
+ doi = doc.at("doi_data/doi").text.gsub("10.6028/", "")
45
+ title = doc.at("titles/title").text
46
+ title += " #{doc.at('titles/subtitle').text}" if doc.at("titles/subtitle")
47
+ case doi
48
+ when "10.6028/NBS.CIRC.12e2revjune" then id.sub!("13e", "12e")
49
+ when "10.6028/NBS.CIRC.36e2" then id.sub!("46e", "36e")
50
+ when "10.6028/NBS.HB.67suppJune1967" then id.sub!("1965", "1967")
51
+ when "10.6028/NBS.HB.105-1r1990" then id.sub!("105-1-1990", "105-1r1990")
52
+ when "10.6028/NIST.HB.150-10-1995" then id.sub!(/150-10$/, "150-10-1995")
53
+ end
54
+
55
+ { id: id, doi: doi, title: title }
56
+ end
57
+
58
+ def comply_with_pubid
59
+ fetch.select do |doc|
60
+ convert(doc) == doc[:id]
61
+ rescue Errors::ParseError
62
+ false
63
+ end
64
+ end
65
+
66
+ def different_with_pubid
67
+ fetch.reject do |doc|
68
+ convert(doc) == doc[:id]
69
+ rescue Errors::ParseError
70
+ true
71
+ end
72
+ end
73
+
74
+ def parse_fail_with_pubid
75
+ fetch.select do |doc|
76
+ convert(doc) && false
77
+ rescue Errors::ParseError
78
+ true
79
+ end
80
+ end
81
+
82
+ # returning current document id, doi, title and final PubID
83
+ def status
84
+ fetch.map do |doc|
85
+ [doc[:id], doc[:doi], doc[:title], convert(doc)]
86
+ rescue Errors::ParseError
87
+ [doc[:id], doc[:doi], doc[:title], "parse error"]
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -5,7 +5,7 @@ module NistPubid
5
5
  attr_accessor :serie
6
6
 
7
7
  def initialize(serie:)
8
- @serie = serie
8
+ @serie = serie == "NISTIR" ? "NIST IR" : serie
9
9
  end
10
10
 
11
11
  def to_s(format)
@@ -18,7 +18,9 @@ module NistPubid
18
18
  end
19
19
 
20
20
  def self.regexp
21
- /(#{(SERIES["long"].keys + SERIES["mr"].values).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
@@ -2,21 +2,36 @@ STAGES = YAML.load_file(File.join(File.dirname(__FILE__), "../../stages.yaml"))
2
2
 
3
3
  module NistPubid
4
4
  class Stage
5
- attr_accessor :stage
5
+ attr_accessor :stage, :original_code
6
6
 
7
- def initialize(stage:)
8
- @stage = stage
7
+ def initialize(original_code)
8
+ self.original_code = original_code
9
+ @stage = self.class.regexp.match(original_code)&.[](1)
9
10
  end
10
11
 
11
- def to_s(format)
12
- return "" if @stage.nil?
13
- return "#{@stage} " if %i[short mr].include?(format)
12
+ def to_s(format = :short)
13
+ return "" if nil?
14
14
 
15
- "#{STAGES[@stage]} "
15
+ case format
16
+ when :short
17
+ "(#{@stage})"
18
+ when :mr
19
+ @stage
20
+ else
21
+ STAGES[@stage]
22
+ end
23
+ end
24
+
25
+ def self.parse(code)
26
+ new(regexp.match(code)&.to_s)
16
27
  end
17
28
 
18
29
  def self.regexp
19
- /(#{STAGES.keys.join('|')})(?=\.|\s)/
30
+ /\((#{STAGES.keys.join('|')})\)/
31
+ end
32
+
33
+ def nil?
34
+ @stage.nil?
20
35
  end
21
36
  end
22
37
  end
@@ -1,3 +1,3 @@
1
1
  module NistPubid
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.5".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
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Ribose Inc."]
9
9
  spec.email = ["open.source@ribose.com"]
10
10
 
11
- spec.homepage = "http://github.com/metanorma/nist-pubid"
12
- spec.summary = "Extract and convert NIST machine-readable PubID."
13
- spec.description = "Extract and convert NIST machine-readable PubID."
11
+ spec.homepage = "https://github.com/metanorma/nist-pubid"
12
+ spec.summary = "Library to generate, parse and manipulate NIST PubID."
13
+ spec.description = "Library to generate, parse and manipulate NIST PubID."
14
14
  spec.license = "BSD-2-Clause"
15
15
 
16
16
  # Specify which files should be added to the gem when it is released.
@@ -26,13 +26,11 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
28
28
 
29
- spec.add_development_dependency "pry-byebug"
30
29
  spec.add_development_dependency "rake", "~> 13.0"
31
30
  spec.add_development_dependency "rspec", "~> 3.0"
32
- spec.add_development_dependency "rubocop", "~> 1.23.0"
33
- spec.add_development_dependency "rubocop-performance", "~> 1.12.0"
34
- spec.add_development_dependency "rubocop-rails", "~> 2.12.4"
35
- spec.metadata = {
36
- "rubygems_mfa_required" => "true",
37
- }
31
+ spec.add_development_dependency "vcr"
32
+ spec.add_development_dependency "webmock"
33
+
34
+ spec.add_dependency "relaton-nist"
35
+ spec.add_dependency "nokogiri"
38
36
  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
data/stages.yaml CHANGED
@@ -2,4 +2,4 @@ IPD: Initial Public Draft
2
2
  2PD: Second Public Draft
3
3
  FPD: Final Public Draft
4
4
  WD: Work-in-Progress Draft
5
- PreD: Preliminary Draft
5
+ PRD: Preliminary Draft
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nist-pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
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-04 00:00:00.000000000 Z
11
+ date: 2022-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: pry-byebug
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -53,66 +39,84 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: '3.0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: rubocop
42
+ name: vcr
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: 1.23.0
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 1.23.0
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: rubocop-performance
56
+ name: webmock
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 1.12.0
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 1.12.0
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: rubocop-rails
70
+ name: relaton-nist
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: 2.12.4
90
- type: :development
75
+ version: '0'
76
+ type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
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
+ - - ">="
95
88
  - !ruby/object:Gem::Version
96
- version: 2.12.4
97
- description: Extract and convert NIST machine-readable PubID.
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
+ description: Library to generate, parse and manipulate NIST PubID.
98
98
  email:
99
99
  - open.source@ribose.com
100
- executables: []
100
+ executables:
101
+ - nist-pubid
101
102
  extensions: []
102
103
  extra_rdoc_files:
103
104
  - README.adoc
104
105
  - LICENSE.txt
105
106
  files:
106
107
  - ".github/workflows/rake.yml"
108
+ - ".github/workflows/release.yml"
107
109
  - ".rspec"
108
110
  - ".rubocop.yml"
109
111
  - Gemfile
110
- - Gemfile.lock
111
112
  - LICENSE.txt
112
113
  - README.adoc
113
114
  - Rakefile
115
+ - exe/nist-pubid
114
116
  - lib/nist_pubid.rb
115
117
  - lib/nist_pubid/document.rb
118
+ - lib/nist_pubid/errors.rb
119
+ - lib/nist_pubid/nist_tech_pubs.rb
116
120
  - lib/nist_pubid/publisher.rb
117
121
  - lib/nist_pubid/serie.rb
118
122
  - lib/nist_pubid/stage.rb
@@ -121,11 +125,10 @@ files:
121
125
  - publishers.yaml
122
126
  - series.yaml
123
127
  - stages.yaml
124
- homepage: http://github.com/metanorma/nist-pubid
128
+ homepage: https://github.com/metanorma/nist-pubid
125
129
  licenses:
126
130
  - BSD-2-Clause
127
- metadata:
128
- rubygems_mfa_required: 'true'
131
+ metadata: {}
129
132
  post_install_message:
130
133
  rdoc_options: []
131
134
  require_paths:
@@ -141,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
144
  - !ruby/object:Gem::Version
142
145
  version: '0'
143
146
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.10
147
+ rubygems_version: 3.3.3
146
148
  signing_key:
147
149
  specification_version: 4
148
- summary: Extract and convert NIST machine-readable PubID.
150
+ summary: Library to generate, parse and manipulate NIST PubID.
149
151
  test_files: []
data/Gemfile.lock DELETED
@@ -1,89 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- nist-pubid (0.1.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- activesupport (6.1.4.1)
10
- concurrent-ruby (~> 1.0, >= 1.0.2)
11
- i18n (>= 1.6, < 2)
12
- minitest (>= 5.1)
13
- tzinfo (~> 2.0)
14
- zeitwerk (~> 2.3)
15
- ast (2.4.2)
16
- byebug (11.1.3)
17
- coderay (1.1.3)
18
- concurrent-ruby (1.1.9)
19
- diff-lcs (1.4.4)
20
- i18n (1.8.11)
21
- concurrent-ruby (~> 1.0)
22
- method_source (1.0.0)
23
- minitest (5.14.4)
24
- parallel (1.21.0)
25
- parser (3.0.3.1)
26
- ast (~> 2.4.1)
27
- pry (0.13.1)
28
- coderay (~> 1.1)
29
- method_source (~> 1.0)
30
- pry-byebug (3.9.0)
31
- byebug (~> 11.0)
32
- pry (~> 0.13.0)
33
- rack (2.2.3)
34
- rainbow (3.0.0)
35
- rake (13.0.6)
36
- regexp_parser (2.1.1)
37
- rexml (3.2.5)
38
- rspec (3.10.0)
39
- rspec-core (~> 3.10.0)
40
- rspec-expectations (~> 3.10.0)
41
- rspec-mocks (~> 3.10.0)
42
- rspec-core (3.10.1)
43
- rspec-support (~> 3.10.0)
44
- rspec-expectations (3.10.1)
45
- diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.10.0)
47
- rspec-mocks (3.10.2)
48
- diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.10.0)
50
- rspec-support (3.10.3)
51
- rubocop (1.23.0)
52
- parallel (~> 1.10)
53
- parser (>= 3.0.0.0)
54
- rainbow (>= 2.2.2, < 4.0)
55
- regexp_parser (>= 1.8, < 3.0)
56
- rexml
57
- rubocop-ast (>= 1.12.0, < 2.0)
58
- ruby-progressbar (~> 1.7)
59
- unicode-display_width (>= 1.4.0, < 3.0)
60
- rubocop-ast (1.14.0)
61
- parser (>= 3.0.1.1)
62
- rubocop-performance (1.12.0)
63
- rubocop (>= 1.7.0, < 2.0)
64
- rubocop-ast (>= 0.4.0)
65
- rubocop-rails (2.12.4)
66
- activesupport (>= 4.2.0)
67
- rack (>= 1.1)
68
- rubocop (>= 1.7.0, < 2.0)
69
- ruby-progressbar (1.11.0)
70
- tzinfo (2.0.4)
71
- concurrent-ruby (~> 1.0)
72
- unicode-display_width (2.1.0)
73
- zeitwerk (2.5.1)
74
-
75
- PLATFORMS
76
- ruby
77
- x86_64-darwin-20
78
-
79
- DEPENDENCIES
80
- nist-pubid!
81
- pry-byebug
82
- rake (~> 13.0)
83
- rspec (~> 3.0)
84
- rubocop (~> 1.23.0)
85
- rubocop-performance (~> 1.12.0)
86
- rubocop-rails (~> 2.12.4)
87
-
88
- BUNDLED WITH
89
- 2.2.22