eaternet 1.4.0 → 1.4.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
  SHA1:
3
- metadata.gz: d4e1375032849d789bc66d07c270c9cbbd1359d2
4
- data.tar.gz: 816728cbcb1c031b7ec8317696c4034e7a73498f
3
+ metadata.gz: bea0f02da14266e9021bb9ba118ac852cbca8d4f
4
+ data.tar.gz: d931c40c286985d654270bd2ef36a0f7d946c575
5
5
  SHA512:
6
- metadata.gz: 23952a31ca0a0aae9bc48ca4264dd0d80cc0929627b3fe857c45beb4727161ae8e2b0f59b01182d0cd8c8f25ec6b53f36e2e668731276a99beb58682e5453b39
7
- data.tar.gz: 5e0e4721edabd70975f6c0ec9bde85e9a03929e7acf45289069e5a8487a483447b5e1ab52c085d389bb7ee21a7e2b604fe417468b8f62bdacca36919d112d11d
6
+ metadata.gz: a33a879a009eb468307e9f6975cbf020c48655a5d89353f0b5a114f1b21b114cdb48cacc4f0cfc3b12c1ecef0f8f1c41ae1ad87ba365d81dd53bb8677163a243
7
+ data.tar.gz: de074c2a1eb77824cecfa79b4b42867994180cf609c64e79a73286bc4f65ef39ee7aa11fe932884b27e3c37767d3d6125412e97a04acaa79abade6732988ce2b
data/.travis.yml CHANGED
@@ -1,4 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
3
  - 2.3.1
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'csv'
2
3
  require 'json'
3
4
  require 'logger'
@@ -193,7 +194,7 @@ module Eaternet
193
194
  end
194
195
 
195
196
  def table_file
196
- @table_file ||= Nyc.download_via_url
197
+ Nyc.download_via_url
197
198
  end
198
199
 
199
200
  # Fastest method for downloading all data but may be non-standard
@@ -12,7 +12,7 @@ module Eaternet
12
12
  logger = Logger.new(ENV['EATERNET_LOG_FILE'] || $stderr)
13
13
  logger.datetime_format = '%Y-%m-%d %H:%M:%S'
14
14
  logger.progname = 'Eaternet'
15
- logger.level = Logger::WARN
15
+ logger.level = Logger::DEBUG
16
16
  logger
17
17
  end
18
18
  end
data/lib/eaternet/util.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'base64'
2
3
  require 'zip'
3
4
  require 'httparty'
@@ -9,30 +10,19 @@ module Eaternet
9
10
  #
10
11
  # @return [String] the directory path
11
12
  def self.download_and_extract_zipfile(url)
12
- dir = make_temp_dir
13
+ dir = Dir.mktmpdir
13
14
  zip_path = File.join(dir, 'zip-file.zip')
14
15
  download_and_cache(source: url, dest: zip_path)
15
16
  extract_zipfile(path: zip_path, dest_dir: dir)
16
17
  dir
17
18
  end
18
19
 
19
- # Create a temporary directory which is automatically deleted when the
20
- # program exits.
21
- #
22
- # @return [String] the directory path
23
- def self.make_temp_dir
24
- dir = Dir.mktmpdir
25
- at_exit { FileUtils.remove_entry dir }
26
- dir
27
- end
28
-
29
20
  # Download a file from the network, using a 12-hour cache.
30
21
  #
31
22
  # @param [String] source the URL to retrieve
32
23
  # @param [String] dest pathname in which to save the file
33
24
  # @return [File] the file
34
25
  def self.download_and_cache(source:, dest:)
35
- # download(source: source, dest: dest)
36
26
  cache_path = generate_cache_path(source)
37
27
  download(source: source, dest: cache_path) if expired? cache_path
38
28
  FileUtils.cp cache_path, dest
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Eaternet
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.1'
4
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'tempfile'
2
3
  require 'test_helper'
3
4
  require 'timecop'
@@ -33,7 +34,7 @@ class UtilTest < Minitest::Test
33
34
  end
34
35
 
35
36
  def test_uses_a_file_cache
36
- (1..3).each { download_and_cache }
37
+ 3.times { download_and_cache }
37
38
  assert_requested :get, @url, times: 1
38
39
  end
39
40
 
@@ -43,5 +44,4 @@ class UtilTest < Minitest::Test
43
44
  Timecop.freeze(Time.now + thirteen_hours) { download_and_cache }
44
45
  assert_requested :get, @url, times: 2
45
46
  end
46
-
47
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eaternet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-12 00:00:00.000000000 Z
11
+ date: 2016-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  requirements: []
319
319
  rubyforge_project:
320
- rubygems_version: 2.5.1
320
+ rubygems_version: 2.6.6
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: Regional adapters for restaurant health scores