backup 2.3.2.pre → 2.3.2.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/backup/connection/s3.rb +18 -28
  2. metadata +9 -9
@@ -1,4 +1,4 @@
1
- require 'aws/s3'
1
+ require 's3'
2
2
 
3
3
  module Backup
4
4
  module Connection
@@ -25,47 +25,37 @@ module Backup
25
25
 
26
26
  # Establishes a connection with Amazon S3 using the credentials provided by the user
27
27
  def connect
28
- AWS::S3::Base.establish_connection!(
29
- :access_key_id => access_key_id,
30
- :secret_access_key => secret_access_key,
31
- :use_ssl => use_ssl
32
- )
28
+ service
33
29
  end
34
-
30
+
35
31
  # Wrapper for the Service object
36
32
  def service
37
- AWS::S3::Service
33
+ ::S3::Service.new(:access_key_id => access_key_id,
34
+ :secret_access_key => secret_access_key,
35
+ :use_ssl => use_ssl)
38
36
  end
39
-
37
+
40
38
  # Wrapper for the Bucket object
41
39
  def bucket
42
- AWS::S3::Bucket
40
+ service.buckets.find(s3_bucket)
43
41
  end
44
-
45
- # Wrapper for the Object object
46
- def object
47
- AWS::S3::S3Object
48
- end
49
-
42
+
50
43
  # Initializes the file transfer to Amazon S3
51
44
  # This can only run after a connection has been made using the #connect method
52
45
  def store
53
- puts "Storing \"#{final_file}\" to bucket \"#{s3_bucket}\" on Amazon S3."
54
- object.store(
55
- final_file,
56
- open(File.join(tmp_path, final_file)),
57
- s3_bucket )
46
+ object = bucket.objects.build(final_file)
47
+ object.content = open(File.join(tmp_path, final_file))
48
+ object.save
58
49
  end
59
-
50
+
60
51
  # Destroys file from a bucket on Amazon S3
61
- def destroy(file, bucket)
62
- object.delete(
63
- file,
64
- bucket )
52
+ def destroy(file, bucket_as_string)
53
+ object = bucket.objects.find(file)
54
+ object.destroy
65
55
  end
66
-
56
+
67
57
  private
68
-
58
+
69
59
  def load_storage_configuration_attributes(static = false)
70
60
  %w(access_key_id secret_access_key use_ssl).each do |attribute|
71
61
  if static
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916020
4
+ hash: -1876988207
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
9
  - 2
10
- - pre
11
- version: 2.3.2.pre
10
+ - pre2
11
+ version: 2.3.2.pre2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Michael van Rooijen
@@ -16,23 +16,23 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-07-10 00:00:00 +02:00
19
+ date: 2010-07-11 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: aws-s3
23
+ name: s3
24
24
  prerelease: false
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- hash: 3
30
+ hash: 19
31
31
  segments:
32
32
  - 0
33
- - 6
34
- - 2
35
- version: 0.6.2
33
+ - 3
34
+ - 0
35
+ version: 0.3.0
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency