From 82c75d760634b9e32f1e7205c7cc6bde5e6e4598 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Thu, 17 Nov 2022 15:08:27 -0800 Subject: [PATCH] mu --- .gitignore | 1 + .ruby-version | 1 + Gemfile | 6 ++++++ Gemfile.lock | 15 +++++++++++++++ Rakefile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ build/info.plist | 10 ++++++++++ 6 files changed, 81 insertions(+) create mode 100644 .gitignore create mode 100644 .ruby-version create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile create mode 100644 build/info.plist diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..8c50098 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.1 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..b85e9fe --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "gemoji" +gem "rake" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..f889544 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,15 @@ +GEM + remote: https://rubygems.org/ + specs: + gemoji (4.0.0) + rake (13.0.6) + +PLATFORMS + ruby + +DEPENDENCIES + gemoji + rake + +BUNDLED WITH + 1.17.3 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..3cfb315 --- /dev/null +++ b/Rakefile @@ -0,0 +1,48 @@ +require "json" +require "securerandom" + +require "gemoji" + +# 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) do |char| + char.add_unicode_alias unicode_alias + char.description = desc + end +end + +file "build" do + mkdir "build" +end + +task :rebuild => "build" do + rm Dir["build/*.json"] + + Emoji.all.each do |emoji| + uuid = SecureRandom.uuid + name = [ + emoji.raw, + emoji.description, + emoji.aliases.map { "\"#{_1}\"" }.join(", "), + ] + name << "(#{emoji.tags.join(", ")})" unless emoji.tags.empty? + + File.write("build/#{emoji.name} [#{uuid}].json", JSON.dump({ + alfredsnippet: { + snippet: emoji.raw, + dontautoexpand: true, + uid: uuid, + name: name.join(" "), + keyword: emoji.name, + }, + })) + end +end +task :default => :rebuild diff --git a/build/info.plist b/build/info.plist new file mode 100644 index 0000000..bb29003 --- /dev/null +++ b/build/info.plist @@ -0,0 +1,10 @@ + + + + + snippetkeywordprefix + + snippetkeywordsuffix + + +