Sha256: 051fd26c8445e1591c3a5c4ec323196eef415d1363076deaca6ba95f2f1cfd1e
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
require 'technologist/yaml_parser' module Technologist class FrameworkDetector FRAMEWORK_RULES = File.expand_path('../frameworks.yml', __FILE__) attr_reader :repository, :yaml_parser def initialize(repository) @repository = repository @yaml_parser = YamlParser.new(FRAMEWORK_RULES) end def primary_frameworks matched_frameworks.map do |technology| # it's either the primary value defined in the yaml # or the technology itself yaml_parser.rules[technology]['primary'] || technology end.uniq end def secondary_frameworks matched_frameworks.map do |technology| # it's a secondary if a primary is defined in the yaml yaml_parser.rules[technology]['primary'] && technology end.compact end private def matched_frameworks @frameworks ||= begin yaml_parser.rules.map do |technology, definition| definition['rules'].map do |rule| if rule.matches?(repository) technology end end end.flatten.compact end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
technologist-0.5.0 | lib/technologist/framework_detector.rb |
technologist-0.4.0 | lib/technologist/framework_detector.rb |