81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/fanforce/factory/addons.rb', line 81
def dir_names
@dirs ||= Dir.chdir($HomeDir) do Dir['*/'].inject([]) do |dirs, d|
d = d.gsub('/', '')
next dirs if d !~ /^((app|plugin|widget)-(.+))\/?$/
next dirs << d if $Filter.blank?
next dirs << d if $Filter[:dir_name].present? and $Filter[:dir_name] == $1
if $Filter[:type] and $Filter[:type] == $2.to_sym and !$Filter[:plugin_type]
next dirs << d
elsif $Filter[:type] and $Filter[:type] == $2.to_sym and $Filter[:plugin_type]
next dirs if !File.exists?("#{$HomeDir}/#{$1}/config.ru")
File.open("#{$HomeDir}/#{$1}/config.ru", 'r') do |f|
if f.read =~ /FanforcePlugin\.config.+config.type\s+=\W+(data_connector|data_processor|broadcaster|identifier|behavior)/m
next dirs << d if $Filter[:plugin_type] == $1.to_sym
else
raise "#{d} is not correctly specifying its type in the config.ru file"
end
end
end
dirs
end end
end
|