Skip to content

Commit

Permalink
The work so far on implementing the new data files for the new Webpac…
Browse files Browse the repository at this point in the history
…k based emoji loaders
  • Loading branch information
keithpitt committed Dec 1, 2015
1 parent c02f93e commit 4e1517b
Show file tree
Hide file tree
Showing 2,545 changed files with 17,207 additions and 79 deletions.
3 changes: 0 additions & 3 deletions Gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions Gemfile.lock

This file was deleted.

41 changes: 40 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'bundler/setup'
require 'json'
require 'gemoji'

task :default do
custom_emojis = JSON.parse(File.read("emojis.json"))
Expand Down Expand Up @@ -29,3 +28,43 @@ task :default do
puts cols.join(" | ")
end
end

task :generate do
parsed = JSON.parse(File.read(ENV.fetch("EMOJI_JSON")))
new = []

parsed.each do |e|
next if not e["has_img_apple"]

aliases = e["short_names"].dup
aliases.delete(e["short_name"])

name = e["short_name"]
category = e["category"]

category = "Flags" if name =~ /flag-/ && category.nil?

modifiers = []

if e["skin_variations"] && e["skin_variations"].length > 0
e["skin_variations"].each_with_index do |(key, skin), i|
modifiers << {
name: "skin-tone-#{i + 2}",
image: "img-apple-64/#{skin["image"]}",
unicode: skin["unified"]
}
end
end

new << {
name: name,
category: category,
image: "img-apple-64/#{e["image"]}",
unicode: e["unified"],
aliases: aliases,
modifiers: modifiers
}
end

puts JSON.pretty_generate(new)
end
Loading

0 comments on commit 4e1517b

Please sign in to comment.