diff options
author | Arinde Eniola <eniolaarinde1@gmail.com> | 2016-04-09 15:29:37 +0300 |
---|---|---|
committer | Arinde Eniola <eniolaarinde1@gmail.com> | 2016-04-09 15:29:37 +0300 |
commit | 1d1ca8b9c257f79ae75740cacad7d361635312b6 (patch) | |
tree | 62b06bd111dcd07a5df2d7715fd31a435c1da8f3 /lib/tasks | |
parent | 26f51bb07df7112cf00ed07e161088374bdb981c (diff) |
fix emoji aliases not showing in autocomplete
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gemojione.rake | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index 7ec00a898fd..030ee8bafcb 100644 --- a/lib/tasks/gemojione.rake +++ b/lib/tasks/gemojione.rake @@ -5,12 +5,23 @@ namespace :gemojione do require 'json' dir = Gemojione.index.images_path + digests = [] + aliases = Hash.new { |hash, key| hash[key] = [] } + aliases_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json') - digests = AwardEmoji.emojis.map do |name, emoji_hash| + JSON.parse(File.read(aliases_path)).each do |alias_name, real_name| + aliases[real_name] << alias_name + end + + AwardEmoji.emojis.map do |name, emoji_hash| fpath = File.join(dir, "#{emoji_hash['unicode']}.png") digest = Digest::SHA256.file(fpath).hexdigest - { name: name, unicode: emoji_hash['unicode'], digest: digest } + digests << { name: name, unicode: emoji_hash['unicode'], digest: digest } + + aliases[name].each do |alias_name| + digests << { name: alias_name, unicode: emoji_hash['unicode'], digest: digest } + end end out = File.join(Rails.root, 'fixtures', 'emojis', 'digests.json') |