12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/framework_identificator.rb', line 12
def self.from(source)
raise ArgumentError unless ["String", "Pathname", "Git::Base"].include?(source.class.name)
source = source.class.name == "Git::Base" ? source.dir.path : source
raise ArgumentError if source == ""
frameworks = {application: nil, testing: []}
FrameworkIdentificator::ApplicationFrameworks.available.detect do |framework|
frameworks[:application] = framework.new(source) if framework.recognized?(source)
end
FrameworkIdentificator::TestingFrameworks.available.each do |framework|
frameworks[:testing] << framework.new(source) if framework.recognized?(source)
end
frameworks
end
|