isobib 0.4.1 → 0.4.2

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
2
  SHA256:
3
- metadata.gz: 8ee0c32efd6b1e81bc88906f97b37e80d88244757d95d055fd44b0efdd0ff9e7
4
- data.tar.gz: 85d1bc63a525a319ec53870d4a4ec41940b976ee1569a3dcf12cbbad26ec3c1f
3
+ metadata.gz: 40b9acb94d63fd23c4e5c064a0e10748db58e8515e1e50487172f90800c4ff16
4
+ data.tar.gz: 33f349728dfebde96f83d833a2d26c3f89f5a78c1ca3124368c6e8022055be36
5
5
  SHA512:
6
- metadata.gz: e207c07abf24d9de2f692198b2fe1a8f28a49b09c52f451b532c81cfc77ca405db6c06b2541189977132618b1eff399133bd7e58370831cfd7e56cd761476670
7
- data.tar.gz: 05af921b19c172567b7fa1f7a742476296a75233be1aec998770e19494857005b23441dc37b0e885240d8b0da2a5ce2d692d9698566dcb9a555ffa8b139c16d6
6
+ metadata.gz: 57145ba1597d569fb305004da9505b2ef91fbf9b4947626326c8c2f05eeceb511228cff6d15017c5eb4cdd3fd43bd4d5347da41ce9eb7301d25ff30155637770
7
+ data.tar.gz: 301778268405d04c2623f3ad19ec1113a22d61d995844cc812daba7d76b00b0f36ebd0baa056251986545f974443fa7f5f9101d4c17903ade2ea1045ee533589
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,4 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
1
7
  AllCops:
2
- TargetRubyVersion: 2.4.0
3
- Metrics/BlockLength:
4
- ExcludedMethods: ['describe', 'context']
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isobib (0.4.1)
4
+ isobib (0.4.2)
5
5
  algoliasearch
6
6
  iecbib (~> 0.2.1)
7
7
  iso-bib-item (~> 0.4.2)
@@ -11,7 +11,7 @@ GEM
11
11
  specs:
12
12
  addressable (2.5.2)
13
13
  public_suffix (>= 2.0.2, < 4.0)
14
- algoliasearch (1.23.2)
14
+ algoliasearch (1.24.0)
15
15
  httpclient (~> 2.8, >= 2.8.3)
16
16
  json (>= 1.5.1)
17
17
  byebug (10.0.2)
@@ -24,7 +24,7 @@ GEM
24
24
  iecbib (0.2.1)
25
25
  addressable
26
26
  iso-bib-item (~> 0.4.2)
27
- iso-bib-item (0.4.2)
27
+ iso-bib-item (0.4.4)
28
28
  isoics (~> 0.1.6)
29
29
  nokogiri (~> 1.8.4)
30
30
  ruby_deep_clone (~> 0.8.0)
@@ -76,4 +76,4 @@ DEPENDENCIES
76
76
  simplecov
77
77
 
78
78
  BUNDLED WITH
79
- 1.16.6
79
+ 1.17.1
@@ -12,7 +12,12 @@ module Isobib
12
12
  # @param text [String]
13
13
  # @return [Isobib::HitPages]
14
14
  def search(text)
15
- HitPages.new text
15
+ begin
16
+ HitPages.new text
17
+ rescue
18
+ warn "Could not access http://www.iso.ch"
19
+ []
20
+ end
16
21
  end
17
22
 
18
23
  # @param text [String]
@@ -40,13 +40,18 @@ module Isobib
40
40
  # @param text [String]
41
41
  # @return [Array<Hash>]
42
42
  def get(text)
43
- iso_workers = WorkersPool.new 4
44
- iso_workers.worker { |hit| iso_worker(hit, iso_workers) }
45
- algolia_workers = start_algolia_search(text, iso_workers)
46
- iso_docs = iso_workers.result
47
- algolia_workers.end
48
- algolia_workers.result
49
- iso_docs
43
+ begin
44
+ iso_workers = WorkersPool.new 4
45
+ iso_workers.worker { |hit| iso_worker(hit, iso_workers) }
46
+ algolia_workers = start_algolia_search(text, iso_workers)
47
+ iso_docs = iso_workers.result
48
+ algolia_workers.end
49
+ algolia_workers.result
50
+ iso_docs
51
+ rescue
52
+ warn "Could not connect to http://www.iso.org"
53
+ []
54
+ end
50
55
  end
51
56
 
52
57
  # Parse page.
@@ -59,7 +64,7 @@ module Isobib
59
64
 
60
65
  # Fetch edition.
61
66
  edition = doc&.xpath("//strong[contains(text(), 'Edition')]/..")
62
- &.children&.last&.text&.match(/\d+/)&.to_s
67
+ &.children&.last&.text&.match(/\d+/)&.to_s
63
68
 
64
69
  titles, abstract = fetch_titles_abstract(doc)
65
70
 
@@ -206,7 +211,7 @@ module Isobib
206
211
  # @return [Hash]
207
212
  def fetch_status(doc, status)
208
213
  stage, substage = doc.css('li.dropdown.active span.stage-code > strong')
209
- .text.split '.'
214
+ .text.split '.'
210
215
  { status: status, stage: stage, substage: substage }
211
216
  end
212
217
 
@@ -256,7 +261,7 @@ module Isobib
256
261
  # @return [String]
257
262
  def fetch_type(title)
258
263
  type_match = title.match(%r{^(ISO|IWA|IEC)(?:(/IEC|/IEEE|/PRF|
259
- /NP)*\s|/)(TS|TR|PAS|AWI|CD|FDIS|NP|DIS|WD|R|Guide|(?=\d+))}x)
264
+ /NP)*\s|/)(TS|TR|PAS|AWI|CD|FDIS|NP|DIS|WD|R|Guide|(?=\d+))}x)
260
265
  #return "international-standard" if type_match.nil?
261
266
  if TYPES[type_match[2]]
262
267
  TYPES[type_match[2]]
@@ -275,7 +280,7 @@ module Isobib
275
280
  # @return [Hash]
276
281
  def fetch_title(doc, lang)
277
282
  titles = doc.at("//h3[@itemprop='description'] | //h2[@itemprop='description']")
278
- .text.split ' -- '
283
+ .text.split ' -- '
279
284
  case titles.size
280
285
  when 0
281
286
  intro, main, part = nil, "", nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isobib
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isobib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
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-10-26 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,6 +159,7 @@ extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
161
  - ".gitignore"
162
+ - ".hound.yml"
162
163
  - ".rspec"
163
164
  - ".rubocop.yml"
164
165
  - ".travis.yml"