jaf-s3 0.6.3.1286550476

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/COPYING +19 -0
  2. data/INSTALL +55 -0
  3. data/README +545 -0
  4. data/Rakefile +334 -0
  5. data/bin/s3sh +6 -0
  6. data/bin/setup.rb +10 -0
  7. data/lib/aws/s3.rb +60 -0
  8. data/lib/aws/s3/acl.rb +636 -0
  9. data/lib/aws/s3/authentication.rb +221 -0
  10. data/lib/aws/s3/base.rb +240 -0
  11. data/lib/aws/s3/bittorrent.rb +58 -0
  12. data/lib/aws/s3/bucket.rb +319 -0
  13. data/lib/aws/s3/connection.rb +278 -0
  14. data/lib/aws/s3/error.rb +69 -0
  15. data/lib/aws/s3/exceptions.rb +133 -0
  16. data/lib/aws/s3/extensions.rb +340 -0
  17. data/lib/aws/s3/logging.rb +314 -0
  18. data/lib/aws/s3/object.rb +612 -0
  19. data/lib/aws/s3/owner.rb +44 -0
  20. data/lib/aws/s3/parsing.rb +99 -0
  21. data/lib/aws/s3/response.rb +180 -0
  22. data/lib/aws/s3/service.rb +51 -0
  23. data/lib/aws/s3/version.rb +12 -0
  24. data/support/faster-xml-simple/lib/faster_xml_simple.rb +187 -0
  25. data/support/faster-xml-simple/test/regression_test.rb +47 -0
  26. data/support/faster-xml-simple/test/test_helper.rb +17 -0
  27. data/support/faster-xml-simple/test/xml_simple_comparison_test.rb +46 -0
  28. data/support/rdoc/code_info.rb +211 -0
  29. data/test/acl_test.rb +254 -0
  30. data/test/authentication_test.rb +114 -0
  31. data/test/base_test.rb +136 -0
  32. data/test/bucket_test.rb +74 -0
  33. data/test/connection_test.rb +215 -0
  34. data/test/error_test.rb +70 -0
  35. data/test/extensions_test.rb +340 -0
  36. data/test/fixtures.rb +89 -0
  37. data/test/fixtures/buckets.yml +133 -0
  38. data/test/fixtures/errors.yml +34 -0
  39. data/test/fixtures/headers.yml +3 -0
  40. data/test/fixtures/logging.yml +15 -0
  41. data/test/fixtures/loglines.yml +5 -0
  42. data/test/fixtures/logs.yml +7 -0
  43. data/test/fixtures/policies.yml +16 -0
  44. data/test/logging_test.rb +89 -0
  45. data/test/mocks/fake_response.rb +26 -0
  46. data/test/object_test.rb +205 -0
  47. data/test/parsing_test.rb +66 -0
  48. data/test/remote/acl_test.rb +117 -0
  49. data/test/remote/bittorrent_test.rb +45 -0
  50. data/test/remote/bucket_test.rb +146 -0
  51. data/test/remote/logging_test.rb +82 -0
  52. data/test/remote/object_test.rb +371 -0
  53. data/test/remote/test_file.data +0 -0
  54. data/test/remote/test_helper.rb +33 -0
  55. data/test/response_test.rb +68 -0
  56. data/test/service_test.rb +23 -0
  57. data/test/test_helper.rb +110 -0
  58. metadata +200 -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,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 ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jaf-s3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 2573101035
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 3
10
+ - 1286550476
11
+ version: 0.6.3.1286550476
12
+ platform: ruby
13
+ authors:
14
+ - Marcel Molina Jr.
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-10-08 00:00:00 -04:00
20
+ default_executable:
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: Like the main version of this gem, this version is 100% unsupported. Use at your own risk. It is forked to remove the alias_method_chain on const_missing to autocreate S3::Bucket objects for any class that ends in Bucket.
65
+ email: marcel@vernix.org
66
+ executables:
67
+ - s3sh
68
+ extensions: []
69
+
70
+ extra_rdoc_files:
71
+ - README
72
+ - COPYING
73
+ - INSTALL
74
+ files:
75
+ - Rakefile
76
+ - lib/aws/s3/acl.rb
77
+ - lib/aws/s3/authentication.rb
78
+ - lib/aws/s3/base.rb
79
+ - lib/aws/s3/bittorrent.rb
80
+ - lib/aws/s3/bucket.rb
81
+ - lib/aws/s3/connection.rb
82
+ - lib/aws/s3/error.rb
83
+ - lib/aws/s3/exceptions.rb
84
+ - lib/aws/s3/extensions.rb
85
+ - lib/aws/s3/logging.rb
86
+ - lib/aws/s3/object.rb
87
+ - lib/aws/s3/owner.rb
88
+ - lib/aws/s3/parsing.rb
89
+ - lib/aws/s3/response.rb
90
+ - lib/aws/s3/service.rb
91
+ - lib/aws/s3/version.rb
92
+ - lib/aws/s3.rb
93
+ - bin/s3sh
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
132
+ has_rdoc: true
133
+ homepage: http://amazon.rubyforge.org
134
+ licenses: []
135
+
136
+ post_install_message:
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
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ none: false
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ hash: 3
152
+ segments:
153
+ - 0
154
+ version: "0"
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ requirements: []
165
+
166
+ rubyforge_project: amazon
167
+ rubygems_version: 1.3.7
168
+ signing_key:
169
+ specification_version: 3
170
+ summary: Unsupported forked version of 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