colin-safe 0.1.6 → 0.1.7

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/Rakefile CHANGED
@@ -9,10 +9,10 @@ begin
9
9
  gem.description = "Simple tool to backup MySQL databases and filesystem locally or to Amazon S3 (with optional encryption)"
10
10
  gem.email = "we@astrails.com"
11
11
  gem.homepage = "http://github.com/astrails/safe"
12
- gem.authors = ["Astrails Ltd."]
12
+ gem.authors = ["Astrails Ltd.", "Colin Schlueter"]
13
13
  gem.files = FileList["[A-Z]*.*", "{bin,examples,generators,lib,rails,spec,test,templates}/**/*", 'Rakefile', 'LICENSE*']
14
14
 
15
- gem.add_dependency("aws-s3")
15
+ gem.add_dependency("right_aws")
16
16
 
17
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
18
  end
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 6
4
+ :patch: 7
data/bin/astrails-safe CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'tempfile'
5
5
  require 'rubygems'
6
6
  require 'fileutils'
7
- require "aws/s3"
7
+ require 'right_aws'
8
8
  require 'yaml'
9
9
 
10
10
  #require 'ruby-debug'
@@ -12,42 +12,34 @@ module Astrails
12
12
  @prefix ||= expand(config[:s3, :path] || expand(config[:local, :path] || ":kind/:id"))
13
13
  end
14
14
 
15
- def save
16
- # needed in cleanup even on dry run
17
- AWS::S3::Base.establish_connection!(:access_key_id => key, :secret_access_key => secret, :use_ssl => true) unless $LOCAL
15
+ def base
16
+ @base ||= File.basename(filename).split(".").first
17
+ end
18
18
 
19
+ def save
19
20
  file = @parent.open
20
21
  puts "Uploading #{bucket}:#{path}" if $_VERBOSE || $DRY_RUN
21
22
  unless $DRY_RUN || $LOCAL
22
- AWS::S3::Bucket.create(bucket)
23
- AWS::S3::S3Object.store(path, file, bucket)
23
+ s3.create_bucket(bucket)
24
+ s3.put(bucket, path, file)
24
25
  puts "...done" if $_VERBOSE
25
26
  end
26
27
  file.close if file
27
-
28
28
  end
29
29
 
30
30
  def cleanup
31
-
32
31
  return if $LOCAL
33
-
34
32
  return unless keep = @config[:keep, :s3]
35
33
 
36
- bucket = @config[:s3, :bucket]
37
-
38
- base = File.basename(filename).split(".").first
39
-
40
34
  puts "listing files in #{bucket}:#{prefix}/#{base}"
41
- files = AWS::S3::Bucket.objects(bucket, :prefix => "#{prefix}/#{base}", :max_keys => keep * 2)
42
- puts files.collect {|x| x.key} if $_VERBOSE
35
+ files = s3.list_bucket(bucket, { 'prefix' => "#{prefix}/#{base}", 'max-keys' => keep * 2 })
36
+ puts files.collect {|x| x[:key]} if $_VERBOSE
43
37
 
44
- files = files.
45
- collect {|x| x.key}.
46
- sort
38
+ files = files.collect {|x| x[:key]}.sort
47
39
 
48
40
  cleanup_with_limit(files, keep) do |f|
49
41
  puts "removing s3 file #{bucket}:#{f}" if $DRY_RUN || $_VERBOSE
50
- AWS::S3::Bucket.find(bucket)[f].delete unless $DRY_RUN || $LOCAL
42
+ s3.delete(bucket, f) unless $DRY_RUN || $LOCAL
51
43
  end
52
44
  end
53
45
 
@@ -63,6 +55,10 @@ module Astrails
63
55
  config[:s3, :secret]
64
56
  end
65
57
 
58
+ def s3
59
+ @s3 ||= RightAws::S3Interface.new(key, secret)
60
+ end
61
+
66
62
  end
67
63
  end
68
64
  end
metadata CHANGED
@@ -1,19 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colin-safe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Astrails Ltd.
8
+ - Colin Schlueter
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-04-16 00:00:00 -07:00
13
+ date: 2009-04-24 00:00:00 -07:00
13
14
  default_executable: astrails-safe
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
- name: aws-s3
17
+ name: right_aws
17
18
  type: :runtime
18
19
  version_requirement:
19
20
  version_requirements: !ruby/object:Gem::Requirement
@@ -80,9 +81,9 @@ requirements: []
80
81
  rubyforge_project:
81
82
  rubygems_version: 1.2.0
82
83
  signing_key:
83
- specification_version: 2
84
+ specification_version: 3
84
85
  summary: Backup filesystem and MySQL to Amazon S3 (with encryption)
85
86
  test_files:
86
87
  - examples/example_helper.rb
87
- - examples/unit/stream_example.rb
88
88
  - examples/unit/config_example.rb
89
+ - examples/unit/stream_example.rb