jets3t-rb 1.0.2 → 1.0.3
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.
- data/examples/s3.rb +8 -3
- data/jets3t-rb.gemspec +1 -1
- data/lib/jets3t/s3_bucket.rb +6 -9
- metadata +19 -28
data/examples/s3.rb
CHANGED
@@ -16,17 +16,22 @@ module JetS3t
|
|
16
16
|
|
17
17
|
# # simple string data
|
18
18
|
data = "Hello World!"
|
19
|
-
test_bucket.
|
19
|
+
test_bucket.put_data('hello_world.txt', data)
|
20
20
|
|
21
21
|
# # file
|
22
22
|
FILE_NAME = '/tmp/hello_world.file'
|
23
23
|
File.open(FILE_NAME, 'w') {|f| f.write('Hello World!') }
|
24
24
|
data = File.new(FILE_NAME)
|
25
|
-
test_bucket.put(data)
|
25
|
+
test_bucket.put('hello_world.file', data)
|
26
26
|
|
27
27
|
object = test_bucket.get('hello_world.txt')
|
28
28
|
p object.data
|
29
|
-
|
29
|
+
|
30
30
|
object = test_bucket.get('hello_world.file')
|
31
31
|
p object.data
|
32
|
+
|
33
|
+
# this should fail and return nil
|
34
|
+
object = test_bucket.get('hello_world.txt.apa')
|
35
|
+
p object
|
36
|
+
|
32
37
|
end
|
data/jets3t-rb.gemspec
CHANGED
@@ -7,7 +7,7 @@ Dir['ext/*.jar'].each { |jar| require jar }
|
|
7
7
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = 'jets3t-rb'
|
10
|
-
s.version = '1.0.
|
10
|
+
s.version = '1.0.3'
|
11
11
|
s.platform = Gem::Platform::RUBY
|
12
12
|
s.authors = ['Daniel Gaiottino', 'David Tollmyr']
|
13
13
|
s.email = ['daniel@burtcorp.com', 'david@burtcorp.com']
|
data/lib/jets3t/s3_bucket.rb
CHANGED
@@ -17,10 +17,6 @@ module JetS3t
|
|
17
17
|
@s3_service = s3_service
|
18
18
|
@bucket_name = name
|
19
19
|
@bucket = @s3_service.get_bucket(name)
|
20
|
-
@stored_files = {}
|
21
|
-
list.each do | item |
|
22
|
-
@stored_files[item.get_name] = true
|
23
|
-
end
|
24
20
|
end
|
25
21
|
|
26
22
|
def put(path, file)
|
@@ -33,7 +29,6 @@ module JetS3t
|
|
33
29
|
object.set_content_length(java_file.length)
|
34
30
|
object.set_content_type('application/octet-stream')
|
35
31
|
data = @s3_service.put_object(@bucket, object)
|
36
|
-
@stored_files[path] = true
|
37
32
|
end
|
38
33
|
|
39
34
|
def put_data(path, data)
|
@@ -42,15 +37,17 @@ module JetS3t
|
|
42
37
|
object.set_content_length(data.size)
|
43
38
|
object.set_content_type('application/octet-stream')
|
44
39
|
data = @s3_service.put_object(@bucket, object)
|
45
|
-
@stored_files[path] = true
|
46
40
|
end
|
47
41
|
|
48
42
|
def get(filename)
|
49
43
|
clean_path(filename)
|
50
|
-
return nil unless @stored_files.has_key?(filename)
|
51
44
|
begin
|
52
|
-
|
45
|
+
d = @s3_service.list_objects(@bucket, filename, nil)
|
46
|
+
if d && d.length > 0
|
47
|
+
S3Object.new(@s3_service.get_object(@bucket, filename))
|
48
|
+
end
|
53
49
|
rescue Exception => e
|
50
|
+
p e.message
|
54
51
|
nil
|
55
52
|
end
|
56
53
|
end
|
@@ -64,7 +61,7 @@ module JetS3t
|
|
64
61
|
end
|
65
62
|
|
66
63
|
def list
|
67
|
-
@
|
64
|
+
@s3_service.list_objects(@bucket_name)
|
68
65
|
end
|
69
66
|
|
70
67
|
private
|
metadata
CHANGED
@@ -1,30 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets3t-rb
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Daniel Gaiottino
|
9
9
|
- David Tollmyr
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
date: 2011-08-04 00:00:00 Z
|
13
|
+
date: 2011-10-26 00:00:00.000000000Z
|
15
14
|
dependencies: []
|
16
|
-
|
17
15
|
description: JRuby wrapper for JetS3t (http://jets3t.s3.amazonaws.com/)
|
18
|
-
email:
|
16
|
+
email:
|
19
17
|
- daniel@burtcorp.com
|
20
18
|
- david@burtcorp.com
|
21
19
|
executables: []
|
22
|
-
|
23
20
|
extensions: []
|
24
|
-
|
25
21
|
extra_rdoc_files: []
|
26
|
-
|
27
|
-
files:
|
22
|
+
files:
|
28
23
|
- .gitignore
|
29
24
|
- Gemfile
|
30
25
|
- README
|
@@ -42,30 +37,26 @@ files:
|
|
42
37
|
- lib/jets3t/s3_object.rb
|
43
38
|
homepage: http://github.com/gaiottino/jets3t-rb
|
44
39
|
licenses: []
|
45
|
-
|
46
40
|
post_install_message:
|
47
41
|
rdoc_options: []
|
48
|
-
|
49
|
-
require_paths:
|
42
|
+
require_paths:
|
50
43
|
- lib
|
51
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
45
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
57
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
51
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version:
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
63
56
|
requirements: []
|
64
|
-
|
65
57
|
rubyforge_project: jets3t-rb
|
66
|
-
rubygems_version: 1.8.
|
58
|
+
rubygems_version: 1.8.6
|
67
59
|
signing_key:
|
68
60
|
specification_version: 3
|
69
61
|
summary: JRuby wrapper for JetS3t
|
70
62
|
test_files: []
|
71
|
-
|