File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ def load(file, cleanup)
154154 unzip_file = File . join ( File . dirname ( file ) , File . basename ( file , ".#{ compressor . file_extension } " ) )
155155 # system("bunzip2 -f #{file} && bundle exec rake db:drop db:create && #{import_cmd(unzip_file)} && bundle exec rake db:migrate")
156156 @cap . info "executing local: #{ compressor . decompress ( file ) } " && #{import_cmd(unzip_file)}"
157- system ( "#{ compressor . decompress ( file ) } && #{ import_cmd ( unzip_file ) } " )
157+ execute ( "#{ compressor . decompress ( file ) } && #{ import_cmd ( unzip_file ) } " )
158158 if cleanup
159159 @cap . info "removing #{ unzip_file } "
160160 File . unlink ( unzip_file )
@@ -165,14 +165,22 @@ def load(file, cleanup)
165165 end
166166
167167 def dump
168- system "#{ dump_cmd } | #{ compressor . compress ( '-' , output_file ) } "
168+ execute "#{ dump_cmd } | #{ compressor . compress ( '-' , output_file ) } "
169169 self
170170 end
171171
172172 def upload
173173 remote_file = "#{ @cap . current_path } /#{ output_file } "
174174 @cap . upload! output_file , remote_file
175175 end
176+
177+ private
178+
179+ def execute ( cmd )
180+ result = system cmd
181+ @cap . error "Failed to executethe local command: #{ cmd } " unless result
182+ result
183+ end
176184 end
177185
178186
You can’t perform that action at this time.
0 commit comments