|
|
@ -1,23 +1,9 @@
|
|
|
|
|
|
|
|
require "open-uri"
|
|
|
|
require "json"
|
|
|
|
require "json"
|
|
|
|
require "securerandom"
|
|
|
|
require "securerandom"
|
|
|
|
|
|
|
|
|
|
|
|
require "gemoji"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# https://github.com/PurpleBooth/alfred-emoji-snippet-pack/blob/main/bin/generate
|
|
|
|
# https://github.com/PurpleBooth/alfred-emoji-snippet-pack/blob/main/bin/generate
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
light_skin_tone: ["🏻", "Light Skin Tone"],
|
|
|
|
|
|
|
|
medium_light_skin_tone: ["🏼", "Medium-Light Skin Tone"],
|
|
|
|
|
|
|
|
medium_skin_tone: ["🏽", "Medium Skin Tone"],
|
|
|
|
|
|
|
|
medium_dark_skin_tone: ["🏾", "Medium-Dark Skin Tone"],
|
|
|
|
|
|
|
|
dark_skin_tone: ["🏿", "Dark Skin Tone"],
|
|
|
|
|
|
|
|
}.each do |key, (unicode_alias, desc)|
|
|
|
|
|
|
|
|
Emoji.create(key.to_s) do |char|
|
|
|
|
|
|
|
|
char.add_unicode_alias unicode_alias
|
|
|
|
|
|
|
|
char.description = desc
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file "build" do
|
|
|
|
file "build" do
|
|
|
|
mkdir "build"
|
|
|
|
mkdir "build"
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -25,28 +11,22 @@ end
|
|
|
|
task :rebuild => "build" do
|
|
|
|
task :rebuild => "build" do
|
|
|
|
rm Dir["build/*.json"]
|
|
|
|
rm Dir["build/*.json"]
|
|
|
|
|
|
|
|
|
|
|
|
Emoji.all.each do |emoji|
|
|
|
|
URI.open("https://www.unicode.org/emoji/charts/emoji-ordering.txt") do |f|
|
|
|
|
|
|
|
|
f.read.scan(/(?:[^\n])#\s+(\S+)\s+(.*)$/).each do |emoji, name|
|
|
|
|
uuid = SecureRandom.uuid
|
|
|
|
uuid = SecureRandom.uuid
|
|
|
|
keywords = [emoji.description]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
keywords.concat(
|
|
|
|
|
|
|
|
emoji.aliases
|
|
|
|
|
|
|
|
.map { _1.gsub(?_, " ") }
|
|
|
|
|
|
|
|
.reject { str_match(emoji.description, _1) }
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
keywords.concat(emoji.tags)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File.write("build/#{emoji.name} [#{uuid}].json", JSON.dump({
|
|
|
|
File.write("build/#{emoji} [#{uuid}].json", JSON.dump({
|
|
|
|
alfredsnippet: {
|
|
|
|
alfredsnippet: {
|
|
|
|
snippet: emoji.raw,
|
|
|
|
snippet: emoji,
|
|
|
|
dontautoexpand: true,
|
|
|
|
dontautoexpand: true,
|
|
|
|
uid: uuid,
|
|
|
|
uid: uuid,
|
|
|
|
name: "#{emoji.raw} #{keywords.join(", ")}",
|
|
|
|
name: "#{emoji} #{name}",
|
|
|
|
keyword: emoji.name,
|
|
|
|
keyword: name.split.map { _1.gsub(":", "") },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
task :default => :rebuild
|
|
|
|
task :default => :rebuild
|
|
|
|
|
|
|
|
|
|
|
|
def str_match(a, b)
|
|
|
|
def str_match(a, b)
|
|
|
|