Sha256: 1d2ac8eba9dd401f7ee1a304673af15a3529741149ea2a03feece566ee489a9d
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 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 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xezat-0.2.0 | lib/xezat/detectors.rb |