ghazel-aws-s3 0.6.4 → 0.6.4.1

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.
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class ServiceTest < Test::Unit::TestCase
4
+ def test_bucket_list_with_empty_bucket_list
5
+ mock_connection_for(Service, :returns => {:body => Fixtures::Buckets.empty_bucket_list, :code => 200})
6
+ list = Service.buckets(:reload)
7
+ assert_equal [], list
8
+ end
9
+
10
+ def test_bucket_list_with_bucket_list_containing_one_bucket
11
+ mock_connection_for(Service, :returns => {:body => Fixtures::Buckets.bucket_list_with_one_bucket, :code => 200})
12
+ list = Service.buckets(:reload)
13
+ assert_equal 1, list.size
14
+ assert_equal 'marcel_molina', list.first.name
15
+ end
16
+
17
+ def test_bucket_list_with_bucket_list_containing_more_than_one_bucket
18
+ mock_connection_for(Service, :returns => {:body => Fixtures::Buckets.bucket_list_with_more_than_one_bucket, :code => 200})
19
+ list = Service.buckets(:reload)
20
+ assert_equal 2, list.size
21
+ assert_equal %w(marcel_molina marcel_molina_jr), list.map {|bucket| bucket.name}.sort
22
+ end
23
+ end
@@ -0,0 +1,110 @@
1
+ require 'test/unit'
2
+ $:.unshift File.dirname(__FILE__) + '/../lib'
3
+ require 'aws/s3'
4
+ require File.dirname(__FILE__) + '/mocks/fake_response'
5
+ require File.dirname(__FILE__) + '/fixtures'
6
+ begin
7
+ require_library_or_gem 'ruby-debug'
8
+ rescue LoadError
9
+ end
10
+ require_library_or_gem 'flexmock'
11
+ require_library_or_gem 'flexmock/test_unit'
12
+
13
+
14
+ # Data copied from http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAuthentication.html
15
+ module AmazonDocExampleData
16
+ module Example1
17
+ module_function
18
+
19
+ def request
20
+ request = Net::HTTP::Put.new('/quotes/nelson')
21
+ request['Content-Md5'] = 'c8fdb181845a4ca6b8fec737b3581d76'
22
+ request['Content-Type'] = 'text/html'
23
+ request['Date'] = 'Thu, 17 Nov 2005 18:49:58 GMT'
24
+ request['X-Amz-Meta-Author'] = 'foo@bar.com'
25
+ request['X-Amz-Magic'] = 'abracadabra'
26
+ request
27
+ end
28
+
29
+ def canonical_string
30
+ "PUT\nc8fdb181845a4ca6b8fec737b3581d76\ntext/html\nThu, 17 Nov 2005 18:49:58 GMT\nx-amz-magic:abracadabra\nx-amz-meta-author:foo@bar.com\n/quotes/nelson"
31
+ end
32
+
33
+ def access_key_id
34
+ '44CF9590006BF252F707'
35
+ end
36
+
37
+ def secret_access_key
38
+ 'OtxrzxIsfpFjA7SwPzILwy8Bw21TLhquhboDYROV'
39
+ end
40
+
41
+ def signature
42
+ 'jZNOcbfWmD/A/f3hSvVzXZjM2HU='
43
+ end
44
+
45
+ def authorization_header
46
+ 'AWS 44CF9590006BF252F707:jZNOcbfWmD/A/f3hSvVzXZjM2HU='
47
+ end
48
+ end
49
+
50
+ module Example3
51
+ module_function
52
+
53
+ def request
54
+ request = Net::HTTP::Get.new('/quotes/nelson')
55
+ request['Date'] = date
56
+ request
57
+ end
58
+
59
+ def date
60
+ 'Thu Mar 9 01:24:20 CST 2006'
61
+ end
62
+
63
+ def access_key_id
64
+ Example1.access_key_id
65
+ end
66
+
67
+ def secret_access_key
68
+ Example1.secret_access_key
69
+ end
70
+
71
+ def expires
72
+ 1141889120
73
+ end
74
+
75
+ def query_string
76
+ 'AWSAccessKeyId=44CF9590006BF252F707&Expires=1141889120&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv4%3D'
77
+ end
78
+
79
+ def canonical_string
80
+ "GET\n\n\n1141889120\n/quotes/nelson"
81
+ end
82
+
83
+ end
84
+ end
85
+
86
+ class Test::Unit::TestCase
87
+ include AWS::S3
88
+
89
+ def sample_proxy_settings
90
+ {:host => 'http://google.com', :port => 8080, :user => 'marcel', :password => 'secret'}
91
+ end
92
+
93
+ def mock_connection_for(klass, options = {})
94
+ data = options[:returns]
95
+ return_values = case data
96
+ when Hash
97
+ FakeResponse.new(data)
98
+ when Array
99
+ data.map {|hash| FakeResponse.new(hash)}
100
+ else
101
+ abort "Response data for mock connection must be a Hash or an Array. Was #{data.inspect}."
102
+ end
103
+
104
+ connection = flexmock('Mock connection') do |mock|
105
+ mock.should_receive(:request).and_return(*return_values).at_least.once
106
+ end
107
+
108
+ flexmock(klass).should_receive(:connection).and_return(connection)
109
+ end
110
+ end
metadata CHANGED
@@ -1,7 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghazel-aws-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ hash: 109
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 4
10
+ - 1
11
+ version: 0.6.4.1
5
12
  platform: ruby
6
13
  authors:
7
14
  - Marcel Molina Jr.
@@ -9,22 +16,62 @@ autorequire:
9
16
  bindir: bin
10
17
  cert_chain: []
11
18
 
12
- date: 2010-08-06 00:00:00 -07:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description:
19
+ date: 2011-03-09 00:00:00 -08:00
20
+ default_executable: s3sh
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: xml-simple
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: builder
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: mime-types
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :runtime
63
+ version_requirements: *id003
64
+ description: Client library for Amazon's Simple Storage Service's REST API
17
65
  email: marcel@vernix.org
18
- executables: []
19
-
66
+ executables:
67
+ - s3sh
20
68
  extensions: []
21
69
 
22
- extra_rdoc_files: []
23
-
24
- files:
25
- - CHANGELOG
70
+ extra_rdoc_files:
71
+ - README
26
72
  - COPYING
27
73
  - INSTALL
74
+ files:
28
75
  - Rakefile
29
76
  - lib/aws/s3/acl.rb
30
77
  - lib/aws/s3/authentication.rb
@@ -45,33 +92,109 @@ files:
45
92
  - lib/aws/s3.rb
46
93
  - bin/s3sh
47
94
  - bin/setup.rb
95
+ - support/faster-xml-simple/lib/faster_xml_simple.rb
96
+ - support/faster-xml-simple/test/regression_test.rb
97
+ - support/faster-xml-simple/test/test_helper.rb
98
+ - support/faster-xml-simple/test/xml_simple_comparison_test.rb
99
+ - support/rdoc/code_info.rb
100
+ - test/acl_test.rb
101
+ - test/authentication_test.rb
102
+ - test/base_test.rb
103
+ - test/bucket_test.rb
104
+ - test/connection_test.rb
105
+ - test/error_test.rb
106
+ - test/extensions_test.rb
107
+ - test/fixtures/buckets.yml
108
+ - test/fixtures/errors.yml
109
+ - test/fixtures/headers.yml
110
+ - test/fixtures/logging.yml
111
+ - test/fixtures/loglines.yml
112
+ - test/fixtures/logs.yml
113
+ - test/fixtures/policies.yml
114
+ - test/fixtures.rb
115
+ - test/logging_test.rb
116
+ - test/mocks/fake_response.rb
117
+ - test/object_test.rb
118
+ - test/parsing_test.rb
119
+ - test/remote/acl_test.rb
120
+ - test/remote/bittorrent_test.rb
121
+ - test/remote/bucket_test.rb
122
+ - test/remote/logging_test.rb
123
+ - test/remote/object_test.rb
124
+ - test/remote/test_file.data
125
+ - test/remote/test_helper.rb
126
+ - test/response_test.rb
127
+ - test/service_test.rb
128
+ - test/test_helper.rb
129
+ - README
130
+ - COPYING
131
+ - INSTALL
48
132
  has_rdoc: true
49
- homepage:
133
+ homepage: http://amazon.rubyforge.org
50
134
  licenses: []
51
135
 
52
136
  post_install_message:
53
- rdoc_options: []
54
-
137
+ rdoc_options:
138
+ - --title
139
+ - AWS::S3 -- Support for Amazon S3's REST api
140
+ - --main
141
+ - README
142
+ - --line-numbers
143
+ - --inline-source
55
144
  require_paths:
56
145
  - lib
57
146
  required_ruby_version: !ruby/object:Gem::Requirement
147
+ none: false
58
148
  requirements:
59
149
  - - ">="
60
150
  - !ruby/object:Gem::Version
151
+ hash: 3
152
+ segments:
153
+ - 0
61
154
  version: "0"
62
- version:
63
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
64
157
  requirements:
65
158
  - - ">="
66
159
  - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
67
163
  version: "0"
68
- version:
69
164
  requirements: []
70
165
 
71
- rubyforge_project:
72
- rubygems_version: 1.3.5
166
+ rubyforge_project: amazon
167
+ rubygems_version: 1.4.2
73
168
  signing_key:
74
169
  specification_version: 3
75
- summary: AWS::S3 -- Support for Amazon S3's REST api
76
- test_files: []
77
-
170
+ summary: Client library for Amazon's Simple Storage Service's REST API
171
+ test_files:
172
+ - test/acl_test.rb
173
+ - test/authentication_test.rb
174
+ - test/base_test.rb
175
+ - test/bucket_test.rb
176
+ - test/connection_test.rb
177
+ - test/error_test.rb
178
+ - test/extensions_test.rb
179
+ - test/fixtures/buckets.yml
180
+ - test/fixtures/errors.yml
181
+ - test/fixtures/headers.yml
182
+ - test/fixtures/logging.yml
183
+ - test/fixtures/loglines.yml
184
+ - test/fixtures/logs.yml
185
+ - test/fixtures/policies.yml
186
+ - test/fixtures.rb
187
+ - test/logging_test.rb
188
+ - test/mocks/fake_response.rb
189
+ - test/object_test.rb
190
+ - test/parsing_test.rb
191
+ - test/remote/acl_test.rb
192
+ - test/remote/bittorrent_test.rb
193
+ - test/remote/bucket_test.rb
194
+ - test/remote/logging_test.rb
195
+ - test/remote/object_test.rb
196
+ - test/remote/test_file.data
197
+ - test/remote/test_helper.rb
198
+ - test/response_test.rb
199
+ - test/service_test.rb
200
+ - test/test_helper.rb
data/CHANGELOG DELETED
@@ -1,107 +0,0 @@
1
- head:
2
-
3
- 0.6.3:
4
-
5
- - Make bucket names globally unique [Jeffrey Hardy jeff@37signals.com]
6
- - Add S3Object.update for updating things like the content-type without re-uploading the file [Jeffrey Hardy jeff@37signals.com]
7
- 0.6.2:
8
-
9
- - Use custom __method__ in Ruby versions *prior* to 1.8.7 not *up to* 1.8.7.
10
-
11
- 0.6.1:
12
-
13
- - Rename Kernel#memoize to Kernel#expirable_memoize so that it doesn't conflict with memoize method in ActiveSupport which has an entirely different API and semantics. Reported by [Florian Dütsc (mail@florian-duetsch.de)].
14
-
15
- 0.6.0:
16
-
17
- - Full 1.9 compatibility (all tests passing against 1.9 & 1.8.6). Thanks to [David (dvdplm@gmail.com), Cyril David (cyx.ucron@gmail.com)]
18
-
19
- 0.5.1:
20
-
21
- - For now just redefine __method__ to take arguments so we don't break 1.8.7 use today
22
-
23
- 0.5.0:
24
-
25
- - Bug #17458 fixed. Normalize the :expires_in option to always be an integer even if the actual object passed in is a proxy to an integer, such as is the case with 2.hours from ActiveSupport which is actually an instance of ActiveSupport::Duration. Reported by [Steve Kickert steve@riverocktech.com]
26
-
27
- - Bug #19158 fixed. Don't prepend leading slash onto bucket name when deleting a bucket with the :force => true option.
28
-
29
- - Bug #17628 fixed. Don't ignore :use_ssl => false in url_for when the connection is established over ssl. Reported by [Tom Fixed (tkat11)]
30
-
31
- - Bug #13052 fixed. Appease some proxies by always including a Content-Length with all requests. Reported by [James Murty (jmurty)]
32
-
33
- - Bug #13756 fixed. Attributes that are false should not raise NoMethodError in Base#method_missing. Fixed by [Scott Patten]
34
-
35
- - Bug #19189 fixed. No longer reference Date::ABBR_MONTHS constant which was removed in Ruby 1.8.6. Reported by [Khurram Virani (kvirani)]
36
-
37
- - Bug #20487 fixed. If a request fails and is retried, only escape the request path the first time. Reported by [anonymous]
38
-
39
- - Replace ad-hoc S3Object.copy method with newly support built in API call.
40
-
41
- - Do not make connections persistent by default. This "feature" causes far more broken pipes than it is worth. Use with caution.
42
-
43
- 0.4.0:
44
-
45
- - Various adjustments to connection handling to try to mitigate exceptions raised from deep within Net::HTTP.
46
-
47
- - Don't coerce numbers that start with a zero because the zero will be lost. If a bucket, for example, has a name like '0815', all operation it will fail. Closes ticket #10089 [reported anonymously]"
48
-
49
- - Add ability to connect through a proxy using the :proxy option when establishing a connection. Suggested by [Simon Horne <simon@soulware.co.uk>]
50
-
51
- - Add :authenticated option to url_for. When passing false, don't generate signature parameters for query string.
52
-
53
- - Make url_for accept custom port settings. [Rich Olson]
54
-
55
- 0.3.0:
56
-
57
- - Ensure content type is eventually set to account for changes made to Net::HTTP in Ruby version 1.8.5. Reported by [David Hanson, Stephen Caudill, Tom Mornini <tmornini@engineyard.com>]
58
-
59
- - Add :persistent option to connections which keeps a persistent connection rather than creating a new one per request, defaulting to true. Based on a patch by [Metalhead <metalhead@metalhead.ws>]
60
-
61
- - If we are retrying a request after rescuing one of the retry exceptions, rewind the body if its an IO stream so it starts at the beginning. [Jamis Buck]
62
-
63
- - Ensure that all paths being submitted to S3 are valid utf8. If they are not, we remove the extended characters. Ample help from [Jamis Buck]
64
-
65
- - Wrap logs in Log objects which exposes each line as a Log::Line that has accessors by name for each field.
66
-
67
- - Various performance optimizations for the extensions code. [Roman LE NEGRATE <roman2k@free.fr>]
68
-
69
- - Make S3Object.copy more efficient by streaming in both directions in parallel.
70
-
71
- - Open up Net:HTTPGenericRequest to make the chunk size 1 megabyte, up from 1 kilobyte.
72
-
73
- - Add S3Object.exists?
74
-
75
- 0.2.1:
76
-
77
- - When the bucket name argument (for e.g. Bucket.objects) is being used as the option hash, reassign it to the options variable and set the bucket to nil so bucket inference + options works.
78
-
79
- - Don't call CGI.escape on query string parameters in Hash#to_query_string since all paths get passed through URI.escape right before the request is made. Paths were getting double escaped. Bug spotted by [David Hanson]
80
-
81
- - Make s3sh exec irb.bat if on Windows. Bug spotted by [N. Sathish Kumar <nsathishk@yahoo.com>]
82
-
83
- - Avoid class_variable_(get|set) since it was only recently added to Ruby. Spotted by [N. Sathish Kumar <nsathishk@yahoo.com>]
84
-
85
- - Raise NoSuchKey if S3Object.about requests a key that does not exist.
86
-
87
- - If the response body is an empty string, don't try to parse it as xml.
88
-
89
- - Don't reject every body type save for IO and String at the door when making a request. Suggested by [Alex MacCaw <maccman@gmail.com>]
90
-
91
- - Allow dots in bucket names. [Jesse Newland]
92
-
93
- 0.2.0:
94
-
95
- - Infer content type for an object when calling S3Object.store without explicitly passing in the :content_type option.
96
-
97
- 0.1.2:
98
-
99
- - Scrap (overly) fancy generator based version of CoercibleString with a much simpler and clearer case statement. Continuations are really slow and the specific use of the generator was leaking memory. Bug spotted by [Remco van't Veer]
100
-
101
- 0.1.1:
102
-
103
- - Don't add the underscore method to String if it is already defined (like, for example, from ActiveSupport). Bug spotted by [Matt White <stockliasteroid@gmail.com>]
104
-
105
- 0.1.0:
106
-
107
- - Initial public release