class RailsScope
Attributes
options[R]
Public Class Methods
clean_up()
click to toggle source
# File lib/rails-scope.rb, line 61 def self.clean_up puts "#{$output_file}" $output_file.close ensure FileUtils.remove_entry_secure $tmpdir if !$tmpdir.nil? && Dir.exists?($tmpdir) end
klasses()
click to toggle source
# File lib/rails-scope.rb, line 34 def self.klasses %w{ Brakeman Flog Flay CodeCount Gemfile} end
run()
click to toggle source
# File lib/rails-scope.rb, line 13 def self.run @options = {} OptionParser.new do |opts| opts.banner = "Usage: rails-scope [options]" opts.on("-p", "--path /var/app/current", "Path to your application directory") do |p| @options[:path] = p end opts.on("-o", "--path /my/dir", "The location you would like the scope.nv file stored") do |o| @options[:output] = o end opts.on("-h", "--help", "Displays help information") do puts opts exit end end.parse! start end
separator(tool_name='')
click to toggle source
# File lib/rails-scope.rb, line 38 def self.separator(tool_name='') sep = tool_name == klasses.first ? "" : "\n" sep << "=" * 15 sep << tool_name sep << "=" * 15 sep << "\n\n" $output_file.puts sep end
start()
click to toggle source
# File lib/rails-scope.rb, line 47 def self.start $path = @options[:path] ? @options[:path] : Dir.pwd $output_path = @options[:output] ? @options[:output] : Dir.pwd $output_file = File.new("#{$output_path}/scope.nv", "w") $tmpdir = Dir.mktmpdir klasses.each do |klass| separator(klass.to_s) obj = Object.const_get(klass) obj.kick_off end ensure clean_up end