blobsterix 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blobsterix.rb +5 -6
- data/lib/blobsterix/transformation/image_transformation.rb +14 -14
- data/lib/blobsterix/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: de4c7f26e746a8a411576f67e073d959d8ae48dd
|
4
|
+
data.tar.gz: 1adb250fcf9cc7546d6e5acd3ad493c6b14e6629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9ba6fe49bf8f777f19f2409c1bec4fa434a108ec1886a62975145e639851cf07b6d1af236418aa06700432165061818f1ec517d4d83f508af569b7b30e55c3
|
7
|
+
data.tar.gz: 48909960b47c5fce517eee45b253fede5eb5583c008017c6293b718da5d68dba0112b15a3e361608a63e476f449679f7de89d57cbd0bc5331c6148b35106ed2f
|
data/lib/blobsterix.rb
CHANGED
@@ -22,6 +22,8 @@ require 'base64'
|
|
22
22
|
require 'zip'
|
23
23
|
require 'goliath/api'
|
24
24
|
|
25
|
+
#exceptions
|
26
|
+
require 'blobsterix/exceptions'
|
25
27
|
|
26
28
|
#utility
|
27
29
|
require 'blobsterix/mimemagic/tables'
|
@@ -84,9 +86,6 @@ require 'blobsterix/transformation/image_transformation'
|
|
84
86
|
#service base
|
85
87
|
require 'blobsterix/service'
|
86
88
|
|
87
|
-
#exceptions
|
88
|
-
require 'blobsterix/exceptions'
|
89
|
-
|
90
89
|
BLOBSTERIX_ROOT=Dir.pwd
|
91
90
|
BLOBSTERIX_GEM_DIR = File.join(File.dirname(__FILE__), "../")
|
92
91
|
|
@@ -157,7 +156,7 @@ module Blobsterix
|
|
157
156
|
def self.use_x_send_file=(obj)
|
158
157
|
@use_x_send_file=obj
|
159
158
|
end
|
160
|
-
|
159
|
+
|
161
160
|
def self.allow_chunked_stream
|
162
161
|
!!@allow_chunked_stream
|
163
162
|
end
|
@@ -218,7 +217,7 @@ module Blobsterix
|
|
218
217
|
def self.event(name,hash)
|
219
218
|
storage_event_listener.call(name,hash)
|
220
219
|
end
|
221
|
-
|
220
|
+
|
222
221
|
def self.encryption_error(blob_access)
|
223
222
|
event("encryption.error",:blob_access => blob_access)
|
224
223
|
end
|
@@ -275,7 +274,7 @@ module Blobsterix
|
|
275
274
|
end
|
276
275
|
|
277
276
|
def self.wait_for_next(op = nil)
|
278
|
-
EM.next_tick do
|
277
|
+
EM.next_tick do
|
279
278
|
wait_for(op)
|
280
279
|
end
|
281
280
|
end
|
@@ -98,12 +98,12 @@ module Blobsterix::Transformations::Impl
|
|
98
98
|
# extent takes gravity, background and size arguments e.g. "gravity=center;background=transparent;size=100x100;"
|
99
99
|
create_simple_trafo("extent", "image/*", "image/*", false) do |input_path, target_path, value|
|
100
100
|
gravity = value.match(/gravity=(.*?);/)[1]
|
101
|
-
raise BlobsterixTransformationError.new("No gravity specified") unless gravity
|
101
|
+
raise ::Blosterix::BlobsterixTransformationError.new("No gravity specified") unless gravity
|
102
102
|
background = value.match(/background=(.*?);/)[1]
|
103
|
-
raise BlobsterixTransformationError.new("No background specified") unless background
|
103
|
+
raise ::Blosterix::BlobsterixTransformationError.new("No background specified") unless background
|
104
104
|
size = value.match(/size=(.*?);/)[1]
|
105
|
-
raise BlobsterixTransformationError.new("No extent size specified") unless size
|
106
|
-
raise BlobsterixTransformationError.new("Bad size format") unless size.match(/^[0-9]+x[0-9]+$/)
|
105
|
+
raise ::Blosterix::BlobsterixTransformationError.new("No extent size specified") unless size
|
106
|
+
raise ::Blosterix::BlobsterixTransformationError.new("Bad size format") unless size.match(/^[0-9]+x[0-9]+$/)
|
107
107
|
image = MiniMagick::Image.open(input_path)
|
108
108
|
image.combine_options do |c|
|
109
109
|
c.background background
|
@@ -142,9 +142,9 @@ module Blobsterix::Transformations::Impl
|
|
142
142
|
|
143
143
|
create_simple_trafo("croppercent", "image/*", "image/*", false) do |input_path, target_path, value|
|
144
144
|
values = /(\d+)x(\d+)\+(\d+)\+(\d+)/.match(value)
|
145
|
-
raise BlobsterixTransformationError.new("The provided cropping values are wrong") unless values
|
145
|
+
raise ::Blosterix::BlobsterixTransformationError.new("The provided cropping values are wrong") unless values
|
146
146
|
width,height,x,y = values[1..-1].map{|i| i.to_i}
|
147
|
-
raise BlobsterixTransformationError.new("Values are to big") if width+x>1000 || height+y>1000
|
147
|
+
raise ::Blosterix::BlobsterixTransformationError.new("Values are to big") if width+x>1000 || height+y>1000
|
148
148
|
|
149
149
|
image = MiniMagick::Image.open(input_path)
|
150
150
|
image.crop "#{width/1000.0*image[:width]}x#{height/1000.0*image[:height]}+#{x/1000.0*image[:width]}+#{y/1000.0*image[:height]}"
|
@@ -182,15 +182,15 @@ module Blobsterix::Transformations::Impl
|
|
182
182
|
end
|
183
183
|
|
184
184
|
create_simple_trafo("raw", "image/*", "image/*", true) do |input_path, target_path, value|
|
185
|
-
raise BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
185
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
186
186
|
end
|
187
187
|
|
188
188
|
create_simple_trafo("ascii", "image/*", "text/plain", true) do |input_path, target_path, value|
|
189
|
-
raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
|
189
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
|
190
190
|
end
|
191
191
|
|
192
192
|
create_simple_trafo("png", "image/*", "image/png", true) do |input_path, target_path, value|
|
193
|
-
raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
|
193
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
|
194
194
|
end
|
195
195
|
|
196
196
|
create_simple_trafo("base642bin", "text/plain", "*/*", false) do |input_path, target_path, value|
|
@@ -205,25 +205,25 @@ module Blobsterix::Transformations::Impl
|
|
205
205
|
end
|
206
206
|
|
207
207
|
create_simple_trafo("jpg", "image/*", "image/jpeg", true) do |input_path, target_path, value|
|
208
|
-
raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
|
208
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
|
209
209
|
end
|
210
210
|
|
211
211
|
create_simple_trafo("gif", "image/*", "image/gif", true) do |input_path, target_path, value|
|
212
|
-
raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
|
212
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
|
213
213
|
end
|
214
214
|
|
215
215
|
create_simple_trafo("webp", "image/png", "image/webp", true) do |input_path, target_path, value|
|
216
|
-
raise BlobsterixTransformationError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
|
216
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
|
217
217
|
end
|
218
218
|
|
219
219
|
create_simple_trafo("text", "image/*", "image/*", true) do |input_path, target_path, value|
|
220
|
-
raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
|
220
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
|
221
221
|
end
|
222
222
|
|
223
223
|
create_simple_trafo("sleep", "image/*", "image/*", true) do |input_path, target_path, value|
|
224
224
|
p "SLEEEP"
|
225
225
|
sleep(value.to_i)
|
226
|
-
raise BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
226
|
+
raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
227
227
|
end
|
228
228
|
|
229
229
|
create_simple_trafo("unzip", "application/zip", "*/*", false) do |input_path, target_path, value|
|
data/lib/blobsterix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blobsterix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Sudmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|