blobsterix_carrierwave 1.0.6 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.txt +4 -0
- data/lib/blobsterix_carrierwave/blobsterix_adhoc_transforms.rb +35 -3
- data/lib/blobsterix_carrierwave/blobsterix_transforms.rb +23 -0
- data/lib/blobsterix_carrierwave/blobsterix_uploader.rb +4 -0
- data/lib/blobsterix_carrierwave/version.rb +1 -2
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc9f5f3785c1396075e386046fe772d66e09a688
|
4
|
+
data.tar.gz: c14789b243fe645392ea0465e00b9dd162a97170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503df11579e24d84fbdd3bc6c0b6fc30b2dff9300d2b7d33f991cbfeccfafa9e54f4ea56f099462f514d7c6a8ba292e8bd2d5637db133e4109e483311748b9df
|
7
|
+
data.tar.gz: 7443c01e15aa47861dd51a0b7948894bde6bdc0b61a8c274c4af8dd5be236dc8fb89c3f8469a8a88e95f9f8cb645cc68ee02c32d05697ec444e3ed760c196a89
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0-
|
1
|
+
2.0.0-p643
|
data/CHANGELOG.txt
CHANGED
@@ -11,6 +11,9 @@ module BlobsterixAdhocTransforms
|
|
11
11
|
@options = options || {}
|
12
12
|
@chain=[]
|
13
13
|
|
14
|
+
# activate relative ssl protocoll as standard option
|
15
|
+
@options[:relative_ssl] = true unless @options.has_key?(:relative_ssl)
|
16
|
+
|
14
17
|
#init the trafos
|
15
18
|
(@options[:trafos] || []).each{|t|
|
16
19
|
self.send(t[0], t[1])
|
@@ -27,9 +30,14 @@ module BlobsterixAdhocTransforms
|
|
27
30
|
self
|
28
31
|
end
|
29
32
|
|
33
|
+
def query(args={})
|
34
|
+
query_options.merge!(args)
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
30
38
|
def url(path=nil)
|
31
39
|
@options[:path] = path if path
|
32
|
-
"#{asset_host}#{encoded_path}"
|
40
|
+
"#{asset_host}#{encoded_path}#{query_options_string}"
|
33
41
|
end
|
34
42
|
|
35
43
|
def url_s3(path=nil, use_subdomain=true)
|
@@ -77,6 +85,9 @@ module BlobsterixAdhocTransforms
|
|
77
85
|
"http://#{@options[:host]}/#{bucket}/"
|
78
86
|
end
|
79
87
|
end
|
88
|
+
def http
|
89
|
+
@options[:ssl] ? "https:" : (@options[:relative_ssl] ? "" : "http:")
|
90
|
+
end
|
80
91
|
def asset_host
|
81
92
|
|
82
93
|
host = @options[:host] || ""
|
@@ -85,14 +96,35 @@ module BlobsterixAdhocTransforms
|
|
85
96
|
else
|
86
97
|
trafo = transform
|
87
98
|
if trafo.length > 0
|
88
|
-
"http
|
99
|
+
"#{http}//#{host}/blob/v#{version}/#{trafo}.#{bucket}/"
|
89
100
|
else
|
90
|
-
"http
|
101
|
+
"#{http}//#{host}/blob/v#{version}/#{bucket}/"
|
91
102
|
end
|
92
103
|
end
|
93
104
|
|
94
105
|
#"http://localhost:9000/blob/v1/#{trafo}.#{uploader.fog_directory}/"
|
95
106
|
end
|
107
|
+
def query_options
|
108
|
+
@query||={}
|
109
|
+
end
|
110
|
+
def query_options=(opts={})
|
111
|
+
@query=opts
|
112
|
+
end
|
113
|
+
def query_options_string
|
114
|
+
if uploader.respond_to?(:force_filename)
|
115
|
+
if query_options.empty?
|
116
|
+
"?filename=#{uploader.force_filename}"
|
117
|
+
else
|
118
|
+
"?filename=#{uploader.force_filename}&#{query_options.map {|i,v| "#{i}=#{v}" }.join("&")}"
|
119
|
+
end
|
120
|
+
else
|
121
|
+
if query_options.empty?
|
122
|
+
""
|
123
|
+
else
|
124
|
+
"?#{query_options.map {|i,v| "#{i.to_s}=#{v.to_s}" }.join("&")}"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
96
128
|
def bucket()
|
97
129
|
if @options.has_key?(:uploader)
|
98
130
|
@options[:uploader].fog_directory
|
@@ -18,6 +18,29 @@ module BlobsterixTransforms
|
|
18
18
|
:args => "#{width}x#{height}"
|
19
19
|
}
|
20
20
|
end
|
21
|
+
|
22
|
+
# extent takes 3 params in a hash, :background, :gravity and :size
|
23
|
+
#
|
24
|
+
# size is mandatory, background
|
25
|
+
#
|
26
|
+
# @param [Hash] args
|
27
|
+
# @option args [String] :size
|
28
|
+
# @option args [String] :background (defaults to "transparent")
|
29
|
+
# @option args [String] :gravity (defaults to "center")
|
30
|
+
def extent(args)
|
31
|
+
# only allow gravity, background and size options
|
32
|
+
args.delete_if do |key, value|
|
33
|
+
!([:gravity, :background, :size].include?(key))
|
34
|
+
end
|
35
|
+
args[:gravity] = "center" unless args[:gravity]
|
36
|
+
args[:background] = "transparent" unless args[:background]
|
37
|
+
send = args.map{|key, value| "#{key}=#{value}"}.join(";") + ";"
|
38
|
+
{
|
39
|
+
:method => "extent",
|
40
|
+
:args => send
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
21
44
|
def rotate(angle)
|
22
45
|
{
|
23
46
|
:method => "rotate",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blobsterix_carrierwave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Sudmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -89,4 +89,3 @@ signing_key:
|
|
89
89
|
specification_version: 4
|
90
90
|
summary: This gem is used to create a carrierwave binding to a blobsterix server
|
91
91
|
test_files: []
|
92
|
-
has_rdoc:
|