Sha256: 74b03a3389b1ebb1066ef62845273f6daf404d57300f968aeac594c679c75060
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require 'xezat' require 'xezat/ext/string' module Xezat class DetectorManager def initialize(detector_dir = File.expand_path(File.join(File.dirname(__FILE__), 'detector'))) Xezat.logger.debug(' Load detectors') @detectors = {} Dir.glob(File.join(detector_dir, '*.rb')).sort.each do |rb| require rb @detectors[File.basename(rb, '.rb').intern] = Object.const_get("Xezat::Detector::#{File.basename(rb, '.rb').camelize}").new end end def detect(variables) Xezat.logger.debug(' Detect tools') tools = [] @detectors.each do |name, detector| if variables[:PN].intern == name Xezat.logger.debug(" #{name} ... no (self)") elsif detector.detect(variables) tools << name Xezat.logger.debug(" #{name} ... yes") else Xezat.logger.debug(" #{name} ... no") end end if tools.include?(:python27) && (tools.include?(:python36) || tools.include?(:python37)) Xezat.logger.debug(' Remove python27 because of detecting python3x') tools.delete(:python27) end tools end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xezat-0.2.3 | lib/xezat/detectors.rb |
xezat-0.2.2 | lib/xezat/detectors.rb |