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 +1 -1
- data/examples/unit/local_example.rb +7 -1
- data/lib/astrails/safe.rb +4 -4
- data/lib/astrails/safe/local.rb +3 -1
- data/lib/astrails/safe/sftp.rb +2 -0
- data/templates/script.rb +1 -1
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -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
|
-
[[
|
45
|
-
[
|
46
|
-
[
|
47
|
-
[
|
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|
|
data/lib/astrails/safe/local.rb
CHANGED
@@ -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
|
25
|
+
system "#{@backup.command}>#{@backup.path}"
|
24
26
|
end
|
25
27
|
puts("command took " + sprintf("%.2f", benchmark) + " second(s).") if $_VERBOSE
|
26
28
|
end
|
data/lib/astrails/safe/sftp.rb
CHANGED
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.
|
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-
|
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
|