activestorage-cloudinary-service 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +21 -21
- data/lib/active_storage/service/download_utils.rb +28 -14
- data/lib/active_storage/service/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dabc2d19ae96fc59d1da3098a2c57bde025d181
|
4
|
+
data.tar.gz: 22502fdb687f935395f06e98237daa1ca2c98ed9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8bc1c8c87d28083ede0fd36330c0c38b296e2cfc7e47faecccf91e3d04c066195d8c5f2158bf7343d91c1c0283c5cb91f0176e62e58e23968e2c424539c7942
|
7
|
+
data.tar.gz: d7479eb0533d704fb94b91a15d0cca6db0194479a40fec5bdcc7022856c92c45a2db104de37890c9460e37717704f086a00245df2a30312d90dab032ee62f03d
|
data/Gemfile
CHANGED
@@ -5,5 +5,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
5
5
|
# Specify your gem's dependencies in active_storage-cloudinary_service.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'activestorage', '~> 5.2.
|
8
|
+
gem 'activestorage', '~> 5.2.1.1', require: false
|
9
9
|
gem 'cloudinary', '~> 1.8.2', require: false
|
data/Gemfile.lock
CHANGED
@@ -6,30 +6,30 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
actionpack (5.2.
|
10
|
-
actionview (= 5.2.
|
11
|
-
activesupport (= 5.2.
|
9
|
+
actionpack (5.2.1.1)
|
10
|
+
actionview (= 5.2.1.1)
|
11
|
+
activesupport (= 5.2.1.1)
|
12
12
|
rack (~> 2.0)
|
13
13
|
rack-test (>= 0.6.3)
|
14
14
|
rails-dom-testing (~> 2.0)
|
15
15
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
-
actionview (5.2.
|
17
|
-
activesupport (= 5.2.
|
16
|
+
actionview (5.2.1.1)
|
17
|
+
activesupport (= 5.2.1.1)
|
18
18
|
builder (~> 3.1)
|
19
19
|
erubi (~> 1.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
21
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
22
|
-
activemodel (5.2.
|
23
|
-
activesupport (= 5.2.
|
24
|
-
activerecord (5.2.
|
25
|
-
activemodel (= 5.2.
|
26
|
-
activesupport (= 5.2.
|
22
|
+
activemodel (5.2.1.1)
|
23
|
+
activesupport (= 5.2.1.1)
|
24
|
+
activerecord (5.2.1.1)
|
25
|
+
activemodel (= 5.2.1.1)
|
26
|
+
activesupport (= 5.2.1.1)
|
27
27
|
arel (>= 9.0)
|
28
|
-
activestorage (5.2.
|
29
|
-
actionpack (= 5.2.
|
30
|
-
activerecord (= 5.2.
|
28
|
+
activestorage (5.2.1.1)
|
29
|
+
actionpack (= 5.2.1.1)
|
30
|
+
activerecord (= 5.2.1.1)
|
31
31
|
marcel (~> 0.3.1)
|
32
|
-
activesupport (5.2.
|
32
|
+
activesupport (5.2.1.1)
|
33
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
34
|
i18n (>= 0.7, < 2)
|
35
35
|
minitest (~> 5.1)
|
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
aws_cf_signer
|
42
42
|
rest-client
|
43
43
|
coderay (1.1.2)
|
44
|
-
concurrent-ruby (1.
|
44
|
+
concurrent-ruby (1.1.3)
|
45
45
|
crass (1.0.4)
|
46
46
|
diff-lcs (1.3)
|
47
47
|
domain_name (0.5.20170404)
|
@@ -49,12 +49,12 @@ GEM
|
|
49
49
|
erubi (1.7.1)
|
50
50
|
http-cookie (1.0.3)
|
51
51
|
domain_name (~> 0.5)
|
52
|
-
i18n (1.0
|
52
|
+
i18n (1.2.0)
|
53
53
|
concurrent-ruby (~> 1.0)
|
54
|
-
loofah (2.2.
|
54
|
+
loofah (2.2.3)
|
55
55
|
crass (~> 1.0.2)
|
56
56
|
nokogiri (>= 1.5.9)
|
57
|
-
marcel (0.3.
|
57
|
+
marcel (0.3.3)
|
58
58
|
mimemagic (~> 0.3.2)
|
59
59
|
method_source (0.9.0)
|
60
60
|
mime-types (3.1)
|
@@ -64,12 +64,12 @@ GEM
|
|
64
64
|
mini_portile2 (2.3.0)
|
65
65
|
minitest (5.11.3)
|
66
66
|
netrc (0.11.0)
|
67
|
-
nokogiri (1.8.
|
67
|
+
nokogiri (1.8.5)
|
68
68
|
mini_portile2 (~> 2.3.0)
|
69
69
|
pry (0.11.3)
|
70
70
|
coderay (~> 1.1.0)
|
71
71
|
method_source (~> 0.9.0)
|
72
|
-
rack (2.0.
|
72
|
+
rack (2.0.6)
|
73
73
|
rack-test (1.1.0)
|
74
74
|
rack (>= 1.0, < 3)
|
75
75
|
rails-dom-testing (2.0.3)
|
@@ -106,7 +106,7 @@ PLATFORMS
|
|
106
106
|
ruby
|
107
107
|
|
108
108
|
DEPENDENCIES
|
109
|
-
activestorage (~> 5.2.
|
109
|
+
activestorage (~> 5.2.1.1)
|
110
110
|
activestorage-cloudinary-service!
|
111
111
|
bundler (~> 1.16)
|
112
112
|
cloudinary (~> 1.8.2)
|
@@ -6,23 +6,37 @@ module DownloadUtils
|
|
6
6
|
url = URI.parse(source)
|
7
7
|
http, req = setup_connection(url)
|
8
8
|
|
9
|
-
content_length = http.request_head(url).content_length
|
10
|
-
upper_limit = content_length + (content_length % chunk_size)
|
11
|
-
offset = 0
|
9
|
+
# content_length = http.request_head(url).content_length
|
10
|
+
# upper_limit = content_length + (content_length % chunk_size)
|
11
|
+
# offset = 0
|
12
|
+
#
|
13
|
+
# parts = (content_length / chunk_size.to_f).ceil
|
12
14
|
|
13
|
-
http.start do |agent|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
chunk = agent.request(req).body
|
22
|
-
yield chunk.force_encoding(Encoding::BINARY)
|
15
|
+
# http.start do |agent|
|
16
|
+
# parts.times do |part|
|
17
|
+
# req.range = (part * chunk_size)...((part + 1) * chunk_size)
|
18
|
+
# chunk = agent.request(req).body
|
19
|
+
# yield chunk.force_encoding(Encoding::BINARY)
|
20
|
+
# end
|
21
|
+
# end
|
23
22
|
|
24
|
-
|
23
|
+
http.start do |agent|
|
24
|
+
agent.request(req) do |resp|
|
25
|
+
resp.read_body { |chunk| yield chunk.force_encoding(Encoding::BINARY) }
|
25
26
|
end
|
27
|
+
|
28
|
+
# while offset < upper_limit
|
29
|
+
# lim = (offset + chunk_size)
|
30
|
+
# # QUESTION: is it relevant to set the last chunk
|
31
|
+
# # to the exact remaining bytes
|
32
|
+
# # lim = content_length if lim > content_length
|
33
|
+
# req.range = (offset..lim)
|
34
|
+
#
|
35
|
+
# chunk = agent.request(req).body
|
36
|
+
# yield chunk.force_encoding(Encoding::BINARY)
|
37
|
+
#
|
38
|
+
# offset += chunk_size + 1
|
39
|
+
# end
|
26
40
|
end
|
27
41
|
end
|
28
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-cloudinary-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Osmond Oscar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|