Sha256: a91d19786ff3fe7fa25e9eed2507d46493950b142ea10fda8ba0f827b19bd5aa

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env ruby
#Adjust path in case called directly and not through gem
$:.unshift "#{File.expand_path(File.dirname(__FILE__))}/../lib"

require 'brakeman'
require 'brakeman/options'
require 'brakeman/version'

trap("INT") do
  $stderr.puts "\nInterrupted - exiting."
  exit!
end

#Parse options
options, parser = Brakeman::Options.parse! ARGV

#Exit early for these options
if options[:list_checks]
  Brakeman.list_checks
  exit
elsif options[:create_config]
  Brakeman.dump_config options
  exit
elsif options[:show_help]
  puts parser
  exit
elsif options[:show_version]
  puts "brakeman #{Brakeman::Version}"
  exit
elsif options[:install_rake_task]
  Brakeman.install_rake_task
  exit
end

#Set application path according to the commandline arguments
unless options[:app_path]
  if ARGV[-1].nil?
    options[:app_path] = File.expand_path "."
  else
    options[:app_path] = File.expand_path ARGV[-1]
  end
end

#Run scan and output a report
clean = Brakeman.run options.merge(:print_report => true, :quiet => options[:quiet])

#Return error code if --exit-on-warn is used and warnings were found
if options[:exit_on_warn] and not clean
  exit Brakeman::Warnings_Found_Exit_Code
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brakeman-1.3.0 bin/brakeman
brakeman-1.2.2 bin/brakeman
brakeman-1.2.1 bin/brakeman
brakeman-1.2.0 bin/brakeman