Class: Harbinger::Analyzers::GoDetector
- Inherits:
-
Object
- Object
- Harbinger::Analyzers::GoDetector
- Defined in:
- lib/harbinger/analyzers/go_detector.rb
Instance Method Summary collapse
- #detect ⇒ Object
- #go_detected? ⇒ Boolean
-
#initialize(project_path) ⇒ GoDetector
constructor
A new instance of GoDetector.
Constructor Details
#initialize(project_path) ⇒ GoDetector
Returns a new instance of GoDetector.
6 7 8 |
# File 'lib/harbinger/analyzers/go_detector.rb', line 6 def initialize(project_path) @project_path = project_path end |
Instance Method Details
#detect ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/harbinger/analyzers/go_detector.rb', line 10 def detect version = detect_from_go_mod || detect_from_go_work || detect_from_go_version_file || detect_from_docker_compose || detect_from_shell normalize_version(version) if version end |
#go_detected? ⇒ Boolean
20 21 22 23 24 |
# File 'lib/harbinger/analyzers/go_detector.rb', line 20 def go_detected? File.exist?(File.join(@project_path, "go.mod")) || File.exist?(File.join(@project_path, "go.work")) || File.exist?(File.join(@project_path, ".go-version")) end |