|
|
@ -14,17 +14,27 @@ class Themes |
|
|
|
result = Hash.new |
|
|
|
Dir.glob(Rails.root.join('app', 'javascript', 'flavours', '*', 'theme.yml')) do |path| |
|
|
|
data = YAML.load_file(path) |
|
|
|
name = File.basename(File.dirname(path)) |
|
|
|
dir = File.dirname(path) |
|
|
|
name = File.basename(dir) |
|
|
|
locales = [] |
|
|
|
screenshots = [] |
|
|
|
if data['locales'] |
|
|
|
locales = [] |
|
|
|
Dir.glob(File.join(File.dirname(path), data['locales'], '*.{js,json}')) do |locale| |
|
|
|
Dir.glob(File.join(dir, data['locales'], '*.{js,json}')) do |locale| |
|
|
|
localeName = File.basename(locale, File.extname(locale)) |
|
|
|
locales.push(localeName) unless localeName.match(/defaultMessages|whitelist|index/) |
|
|
|
end |
|
|
|
data['locales'] = locales |
|
|
|
end |
|
|
|
if data['screenshot'] |
|
|
|
if data['screenshot'].is_a? Array |
|
|
|
screenshots = data['screenshot'] |
|
|
|
else |
|
|
|
screenshots.push(data['screenshot']) |
|
|
|
end |
|
|
|
end |
|
|
|
if data['pack'] |
|
|
|
data['name'] = name |
|
|
|
data['locales'] = locales |
|
|
|
data['screenshot'] = screenshots |
|
|
|
data['skin'] = { 'default' => [] } |
|
|
|
result[name] = data |
|
|
|
end |
|
|
|