dato 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dato.gemspec +0 -1
- data/lib/dato/upload/file.rb +2 -31
- data/lib/dato/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2db7bdd32377323ced0898556ea20771ae90d3b3ece302ce020c21c99d685ef3
|
4
|
+
data.tar.gz: 669af6a048649fe3841002882fbb0bdfa3946ba21254f8c11c4cfcc5fb6c3fc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5097086d93b92922604d95597a175e7b15735c47e70b2b61564c4037ff2ff32e3ac1786572d1a847fc68e1762a9711f19f09e3f86736d800d56d7ce270a0beb
|
7
|
+
data.tar.gz: 18732a788ef213bb02099ea0e830e16be4c51afe3b481607a75ff1e1b4dca7aa3dcf97070a130800ab8769f6de8d37b398473b337b91c0e82f82738f85337919
|
data/dato.gemspec
CHANGED
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_runtime_dependency 'faraday', ['>= 0.9.0']
|
36
36
|
spec.add_runtime_dependency 'faraday_middleware', ['>= 0.9.0']
|
37
37
|
spec.add_runtime_dependency 'activesupport', ['>= 4.2.7']
|
38
|
-
spec.add_runtime_dependency 'fastimage'
|
39
38
|
spec.add_runtime_dependency 'addressable'
|
40
39
|
spec.add_runtime_dependency 'thor'
|
41
40
|
spec.add_runtime_dependency 'imgix', ['>= 0.3.1']
|
data/lib/dato/upload/file.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'fastimage'
|
4
3
|
require 'tempfile'
|
5
4
|
require 'addressable'
|
6
5
|
require 'net/http'
|
@@ -50,10 +49,7 @@ module Dato
|
|
50
49
|
upload_request = client.upload_request.create(filename: filename)
|
51
50
|
uri = URI.parse(upload_request[:url])
|
52
51
|
|
53
|
-
request = Net::HTTP::Put.new(
|
54
|
-
uri,
|
55
|
-
'x-amz-acl' => 'public-read'
|
56
|
-
)
|
52
|
+
request = Net::HTTP::Put.new(uri)
|
57
53
|
request.body = file.read
|
58
54
|
|
59
55
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -61,9 +57,7 @@ module Dato
|
|
61
57
|
|
62
58
|
http.request(request)
|
63
59
|
|
64
|
-
uploads = client.uploads.create(
|
65
|
-
format_resource(upload_request)
|
66
|
-
)
|
60
|
+
uploads = client.uploads.create(path: upload_request[:id])
|
67
61
|
|
68
62
|
uploads['id']
|
69
63
|
end
|
@@ -79,29 +73,6 @@ module Dato
|
|
79
73
|
puts "Error during uploading #{url}"
|
80
74
|
raise e
|
81
75
|
end
|
82
|
-
|
83
|
-
def format_resource(upload_request)
|
84
|
-
extension = FastImage.type(file.path).to_s
|
85
|
-
if extension.empty?
|
86
|
-
extension = ::File.extname(::File.basename(file.path)).delete('.').downcase
|
87
|
-
end
|
88
|
-
|
89
|
-
raise FastImage::UnknownImageType if extension.empty?
|
90
|
-
|
91
|
-
base_format = {
|
92
|
-
path: upload_request[:id],
|
93
|
-
size: ::File.size(file.path),
|
94
|
-
format: extension
|
95
|
-
}
|
96
|
-
if IMAGE_FORMATS.include?(extension)
|
97
|
-
width, height = FastImage.size(file.path)
|
98
|
-
base_format = base_format.merge(
|
99
|
-
width: width,
|
100
|
-
height: height
|
101
|
-
)
|
102
|
-
end
|
103
|
-
base_format
|
104
|
-
end
|
105
76
|
end
|
106
77
|
end
|
107
78
|
end
|
data/lib/dato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -206,20 +206,6 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 4.2.7
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: fastimage
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :runtime
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
209
|
- !ruby/object:Gem::Dependency
|
224
210
|
name: addressable
|
225
211
|
requirement: !ruby/object:Gem::Requirement
|