rfcbib 0.1.1 → 0.2.0

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: 7efca45eeb81da661be8978f11a8c042cada52ad1afcf7f83778c61ff42cb95c
4
- data.tar.gz: d62cbf6337e4888925de63b0074144b971370e967ad3440ee67d9236548d4277
3
+ metadata.gz: e71d2a7180ac4890509e190af31b890f4e9484ecc78fdc140e76cee6c54a6868
4
+ data.tar.gz: 7d5a90b55ae0fb17628b0ecac82e8ba6b50597d64730123ee7b94cc554a0309c
5
5
  SHA512:
6
- metadata.gz: 53d845481efaf30667074e82c9808385d346ac9907701b1869f634e2118f8d4f4cf0bee37daa84ef4063cf256f535449e78b00a49c5eba01215f60119dd00459
7
- data.tar.gz: 76610c06062009a941b6bb8d31ae75ed9e11ad617ef0374ca809e5ea1a661d29bf43e55272b29276eb9a9d747ac79cbe3e080fd8036abd796ed151050e3cfc41
6
+ metadata.gz: 9835849f913acdc11f5a9e30203077cfc04eae377344c4ffc39bf6a17ed10fdefebaa903a41821f14f5aea7db8efcbf8cae44219f595994ba7f483f945d1815b
7
+ data.tar.gz: ca7371cb1cc578dac415673b2a7117a896b0765651902ca9670611536011252e9a557b656d23d152eb9bb8c49dac87a572354ec38ab5dcb65ab95baba821bf72
data/.travis.yml CHANGED
@@ -1,5 +1,14 @@
1
1
  sudo: false
2
2
  language: ruby
3
+
3
4
  rvm:
4
- - 2.4.0
5
+ - 2.5
6
+ - 2.4
7
+ - 2.3
8
+ - ruby-head
9
+
5
10
  before_install: gem install bundler -v 1.16.1
11
+
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: ruby-head
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rfcbib (0.1.0)
5
- iso-bib-item (~> 0.1.10)
4
+ rfcbib (0.1.1)
5
+ iso-bib-item (~> 0.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -11,18 +11,17 @@ GEM
11
11
  coderay (1.1.2)
12
12
  diff-lcs (1.3)
13
13
  docile (1.3.1)
14
- duplicate (1.1.1)
15
14
  equivalent-xml (0.6.0)
16
15
  nokogiri (>= 1.4.3)
17
- iso-bib-item (0.1.10)
18
- duplicate
16
+ iso-bib-item (0.2.1)
19
17
  isoics (~> 0.1.6)
20
- nokogiri
18
+ nokogiri (~> 1.8.4)
19
+ ruby_deep_clone (~> 0.8.0)
21
20
  isoics (0.1.6)
22
21
  json (2.1.0)
23
22
  method_source (0.9.0)
24
23
  mini_portile2 (2.3.0)
25
- nokogiri (1.8.3)
24
+ nokogiri (1.8.4)
26
25
  mini_portile2 (~> 2.3.0)
27
26
  pry (0.11.3)
28
27
  coderay (~> 1.1.0)
@@ -44,6 +43,7 @@ GEM
44
43
  diff-lcs (>= 1.2.0, < 2.0)
45
44
  rspec-support (~> 3.7.0)
46
45
  rspec-support (3.7.1)
46
+ ruby_deep_clone (0.8.0)
47
47
  simplecov (0.16.1)
48
48
  docile (~> 1.1)
49
49
  json (>= 1.8, < 3)
@@ -0,0 +1,16 @@
1
+ require 'relaton/processor'
2
+
3
+ module Relaton
4
+ module RfcBib
5
+ class Processor < Relaton::Processor
6
+ def initialize
7
+ @short = :rfcbib
8
+ @prefix = /^RFC|^I-D/
9
+ end
10
+
11
+ def get(code, date, opts)
12
+ ::RfcBib::RfcBibliography.get(code, date, opts)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,9 +6,19 @@ module RfcBib
6
6
  # RFC bibliography module
7
7
  module RfcBibliography
8
8
  class << self
9
+ # @param code [String] the ISO standard Code to look up (e..g "ISO 9000")
10
+ # @return [IsoBibItem::BibliographicItem]
9
11
  def search(text)
10
12
  Scrapper.scrape_page text
11
13
  end
14
+
15
+ # @param code [String] the ISO standard Code to look up (e..g "ISO 9000")
16
+ # @param year [String] the year the standard was published (optional)
17
+ # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
18
+ # @return [IsoBibItem::BibliographicItem] Relaton of reference
19
+ def get(code, _year, _opts)
20
+ search code
21
+ end
12
22
  end
13
23
  end
14
24
  end
@@ -14,7 +14,11 @@ module RfcBib
14
14
  # @return [IsoBibItem::BibliographicItem]
15
15
  def scrape_page(text)
16
16
  ref = text.sub(' ', '.') + '.xml'
17
- uri = URI("https://www.rfc-editor.org/refs/bibxml/reference.#{ref}")
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}"
21
+ end
18
22
  doc = Nokogiri::HTML Net::HTTP.get(uri)
19
23
  @reference = doc.at('//reference')
20
24
  return unless @reference
@@ -1,3 +1,3 @@
1
1
  module Rfcbib
2
- VERSION = "0.1.1"
2
+ VERSION = '0.2.0'.freeze
3
3
  end
data/lib/rfcbib.rb CHANGED
@@ -2,3 +2,8 @@
2
2
 
3
3
  require 'rfcbib/version'
4
4
  require 'rfcbib/rfc_bibliography'
5
+
6
+ if defined? Relaton
7
+ require_relative 'relaton/processor'
8
+ Relaton::Registry.instance.register(Relaton::RfcBib::Processor)
9
+ end
data/rfcbib.gemspec CHANGED
@@ -25,11 +25,11 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ['lib']
26
26
 
27
27
  spec.add_development_dependency 'bundler', '~> 1.16'
28
+ spec.add_development_dependency 'equivalent-xml', '~> 0.6'
28
29
  spec.add_development_dependency 'pry-byebug'
29
30
  spec.add_development_dependency 'rake', '~> 10.0'
30
31
  spec.add_development_dependency 'rspec', '~> 3.0'
31
32
  spec.add_development_dependency 'simplecov'
32
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
33
33
 
34
- spec.add_dependency 'iso-bib-item', '~> 0.1.10'
34
+ spec.add_dependency 'iso-bib-item', '~> 0.2.0'
35
35
  end
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.1.1
4
+ version: 0.2.0
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-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: equivalent-xml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: pry-byebug
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,34 +94,20 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: equivalent-xml
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.6'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0.6'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: iso-bib-item
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.1.10
103
+ version: 0.2.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.1.10
110
+ version: 0.2.0
111
111
  description: 'RfcBib: retrieve RFC Standards for bibliographic use using the BibliographicItem
112
112
  model'
113
113
  email:
@@ -127,6 +127,7 @@ files:
127
127
  - Rakefile
128
128
  - bin/console
129
129
  - bin/setup
130
+ - lib/relaton/processor.rb
130
131
  - lib/rfcbib.rb
131
132
  - lib/rfcbib/rfc_bibliography.rb
132
133
  - lib/rfcbib/scrapper.rb