blobsterix 0.0.32 → 0.0.33

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: 84d8040f056cf1de1de49568af0cccf424a6c990
4
- data.tar.gz: 436842aa680d447ca3e6307f2ae984f6b0931aed
3
+ metadata.gz: a799a0f427f6ced555737bc0520cff9c48d2dbba
4
+ data.tar.gz: 8e0a1e55e697f05af5ebc5f05cb42ed9a054aa32
5
5
  SHA512:
6
- metadata.gz: 8a0baf3c7a14c6f7d7b9b3fec9e4aa00a9b88a3dae2f14c14a689bdee0a814120d29c07ed43e7fd639d96cdfa86096df067afeea3daa70a32a61639563519dd1
7
- data.tar.gz: 56f9c9ed4ff63b50cfa31cc6e31b4e3aae15b6a1ae005eadaf0b2040fb61ce8bb78b071555805ed56089322794a125f441b2cadd55b1fcd48b701b41fea7972e
6
+ metadata.gz: b9307ba8288bb99fabb3ab57ff6509578d81922c218a35d77085f5aa39699878aa52b5724f6114943826d713bf7cd420f43c7b343b9deb0dbf1f496c39c5da4a
7
+ data.tar.gz: 642846c3b7ef09b28a8402e736071363444c71d85333c67211d38d7af763d62a75baa3aa5cac5f2aa2ba261e2f4936ed294186a9eb4e6d0f6d300a2f6e794fe3
@@ -0,0 +1,5 @@
1
+ module Blosterix
2
+
3
+ class BlobsertixTransformationError < StandardError; end
4
+
5
+ end
@@ -1,4 +1,5 @@
1
1
  module Blobsterix::Transformations::Impl
2
+
2
3
  def self.create_simple_trafo(name_, input, output, is_format_=false, &block)
3
4
  trafo = ::Class.new Blobsterix::Transformations::Transformation do
4
5
 
@@ -94,6 +95,24 @@ module Blobsterix::Transformations::Impl
94
95
  image.write target_path
95
96
  end
96
97
 
98
+ # extent takes gravity, background and size arguments e.g. "gravity=center;background=transparent;size=100x100;"
99
+ create_simple_trafo("extent", "image/*", "image/*", false) do |input_path, target_path, value|
100
+ gravity = value.match(/gravity=(.*?);/)[1]
101
+ raise BlobsterixTransformationError.new("No gravity specified") unless gravity
102
+ background = value.match(/background=(.*?);/)[1]
103
+ raise BlobsterixTransformationError.new("No background specified") unless background
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]+$/)
107
+ image = MiniMagick::Image.open(input_path)
108
+ image.combine_options do |c|
109
+ c.background background
110
+ c.gravity gravity
111
+ c.extent size
112
+ end
113
+ image.write target_path
114
+ end
115
+
97
116
  create_simple_trafo("rotate", "image/*", "image/*", false) do |input_path, target_path, value|
98
117
  image = MiniMagick::Image.open(input_path)
99
118
  image.combine_options do |c|
@@ -123,9 +142,9 @@ module Blobsterix::Transformations::Impl
123
142
 
124
143
  create_simple_trafo("croppercent", "image/*", "image/*", false) do |input_path, target_path, value|
125
144
  values = /(\d+)x(\d+)\+(\d+)\+(\d+)/.match(value)
126
- raise StandardError.new("The provided cropping values are wrong") unless values
145
+ raise BlobsterixTransformationError.new("The provided cropping values are wrong") unless values
127
146
  width,height,x,y = values[1..-1].map{|i| i.to_i}
128
- raise StandardError.new("Values are to big") if width+x>1000 || height+y>1000
147
+ raise BlobsterixTransformationError.new("Values are to big") if width+x>1000 || height+y>1000
129
148
 
130
149
  image = MiniMagick::Image.open(input_path)
131
150
  image.crop "#{width/1000.0*image[:width]}x#{height/1000.0*image[:height]}+#{x/1000.0*image[:width]}+#{y/1000.0*image[:height]}"
@@ -163,15 +182,15 @@ module Blobsterix::Transformations::Impl
163
182
  end
164
183
 
165
184
  create_simple_trafo("raw", "image/*", "image/*", true) do |input_path, target_path, value|
166
- raise StandardError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
185
+ raise BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
167
186
  end
168
187
 
169
188
  create_simple_trafo("ascii", "image/*", "text/plain", true) do |input_path, target_path, value|
170
- raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
189
+ raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
171
190
  end
172
191
 
173
192
  create_simple_trafo("png", "image/*", "image/png", true) do |input_path, target_path, value|
174
- raise StandardError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
193
+ raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
175
194
  end
176
195
 
177
196
  create_simple_trafo("base642bin", "text/plain", "*/*", false) do |input_path, target_path, value|
@@ -186,25 +205,25 @@ module Blobsterix::Transformations::Impl
186
205
  end
187
206
 
188
207
  create_simple_trafo("jpg", "image/*", "image/jpeg", true) do |input_path, target_path, value|
189
- raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
208
+ raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
190
209
  end
191
210
 
192
211
  create_simple_trafo("gif", "image/*", "image/gif", true) do |input_path, target_path, value|
193
- raise StandardError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
212
+ raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
194
213
  end
195
214
 
196
215
  create_simple_trafo("webp", "image/png", "image/webp", true) do |input_path, target_path, value|
197
- raise StandardError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
216
+ raise BlobsterixTransformationError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
198
217
  end
199
218
 
200
219
  create_simple_trafo("text", "image/*", "image/*", true) do |input_path, target_path, value|
201
- raise StandardError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
220
+ raise BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
202
221
  end
203
222
 
204
223
  create_simple_trafo("sleep", "image/*", "image/*", true) do |input_path, target_path, value|
205
224
  p "SLEEEP"
206
225
  sleep(value.to_i)
207
- raise StandardError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
226
+ raise BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
208
227
  end
209
228
 
210
229
  create_simple_trafo("unzip", "application/zip", "*/*", false) do |input_path, target_path, value|
@@ -1,3 +1,3 @@
1
1
  module Blobsterix
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.33"
3
3
  end
data/lib/blobsterix.rb CHANGED
@@ -84,12 +84,16 @@ require 'blobsterix/transformation/image_transformation'
84
84
  #service base
85
85
  require 'blobsterix/service'
86
86
 
87
+ #exceptions
88
+ require 'blobsterix/exceptions'
89
+
87
90
  BLOBSTERIX_ROOT=Dir.pwd
88
91
  BLOBSTERIX_GEM_DIR = File.join(File.dirname(__FILE__), "../")
89
92
 
90
93
  Zip.on_exists_proc = true
91
94
 
92
95
  module Blobsterix
96
+
93
97
  def self.root
94
98
  @root ||= Pathname.new(BLOBSTERIX_ROOT)
95
99
  end
metadata CHANGED
@@ -1,209 +1,209 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.8.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: goliath
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: journey
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.6.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.6.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby-webp
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mini_magick
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.5.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.5.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubyzip
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.0.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.0.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: log4r
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.9.6
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.9.6
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 2.14.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 2.14.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rspec-core
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec-expectations
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rspec-mocks
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - '>='
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '>='
192
+ - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: pry
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - '>='
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - '>='
206
+ - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  description: Blobsterix is a transcoding, caching, storage server that can transform
@@ -215,8 +215,8 @@ executables:
215
215
  extensions: []
216
216
  extra_rdoc_files: []
217
217
  files:
218
- - .gitignore
219
- - .travis.yml
218
+ - ".gitignore"
219
+ - ".travis.yml"
220
220
  - CHANGELOG.txt
221
221
  - Gemfile
222
222
  - LICENSE
@@ -229,6 +229,7 @@ files:
229
229
  - lib/blobsterix.rb
230
230
  - lib/blobsterix/blob/blob_api.rb
231
231
  - lib/blobsterix/blob/blob_url_helper.rb
232
+ - lib/blobsterix/exceptions.rb
232
233
  - lib/blobsterix/helper/accept_type.rb
233
234
  - lib/blobsterix/helper/blob_access.rb
234
235
  - lib/blobsterix/helper/config_loader.rb
@@ -306,17 +307,17 @@ require_paths:
306
307
  - lib
307
308
  required_ruby_version: !ruby/object:Gem::Requirement
308
309
  requirements:
309
- - - '>='
310
+ - - ">="
310
311
  - !ruby/object:Gem::Version
311
312
  version: 2.0.0.451
312
313
  required_rubygems_version: !ruby/object:Gem::Requirement
313
314
  requirements:
314
- - - '>='
315
+ - - ">="
315
316
  - !ruby/object:Gem::Version
316
317
  version: '0'
317
318
  requirements: []
318
319
  rubyforge_project:
319
- rubygems_version: 2.0.14
320
+ rubygems_version: 2.4.5.1
320
321
  signing_key:
321
322
  specification_version: 4
322
323
  summary: Blobsterix is a transcoding, caching, storage server.