forked from buildkite/emojis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
37 lines (32 loc) · 993 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Generates a table to be copy and pasted into the readme when emojis are updated
#
# To run via Docker:
#
# docker run -it --rm -v "$(pwd)":/src ruby bash -c "cd /src && bundle install && rake"
require 'bundler/setup'
require 'json'
require 'gemoji'
task :default do
custom_emojis = JSON.parse(File.read("emojis.json"))
custom_emojis.each do |name, aliases|
Emoji.create(name) do |emoji|
if aliases.kind_of?(Array)
[aliases].flatten.each {|a| emoji.add_alias(a)}
end
end
end
rows = []
Emoji.all.each do |emoji|
rows << [
%{<img src="https://raw.githubusercontent.com/buildkite/emojis/master/images/#{emoji.image_filename}" width="20" height="20" alt="#{emoji.name}"/>},
[ emoji.name, emoji.aliases ].flatten.compact.uniq.join(", ")
]
end
# Reverse the rows so the latest emojis show up first
rows = rows.reverse
puts "Emoji | Aliases"
puts "----- | -------"
rows.each do |cols|
puts cols.join(" | ")
end
end