understudy 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,4 @@
1
1
  language: ruby
2
- bundler_args: --without development
3
2
  rvm:
4
- - 1.8.7
5
- - 1.9.2
6
3
  - 1.9.3
7
4
  - 2.0.0
@@ -13,7 +13,10 @@ module Understudy
13
13
  ENV['TMPDIR']='/tmp/understudy/'
14
14
 
15
15
  log = Logger.new(STDOUT)
16
- log.level = Logger::INFO if options[:verbose]
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.info "Running: #{friendly}"
91
- RdiffSimple::RdiffBackup.execute( friendly ) or log.error "Could not run #{friendly}"
97
+ log.debug "Running: #{friendly}"
98
+ success = backup.execute friendly
92
99
  else
93
100
  friendly = command
94
- log.info "Running: #{friendly}"
95
- RdiffSimple::RdiffBackup.execute( friendly ) or log.error "Could not run #{friendly}"
101
+ log.debug "Running: #{friendly}"
102
+ success = backup.execute friendly
96
103
  end
97
- if $? != 0
98
- log.error "Could not run #{friendly}"
104
+
105
+ log.info backup.output_log
106
+ if success
107
+ log.debug "Backup successful"
99
108
  else
100
- log.info "Backup successful"
109
+ log.error "Could not run #{friendly}"
101
110
  end
102
111
  end
103
112
  end
@@ -1,3 +1,3 @@
1
1
  module Understudy
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: understudy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
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: -1337194065559452469
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: -1337194065559452469
189
+ hash: -1289708672271799556
190
190
  version: '0'
191
191
  none: false
192
192
  requirements: []