Class: ToolVersion::Detector
- Inherits:
-
Object
- Object
- ToolVersion::Detector
- Defined in:
- lib/tool_version/detector.rb
Constant Summary collapse
- TOOL_DETECTOR =
{ generic: ToolVersion::Detectors::Asdf, ruby: ToolVersion::Detectors::Ruby, nodejs: ToolVersion::Detectors::Node }
Instance Method Summary collapse
-
#fetch_tool_versions ⇒ Object
Run through the specified schema and fetch the most recent version for tooling.
-
#initialize(directory_interface, schemas: :generic) ⇒ Detector
constructor
A new instance of Detector.
Constructor Details
#initialize(directory_interface, schemas: :generic) ⇒ Detector
9 10 11 12 |
# File 'lib/tool_version/detector.rb', line 9 def initialize(directory_interface, schemas: :generic) @directory_interface = directory_interface @schemas = Array(schemas || :generic) end |
Instance Method Details
#fetch_tool_versions ⇒ Object
Run through the specified schema and fetch the most recent version for tooling
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tool_version/detector.rb', line 15 def fetch_tool_versions @schemas.map do |schema| Array(TOOL_DETECTOR[schema.to_sym]).map do |tool_detector| detector_instance = tool_detector.new( @directory_interface ) detector_instance.versions end end.flatten end |