gbbib 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: eb3b926e47fdfca5623a37e092d8072be696a8fe
4
- data.tar.gz: 781ce62f34f01ea01ce1b1bea083ec851beb56e8
2
+ SHA256:
3
+ metadata.gz: f37b15238b5f0416f6c47510eab966bc8eeb63308f0b03a339acf3dde5688f40
4
+ data.tar.gz: ee15c19b4d3d9cea1c4a58181c8fd21e1b812694cf7037ec315ac315dc7395c1
5
5
  SHA512:
6
- metadata.gz: c19520eb951344e11564dfba80bc16111ef331dc5b46e8bb37a31b1d3892ad56165ed90495eb82a1158e1034f6e05800dc7d40feced12c74f2e067a50e7ce173
7
- data.tar.gz: 4b75cfa4a98a855a83800d7c84c207997f008a5d5ab80a655fa5d2098be19ae248dd255afce983b069a7d27d997aa1ac411cd26d26f5c7c31a327f11069f5776
6
+ metadata.gz: 858b4851abdb8f0e6e2a8156d969cc8ffcb65d9b953fe47f1ae7b6dbac7317b1a077d2b57bcea4f06a61c838f5e7003235de27ca684ad2c35e7799d1d6fe9b43
7
+ data.tar.gz: bb59a8be1116609e293fbb9d276ff72aef024eb7c9b7ef9aba5cfaf5a6bbc32614246e7d6d4fcf731cd5b9f501a83293bf0b939d25d476f83bc3c11cc3d20059
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,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gbbib (0.1.4)
5
- cnccs
6
- iso-bib-item
4
+ gbbib (0.1.5)
5
+ cnccs (~> 0.1.1)
6
+ iso-bib-item (~> 0.1.10)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -17,14 +17,14 @@ GEM
17
17
  equivalent-xml (0.6.0)
18
18
  nokogiri (>= 1.4.3)
19
19
  iso-bib-item (0.1.10)
20
- duplicate
20
+ duplicate (~> 1.1.1)
21
21
  isoics (~> 0.1.6)
22
22
  nokogiri
23
23
  isoics (0.1.6)
24
24
  json (2.1.0)
25
25
  method_source (0.9.0)
26
26
  mini_portile2 (2.3.0)
27
- nokogiri (1.8.3)
27
+ nokogiri (1.8.4)
28
28
  mini_portile2 (~> 2.3.0)
29
29
  pry (0.11.3)
30
30
  coderay (~> 1.1.0)
data/README.adoc CHANGED
@@ -1,4 +1,9 @@
1
- = Gdbib
1
+ = Gbbib
2
+
3
+ image:https://img.shields.io/gem/v/gbbib.svg["Gem Version", link="https://rubygems.org/gems/gbbib"]
4
+ image:https://img.shields.io/travis/riboseinc/gbbib/master.svg["Build Status", link="https://travis-ci.org/riboseinc/gbbib"]
5
+ image:https://codeclimate.com/github/riboseinc/gbbib/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/gbbib"]
6
+
2
7
 
3
8
  GbBib is a Ruby gem that search and fetch Chinese GB standards.
4
9
  The standards scraped form:
data/gbbib.gemspec CHANGED
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'simplecov'
31
31
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
32
32
 
33
- spec.add_dependency 'cnccs'
34
- spec.add_dependency 'iso-bib-item'
35
- # spec.add_dependency 'nokogiri'
33
+ spec.add_dependency 'cnccs', "~> 0.1.1"
34
+ spec.add_dependency 'iso-bib-item', "~> 0.1.10"
36
35
  end
@@ -11,17 +11,17 @@ module Gbbib
11
11
  # @param text [Strin] code of standard for search
12
12
  # @return [Gbbib::HitCollection]
13
13
  def search(text)
14
- if text.match?(/^(GB|GJ|GS)/)
14
+ if text =~ /^(GB|GJ|GS)/
15
15
  # Scrape national standards.
16
16
  require 'gbbib/gb_scrapper'
17
17
  GbScrapper.scrape_page text
18
- elsif text.match?(/^ZB/)
18
+ elsif text =~ /^ZB/
19
19
  # Scrape proffesional.
20
- elsif text.match?(/^DB/)
20
+ elsif text =~ /^DB/
21
21
  # Scrape local standard.
22
- elsif text.match? %r{^Q\/}
22
+ elsif text =~ %r{^Q\/}
23
23
  # Enterprise standard
24
- elsif text.match? %r{^T\/[^\s]{3,6}\s}
24
+ elsif text =~ %r{^T\/[^\s]{3,6}\s}
25
25
  # Scrape social standard.
26
26
  require 'gbbib/t_scrapper'
27
27
  TScrapper.scrape_page text
@@ -38,7 +38,7 @@ module Gbbib
38
38
  # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
39
39
  # @return [String] Relaton XML serialisation of reference
40
40
  def get(code, year, opts)
41
- return iev.to_xml if code.casecmp? 'IEV'
41
+ return iev.to_xml if code.casecmp('IEV') == 0
42
42
  code += '.1' if opts[:all_parts]
43
43
  ret = get1(code, year, opts)
44
44
  return nil if ret.nil?
@@ -55,7 +55,7 @@ module Gbbib
55
55
  "The code must be exactly like it is on the website."
56
56
  warn "(There was no match for #{year}, though there were matches "\
57
57
  "found for #{missed_years.join(', ')}.)" unless missed_years.empty?
58
- if /\d-\d/.match? code
58
+ if /\d-\d/ =~ code
59
59
  warn "The provided document part may not exist, or the document "\
60
60
  "may no longer be published in parts."
61
61
  else
@@ -67,7 +67,7 @@ module Gbbib
67
67
  end
68
68
 
69
69
  def get1(code, year, opts)
70
- return iev if code.casecmp? "IEV"
70
+ return iev if code.casecmp("IEV") == 0
71
71
  result = search_filter(code) or return nil
72
72
  ret = results_filter(result, year)
73
73
  return ret[:ret] if ret[:ret]
@@ -81,7 +81,7 @@ module Gbbib
81
81
  result = search(code)
82
82
  ret = result.select do |hit|
83
83
  hit.title && hit.title.match(docidrx).to_s == code # &&
84
- # !corrigrx.match?(hit.title)
84
+ # !corrigrx =~ hit.title
85
85
  end
86
86
  return ret unless ret.empty?
87
87
  []
@@ -124,7 +124,7 @@ module Gbbib
124
124
  scope = doc.at('.s-status.label-info').text
125
125
  if scope == '国家标准'
126
126
  'national'
127
- elsif scope.match?(/^行业标准/)
127
+ elsif scope =~ /^行业标准/
128
128
  'sector'
129
129
  end
130
130
  end
data/lib/gbbib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gbbib
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gbbib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
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: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,30 +98,30 @@ dependencies:
98
98
  name: cnccs
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.1.1
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'
110
+ version: 0.1.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: iso-bib-item
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.1.10
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 0.1.10
125
125
  description: 'GdBib: retrieve Chinese GB Standards for bibliographic use using the
126
126
  BibliographicItem model.'
127
127
  email:
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  version: '0'
177
177
  requirements: []
178
178
  rubyforge_project:
179
- rubygems_version: 2.6.12
179
+ rubygems_version: 2.7.6
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: 'GdBib: retrieve Chinese GB Standards for bibliographic use using the BibliographicItem