lib/runner.rb in tdi-0.1.0 vs lib/runner.rb in tdi-0.1.1

- old
+ new

@@ -1,5 +1,25 @@ +# +# Copyright (C) 2013-2014 Globo.com +# + +# This file is part of TDI. + +# TDI is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# TDI is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with TDI. If not, see <http://www.gnu.org/licenses/>. + +require 'os' require_relative 'tdi' # Run tests. def runner(opts, filename, plan) puts 'Running tests...'.cyan if opts[:verbose] > 1 @@ -76,10 +96,18 @@ summary(opts, tdiplan) # Shred. if opts.shred? puts "Shreding and removing test plan file: \"#{filename}\"...".cyan if opts[:verbose] > 2 - if system("shred -f -n 38 -u -z #{filename}") + if OS.linux? + shred_cmd = "shred -f -n 38 -u -z #{filename}" + elsif OS.mac? + shred_cmd = "srm -f -z #{filename}" + else + shred_cmd = "rm -f #{filename}" + end + puts "Shreding with command \"#{shred_cmd}\"...".cyan if opts[:verbose] > 2 + if system(shred_cmd) puts "Shreding and removing test plan file: \"#{filename}\"... done.".green if opts[:verbose] > 2 else puts "ERR: Shreding and removing test plan file: \"#{filename}\".".light_magenta end end