aws 2.3.7 → 2.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/awsbase/support.rb +90 -86
- data/lib/s3/right_s3_interface.rb +2 -1
- metadata +3 -3
data/lib/awsbase/support.rb
CHANGED
@@ -2,110 +2,114 @@
|
|
2
2
|
# want a dependency on it, so if it's not present, define the few
|
3
3
|
# extensions that we want to use...
|
4
4
|
unless defined? ActiveSupport
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
25
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
26
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
27
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
28
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
29
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
|
-
#++
|
31
|
-
#
|
32
|
-
#
|
33
|
-
class String #:nodoc:
|
34
|
-
|
35
|
-
# Constantize tries to find a declared constant with the name specified
|
36
|
-
# in the string. It raises a NameError when the name is not in CamelCase
|
37
|
-
# or is not initialized.
|
5
|
+
# These are ActiveSupport-;like extensions to do a few handy things in the gems
|
6
|
+
# Derived from ActiveSupport, so the AS copyright notice applies:
|
7
|
+
#
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# Copyright (c) 2005 David Heinemeier Hansson
|
11
|
+
#
|
12
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
13
|
+
# a copy of this software and associated documentation files (the
|
14
|
+
# "Software"), to deal in the Software without restriction, including
|
15
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
16
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
17
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
18
|
+
# the following conditions:
|
19
|
+
#
|
20
|
+
# The above copyright notice and this permission notice shall be
|
21
|
+
# included in all copies or substantial portions of the Software.
|
38
22
|
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
23
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
25
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
26
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
27
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
28
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
29
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
|
+
#++
|
31
|
+
#
|
32
|
+
#
|
33
|
+
class String #:nodoc:
|
34
|
+
|
35
|
+
# Constantize tries to find a declared constant with the name specified
|
36
|
+
# in the string. It raises a NameError when the name is not in CamelCase
|
37
|
+
# or is not initialized.
|
38
|
+
#
|
39
|
+
# Examples
|
40
|
+
# "Module".constantize #=> Module
|
41
|
+
# "Class".constantize #=> Class
|
42
|
+
def constantize()
|
43
|
+
camel_cased_word = self
|
44
|
+
names = camel_cased_word.split('::')
|
45
|
+
names.shift if names.empty? || names.first.empty?
|
46
|
+
|
47
|
+
constant = Object
|
48
|
+
names.each do |name|
|
49
|
+
constant = constant.const_get(name, false) || constant.const_missing(name)
|
50
|
+
end
|
51
|
+
constant
|
52
|
+
end
|
46
53
|
|
47
|
-
Object.module_eval("::#{$1}", __FILE__, __LINE__)
|
48
54
|
end
|
49
55
|
|
50
|
-
end
|
51
56
|
|
57
|
+
class Object #:nodoc:
|
58
|
+
# "", " ", nil, [], and {} are blank
|
59
|
+
def blank?
|
60
|
+
if respond_to?(:empty?) && respond_to?(:strip)
|
61
|
+
empty? or strip.empty?
|
62
|
+
elsif respond_to?(:empty?)
|
63
|
+
empty?
|
64
|
+
else
|
65
|
+
!self
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
52
69
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
empty? or strip.empty?
|
58
|
-
elsif respond_to?(:empty?)
|
59
|
-
empty?
|
60
|
-
else
|
61
|
-
!self
|
62
|
-
end
|
70
|
+
class NilClass #:nodoc:
|
71
|
+
def blank?
|
72
|
+
true
|
73
|
+
end
|
63
74
|
end
|
64
|
-
end
|
65
75
|
|
66
|
-
|
67
|
-
|
68
|
-
|
76
|
+
class FalseClass #:nodoc:
|
77
|
+
def blank?
|
78
|
+
true
|
79
|
+
end
|
69
80
|
end
|
70
|
-
end
|
71
81
|
|
72
|
-
|
73
|
-
|
74
|
-
|
82
|
+
class TrueClass #:nodoc:
|
83
|
+
def blank?
|
84
|
+
false
|
85
|
+
end
|
75
86
|
end
|
76
|
-
end
|
77
87
|
|
78
|
-
|
79
|
-
|
80
|
-
false
|
88
|
+
class Array #:nodoc:
|
89
|
+
alias_method :blank?, :empty?
|
81
90
|
end
|
82
|
-
end
|
83
91
|
|
84
|
-
|
85
|
-
|
86
|
-
end
|
92
|
+
class Hash #:nodoc:
|
93
|
+
alias_method :blank?, :empty?
|
87
94
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
options
|
96
|
-
end
|
95
|
+
# Return a new hash with all keys converted to symbols.
|
96
|
+
def symbolize_keys
|
97
|
+
inject({}) do |options, (key, value)|
|
98
|
+
options[key.to_sym] = value
|
99
|
+
options
|
100
|
+
end
|
101
|
+
end
|
97
102
|
end
|
98
|
-
end
|
99
103
|
|
100
|
-
|
101
|
-
|
102
|
-
|
104
|
+
class String #:nodoc:
|
105
|
+
def blank?
|
106
|
+
empty? || strip.empty?
|
107
|
+
end
|
103
108
|
end
|
104
|
-
end
|
105
109
|
|
106
|
-
|
107
|
-
|
108
|
-
|
110
|
+
class Numeric #:nodoc:
|
111
|
+
def blank?
|
112
|
+
false
|
113
|
+
end
|
109
114
|
end
|
110
|
-
end
|
111
115
|
end
|
@@ -402,7 +402,8 @@ module Aws
|
|
402
402
|
(data.respond_to?(:size) && data.size >= USE_100_CONTINUE_PUT_SIZE)
|
403
403
|
headers['expect'] = '100-continue'
|
404
404
|
end
|
405
|
-
req_hash = generate_rest_request('PUT', headers.merge(:url=>"#{bucket}/#{CGI::escape key}", :data=>data
|
405
|
+
req_hash = generate_rest_request('PUT', headers.merge(:url=>"#{bucket}/#{CGI::escape key}", :data=>data,
|
406
|
+
'Content-Length' => ((data && data.size) || 0).to_s))
|
406
407
|
request_info(req_hash, RightHttp2xxParser.new)
|
407
408
|
rescue
|
408
409
|
on_exception
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 2.3.
|
8
|
+
- 8
|
9
|
+
version: 2.3.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Travis Reeder
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-08 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|