Sha256: ef9eb756a3f14b37b79be3ea678ef171f9edebfc51d2a09ab349cf5c689f9e2f
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
module Omnitest class Psychic module ScriptRunner def script_factory_manager @script_factory_manager ||= ScriptFactoryManager.new(self, opts) end def known_scripts @known_scripts ||= hints.scripts.map do | script_name, script_file | Script.new(self, script_name, script_file, opts) end end def script(script_name) find_in_known_scripts(script_name) || find_in_basedir(script_name) end protected def find_in_known_scripts(script_name) known_scripts.find do |script| script.name.downcase == script_name.downcase end end def find_in_basedir(script_name) # rubocop:disable Metrics/AbcSize file = FileFinder.find_file_by_alias(script_name, basedir) do | files | candidates = files.group_by do | script_file | # Chooses the file w/ the highest chance of being runnable path = Omnitest::Core::FileSystem.relativize(script_file, cwd) script = Script.new(self, script_name, path, opts) script_factory_manager.priority_for(script) || 0 end candidates.empty? ? files.first : candidates[candidates.keys.max].min_by(&:length) end return nil if file.nil? Script.new(self, script_name, file, opts).tap do | script | @known_scripts << script end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omnitest-psychic-0.0.9 | lib/omnitest/psychic/script_runner.rb |