Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Trying to parse in CSV compatibility for Ruby version 1.8.X in additi…
Browse files Browse the repository at this point in the history
…on to 1.9.X
  • Loading branch information
chrisallenlane committed Feb 9, 2013
1 parent 1478a20 commit f8e8fd8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions watchtower
Expand Up @@ -8,11 +8,16 @@
# http://twitter.com/chrisallenlane
#######################################################################


# try to patch in support for old ruby
is_ruby_18 = (RUBY_VERSION[0,3] === '1.8')

require 'rubygems'
require 'backports'
require 'csv'
require 'csv' unless is_ruby_18
require 'digest'
require 'erb'
require 'fastercsv' if is_ruby_18
require 'fileutils'
require 'iconv'
require 'open-uri'
Expand Down Expand Up @@ -165,7 +170,8 @@ case opts[:output_format]
# print a header row
puts '"file_type","file","line_number","match","name","snippet","group"'
vulnscanner.points_of_interest.each do |point|
puts CSV.generate_line(point.to_a, { :force_quotes => true }).gsub("\r", '').gsub("\n", '') + "\n";
puts CSV.generate_line(point.to_a, { :force_quotes => true }).gsub("\r", '').gsub("\n", '') + "\n" unless is_ruby_18
puts FasterCSV.generate_line(point.to_a, { :force_quotes => true }).gsub("\r", '').gsub("\n", '') + "\n" if is_ruby_18
end

when 'html'
Expand Down

0 comments on commit f8e8fd8

Please sign in to comment.