astrails-safe 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 2
4
+ :patch: 3
@@ -73,9 +73,15 @@ describe Astrails::Safe::Local do
73
73
  end
74
74
 
75
75
  describe "dry run" do
76
+ before(:all) {$DRY_RUN = true}
77
+ after(:all) {$DRY_RUN = false}
78
+
76
79
  it "should not create directory"
77
80
  it "should not call system"
78
- it "should set backup.path"
81
+ it "should set backup.path" do
82
+ mock(@backup).path = "file-path"
83
+ @local.send(:save)
84
+ end
79
85
  end
80
86
  end
81
87
 
data/lib/astrails/safe.rb CHANGED
@@ -41,10 +41,10 @@ module Astrails
41
41
  #config.dump
42
42
 
43
43
 
44
- [[Astrails::Safe::Mysqldump, [:mysqldump, :databases]],
45
- [Astrails::Safe::Pgdump, [:pgdump, :databases]],
46
- [Astrails::Safe::Archive, [:tar, :archives]],
47
- [Astrails::Safe::Svndump, [:svndump, :repos]]
44
+ [[Mysqldump, [:mysqldump, :databases]],
45
+ [Pgdump, [:pgdump, :databases]],
46
+ [Archive, [:tar, :archives]],
47
+ [Svndump, [:svndump, :repos]]
48
48
  ].each do |klass, path|
49
49
  if collection = config[*path]
50
50
  collection.each do |name, config|
@@ -17,10 +17,12 @@ module Astrails
17
17
  def save
18
18
  puts "command: #{@backup.command}" if $_VERBOSE
19
19
 
20
+ @backup.path = full_path # need to do it outside DRY_RUN so that it will be avialable for S3 DRY_RUN
21
+
20
22
  unless $DRY_RUN
21
23
  FileUtils.mkdir_p(path) unless File.directory?(path)
22
24
  benchmark = Benchmark.realtime do
23
- system "#{@backup.command}>#{@backup.path = full_path}"
25
+ system "#{@backup.command}>#{@backup.path}"
24
26
  end
25
27
  puts("command took " + sprintf("%.2f", benchmark) + " second(s).") if $_VERBOSE
26
28
  end
@@ -13,6 +13,8 @@ module Astrails
13
13
  end
14
14
 
15
15
  def save
16
+ raise RuntimeError, "pipe-streaming not supported for SFTP." unless @backup.path
17
+
16
18
  puts "Uploading #{host}:#{full_path} via SFTP" if $_VERBOSE || $DRY_RUN
17
19
 
18
20
  unless $DRY_RUN || $LOCAL
data/templates/script.rb CHANGED
@@ -22,7 +22,7 @@ safe do
22
22
  # end
23
23
 
24
24
  ## alternative style:
25
- # s3 :key => YOUR_S3_KEY, :secret => YOUR_S3_SECRET, :bucket => S3_BUCKET
25
+ # s3 :key => YOUR_S3_KEY, :secret => YOUR_S3_SECRET, :bucket => S3_BUCKET, :path => ":kind/"
26
26
 
27
27
  ## uncomment to enable uploads via SFTP
28
28
  # sftp do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrails-safe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Astrails Ltd.
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-07-05 00:00:00 -07:00
13
+ date: 2009-07-17 00:00:00 -07:00
14
14
  default_executable: astrails-safe
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency