blobsterix 0.0.37 → 0.0.38

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: 7855675566155a8bd7be89629163eaf8af99f2fd
4
- data.tar.gz: cb18dcdf5d1c689e5c972a0da97a0e62f1a5a5eb
3
+ metadata.gz: 3a9e6d538173dbacbf3af12d3e416e133c8e793a
4
+ data.tar.gz: 365dc0beceee264a2716b3b32115f5e050ebd4b9
5
5
  SHA512:
6
- metadata.gz: 5ea49c92c6b6534a3d848231dd2dc24533c8d298dc88d992e8a0e0799f6115a663f9be22398986d195807ff939c630c84145af6c3bc6dbfb3d7637fce5043e47
7
- data.tar.gz: 440788ca5b7fe95ccae87486e1656bf04856bcb5c1c8383ec910ec3beef8477c31a3c239548006c9ef2caf00e820ed830626ff0a69416bbb9e404ab02e1aefb5
6
+ metadata.gz: 132b64eb5d6d89b4280324e7b393f937c0ae3e0f38f2ad7e255d191b4f7613b1080d94703128505f6889e05db57c389fbc6d4c90414daeba0a9c57b69f495137
7
+ data.tar.gz: a92c3cf0588e8591033298a6b3962d4141c529a29e0a48f7c23c73741db46b26feaacc79cdd48d258de6a1c9abc570fb15261f2606a40211bb5f998d31b37bf1
@@ -1,7 +1,7 @@
1
- module Blosterix
1
+ module Blobsterix
2
2
 
3
- class BlobsertixTransformationError < StandardError; end
3
+ class TransformationError < StandardError; end
4
4
 
5
- class BlobsterixStorageError < StandardError; end
5
+ class StorageError < StandardError; end
6
6
 
7
7
  end
@@ -15,10 +15,10 @@ module Blobsterix
15
15
  begin
16
16
  Dir.entries(contents).include?(bucket) and File.directory?(File.join(contents,bucket))
17
17
  rescue => e
18
- if e.is_a? ::Blosterix::BlobsterixStorageError
18
+ if e.is_a? ::Blobsterix::StorageError
19
19
  raise e
20
20
  else
21
- raise ::Blosterix::BlobsterixStorageError.new("Could not check for bucket")
21
+ raise ::Blobsterix::StorageError.new("Could not check for bucket")
22
22
  end
23
23
  end
24
24
  end
@@ -42,10 +42,10 @@ module Blobsterix
42
42
  end
43
43
  end
44
44
  rescue => e
45
- if e.is_a? ::Blosterix::BlobsterixStorageError
45
+ if e.is_a? ::Blobsterix::StorageError
46
46
  raise e
47
47
  else
48
- raise ::Blosterix::BlobsterixStorageError.new("Could not list bucket(s)")
48
+ raise ::Blobsterix::StorageError.new("Could not list bucket(s)")
49
49
  end
50
50
  end
51
51
  end
@@ -60,10 +60,10 @@ module Blobsterix
60
60
  Blobsterix::Storage::BlobMetaData.new
61
61
  end
62
62
  rescue => e
63
- if e.is_a? ::Blosterix::BlobsterixStorageError
63
+ if e.is_a? ::Blobsterix::StorageError
64
64
  raise e
65
65
  else
66
- raise ::Blosterix::BlobsterixStorageError.new("Could not get bucket entry: #{@contents_path}")
66
+ raise ::Blobsterix::StorageError.new("Could not get bucket entry: #{@contents_path}")
67
67
  end
68
68
  end
69
69
  end
@@ -86,10 +86,10 @@ module Blobsterix
86
86
 
87
87
  meta
88
88
  rescue => e
89
- if e.is_a? ::Blosterix::BlobsterixStorageError
89
+ if e.is_a? ::Blobsterix::StorageError
90
90
  raise e
91
91
  else
92
- raise ::Blosterix::BlobsterixStorageError.new("Could not create bucket entry")
92
+ raise ::Blobsterix::StorageError.new("Could not create bucket entry")
93
93
  end
94
94
  end
95
95
  end
@@ -103,10 +103,10 @@ module Blobsterix
103
103
  Nokogiri::XML::Builder.new do |xml|
104
104
  end.to_s
105
105
  rescue => e
106
- if e.is_a? ::Blosterix::BlobsterixStorageError
106
+ if e.is_a? ::Blobsterix::StorageError
107
107
  raise e
108
108
  else
109
- raise ::Blosterix::BlobsterixStorageError.new("Could not create bucket")
109
+ raise ::Blobsterix::StorageError.new("Could not create bucket")
110
110
  end
111
111
  end
112
112
  end
@@ -116,10 +116,10 @@ module Blobsterix
116
116
  logger.info "Storage: delete bucket #{contents(bucket)}"
117
117
  FileUtils.rm_rf(contents(bucket)) if bucket_exist(bucket) && bucket_empty?(bucket)
118
118
  rescue => e
119
- if e.is_a? ::Blosterix::BlobsterixStorageError
119
+ if e.is_a? ::Blobsterix::StorageError
120
120
  raise e
121
121
  else
122
- raise ::Blosterix::BlobsterixStorageError.new("Could not delete bucket")
122
+ raise ::Blobsterix::StorageError.new("Could not delete bucket")
123
123
  end
124
124
  end
125
125
  end
@@ -131,10 +131,10 @@ module Blobsterix
131
131
 
132
132
  metaData(bucket, key).delete # if bucket_files(bucket).include? key
133
133
  rescue => e
134
- if e.is_a? ::Blosterix::BlobsterixStorageError
134
+ if e.is_a? ::Blobsterix::StorageError
135
135
  raise e
136
136
  else
137
- raise ::Blosterix::BlobsterixStorageError.new("Could not delete bucket key")
137
+ raise ::Blobsterix::StorageError.new("Could not delete bucket key")
138
138
  end
139
139
  end
140
140
  end
@@ -186,7 +186,7 @@ module Blobsterix
186
186
  FileUtils.touch File.join(@contents_path,".keep")
187
187
  @contents = @contents_path
188
188
  rescue
189
- raise ::Blosterix::BlobsterixStorageError.new("Could not connect to FileSystem")
189
+ raise ::Blobsterix::StorageError.new("Could not connect to FileSystem")
190
190
  end
191
191
  end
192
192
 
@@ -90,7 +90,7 @@ module Blobsterix
90
90
  save_meta_file
91
91
  self
92
92
  rescue
93
- raise ::Blosterix::BlobsterixStorageError.new("Could not create MetaData entry")
93
+ raise ::Blobsterix::StorageError.new("Could not create MetaData entry")
94
94
  end
95
95
  end
96
96
 
@@ -104,7 +104,7 @@ module Blobsterix
104
104
  File.open(path, "rb")
105
105
  end
106
106
  rescue
107
- raise ::Blosterix::BlobsterixStorageError.new("Could not open FilesystemMetaData")
107
+ raise ::Blobsterix::StorageError.new("Could not open FilesystemMetaData")
108
108
  end
109
109
  end
110
110
 
@@ -149,7 +149,7 @@ module Blobsterix
149
149
  begin
150
150
  File.write(meta_path, to_json)
151
151
  rescue
152
- raise ::Blosterix::BlobsterixStorageError.new("Could not create MetaData entry")
152
+ raise ::Blobsterix::StorageError.new("Could not create MetaData entry")
153
153
  end
154
154
  end
155
155
  def load_meta_file
@@ -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 ::Blosterix::BlobsterixTransformationError.new("No gravity specified") unless gravity
101
+ raise ::Blobsterix::TransformationError.new("No gravity specified") unless gravity
102
102
  background = value.match(/background=(.*?);/)[1]
103
- raise ::Blosterix::BlobsterixTransformationError.new("No background specified") unless background
103
+ raise ::Blobsterix::TransformationError.new("No background specified") unless background
104
104
  size = value.match(/size=(.*?);/)[1]
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]+$/)
105
+ raise ::Blobsterix::TransformationError.new("No extent size specified") unless size
106
+ raise ::Blobsterix::TransformationError.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 ::Blosterix::BlobsterixTransformationError.new("The provided cropping values are wrong") unless values
145
+ raise ::Blobsterix::TransformationError.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 ::Blosterix::BlobsterixTransformationError.new("Values are to big") if width+x>1000 || height+y>1000
147
+ raise ::Blobsterix::TransformationError.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]}"
@@ -188,15 +188,15 @@ module Blobsterix::Transformations::Impl
188
188
  end
189
189
 
190
190
  create_simple_trafo("raw", "image/*", "image/*", true) do |input_path, target_path, value|
191
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
191
+ raise ::Blobsterix::TransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
192
192
  end
193
193
 
194
194
  create_simple_trafo("ascii", "image/*", "text/plain", true) do |input_path, target_path, value|
195
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
195
+ raise ::Blobsterix::TransformationError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
196
196
  end
197
197
 
198
198
  create_simple_trafo("png", "image/*", "image/png", true) do |input_path, target_path, value|
199
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
199
+ raise ::Blobsterix::TransformationError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
200
200
  end
201
201
 
202
202
  create_simple_trafo("base642bin", "text/plain", "*/*", false) do |input_path, target_path, value|
@@ -211,25 +211,25 @@ module Blobsterix::Transformations::Impl
211
211
  end
212
212
 
213
213
  create_simple_trafo("jpg", "image/*", "image/jpeg", true) do |input_path, target_path, value|
214
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
214
+ raise ::Blobsterix::TransformationError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
215
215
  end
216
216
 
217
217
  create_simple_trafo("gif", "image/*", "image/gif", true) do |input_path, target_path, value|
218
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
218
+ raise ::Blobsterix::TransformationError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
219
219
  end
220
220
 
221
221
  create_simple_trafo("webp", "image/png", "image/webp", true) do |input_path, target_path, value|
222
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
222
+ raise ::Blobsterix::TransformationError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
223
223
  end
224
224
 
225
225
  create_simple_trafo("text", "image/*", "image/*", true) do |input_path, target_path, value|
226
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
226
+ raise ::Blobsterix::TransformationError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
227
227
  end
228
228
 
229
229
  create_simple_trafo("sleep", "image/*", "image/*", true) do |input_path, target_path, value|
230
230
  p "SLEEEP"
231
231
  sleep(value.to_i)
232
- raise ::Blosterix::BlobsterixTransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
232
+ raise ::Blobsterix::TransformationError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
233
233
  end
234
234
 
235
235
  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.37"
2
+ VERSION = "0.0.38"
3
3
  end
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.37
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-26 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json