condo 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/condo/configuration.rb +5 -11
- data/lib/condo/strata/open_stack_swift.rb +24 -25
- data/lib/condo/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: 8ee92183ae24774b0f9c5fda025f9632bb3560e7
|
4
|
+
data.tar.gz: f589c67b56e83ff7252f06bad73ec7067e6ecf3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe6c8701d1cb6ddcfc2e6ecd48c9f0dd9a7290fb651af2bac719f264cd91f55ed94496329d12920df90c5583dba7b5fafa28f9818d1e6229273b9f9520b54b0
|
7
|
+
data.tar.gz: c8eb497535c733525785e9d1b2705af97bfcc1646a205f154a63a6636c3f65acd578d54c3b9241e954332f173a4b32df64fe1edb294d4437df359fbcad108f9f
|
data/lib/condo/configuration.rb
CHANGED
@@ -1,17 +1,13 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
|
3
1
|
|
4
2
|
module Condo
|
5
|
-
|
6
3
|
class Configuration
|
7
|
-
include Singleton
|
8
|
-
|
9
|
-
|
10
4
|
@@callbacks = {
|
5
|
+
# Must be defined by the including class:
|
6
|
+
#:resident_id => proc
|
7
|
+
#:bucket_name => proc
|
8
|
+
#:upload_complete => proc
|
9
|
+
#:destroy_upload => proc
|
11
10
|
#
|
12
|
-
#:resident_id # Must be defined by the including class
|
13
|
-
#
|
14
|
-
:bucket_name => proc {"#{Rails.application.class.parent_name}#{instance_eval @@callbacks[:resident_id]}"},
|
15
11
|
:object_key => proc { |upload|
|
16
12
|
if upload[:file_path]
|
17
13
|
upload[:file_path] + upload[:file_name]
|
@@ -42,8 +38,6 @@ module Condo
|
|
42
38
|
# upload will only be present if it already exists
|
43
39
|
config.residencies[0]
|
44
40
|
}
|
45
|
-
#:upload_complete # Must be defined by the including class
|
46
|
-
#:destroy_upload # the actual delete should be done by the application
|
47
41
|
}
|
48
42
|
|
49
43
|
def self.callbacks
|
@@ -66,7 +66,7 @@ class Condo::Strata::OpenStackSwift
|
|
66
66
|
end
|
67
67
|
|
68
68
|
|
69
|
-
def allow_cors(domains = 'http://localhost:
|
69
|
+
def allow_cors(domains = 'http://localhost:9000', options_age = 10, headers = 'etag, content-type, accept, origin, x-requested-with')
|
70
70
|
fog_connection.request(
|
71
71
|
:expects => [201, 202, 204],
|
72
72
|
:method => 'POST',
|
@@ -152,29 +152,28 @@ class Condo::Strata::OpenStackSwift
|
|
152
152
|
|
153
153
|
request = {}
|
154
154
|
if options[:part] == 'finish'
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
request[:signature] = sign_request(options, '&multipart-manifest=put')
|
155
|
+
# Dynamic large object now have to be created on the server...
|
156
|
+
# Static Large Objects could be created client side.
|
157
|
+
if @options[:use_static_large_objects]
|
158
|
+
options[:object_options][:headers]['ETag'] = options[:file_id] if options[:file_id].present?
|
159
|
+
options[:object_options][:headers]['Content-Type'] = 'text/plain'
|
160
|
+
options[:object_key] = CGI::escape(options[:object_key])
|
161
|
+
request[:signature] = sign_request(options, 'multipart-manifest=put&')
|
162
|
+
else
|
163
|
+
key = CGI::escape options[:object_key]
|
164
|
+
|
165
|
+
# Send the commitment request
|
166
|
+
fog_connection.request(
|
167
|
+
:expects => [200, 201],
|
168
|
+
:method => 'PUT',
|
169
|
+
:headers => {
|
170
|
+
'X-Object-Manifest' => "#{CGI::escape options[:bucket_name]}/#{key}/p"
|
171
|
+
},
|
172
|
+
path: "#{CGI::escape options[:bucket_name]}/#{key}"
|
173
|
+
)
|
174
|
+
|
175
|
+
return {}
|
176
|
+
end
|
178
177
|
else
|
179
178
|
# Send the part upload request
|
180
179
|
options[:object_options][:headers]['ETag'] = options[:file_id] if options[:file_id].present? && options[:object_options][:headers]['ETag'].nil?
|
@@ -235,7 +234,7 @@ This is how that was done. We now use Static Large Objects that can be created c
|
|
235
234
|
# Finish building the request
|
236
235
|
return {
|
237
236
|
:verb => options[:object_options][:verb].to_s.upcase,
|
238
|
-
:url => "#{options[:http_only] ? 'http' : 'https'}://#{@options[:location]}#{url}
|
237
|
+
:url => "#{options[:http_only] ? 'http' : 'https'}://#{@options[:location]}#{url}?#{param}temp_url_sig=#{signature}&temp_url_expires=#{options[:object_options][:expires]}",
|
239
238
|
:headers => options[:object_options][:headers]
|
240
239
|
}
|
241
240
|
end
|
data/lib/condo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: condo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|