rfcbib 0.3.0 → 0.3.1

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: 841490d1cc201afc1837d5d3f774c336027e258375cc0307f9e8a689ff6fbd98
4
- data.tar.gz: 79784a1d4d2106d359316be886bb7c8e45be2cf6fe257211c9ccecb18de2dd0f
3
+ metadata.gz: 07f6ab52973e93ae6aa47c9902f04be6e94a7e525cf7a81727ac5ef0b1d80df1
4
+ data.tar.gz: 607c8ea25f5885db73e8f4faae55a3285ae34aafb643616ad11b6739f5590811
5
5
  SHA512:
6
- metadata.gz: 7ce54df2766cadce1956040710e54cb979d811976e252c21f5a947364ab34d3aafb68382fc5d889fd44245bcc3aaa444542fb8014361b06270087cac26beac59
7
- data.tar.gz: 634a253f4b7b9adba50b1fd530e74bddcaec437187eb121b08124fc3753dac891a301de385f30cfb6e3cedeef8ebb4fad0623a69475a1f74e98a0e3a0e985c9c
6
+ metadata.gz: d688f95967c328932b46db1240f185cd0da00d39c2cc83288a573a66542ef6b535f13cf226ebfeec49e708f86974c79c378a30edfd479b33b6ce620d9efc52df
7
+ data.tar.gz: 5ac830d72eab384e018a88d04b25527db14b0201dbde49699cfe4372479eb7128670361a01d3ee45e667731f0db0c00a68dc7f923e2730ff0f28d10bb9d73955
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rfcbib (0.3.0)
4
+ rfcbib (0.3.1)
5
5
  iso-bib-item (~> 0.3.0)
6
6
 
7
7
  GEM
@@ -9,17 +9,37 @@ module RfcBib
9
9
 
10
10
  # Scrapper module
11
11
  module Scrapper
12
+
13
+ RFC_URI_PATTERN = "https://www.rfc-editor.org/refs/bibxml/reference.CODE"
14
+ ID_URI_PATTERN = "https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ids/reference.CODE"
15
+
12
16
  class << self
13
17
  # @param text [String]
14
18
  # @return [IsoBibItem::BibliographicItem]
15
19
  def scrape_page(text)
16
- ref = text.sub(' ', '.') + '.xml'
17
- if text =~ /^RFC/
18
- uri = URI("https://www.rfc-editor.org/refs/bibxml/reference.#{ref}")
19
- elsif text =~ /^I-D/
20
- uri = URI("https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ids/reference.#{ref}")
20
+
21
+ # Remove initial "IETF " string if specified
22
+ ref = text.
23
+ gsub(/^IETF /, "").
24
+ sub(' ', '.') + '.xml'
25
+
26
+ uri = case ref
27
+ when /^RFC/
28
+ RFC_URI_PATTERN.dup
29
+ when /^I-D/
30
+ ID_URI_PATTERN.dup
31
+ else
32
+ warn "#{ref}: not recognised for RFC"
33
+ return
34
+ end
35
+
36
+ uri = uri.gsub("CODE", ref)
37
+ res = Net::HTTP.get_response(URI(uri))
38
+ if res.code != "200"
39
+ warn "No document found at #{uri}"
40
+ return
21
41
  end
22
- doc = Nokogiri::HTML Net::HTTP.get(uri)
42
+ doc = Nokogiri::HTML Net::HTTP.get(URI(uri))
23
43
  @reference = doc.at('//reference')
24
44
  return unless @reference
25
45
  bib_item
@@ -158,7 +178,7 @@ module RfcBib
158
178
  #
159
179
  def dates
160
180
  return unless (date = @reference.at '//front/date')
161
- d = [date[:year], month(date[:month]),
181
+ d = [date[:year], month(date[:month]),
162
182
  (date[:day] || "01")].compact.join '-'
163
183
  date = Time.parse(d).strftime '%Y-%m-%d'
164
184
  [IsoBibItem::BibliographicDate.new(type: 'published', on: date)]
@@ -1,3 +1,3 @@
1
1
  module Rfcbib
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  'using the BibliographicItem model'
17
17
  spec.homepage = 'https://github.com/riboseinc/rfcbib'
18
18
  spec.license = 'BSD-2-Clause'
19
+ spec.post_install_message = "The rfcbib gem has been deprecated and has been replaced by ietfbib"
19
20
 
20
21
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
22
  f.match(%r{^(test|spec|features)/})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfcbib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-04 00:00:00.000000000 Z
11
+ date: 2018-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,7 +137,8 @@ homepage: https://github.com/riboseinc/rfcbib
137
137
  licenses:
138
138
  - BSD-2-Clause
139
139
  metadata: {}
140
- post_install_message:
140
+ post_install_message: The rfcbib gem has been deprecated and has been replaced by
141
+ ietfbib
141
142
  rdoc_options: []
142
143
  require_paths:
143
144
  - lib