diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gemojione.rake | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index c24207b134a..560a52053d8 100644 --- a/lib/tasks/gemojione.rake +++ b/lib/tasks/gemojione.rake @@ -30,28 +30,33 @@ namespace :gemojione do # We don't have `node_modules` available in built versions of GitLab FileUtils.cp_r(Rails.root.join('node_modules', 'emoji-unicode-version', 'emoji-unicode-version-map.json'), File.join(Rails.root, 'fixtures', 'emojis')) + dir = Gemojione.images_path resultant_emoji_map = {} Gitlab::Emoji.emojis.each do |name, emoji_hash| # Ignore aliases unless Gitlab::Emoji.emojis_aliases.key?(name) + fpath = File.join(dir, "#{emoji_hash['unicode']}.png") + hash_digest = Digest::SHA256.file(fpath).hexdigest + category = emoji_hash['category'] if name == 'gay_pride_flag' category = 'flags' end entry = { - c: category, - e: emoji_hash['moji'], - d: emoji_hash['description'], - u: Gitlab::Emoji.emoji_unicode_version(name) + category: category, + moji: emoji_hash['moji'], + description: emoji_hash['description'], + unicodeVersion: Gitlab::Emoji.emoji_unicode_version(name), + digest: hash_digest } resultant_emoji_map[name] = entry end end - out = File.join(Rails.root, 'public', '-', 'emojis', '1', 'emojis.json') + out = File.join(Rails.root, 'fixtures', 'emojis', 'digests.json') File.open(out, 'w') do |handle| handle.write(JSON.pretty_generate(resultant_emoji_map)) end |