lib/mutx/support/files_cleanner.rb in mutx-0.1.69 vs lib/mutx/support/files_cleanner.rb in mutx-0.2.0
- old
+ new
@@ -13,10 +13,12 @@
false
end
end
+ # Returns true if delete fiven file_name
+ # @param [String] file_name
def self.delete_file file_name
begin
File.delete("#{file_name}") and true
rescue
false
@@ -32,18 +34,25 @@
def self.delete_report_which_has text
text = text.to_s if text.respond_to? :to_s
report = all_mutx_reports.select do |file|
file.include? text
end.first
-
- delete_file(report)
+ if delete_file(report)
+ Mutx::Support::Log.debug "Execution files(id=#{result.id}) cleanned" and true
+ else
+ false
+ end
end
def self.delete_html_report_for result_id
file = all_mutx_reports.select do |file|
file.include? result_id
end.first
- delete_file(file) if file
+ if file
+ delete_file(file) and true
+ else
+ false
+ end
end
def self.all_mutx_reports
Dir["#{Dir.pwd}/mutx/temp/*.*"].select do |file|
!file.scan(/mutx_report_\d+\.html/).empty?
\ No newline at end of file