summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-03-14 10:18:18 +0100
committerStan Hu <stanhu@gmail.com>2019-04-10 11:49:06 -0700
commitc57529556c2ba3053e3a622efc2f5b6eeaabe009 (patch)
tree1cb928c3fa9c214f083e2f8b1ccc292ebda438db /lib/tasks
parentddab30ad3561c6834fd779458ce89084c8a95ca5 (diff)
downloadgitlab-ce-c57529556c2ba3053e3a622efc2f5b6eeaabe009.tar.gz
Revert "Merge branch 'tz-reorganise-digests-json' into 'master'"tz-revert-new-emojis-loading
Reverts the loading of emojis and its images to move forward with RC
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/gemojione.rake15
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