Class: Hecks::Bluebook::ProjectDiscovery
- Inherits:
-
Object
- Object
- Hecks::Bluebook::ProjectDiscovery
- Defined in:
- lib/hecks/bluebook/project_discovery.rb
Overview
Finds domain declaration folders without loading or executing them.
Constant Summary collapse
- SKIPPED_DIRECTORIES =
%w[.git .bundle data node_modules target tmp vendor generated coverage].freeze
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #bluebook_directories ⇒ Object
-
#initialize(root) ⇒ ProjectDiscovery
constructor
A new instance of ProjectDiscovery.
Constructor Details
#initialize(root) ⇒ ProjectDiscovery
Returns a new instance of ProjectDiscovery.
11 12 13 |
# File 'lib/hecks/bluebook/project_discovery.rb', line 11 def initialize(root) @root = File.(root) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
9 10 11 |
# File 'lib/hecks/bluebook/project_discovery.rb', line 9 def root @root end |
Instance Method Details
#bluebook_directories ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hecks/bluebook/project_discovery.rb', line 15 def bluebook_directories found = [] Find.find(root) do |path| if File.directory?(path) if SKIPPED_DIRECTORIES.include?(File.basename(path)) Find.prune elsif File.basename(path) == "bluebook" && Dir.glob(File.join(path, "*.bluebook")).any? found << path end end end found.sort end |