# File lib/brakeman/app_tree.rb, line 7 def self.from_options(options) root = options[:app_path] # Convert files into Regexp for matching if options[:skip_files] list = "(?:" << options[:skip_files].map { |f| Regexp.escape f }.join("|") << ")$" new(root, Regexp.new(list)) else new(root) end end
# File lib/brakeman/app_tree.rb, line 53 def controller_paths @controller_paths ||= find_paths("app/controllers") end
# File lib/brakeman/app_tree.rb, line 40 def exists?(path) File.exists?(File.join(@root, path)) end
# File lib/brakeman/app_tree.rb, line 24 def expand_path(path) File.expand_path(path, @root) end
# File lib/brakeman/app_tree.rb, line 49 def initializer_paths @initializer_paths ||= find_paths("config/initializers") end
# File lib/brakeman/app_tree.rb, line 65 def layout_exists?(name) pattern = "#{@root}/app/views/layouts/#{name}.html.{erb,haml}" !Dir.glob(pattern).empty? end
# File lib/brakeman/app_tree.rb, line 70 def lib_paths @lib_files ||= find_paths("lib") end
# File lib/brakeman/app_tree.rb, line 57 def model_paths @model_paths ||= find_paths("app/models") end
This is a pair for read_path. Again, would like to kill these
# File lib/brakeman/app_tree.rb, line 45 def path_exists?(path) File.exists?(path) end
# File lib/brakeman/app_tree.rb, line 28 def read(path) File.read(File.join(@root, path)) end
This variation requires full paths instead of paths based off the project root. I'd prefer to get all the code outside of AppTree using project-root based paths (e.g. app/models/user.rb) instead of full paths, but I suspect it's an incompatible change.
# File lib/brakeman/app_tree.rb, line 36 def read_path(path) File.read(path) end
Generated with the Darkfish Rdoc Generator 2.