understudy 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -3
- data/lib/understudy/cli.rb +17 -8
- data/lib/understudy/version.rb +1 -1
- metadata +3 -3
data/.travis.yml
CHANGED
data/lib/understudy/cli.rb
CHANGED
@@ -13,7 +13,10 @@ module Understudy
|
|
13
13
|
ENV['TMPDIR']='/tmp/understudy/'
|
14
14
|
|
15
15
|
log = Logger.new(STDOUT)
|
16
|
-
log.level =
|
16
|
+
log.level = options[:verbose] ? Logger::DEBUG : Logger::INFO
|
17
|
+
log.formatter = proc do |severity, datetime, progname, msg|
|
18
|
+
"#{msg}\n"
|
19
|
+
end
|
17
20
|
|
18
21
|
job_name = job
|
19
22
|
|
@@ -63,8 +66,10 @@ module Understudy
|
|
63
66
|
|
64
67
|
if exists && options["first-time"]
|
65
68
|
log.error "Cannot force first time, destination '#{config.dest}' already exists"
|
69
|
+
return 1
|
66
70
|
elsif !exists && !options["first-time"]
|
67
71
|
log.error "Destination '#{config.dest}' does not appear to exist, try again with --first-time"
|
72
|
+
return 1
|
68
73
|
end
|
69
74
|
|
70
75
|
run config.command if config.command
|
@@ -84,20 +89,24 @@ module Understudy
|
|
84
89
|
|
85
90
|
private
|
86
91
|
def run(command, log)
|
92
|
+
backup = RdiffSimple::RdiffBackup.new
|
87
93
|
friendly = nil
|
94
|
+
succes = false
|
88
95
|
if command.is_a? Array
|
89
96
|
friendly = command.map { |i| i =~ /[^-=\/\.\w]/ ? "#{i}" : i }.join ' '
|
90
|
-
log.
|
91
|
-
|
97
|
+
log.debug "Running: #{friendly}"
|
98
|
+
success = backup.execute friendly
|
92
99
|
else
|
93
100
|
friendly = command
|
94
|
-
log.
|
95
|
-
|
101
|
+
log.debug "Running: #{friendly}"
|
102
|
+
success = backup.execute friendly
|
96
103
|
end
|
97
|
-
|
98
|
-
|
104
|
+
|
105
|
+
log.info backup.output_log
|
106
|
+
if success
|
107
|
+
log.debug "Backup successful"
|
99
108
|
else
|
100
|
-
log.
|
109
|
+
log.error "Could not run #{friendly}"
|
101
110
|
end
|
102
111
|
end
|
103
112
|
end
|
data/lib/understudy/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: understudy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.11
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ryan Hansen
|
@@ -177,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
segments:
|
179
179
|
- 0
|
180
|
-
hash: -
|
180
|
+
hash: -1289708672271799556
|
181
181
|
version: '0'
|
182
182
|
none: false
|
183
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
segments:
|
188
188
|
- 0
|
189
|
-
hash: -
|
189
|
+
hash: -1289708672271799556
|
190
190
|
version: '0'
|
191
191
|
none: false
|
192
192
|
requirements: []
|