astrails-safe 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,22 +2,26 @@ require 'tmpdir'
2
2
  module Astrails
3
3
  module Safe
4
4
  module TmpFile
5
- @KEEP_FILES = []
6
- TMPDIR = Dir.mktmpdir
5
+ @keep_files = []
6
+
7
+ def self.tmproot
8
+ @tmproot ||= Dir.mktmpdir
9
+ end
7
10
 
8
11
  def self.cleanup
9
- FileUtils.remove_entry_secure TMPDIR
12
+ FileUtils.remove_entry_secure tmproot
13
+ @tmproot = nil
10
14
  end
11
15
 
12
16
  def self.create(name)
13
17
  # create temp directory
14
18
 
15
- file = Tempfile.new(name, TMPDIR)
19
+ file = Tempfile.new(name, tmproot)
16
20
 
17
21
  yield file
18
22
 
19
23
  file.close
20
- @KEEP_FILES << file # so that it will not get gcollected and removed from filesystem until the end
24
+ @keep_files << file # so that it will not get gcollected and removed from filesystem until the end
21
25
  file.path
22
26
  end
23
27
  end
data/templates/script.rb CHANGED
@@ -72,6 +72,19 @@ safe do
72
72
 
73
73
  end
74
74
 
75
+ # # uncomment to enable
76
+ # # backup PostgreSQL databases with pg_dump
77
+ # pgdump do
78
+ # option "-i -x -O"
79
+ #
80
+ # user "markmansour"
81
+ # # password "" - leave this out if you have ident setup
82
+ #
83
+ # # database is a 'collection' element. it must have a hash or block parameter
84
+ # # it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
85
+ # database :blog
86
+ # database :production
87
+ # end
75
88
 
76
89
  tar do
77
90
  # 'archive' is a collection item, just like 'database'
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrails-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
+ - Mark Mansour
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-05-21 00:00:00 -07:00
13
14
  default_executable: astrails-safe
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
@@ -22,7 +23,7 @@ dependencies:
22
23
  - !ruby/object:Gem::Version
23
24
  version: "0"
24
25
  version:
25
- description: Simple tool to backup MySQL databases and filesystem locally or to Amazon S3 (with optional encryption)
26
+ description: Simple tool to backup databases (MySQL and PostgreSQL) and filesystem locally or to Amazon S3 (with optional encryption)
26
27
  email: we@astrails.com
27
28
  executables:
28
29
  - astrails-safe
@@ -36,12 +37,22 @@ files:
36
37
  - VERSION.yml
37
38
  - bin/astrails-safe
38
39
  - examples/example_helper.rb
40
+ - examples/integration
41
+ - examples/integration/archive_integration_example.rb
39
42
  - examples/unit
43
+ - examples/unit/archive_example.rb
40
44
  - examples/unit/config_example.rb
41
- - examples/unit/stream_example.rb
45
+ - examples/unit/gpg_example.rb
46
+ - examples/unit/gzip_example.rb
47
+ - examples/unit/local_example.rb
48
+ - examples/unit/mysqldump_example.rb
49
+ - examples/unit/pgdump_example.rb
50
+ - examples/unit/s3_example.rb
51
+ - examples/unit/svndump_example.rb
42
52
  - lib/astrails
43
53
  - lib/astrails/safe
44
54
  - lib/astrails/safe/archive.rb
55
+ - lib/astrails/safe/backup.rb
45
56
  - lib/astrails/safe/config
46
57
  - lib/astrails/safe/config/builder.rb
47
58
  - lib/astrails/safe/config/node.rb
@@ -49,11 +60,13 @@ files:
49
60
  - lib/astrails/safe/gzip.rb
50
61
  - lib/astrails/safe/local.rb
51
62
  - lib/astrails/safe/mysqldump.rb
63
+ - lib/astrails/safe/pgdump.rb
52
64
  - lib/astrails/safe/pipe.rb
53
65
  - lib/astrails/safe/s3.rb
54
66
  - lib/astrails/safe/sink.rb
55
67
  - lib/astrails/safe/source.rb
56
68
  - lib/astrails/safe/stream.rb
69
+ - lib/astrails/safe/svndump.rb
57
70
  - lib/astrails/safe/tmp_file.rb
58
71
  - lib/astrails/safe.rb
59
72
  - lib/extensions
@@ -87,6 +100,6 @@ rubyforge_project:
87
100
  rubygems_version: 1.2.0
88
101
  signing_key:
89
102
  specification_version: 2
90
- summary: Backup filesystem and MySQL to Amazon S3 (with encryption)
103
+ summary: Backup filesystem and databases (MySQL and PostgreSQL) to Amazon S3 (with encryption)
91
104
  test_files: []
92
105
 
@@ -1,33 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../example_helper')
2
-
3
- describe Astrails::Safe::Stream do
4
-
5
- before(:each) do
6
- @parent = Object.new
7
- @stream = Astrails::Safe::Stream.new(@parent)
8
- @r = rand(10)
9
- end
10
-
11
- def self.it_delegates_to_parent(prop)
12
- it "delegates #{prop} to parent if not set" do
13
- mock(@parent).__send__(prop) {@r}
14
- @stream.send(prop).should == @r
15
- end
16
- end
17
-
18
- def self.it_delegates_to_parent_with_cache(prop)
19
- it_delegates_to_parent(prop)
20
-
21
- it "uses cached value for #{prop}" do
22
- dont_allow(@parent).__send__(prop)
23
- @stream.instance_variable_set "@#{prop}", @r + 1
24
- @stream.send(prop).should == @r + 1
25
- end
26
- end
27
-
28
- it_delegates_to_parent_with_cache :id
29
- it_delegates_to_parent_with_cache :config
30
-
31
- it_delegates_to_parent :filename
32
-
33
- end