fmalamitsas-aws-s3 0.6.2.1254423625

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG +107 -0
  2. data/COPYING +19 -0
  3. data/INSTALL +55 -0
  4. data/README.erb +58 -0
  5. data/Rakefile +334 -0
  6. data/TODO +26 -0
  7. data/aws-s3.gemspec +42 -0
  8. data/bin/s3sh +6 -0
  9. data/bin/setup.rb +10 -0
  10. data/lib/aws/s3.rb +60 -0
  11. data/lib/aws/s3/acl.rb +636 -0
  12. data/lib/aws/s3/authentication.rb +222 -0
  13. data/lib/aws/s3/base.rb +270 -0
  14. data/lib/aws/s3/bittorrent.rb +58 -0
  15. data/lib/aws/s3/bucket.rb +372 -0
  16. data/lib/aws/s3/connection.rb +288 -0
  17. data/lib/aws/s3/error.rb +69 -0
  18. data/lib/aws/s3/exceptions.rb +133 -0
  19. data/lib/aws/s3/extensions.rb +342 -0
  20. data/lib/aws/s3/logging.rb +317 -0
  21. data/lib/aws/s3/object.rb +626 -0
  22. data/lib/aws/s3/owner.rb +46 -0
  23. data/lib/aws/s3/parsing.rb +99 -0
  24. data/lib/aws/s3/response.rb +180 -0
  25. data/lib/aws/s3/service.rb +51 -0
  26. data/lib/aws/s3/version.rb +12 -0
  27. data/site/index.erb +41 -0
  28. data/site/public/images/box-and-gem.gif +0 -0
  29. data/site/public/images/favicon.ico +0 -0
  30. data/site/public/ruby.css +18 -0
  31. data/site/public/screen.css +99 -0
  32. data/support/faster-xml-simple/COPYING +18 -0
  33. data/support/faster-xml-simple/README +8 -0
  34. data/support/faster-xml-simple/Rakefile +54 -0
  35. data/support/faster-xml-simple/lib/faster_xml_simple.rb +190 -0
  36. data/support/faster-xml-simple/test/fixtures/test-1.rails.yml +4 -0
  37. data/support/faster-xml-simple/test/fixtures/test-1.xml +3 -0
  38. data/support/faster-xml-simple/test/fixtures/test-1.yml +4 -0
  39. data/support/faster-xml-simple/test/fixtures/test-2.rails.yml +6 -0
  40. data/support/faster-xml-simple/test/fixtures/test-2.xml +3 -0
  41. data/support/faster-xml-simple/test/fixtures/test-2.yml +6 -0
  42. data/support/faster-xml-simple/test/fixtures/test-3.rails.yml +6 -0
  43. data/support/faster-xml-simple/test/fixtures/test-3.xml +5 -0
  44. data/support/faster-xml-simple/test/fixtures/test-3.yml +6 -0
  45. data/support/faster-xml-simple/test/fixtures/test-4.rails.yml +5 -0
  46. data/support/faster-xml-simple/test/fixtures/test-4.xml +7 -0
  47. data/support/faster-xml-simple/test/fixtures/test-4.yml +5 -0
  48. data/support/faster-xml-simple/test/fixtures/test-5.rails.yml +8 -0
  49. data/support/faster-xml-simple/test/fixtures/test-5.xml +7 -0
  50. data/support/faster-xml-simple/test/fixtures/test-5.yml +8 -0
  51. data/support/faster-xml-simple/test/fixtures/test-6.rails.yml +43 -0
  52. data/support/faster-xml-simple/test/fixtures/test-6.xml +29 -0
  53. data/support/faster-xml-simple/test/fixtures/test-6.yml +41 -0
  54. data/support/faster-xml-simple/test/fixtures/test-7.rails.yml +23 -0
  55. data/support/faster-xml-simple/test/fixtures/test-7.xml +22 -0
  56. data/support/faster-xml-simple/test/fixtures/test-7.yml +22 -0
  57. data/support/faster-xml-simple/test/fixtures/test-8.rails.yml +14 -0
  58. data/support/faster-xml-simple/test/fixtures/test-8.xml +8 -0
  59. data/support/faster-xml-simple/test/fixtures/test-8.yml +11 -0
  60. data/support/faster-xml-simple/test/regression_test.rb +47 -0
  61. data/support/faster-xml-simple/test/test_helper.rb +17 -0
  62. data/support/faster-xml-simple/test/xml_simple_comparison_test.rb +46 -0
  63. data/support/rdoc/code_info.rb +211 -0
  64. data/test/acl_test.rb +254 -0
  65. data/test/authentication_test.rb +118 -0
  66. data/test/base_test.rb +136 -0
  67. data/test/bucket_test.rb +74 -0
  68. data/test/connection_test.rb +216 -0
  69. data/test/error_test.rb +70 -0
  70. data/test/extensions_test.rb +340 -0
  71. data/test/fixtures.rb +89 -0
  72. data/test/fixtures/buckets.yml +133 -0
  73. data/test/fixtures/errors.yml +34 -0
  74. data/test/fixtures/headers.yml +3 -0
  75. data/test/fixtures/logging.yml +15 -0
  76. data/test/fixtures/loglines.yml +5 -0
  77. data/test/fixtures/logs.yml +7 -0
  78. data/test/fixtures/policies.yml +16 -0
  79. data/test/logging_test.rb +89 -0
  80. data/test/mocks/fake_response.rb +26 -0
  81. data/test/object_test.rb +205 -0
  82. data/test/parsing_test.rb +66 -0
  83. data/test/remote/acl_test.rb +116 -0
  84. data/test/remote/bittorrent_test.rb +45 -0
  85. data/test/remote/bucket_test.rb +146 -0
  86. data/test/remote/logging_test.rb +82 -0
  87. data/test/remote/object_test.rb +379 -0
  88. data/test/remote/test_file.data +0 -0
  89. data/test/remote/test_helper.rb +33 -0
  90. data/test/response_test.rb +68 -0
  91. data/test/service_test.rb +23 -0
  92. data/test/test_helper.rb +118 -0
  93. metadata +241 -0
@@ -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,118 @@
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('/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 current_host
30
+ "quotes"
31
+ end
32
+
33
+ def canonical_string
34
+ "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"
35
+ end
36
+
37
+ def access_key_id
38
+ '44CF9590006BF252F707'
39
+ end
40
+
41
+ def secret_access_key
42
+ 'OtxrzxIsfpFjA7SwPzILwy8Bw21TLhquhboDYROV'
43
+ end
44
+
45
+ def signature
46
+ 'jZNOcbfWmD/A/f3hSvVzXZjM2HU='
47
+ end
48
+
49
+ def authorization_header
50
+ 'AWS 44CF9590006BF252F707:jZNOcbfWmD/A/f3hSvVzXZjM2HU='
51
+ end
52
+ end
53
+
54
+ module Example3
55
+ module_function
56
+
57
+ def request
58
+ request = Net::HTTP::Get.new('/nelson')
59
+ request['Date'] = date
60
+ request
61
+ end
62
+
63
+ def current_host
64
+ "quotes"
65
+ end
66
+
67
+ def date
68
+ 'Thu Mar 9 01:24:20 CST 2006'
69
+ end
70
+
71
+ def access_key_id
72
+ Example1.access_key_id
73
+ end
74
+
75
+ def secret_access_key
76
+ Example1.secret_access_key
77
+ end
78
+
79
+ def expires
80
+ 1141889120
81
+ end
82
+
83
+ def query_string
84
+ 'AWSAccessKeyId=44CF9590006BF252F707&Expires=1141889120&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv4%3D'
85
+ end
86
+
87
+ def canonical_string
88
+ "GET\n\n\n1141889120\n/quotes/nelson"
89
+ end
90
+
91
+ end
92
+ end
93
+
94
+ class Test::Unit::TestCase
95
+ include AWS::S3
96
+
97
+ def sample_proxy_settings
98
+ {:host => 'http://google.com', :port => 8080, :user => 'marcel', :password => 'secret'}
99
+ end
100
+
101
+ def mock_connection_for(klass, options = {})
102
+ data = options[:returns]
103
+ return_values = case data
104
+ when Hash
105
+ FakeResponse.new(data)
106
+ when Array
107
+ data.map {|hash| FakeResponse.new(hash)}
108
+ else
109
+ abort "Response data for mock connection must be a Hash or an Array. Was #{data.inspect}."
110
+ end
111
+
112
+ connection = flexmock('Mock connection') do |mock|
113
+ mock.should_receive(:request).and_return(*return_values).at_least.once
114
+ end
115
+
116
+ flexmock(klass).should_receive(:connection).and_return(connection)
117
+ end
118
+ end
metadata ADDED
@@ -0,0 +1,241 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fmalamitsas-aws-s3
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 6
8
+ - 2
9
+ - 1254423625
10
+ version: 0.6.2.1254423625
11
+ platform: ruby
12
+ authors:
13
+ - marcel@vernix.org
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2009-10-01 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: xml-simple
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: builder
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :runtime
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: mime-types
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ type: :runtime
59
+ version_requirements: *id003
60
+ description: Client library for Amazon's Simple Storage Service's REST API.
61
+ email: Marcel Molina Jr.
62
+ executables:
63
+ - s3sh
64
+ - setup.rb
65
+ extensions: []
66
+
67
+ extra_rdoc_files:
68
+ - CHANGELOG
69
+ - COPYING
70
+ - README.erb
71
+ - TODO
72
+ - bin/s3sh
73
+ - bin/setup.rb
74
+ - lib/aws/s3.rb
75
+ - lib/aws/s3/acl.rb
76
+ - lib/aws/s3/authentication.rb
77
+ - lib/aws/s3/base.rb
78
+ - lib/aws/s3/bittorrent.rb
79
+ - lib/aws/s3/bucket.rb
80
+ - lib/aws/s3/connection.rb
81
+ - lib/aws/s3/error.rb
82
+ - lib/aws/s3/exceptions.rb
83
+ - lib/aws/s3/extensions.rb
84
+ - lib/aws/s3/logging.rb
85
+ - lib/aws/s3/object.rb
86
+ - lib/aws/s3/owner.rb
87
+ - lib/aws/s3/parsing.rb
88
+ - lib/aws/s3/response.rb
89
+ - lib/aws/s3/service.rb
90
+ - lib/aws/s3/version.rb
91
+ files:
92
+ - CHANGELOG
93
+ - COPYING
94
+ - INSTALL
95
+ - README.erb
96
+ - Rakefile
97
+ - TODO
98
+ - aws-s3.gemspec
99
+ - bin/s3sh
100
+ - bin/setup.rb
101
+ - lib/aws/s3.rb
102
+ - lib/aws/s3/acl.rb
103
+ - lib/aws/s3/authentication.rb
104
+ - lib/aws/s3/base.rb
105
+ - lib/aws/s3/bittorrent.rb
106
+ - lib/aws/s3/bucket.rb
107
+ - lib/aws/s3/connection.rb
108
+ - lib/aws/s3/error.rb
109
+ - lib/aws/s3/exceptions.rb
110
+ - lib/aws/s3/extensions.rb
111
+ - lib/aws/s3/logging.rb
112
+ - lib/aws/s3/object.rb
113
+ - lib/aws/s3/owner.rb
114
+ - lib/aws/s3/parsing.rb
115
+ - lib/aws/s3/response.rb
116
+ - lib/aws/s3/service.rb
117
+ - lib/aws/s3/version.rb
118
+ - site/index.erb
119
+ - site/public/images/box-and-gem.gif
120
+ - site/public/images/favicon.ico
121
+ - site/public/ruby.css
122
+ - site/public/screen.css
123
+ - support/faster-xml-simple/COPYING
124
+ - support/faster-xml-simple/README
125
+ - support/faster-xml-simple/Rakefile
126
+ - support/faster-xml-simple/lib/faster_xml_simple.rb
127
+ - support/faster-xml-simple/test/fixtures/test-1.rails.yml
128
+ - support/faster-xml-simple/test/fixtures/test-1.xml
129
+ - support/faster-xml-simple/test/fixtures/test-1.yml
130
+ - support/faster-xml-simple/test/fixtures/test-2.rails.yml
131
+ - support/faster-xml-simple/test/fixtures/test-2.xml
132
+ - support/faster-xml-simple/test/fixtures/test-2.yml
133
+ - support/faster-xml-simple/test/fixtures/test-3.rails.yml
134
+ - support/faster-xml-simple/test/fixtures/test-3.xml
135
+ - support/faster-xml-simple/test/fixtures/test-3.yml
136
+ - support/faster-xml-simple/test/fixtures/test-4.rails.yml
137
+ - support/faster-xml-simple/test/fixtures/test-4.xml
138
+ - support/faster-xml-simple/test/fixtures/test-4.yml
139
+ - support/faster-xml-simple/test/fixtures/test-5.rails.yml
140
+ - support/faster-xml-simple/test/fixtures/test-5.xml
141
+ - support/faster-xml-simple/test/fixtures/test-5.yml
142
+ - support/faster-xml-simple/test/fixtures/test-6.rails.yml
143
+ - support/faster-xml-simple/test/fixtures/test-6.xml
144
+ - support/faster-xml-simple/test/fixtures/test-6.yml
145
+ - support/faster-xml-simple/test/fixtures/test-7.rails.yml
146
+ - support/faster-xml-simple/test/fixtures/test-7.xml
147
+ - support/faster-xml-simple/test/fixtures/test-7.yml
148
+ - support/faster-xml-simple/test/fixtures/test-8.rails.yml
149
+ - support/faster-xml-simple/test/fixtures/test-8.xml
150
+ - support/faster-xml-simple/test/fixtures/test-8.yml
151
+ - support/faster-xml-simple/test/regression_test.rb
152
+ - support/faster-xml-simple/test/test_helper.rb
153
+ - support/faster-xml-simple/test/xml_simple_comparison_test.rb
154
+ - support/rdoc/code_info.rb
155
+ - test/acl_test.rb
156
+ - test/authentication_test.rb
157
+ - test/base_test.rb
158
+ - test/bucket_test.rb
159
+ - test/connection_test.rb
160
+ - test/error_test.rb
161
+ - test/extensions_test.rb
162
+ - test/fixtures.rb
163
+ - test/fixtures/buckets.yml
164
+ - test/fixtures/errors.yml
165
+ - test/fixtures/headers.yml
166
+ - test/fixtures/logging.yml
167
+ - test/fixtures/loglines.yml
168
+ - test/fixtures/logs.yml
169
+ - test/fixtures/policies.yml
170
+ - test/logging_test.rb
171
+ - test/mocks/fake_response.rb
172
+ - test/object_test.rb
173
+ - test/parsing_test.rb
174
+ - test/remote/acl_test.rb
175
+ - test/remote/bittorrent_test.rb
176
+ - test/remote/bucket_test.rb
177
+ - test/remote/logging_test.rb
178
+ - test/remote/object_test.rb
179
+ - test/remote/test_file.data
180
+ - test/remote/test_helper.rb
181
+ - test/response_test.rb
182
+ - test/service_test.rb
183
+ - test/test_helper.rb
184
+ has_rdoc: true
185
+ homepage: http://amazon.rubyforge.org
186
+ licenses: []
187
+
188
+ post_install_message:
189
+ rdoc_options:
190
+ - --line-numbers
191
+ - --inline-source
192
+ - --title
193
+ - Aws-s3
194
+ - --main
195
+ - README.erb
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ none: false
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ segments:
204
+ - 0
205
+ version: "0"
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ none: false
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ segments:
212
+ - 1
213
+ - 2
214
+ version: "1.2"
215
+ requirements: []
216
+
217
+ rubyforge_project: aws-s3
218
+ rubygems_version: 1.3.7
219
+ signing_key:
220
+ specification_version: 2
221
+ summary: Client library for Amazon's Simple Storage Service's REST API.
222
+ test_files:
223
+ - test/acl_test.rb
224
+ - test/authentication_test.rb
225
+ - test/base_test.rb
226
+ - test/bucket_test.rb
227
+ - test/connection_test.rb
228
+ - test/error_test.rb
229
+ - test/extensions_test.rb
230
+ - test/logging_test.rb
231
+ - test/object_test.rb
232
+ - test/parsing_test.rb
233
+ - test/remote/acl_test.rb
234
+ - test/remote/bittorrent_test.rb
235
+ - test/remote/bucket_test.rb
236
+ - test/remote/logging_test.rb
237
+ - test/remote/object_test.rb
238
+ - test/remote/test_helper.rb
239
+ - test/response_test.rb
240
+ - test/service_test.rb
241
+ - test/test_helper.rb