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