Class: Harbinger::Analyzers::MongoDetector
- Inherits:
-
Object
- Object
- Harbinger::Analyzers::MongoDetector
- Defined in:
- lib/harbinger/analyzers/mongo_detector.rb
Overview
Detects MongoDB version from projects
Instance Attribute Summary collapse
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
Instance Method Summary collapse
-
#detect ⇒ Object
Main detection method - returns version string or nil.
-
#initialize(project_path) ⇒ MongoDetector
constructor
A new instance of MongoDetector.
-
#mongo_detected? ⇒ Boolean
Check if MongoDB is used in this project.
Constructor Details
#initialize(project_path) ⇒ MongoDetector
Returns a new instance of MongoDetector.
11 12 13 |
# File 'lib/harbinger/analyzers/mongo_detector.rb', line 11 def initialize(project_path) @project_path = project_path end |
Instance Attribute Details
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
9 10 11 |
# File 'lib/harbinger/analyzers/mongo_detector.rb', line 9 def project_path @project_path end |
Instance Method Details
#detect ⇒ Object
Main detection method - returns version string or nil
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/harbinger/analyzers/mongo_detector.rb', line 16 def detect return nil unless mongo_detected? # Try docker-compose.yml first version = detect_from_docker_compose return version if version # Try shell command version = detect_from_shell return version if version # Fallback to gem version detect_from_gemfile_lock end |
#mongo_detected? ⇒ Boolean
Check if MongoDB is used in this project
32 33 34 |
# File 'lib/harbinger/analyzers/mongo_detector.rb', line 32 def mongo_detected? gemfile_has_mongo? || docker_compose_has_mongo? end |