lib/stowaway/runner.rb in stowaway-0.1.8 vs lib/stowaway/runner.rb in stowaway-0.1.9
- old
+ new
@@ -21,22 +21,42 @@
end
private
def respond(result)
- if result.files.empty?
- print "Zero stowaways found. You run a tight ship.\n\n"
- else
- print "\nYou have #{result.files.length} stowaway(s) ... shameful\n\n"
+ files = result.files
+ name_only_matches = result.name_only_matches
- unless result.name_only_matches.empty?
- p "Warning: #{result.name_only_matches.length} file(s) partially matched on name only"
- end
+ if files.empty?
+ print "Zero stowaways found. "
+ end
- 60.times { print "-" }
- print "\n\n"
- result.files.each_with_index { |f, i| print "#{i+1}: #{f.root_path}\n" }
- print "\n"
+ if files.empty? and name_only_matches.empty?
+ print "You run a tight ship."
+ blank_lines
+ return
end
+
+ damage(result)
+ end
+
+ def damage(result)
+ files = result.files
+ name_only_matches = result.name_only_matches
+
+ print "\nYou have #{files.length} stowaway(s) ... scurvy dogs!\n"
+ warn name_only_matches
+ 60.times { print "-" }
+ blank_lines
+ files.each_with_index { |f, i| print "#{i+1}: #{f.root_path}\n" }
+ end
+
+ def warn name_only_matches
+ return if name_only_matches.empty?
+ print "WARNING: #{name_only_matches.length} file(s) partially matched on name only\n"
+ end
+
+ def blank_lines
+ print "\n\n"
end
end
end