# File lib/technologist/framework_detector.rb, line 20 def primary_frameworks matched_frameworks.map do |technology, definition| # it's either the primary value defined in the yaml # or the technology itself definition['primary'] || technology end.uniq end
class Technologist::FrameworkDetector
Constants
- FRAMEWORK_RULES
Attributes
repository[R]
yaml_parser[R]
Public Class Methods
new(repository)
click to toggle source
# File lib/technologist/framework_detector.rb, line 9 def initialize(repository) @repository = repository @yaml_parser = YamlParser.new(FRAMEWORK_RULES) end
Public Instance Methods
frameworks()
click to toggle source
# File lib/technologist/framework_detector.rb, line 14 def frameworks matched_frameworks.flat_map do |technology, definition| [definition['primary'], technology] end.compact.uniq end
primary_frameworks()
click to toggle source
secondary_frameworks()
click to toggle source
# File lib/technologist/framework_detector.rb, line 28 def secondary_frameworks matched_frameworks.map do |technology, definition| # it's a secondary if a primary is defined in the yaml definition['primary'] && technology end.compact end
Private Instance Methods
matched_frameworks()
click to toggle source
# File lib/technologist/framework_detector.rb, line 37 def matched_frameworks @frameworks ||= begin matched_rules = yaml_parser.rules.select do |technology, definition| definition['rules'].any? do |rule| rule.matches?(repository) end end Hash[matched_rules] end end