diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-11-14 15:32:45 -0600 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-11-14 16:14:02 -0600 |
commit | b5b35865435ee12be26c22d37b286a4936b701af (patch) | |
tree | 6c05bc43e7447ad847b1772a244e4d007eeb43b9 /lib | |
parent | 27c9e83573df07799f5d77ccf4cafe96a2d43ee5 (diff) | |
download | gitlab-ce-b5b35865435ee12be26c22d37b286a4936b701af.tar.gz |
Regenerate emoji digests with latest gemojione
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gemojione.rake | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index 87ca39b079b..7a814da36bc 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' @@ -29,7 +52,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 |