diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-11-15 18:08:25 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-11-15 18:08:25 +0000 |
commit | 0f5faea404ab514917adf06768f1a0991482b5b5 (patch) | |
tree | 6d90e4791404fda0cf1b44732eed45d0f00b6bdc /lib | |
parent | 69953fae36560773a06bbc426747e3dac6aa1ae1 (diff) | |
parent | ce1a1aa1f67d0438fd534920c9aef4e068ea4ddd (diff) | |
download | gitlab-ce-0f5faea404ab514917adf06768f1a0991482b5b5.tar.gz |
Merge branch 'update-emoji-digests-with-latest-from-gemojione' into 'master'
Update Emoji digests and assets with latest from Gemojione v3.3.0
Closes #32634
See merge request gitlab-org/gitlab-ce!15390
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gemojione.rake | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index 87ca39b079b..c2d3a6b6950 100644 --- a/lib/tasks/gemojione.rake +++ b/lib/tasks/gemojione.rake @@ -1,5 +1,28 @@ namespace :gemojione do desc 'Generates Emoji SHA256 digests' + + task aliases: ['yarn:check', 'environment'] do + require 'json' + + aliases = {} + + index_file = File.join(Rails.root, 'fixtures', 'emojis', 'index.json') + index = JSON.parse(File.read(index_file)) + + index.each_pair do |key, data| + data['aliases'].each do |a| + a.tr!(':', '') + + aliases[a] = key + end + end + + out = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json') + File.open(out, 'w') do |handle| + handle.write(JSON.pretty_generate(aliases, indent: ' ', space: '', space_before: '')) + end + end + task digests: ['yarn:check', 'environment'] do require 'digest/sha2' require 'json' @@ -16,8 +39,13 @@ namespace :gemojione do 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 = { - category: emoji_hash['category'], + category: category, moji: emoji_hash['moji'], description: emoji_hash['description'], unicodeVersion: Gitlab::Emoji.emoji_unicode_version(name), @@ -29,7 +57,6 @@ namespace :gemojione do end out = File.join(Rails.root, 'fixtures', 'emojis', 'digests.json') - File.open(out, 'w') do |handle| handle.write(JSON.pretty_generate(resultant_emoji_map)) end |