miteru 0.14.3 → 0.14.4

This diff has not been reviewed by any users.
Log in in order to be able to vote.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95bccae4b2e34a97963be17cea1b90180ab18278b07be56db5bbc9e1755f673a
4
- data.tar.gz: 0cf9b0015a178f037c802cd88da68828d6db7618cd35a4fc4e9a6dd9f5030703
3
+ metadata.gz: 89102143e9e405545e94b50da7b81b90c85ae9612c8c914d4b50b6d09ca2e023
4
+ data.tar.gz: 2d6e60e6301425b9ceb8ed7cf103caab144f2ddab4fdd3872ef3f332a6667e37
5
5
  SHA512:
6
- metadata.gz: 65ebef82c94e969c4886a34bab6241aea8c6a495a041a10a8df7af7429d77a0eda03f233df8ae56b904542d649c8a9bb549e6ceeb4007b5f19ad2616407b20ff
7
- data.tar.gz: 2d145f705bd18c0219695ae83aeff01bccfeb3fc34dc04a0a9dcf9374a9b839bd43762d76501430509baac8598895df088e35dcd24a5c846e5962072ce00ec40
6
+ metadata.gz: 3df145d910400efc069d07c718943560a064b5d9fff849fb695795bf49b1d30681e6c31946172f2cd0e7508ca46ded7ff93d2935e48fc6dc970e1817d6e6348c
7
+ data.tar.gz: 70057c7c2451f4631bfda279431e40dfc86bc4931caa555141e607d0a2d73e5308bd0458ddc9046b1e0ccbe0329829ab8568202e8671c68146e5b6b4b6688705
@@ -14,7 +14,7 @@ module Miteru
14
14
  end
15
15
 
16
16
  def valid?;
17
- valid_ext? && reachable?
17
+ valid_ext? && reachable_and_archive_file?
18
18
  end
19
19
 
20
20
  def extname
@@ -69,9 +69,17 @@ module Miteru
69
69
  VALID_EXTENSIONS.include? extname
70
70
  end
71
71
 
72
- def reachable?
72
+ def reachable?(response)
73
+ response.status.success?
74
+ end
75
+
76
+ def archive_file?(response)
77
+ !response.content_type.mime_type.to_s.start_with? "text/"
78
+ end
79
+
80
+ def reachable_and_archive_file?
73
81
  res = HTTPClient.head(url)
74
- res.status.success?
82
+ reachable?(res) && archive_file?(res)
75
83
  rescue StandardError
76
84
  false
77
85
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miteru
4
- VERSION = "0.14.3"
4
+ VERSION = "0.14.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miteru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler