Ok the script is almost fully functional, few highlights:
➜ Projects rake -f emoji.rake emoji:clean && rake -f emoji.rake emoji:update
Cleaning emoji folder...
Downloading remote emoji list...
Downloading remote emoji images list...
Parsing remote emoji images list...
............................................. [omitted]
[!] Found existing image `sleeping_bed` for platform: apple, might want to remove the patch.
[!] Found existing image `snowboarder` for platform: apple, might want to remove the patch.
Writing emojis to disk...
.............................................. [omitted]
[!] Skipping zero :zero:, undefined platforms: windows
The script will warn you if an emoji hasn’t been created due to images missing on one or more platforms, it will also warn you if you have patched an image of one platform and this platform now has an image available.
A patch is as easy as tweaking a constant, also it uses readable names instead of code points for easier maintenance:
EMOJI_IMAGES_CELLS_INDEX_PATCH = {
:windows => {
"zero" => APPLE_CELL_INDEX # this cell index is the index of the col in http://unicode.org/emoji/charts/full-emoji-list.html
}
}
note: it’s also possible to patch skin toned emojis. (like snowboarder/2/3/4/5/6 for apple)
At the moment the source of truth for the emoji list is https://raw.githubusercontent.com/muan/emojilib/master/emojis.json
, some data is outdated, you can perform a patch on the output using a simple constant tweak:
EMOJI_KEYWORDS_PATCH = {
"blonde_woman" => { "fitzpatrick_scale" => true }
}
The db.json generated (and images) now contain the skin tones variations:
{
"code": "1f44b-1f3fd",
"name": "wave:t4"
}
You can read a first draft of the code here, I still have some cleaning/improvements to do, but it’s probably good enough for first comments : https://gist.github.com/jjaffeux/f56236a0858471a58c643aa1a3dc3e3d
Usage should be as simple as rake -f emoji.rake emoji:clean && rake -f emoji.rake emoji:update
I should soon be able to make a pull request containing this. Thanks to @sam for some of theses ideas.
TODO: