sweety_backy 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,20 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sweety_backy (0.0.13)
5
- s3
4
+ sweety_backy (0.0.15)
5
+ aws-sdk
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
+ aws-sdk (1.1.1)
11
+ httparty (~> 0.7)
12
+ json (~> 1.4)
13
+ nokogiri (>= 1.4.4)
14
+ uuidtools (~> 2.1)
10
15
  chronic (0.6.2)
16
+ crack (0.1.8)
11
17
  delorean (1.1.0)
12
18
  chronic
19
+ httparty (0.7.8)
20
+ crack (= 0.1.8)
21
+ json (1.5.3)
13
22
  mocha (0.9.12)
14
- proxies (0.2.1)
23
+ nokogiri (1.5.0)
15
24
  rake (0.9.2)
16
- s3 (0.3.8)
17
- proxies (~> 0.2.0)
25
+ uuidtools (2.1.2)
18
26
 
19
27
  PLATFORMS
20
28
  ruby
@@ -1,8 +1,8 @@
1
1
  begin
2
- require 's3'
2
+ require 'aws-sdk'
3
3
  rescue LoadError
4
4
  require 'rubygems'
5
- require 's3'
5
+ require 'aws-sdk'
6
6
  end
7
7
 
8
8
  require 'digest/md5'
@@ -1,32 +1,30 @@
1
1
  module SweetyBacky
2
2
  class S3
3
- def self.upload( path, backup_path, opts )
4
- SweetyBacky::Utils.log( "S3 uploading: #{path} to #{opts[:bucket]}/#{backup_path}" )
3
+ def self.upload( path, s3_path, opts )
4
+ SweetyBacky::Utils.log( "S3 uploading: #{path} to #{opts[:bucket]}/#{s3_path}" )
5
5
 
6
- s3 = ::S3::Service.new( read_s3_password( opts[:passwd_file] ) )
7
- bucket = s3.bucket( opts[:bucket] )
6
+ s3 = AWS::S3.new( read_s3_password( opts[:passwd_file] ) )
7
+ bucket = s3.buckets[ opts[:bucket] ]
8
8
 
9
9
  if !bucket.exists?
10
- bucket = s3.buckets.build( opts[:bucket] )
11
- bucket.save
10
+ bucket = s3.buckets.create( opts[:bucket] )
12
11
  end
13
12
 
14
- object = bucket.objects.build( backup_path )
15
- object.content = File.open( path )
16
- object.save
13
+ object = bucket.objects.create( s3_path )
14
+ object.write( :file => path )
17
15
  end
18
16
 
19
17
  def self.object( path, opts )
20
- s3 = ::S3::Service.new( read_s3_password( opts[:passwd_file] ) )
21
- bucket = s3.buckets.find( opts[:bucket] )
22
- object = bucket.objects.find( path )
18
+ s3 = AWS::S3.new( read_s3_password( opts[:passwd_file] ) )
19
+ bucket = s3.buckets[ opts[:bucket] ]
20
+ object = bucket.objects[ path ]
23
21
 
24
- return object
22
+ object
25
23
  end
26
24
 
27
25
  def self.paths_in( path, opts )
28
- s3 = ::S3::Service.new( read_s3_password( opts[:passwd_file] ) )
29
- bucket = s3.buckets.find( opts[:bucket] )
26
+ s3 = AWS::S3.new( read_s3_password( opts[:passwd_file] ) )
27
+ bucket = s3.buckets[ opts[:bucket] ]
30
28
 
31
29
  regex = Regexp.escape( path ).gsub('\*', '.*').gsub('\?', '.')
32
30
 
@@ -49,7 +47,7 @@ module SweetyBacky
49
47
  end
50
48
 
51
49
  def self.delete( path, opts )
52
- SweetyBacky::S3.object( path, opts ).destroy
50
+ SweetyBacky::S3.object( path, opts ).delete
53
51
  end
54
52
 
55
53
  end
@@ -1,3 +1,3 @@
1
1
  module SweetyBacky
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_development_dependency "delorean"
19
19
  s.add_development_dependency "rake"
20
20
 
21
- s.add_dependency "s3"
21
+ s.add_dependency "aws-sdk"
22
22
 
23
23
  s.files = `git ls-files`.split("\n")
24
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -21,14 +21,13 @@ class CommanderS3Test < Test::Unit::TestCase
21
21
  :working_path => @tmp_dir
22
22
  }
23
23
 
24
- s3 = ::S3::Service.new( SweetyBacky::S3.read_s3_password( @opts[:s3_opts][:passwd_file] ) )
24
+ s3 = AWS::S3.new( SweetyBacky::S3.read_s3_password( @opts[:s3_opts][:passwd_file] ) )
25
25
 
26
- @bucket = s3.buckets.build( @opts[:s3_opts][:bucket] )
27
- @bucket.save
26
+ @bucket = s3.buckets.create( @opts[:s3_opts][:bucket] )
28
27
  end
29
28
 
30
29
  def teardown
31
- @bucket.destroy( true )
30
+ @bucket.delete!
32
31
  end
33
32
 
34
33
  def test_clean
@@ -26,13 +26,12 @@ class RunnerS3Test < Test::Unit::TestCase
26
26
  @runner = SweetyBacky::Runner.new
27
27
  @runner.config( @opts )
28
28
 
29
- s3 = ::S3::Service.new( SweetyBacky::S3.read_s3_password( @opts[:s3_opts][:passwd_file] ) )
30
- @bucket = s3.buckets.build( @opts[:s3_opts][:bucket] )
31
- @bucket.save
29
+ s3 = AWS::S3.new( SweetyBacky::S3.read_s3_password( @opts[:s3_opts][:passwd_file] ) )
30
+ @bucket = s3.buckets.create( @opts[:s3_opts][:bucket] )
32
31
  end
33
32
 
34
33
  def teardown
35
- @bucket.destroy( true )
34
+ @bucket.delete!
36
35
  end
37
36
 
38
37
  def test_do_backup_daily
@@ -42,30 +41,30 @@ class RunnerS3Test < Test::Unit::TestCase
42
41
 
43
42
  assert(
44
43
  @bucket.
45
- object(
44
+ objects[
46
45
  "test/path/files/#{SweetyBacky::Utils.namerize( @opts[:paths][0] )}.#{Date.today.strftime('%Y%m%d')}.daily.tar.gz"
47
- ).exists?
46
+ ].exists?
48
47
  )
49
48
 
50
49
  assert(
51
50
  @bucket.
52
- object(
51
+ objects[
53
52
  "test/path/databases/test.#{Date.today.strftime('%Y%m%d')}.daily.sql.tar.gz"
54
- ).exists?
53
+ ].exists?
55
54
  )
56
55
 
57
56
  assert(
58
57
  @bucket.
59
- object(
58
+ objects[
60
59
  "test/path/files/#{SweetyBacky::Utils.namerize( @opts[:paths][0] )}.#{Date.today.strftime('%Y%m%d')}.daily.tar.gz.md5"
61
- ).exists?
60
+ ].exists?
62
61
  )
63
62
 
64
63
  assert(
65
64
  @bucket.
66
- object(
65
+ objects[
67
66
  "test/path/databases/test.#{Date.today.strftime('%Y%m%d')}.daily.sql.tar.gz.md5"
68
- ).exists?
67
+ ].exists?
69
68
  )
70
69
  end
71
70
 
@@ -11,13 +11,12 @@ class S3Test < Test::Unit::TestCase
11
11
  :passwd_file => '~/.s3.passwd'
12
12
  }
13
13
 
14
- s3 = ::S3::Service.new( SweetyBacky::S3.read_s3_password( @opts[:passwd_file] ) )
15
- @bucket = s3.buckets.build( @opts[:bucket] )
16
- @bucket.save
14
+ s3 = AWS::S3.new( SweetyBacky::S3.read_s3_password( @opts[:passwd_file] ) )
15
+ @bucket = s3.buckets.create( @opts[:bucket] )
17
16
  end
18
17
 
19
18
  def teardown
20
- @bucket.destroy( true )
19
+ @bucket.delete!
21
20
  end
22
21
 
23
22
  def test_upload
@@ -29,7 +28,7 @@ class S3Test < Test::Unit::TestCase
29
28
 
30
29
  assert_equal(
31
30
  File.read( "#{FIXTURES_PATH}/file.txt" ),
32
- SweetyBacky::S3.object( "test/path/file.txt", @opts ).content
31
+ SweetyBacky::S3.object( "test/path/file.txt", @opts ).read
33
32
  )
34
33
  end
35
34
 
@@ -54,8 +53,8 @@ class S3Test < Test::Unit::TestCase
54
53
 
55
54
  SweetyBacky::S3.delete( "test/path/file2.txt", @opts )
56
55
 
57
- assert( @bucket.object( "test/path/file1.txt" ).exists? )
58
- assert( !@bucket.object( "test/path/file2.txt" ).exists? )
56
+ assert( @bucket.objects[ "test/path/file1.txt" ].exists? )
57
+ assert( !@bucket.objects[ "test/path/file2.txt" ].exists? )
59
58
  end
60
59
 
61
60
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweety_backy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 15
10
- version: 0.0.15
9
+ - 17
10
+ version: 0.0.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Fernando Guillen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-22 00:00:00 +02:00
18
+ date: 2011-08-23 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -79,7 +79,7 @@ dependencies:
79
79
  type: :development
80
80
  version_requirements: *id004
81
81
  - !ruby/object:Gem::Dependency
82
- name: s3
82
+ name: aws-sdk
83
83
  prerelease: false
84
84
  requirement: &id005 !ruby/object:Gem::Requirement
85
85
  none: false