blobsterix 0.0.9

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.
Files changed (67) hide show
  1. data/.gitignore +27 -0
  2. data/CHANGELOG.txt +13 -0
  3. data/Gemfile +16 -0
  4. data/LICENSE +22 -0
  5. data/README.md +122 -0
  6. data/Rakefile +13 -0
  7. data/bin/blobsterix +152 -0
  8. data/bin/test +26 -0
  9. data/blobsterix.gemspec +39 -0
  10. data/config/lighttpd.conf +50 -0
  11. data/lib/blobsterix.rb +213 -0
  12. data/lib/blobsterix/blob/blob_api.rb +55 -0
  13. data/lib/blobsterix/blob/blob_url_helper.rb +55 -0
  14. data/lib/blobsterix/helper/accept_type.rb +62 -0
  15. data/lib/blobsterix/helper/blob_access.rb +73 -0
  16. data/lib/blobsterix/helper/config_loader.rb +33 -0
  17. data/lib/blobsterix/helper/data_response.rb +54 -0
  18. data/lib/blobsterix/helper/http.rb +47 -0
  19. data/lib/blobsterix/helper/logable.rb +11 -0
  20. data/lib/blobsterix/helper/murmur.rb +137 -0
  21. data/lib/blobsterix/helper/status_info.rb +42 -0
  22. data/lib/blobsterix/helper/template_renderer.rb +39 -0
  23. data/lib/blobsterix/mimemagic/magic.rb +138 -0
  24. data/lib/blobsterix/mimemagic/tables.rb +1770 -0
  25. data/lib/blobsterix/mimemagic/version.rb +5 -0
  26. data/lib/blobsterix/router/app_router.rb +134 -0
  27. data/lib/blobsterix/s3/s3_api.rb +92 -0
  28. data/lib/blobsterix/s3/s3_url_helper.rb +93 -0
  29. data/lib/blobsterix/service.rb +34 -0
  30. data/lib/blobsterix/status/status_api.rb +62 -0
  31. data/lib/blobsterix/status/status_url_helper.rb +11 -0
  32. data/lib/blobsterix/storage/blob_meta_data.rb +60 -0
  33. data/lib/blobsterix/storage/bucket.rb +36 -0
  34. data/lib/blobsterix/storage/bucket_entry.rb +29 -0
  35. data/lib/blobsterix/storage/bucket_list.rb +26 -0
  36. data/lib/blobsterix/storage/cache.rb +90 -0
  37. data/lib/blobsterix/storage/file_system.rb +132 -0
  38. data/lib/blobsterix/storage/file_system_meta_data.rb +136 -0
  39. data/lib/blobsterix/storage/storage.rb +30 -0
  40. data/lib/blobsterix/transformation/image_transformation.rb +439 -0
  41. data/lib/blobsterix/transformation/transformation.rb +30 -0
  42. data/lib/blobsterix/transformation/transformation_chain.rb +78 -0
  43. data/lib/blobsterix/transformation/transformation_manager.rb +115 -0
  44. data/lib/blobsterix/version.rb +3 -0
  45. data/scripts/download.rb +30 -0
  46. data/scripts/test +6 -0
  47. data/spec/lib/blob/blob_api_spec.rb +81 -0
  48. data/spec/lib/helper/blob_access_spec.rb +72 -0
  49. data/spec/lib/s3/s3_api_spec.rb +183 -0
  50. data/spec/lib/service_spec.rb +12 -0
  51. data/spec/lib/status/status_api_spec.rb +42 -0
  52. data/spec/lib/storage/cache_spec.rb +135 -0
  53. data/spec/lib/storage/file_system_spec.rb +84 -0
  54. data/spec/spec_helper.rb +139 -0
  55. data/templates/app/Gemfile +12 -0
  56. data/templates/app/Rakefile +7 -0
  57. data/templates/app/config.rb +61 -0
  58. data/templates/app/config/environments/development.rb +40 -0
  59. data/templates/app/config/environments/production.rb +40 -0
  60. data/templates/app/storages/.keep +0 -0
  61. data/templates/app/transformators/.keep +0 -0
  62. data/templates/app/views/.keep +0 -0
  63. data/templates/storage_template.rb +30 -0
  64. data/templates/transformation_template.rb +41 -0
  65. data/templates/views/error_page.erb +18 -0
  66. data/templates/views/status_page.erb +31 -0
  67. metadata +325 -0
@@ -0,0 +1,40 @@
1
+ # # Use a different logger
2
+ # Blobsterix.logger=Logger.new(STDOUT)
3
+
4
+ # # Set different dirs
5
+ # Blobsterix.storage_dir=Blobsterix.root.join("contents")
6
+ # Blobsterix.cache_dir=Blobsterix.root.join("cache")
7
+
8
+ # # Set different cache or storage handler
9
+ # Blobsterix.storage=Blobsterix::Storage::FileSystem.new(Blobsterix.storage_dir)
10
+ # Blobsterix.cache=Blobsterix::Storage::Cache.new(cache_dir)
11
+
12
+ # # Set different transformation manager
13
+ # Blobsterix.transformation=Blobsterix::Transformations::TransformationManager.new
14
+
15
+ # # Use a specific transformation decrypter
16
+ # Blobsterix.decrypt_trafo= lambda { |blob_access, trafo_string, logger|
17
+ # trafo_string # this has to return a string in format of: trafoName_value,trafoName_value,....
18
+ # }
19
+
20
+ # # Use a specific cache checker for invalidation
21
+ # Blobsterix.cache_checker= lambda { |blob_access, last_accessed_at, created_at|
22
+ # false # return true to invalidate the cache entry
23
+ # }
24
+
25
+ # # Use a specific storage and cache event listener
26
+ # Blobsterix.storage_event_listener= lambda { |target, blob_access|
27
+ # # target is what happend where
28
+ # # Possible events are:
29
+ # # encryption.error
30
+ # # cache.miss
31
+ # # cache.fatal_error
32
+ # # cache.hit
33
+ # # storage.read
34
+ # # storage.read_fail
35
+ # # storage.write
36
+ # # storage.delete
37
+ #
38
+ # # do stuff here... on standard it just logs the access
39
+ # logger.info("#{target}: #{blob_access}")
40
+ # }
@@ -0,0 +1,40 @@
1
+ # # Use a different logger
2
+ # Blobsterix.logger=Logger.new(STDOUT)
3
+
4
+ # # Set different dirs
5
+ # Blobsterix.storage_dir=Blobsterix.root.join("contents")
6
+ # Blobsterix.cache_dir=Blobsterix.root.join("cache")
7
+
8
+ # # Set different cache or storage handler
9
+ # Blobsterix.storage=Blobsterix::Storage::FileSystem.new(Blobsterix.storage_dir)
10
+ # Blobsterix.cache=Blobsterix::Storage::Cache.new(cache_dir)
11
+
12
+ # # Set different transformation manager
13
+ # Blobsterix.transformation=Blobsterix::Transformations::TransformationManager.new
14
+
15
+ # # Use a specific transformation decrypter
16
+ # Blobsterix.decrypt_trafo= lambda { |blob_access, trafo_string, logger|
17
+ # trafo_string # this has to return a string in format of: trafoName_value,trafoName_value,....
18
+ # }
19
+
20
+ # # Use a specific cache checker for invalidation
21
+ # Blobsterix.cache_checker= lambda { |blob_access, last_accessed_at, created_at|
22
+ # false # return true to invalidate the cache entry
23
+ # }
24
+
25
+ # # Use a specific storage and cache event listener
26
+ # Blobsterix.storage_event_listener= lambda { |target, blob_access|
27
+ # # target is what happend where
28
+ # # Possible events are:
29
+ # # encryption.error
30
+ # # cache.miss
31
+ # # cache.fatal_error
32
+ # # cache.hit
33
+ # # storage.read
34
+ # # storage.read_fail
35
+ # # storage.write
36
+ # # storage.delete
37
+ #
38
+ # # do stuff here... on standard it just logs the access
39
+ # logger.info("#{target}: #{blob_access}")
40
+ # }
File without changes
File without changes
File without changes
@@ -0,0 +1,30 @@
1
+ module Blobsterix
2
+ module Storage
3
+ class $ClassNameStorage < Storage
4
+ def list(bucket="root")
5
+ Nokogiri::XML::Builder.new do |xml|
6
+ xml.Error "no such bucket"
7
+ end
8
+ end
9
+ def bucket_exist(bucket="root")
10
+ false
11
+ end
12
+ def get(bucket, key)
13
+ Blobsterix::Storage::BlobMetaData.new
14
+ end
15
+ def put(bucket, key, value)
16
+ Blobsterix::Storage::BlobMetaData.new
17
+ end
18
+ def create(bucket)
19
+ Nokogiri::XML::Builder.new do |xml|
20
+ end
21
+ end
22
+ def delete(bucket)
23
+ nil
24
+ end
25
+ def delete_key(bucket, key)
26
+ nil
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,41 @@
1
+ module Blobsterix::Transformations::Impl
2
+ class $ClassNameTransformation < Blobsterix::Transformations::Transformation
3
+
4
+ def name()
5
+ #this function should return the name of the trafo that will be used in the url
6
+ "$url_name"
7
+ end
8
+
9
+ def is_format?()
10
+ # this function tells the transformation chain if this transformation counts as a fixed format.
11
+ # That way no further transformation will be added if the browser requested a different format.
12
+ # usefull to force a specific format
13
+ # @return
14
+ # => true : force format
15
+ # => false: allow different format
16
+ false
17
+ end
18
+
19
+ def input_type()
20
+ # this function should return a Blobsterix::AcceptType that tells the transformator
21
+ # which formats are supported
22
+ # its normal mimetype
23
+ @input_type ||= Blobsterix::AcceptType.new "*/*"
24
+ end
25
+
26
+ def output_type()
27
+ # this function should return a Blobsterix::AcceptType that tells the transformator
28
+ # which format is produced by this transformation
29
+ # its normal mimetype
30
+ @output_type ||= Blobsterix::AcceptType.new "*/*"
31
+ end
32
+
33
+ def transform(input_path, target_path, value)
34
+ # this function is doing the actual work
35
+ # the input file is in input_path and the result of the transformation shall be written
36
+ # to target_path. The value parameter is a string that is given to the transformation.
37
+ # The value parsing and verification has to be done here.
38
+ FileUtils.cp(input_path, target_path)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=windows-1250">
5
+ <title><%=title%></title>
6
+ <style type="text/css">
7
+ .c {
8
+ text-align: center;
9
+ }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <h1 class="c"><%=error_code%></h1>
14
+ <div class="c">
15
+ <%=content%>
16
+ </div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>Blobsterix Status Page</title>
5
+ <style type="text/css">
6
+ .content {
7
+ width: 80%;
8
+ margin: auto;
9
+ text-align: center;
10
+ }
11
+ </style>
12
+ </head>
13
+ <body>
14
+ <h1 align="center">Blobsterix Status</h1>
15
+
16
+ <div class="content">
17
+ <div>Cache-Hit-Rate: <%=cache_hit_rate%></div>
18
+ <hr/>
19
+ <div>Cache-Hits: <%=cache_hits%></div>
20
+ <div>Cache-Misses: <%=cache_misses%></div>
21
+ <div>Cache-Accesses: <%=cache_accesses%></div>
22
+ <div>Cache-Cache-Errors: <%=cache_errors%></div>
23
+ <hr/>
24
+ <div>Current Connections: <%=connections%></div>
25
+ <hr/>
26
+ <div>RAM Used: <%=ram_usage%></div>
27
+ <hr/>
28
+ <div>UpTime: <%=uptime%></div>
29
+ </div>
30
+ </body>
31
+ </html>
metadata ADDED
@@ -0,0 +1,325 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blobsterix
3
+ version: !ruby/object:Gem::Version
4
+ hash: 13
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 9
10
+ version: 0.0.9
11
+ platform: ruby
12
+ authors:
13
+ - Daniel Sudmann
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2014-04-10 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: json
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 53
30
+ segments:
31
+ - 1
32
+ - 8
33
+ - 1
34
+ version: 1.8.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: goliath
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 17
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 3
50
+ version: 1.0.3
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: journey
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 31
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 4
66
+ version: 1.0.4
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: nokogiri
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 13
78
+ segments:
79
+ - 1
80
+ - 6
81
+ - 1
82
+ version: 1.6.1
83
+ type: :runtime
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: ruby-webp
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ hash: 27
94
+ segments:
95
+ - 0
96
+ - 1
97
+ - 0
98
+ version: 0.1.0
99
+ type: :runtime
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: mini_magick
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 19
110
+ segments:
111
+ - 3
112
+ - 5
113
+ - 0
114
+ version: 3.5.0
115
+ type: :runtime
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
129
+ type: :development
130
+ version_requirements: *id007
131
+ - !ruby/object:Gem::Dependency
132
+ name: rspec-core
133
+ prerelease: false
134
+ requirement: &id008 !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 3
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ type: :development
144
+ version_requirements: *id008
145
+ - !ruby/object:Gem::Dependency
146
+ name: rspec-expectations
147
+ prerelease: false
148
+ requirement: &id009 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ type: :development
158
+ version_requirements: *id009
159
+ - !ruby/object:Gem::Dependency
160
+ name: rspec-mocks
161
+ prerelease: false
162
+ requirement: &id010 !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
171
+ type: :development
172
+ version_requirements: *id010
173
+ - !ruby/object:Gem::Dependency
174
+ name: pry
175
+ prerelease: false
176
+ requirement: &id011 !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ hash: 3
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ type: :development
186
+ version_requirements: *id011
187
+ description: BlobServer
188
+ email:
189
+ - suddani@googlemail.com
190
+ executables:
191
+ - blobsterix
192
+ extensions: []
193
+
194
+ extra_rdoc_files: []
195
+
196
+ files:
197
+ - .gitignore
198
+ - CHANGELOG.txt
199
+ - Gemfile
200
+ - LICENSE
201
+ - README.md
202
+ - Rakefile
203
+ - bin/blobsterix
204
+ - bin/test
205
+ - blobsterix.gemspec
206
+ - config/lighttpd.conf
207
+ - contents/images/417/40e/208/792/06e/113/syncview21.png
208
+ - contents/images/417/40e/208/792/06e/113/syncview21.png.meta
209
+ - contents/images/61d/6ca/3c0/04f/011/009/editor.html
210
+ - contents/images/61d/6ca/3c0/04f/011/009/editor.html.meta
211
+ - contents/images/628/643/14d/091/405/04c/syncview21force.png
212
+ - contents/images/628/643/14d/091/405/04c/syncview21force.png.meta
213
+ - contents/images/64a/7e6/43a/340/05a/052/expired.png
214
+ - contents/images/64a/7e6/43a/340/05a/052/expired.png.meta
215
+ - contents/images/683/0e0/193/1fc/360/102/expired_0.png
216
+ - contents/images/683/0e0/193/1fc/360/102/expired_0.png.meta
217
+ - contents/images/74a/468/084/62e/43d/056/IMG_06102011_152958.png
218
+ - contents/images/74a/468/084/62e/43d/056/IMG_06102011_152958.png.meta
219
+ - contents/presentation/417/40e/208/792/06e/113/syncview21.png
220
+ - contents/presentation/4a2/0fe/748/079/613/0f1/blobsterix.html
221
+ - contents/presentation/4fe/468/31c/3a3/6b7/0f1/experteer.png
222
+ - contents/presentation/67c/581/1f9/341/75e/13f/crop.png
223
+ - lib/blobsterix.rb
224
+ - lib/blobsterix/blob/blob_api.rb
225
+ - lib/blobsterix/blob/blob_url_helper.rb
226
+ - lib/blobsterix/helper/accept_type.rb
227
+ - lib/blobsterix/helper/blob_access.rb
228
+ - lib/blobsterix/helper/config_loader.rb
229
+ - lib/blobsterix/helper/data_response.rb
230
+ - lib/blobsterix/helper/http.rb
231
+ - lib/blobsterix/helper/logable.rb
232
+ - lib/blobsterix/helper/murmur.rb
233
+ - lib/blobsterix/helper/status_info.rb
234
+ - lib/blobsterix/helper/template_renderer.rb
235
+ - lib/blobsterix/mimemagic/magic.rb
236
+ - lib/blobsterix/mimemagic/tables.rb
237
+ - lib/blobsterix/mimemagic/version.rb
238
+ - lib/blobsterix/router/app_router.rb
239
+ - lib/blobsterix/s3/s3_api.rb
240
+ - lib/blobsterix/s3/s3_url_helper.rb
241
+ - lib/blobsterix/service.rb
242
+ - lib/blobsterix/status/status_api.rb
243
+ - lib/blobsterix/status/status_url_helper.rb
244
+ - lib/blobsterix/storage/blob_meta_data.rb
245
+ - lib/blobsterix/storage/bucket.rb
246
+ - lib/blobsterix/storage/bucket_entry.rb
247
+ - lib/blobsterix/storage/bucket_list.rb
248
+ - lib/blobsterix/storage/cache.rb
249
+ - lib/blobsterix/storage/file_system.rb
250
+ - lib/blobsterix/storage/file_system_meta_data.rb
251
+ - lib/blobsterix/storage/storage.rb
252
+ - lib/blobsterix/transformation/image_transformation.rb
253
+ - lib/blobsterix/transformation/transformation.rb
254
+ - lib/blobsterix/transformation/transformation_chain.rb
255
+ - lib/blobsterix/transformation/transformation_manager.rb
256
+ - lib/blobsterix/version.rb
257
+ - scripts/download.rb
258
+ - scripts/test
259
+ - spec/lib/blob/blob_api_spec.rb
260
+ - spec/lib/helper/blob_access_spec.rb
261
+ - spec/lib/s3/s3_api_spec.rb
262
+ - spec/lib/service_spec.rb
263
+ - spec/lib/status/status_api_spec.rb
264
+ - spec/lib/storage/cache_spec.rb
265
+ - spec/lib/storage/file_system_spec.rb
266
+ - spec/spec_helper.rb
267
+ - templates/app/Gemfile
268
+ - templates/app/Rakefile
269
+ - templates/app/config.rb
270
+ - templates/app/config/environments/development.rb
271
+ - templates/app/config/environments/production.rb
272
+ - templates/app/storages/.keep
273
+ - templates/app/transformators/.keep
274
+ - templates/app/views/.keep
275
+ - templates/storage_template.rb
276
+ - templates/transformation_template.rb
277
+ - templates/views/error_page.erb
278
+ - templates/views/status_page.erb
279
+ has_rdoc: true
280
+ homepage: http://experteer.com
281
+ licenses:
282
+ - MIT License
283
+ post_install_message:
284
+ rdoc_options: []
285
+
286
+ require_paths:
287
+ - lib
288
+ required_ruby_version: !ruby/object:Gem::Requirement
289
+ none: false
290
+ requirements:
291
+ - - ">="
292
+ - !ruby/object:Gem::Version
293
+ hash: -3603376774
294
+ segments:
295
+ - 2
296
+ - 0
297
+ - 0
298
+ - p
299
+ - 451
300
+ version: 2.0.0.p451
301
+ required_rubygems_version: !ruby/object:Gem::Requirement
302
+ none: false
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ hash: 3
307
+ segments:
308
+ - 0
309
+ version: "0"
310
+ requirements: []
311
+
312
+ rubyforge_project:
313
+ rubygems_version: 1.5.3
314
+ signing_key:
315
+ specification_version: 3
316
+ summary: BlobServer
317
+ test_files:
318
+ - spec/lib/blob/blob_api_spec.rb
319
+ - spec/lib/helper/blob_access_spec.rb
320
+ - spec/lib/s3/s3_api_spec.rb
321
+ - spec/lib/service_spec.rb
322
+ - spec/lib/status/status_api_spec.rb
323
+ - spec/lib/storage/cache_spec.rb
324
+ - spec/lib/storage/file_system_spec.rb
325
+ - spec/spec_helper.rb