dronejob 1.1.7 → 1.1.8

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: 95bbf56fbf52ab7285d8d711b3f5ae81005d326c
4
- data.tar.gz: aed5ee7e7432283ac7ede34439bf18e1cb56043f
3
+ metadata.gz: 72e95a002487cbd82ec7e7d4624f0ca3b6b8f2ba
4
+ data.tar.gz: 5f91348f2960eeed742cda0aa547f07a51dc1e29
5
5
  SHA512:
6
- metadata.gz: e9ec063fb39aeb8c445f8571f8dabea965264c88c97998c08d02bdbbc62aada3f23a89911c237953503754a36b899da7a11c2b8e747d7f9a384c876d3b30e049
7
- data.tar.gz: fd9b800728cb93d5e8f3467f75bd679de7deebdeea7923cdce64675569ac3fef3d8165dc68474c33a142a944a7cb25abb6be6008eb7f3f09cdd6d2aae1499edf
6
+ metadata.gz: 6cd67c59b1c7127b3aa6e68e7937800b838af487b00e0633e574b1e7f8b63de81259d3b1b980ff73dad9c746f940ebf8a355ad33d5945320d159991bba20f607
7
+ data.tar.gz: 9d28731e9e9bdd512211976ea89f290e809e0dcd4c42638091b2c77a244e587aba8705aee615889cb7faaddc6a25e96b5c48b1cafb03e46d28a5175b5babf794
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dronejob (1.1.7)
4
+ dronejob (1.1.8)
5
5
  activejob (~> 4.2)
6
6
  bundler (>= 1.3.0, < 2.0)
7
7
  git (~> 1.2)
@@ -1,3 +1,3 @@
1
1
  module Dronejob
2
- VERSION = "1.1.7"
2
+ VERSION = "1.1.8"
3
3
  end
@@ -28,8 +28,8 @@ module Dronejob
28
28
  def cache_assets(cache_dir, &block)
29
29
  hydra = Typhoeus::Hydra.new(max_concurrency: 10)
30
30
  html = contents
31
- html.scan(/["'(]{1}((https:|http:)?\/\/[^"')]+\.(jpg|jpeg|png|gif|mp3|mp4))["')?#]{1}/).map{|match| match[0]}.uniq.each do |url|
32
- original_url = url
31
+ html.scan(/["'(]{1}((https:\/\/|http:\/\/|\/\/)[^"')]+\.(jpg|jpeg|png|gif|mp3|mp4))["')?#]{1}/).map{|match| match[0]}.uniq.each do |url|
32
+ original_url = url.clone
33
33
  url = "http:#{url}" if url[0..1] == "//"
34
34
  ext = File.extname(url).gsub(/^\./, "")
35
35
  cache_file = cache_dir.file("#{Digest::MD5.hexdigest(url)}.#{ext}")
@@ -12,17 +12,19 @@ module Dronejob
12
12
  end
13
13
 
14
14
  def queue_download(url, &block)
15
- request = Typhoeus::Request.new(url)
16
- request.on_complete do |response|
17
- if response.success?
18
- write(response.body)
19
- block.call(self) if !block.nil?
20
- end
21
- end
22
- request
15
+ url = "http:#{url}" if url[0..1] == "//"
16
+ request = Typhoeus::Request.new(url)
17
+ request.on_complete do |response|
18
+ if response.success?
19
+ write(response.body)
20
+ block.call(self) if !block.nil?
21
+ end
22
+ end
23
+ request
23
24
  end
24
25
 
25
26
  def download(url)
27
+ url = "http:#{url}" if url[0..1] == "//"
26
28
  contents = open(url, { ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, allow_redirections: :safe }).read
27
29
  dir.create if !dir.exists?
28
30
  write(contents)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dronejob
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer