images/emoji/*.png → images/*.png
2
.gitignore
vendored
@@ -3,5 +3,5 @@
|
||||
.bundle
|
||||
.ruby-version
|
||||
db/NamesList.txt
|
||||
images/emoji/unicode
|
||||
images/unicode/*.png
|
||||
vendor/
|
||||
|
||||
10
Rakefile
@@ -28,11 +28,7 @@ file 'db/NamesList.txt' do |t|
|
||||
system "curl -fsSL '#{nameslist_url}' -o '#{t.name}'"
|
||||
end
|
||||
|
||||
namespace :images do
|
||||
desc %(Extract PNG images from Apple's "Apple Color Emoji.ttf" font)
|
||||
task :extract do
|
||||
require 'emoji/extractor'
|
||||
images_path = File.expand_path("../images/emoji", __FILE__)
|
||||
Emoji::Extractor.new(64, images_path).extract!
|
||||
end
|
||||
directory 'images/unicode' do
|
||||
require 'emoji/extractor'
|
||||
Emoji::Extractor.new(64, Emoji.images_path).extract!
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
||||
s.files = Dir[
|
||||
"README.md",
|
||||
"bin/gemoji",
|
||||
"images/emoji/*.png",
|
||||
"images/*.png",
|
||||
"db/Category-Emoji.json",
|
||||
"db/emoji.json",
|
||||
"lib/**/*.rb",
|
||||
|
||||
|
Before Width: | Height: | Size: 898 B After Width: | Height: | Size: 898 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 1004 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -33,7 +33,7 @@ module Emoji
|
||||
raise ArgumentError if path.to_s.empty?
|
||||
|
||||
Emoji::Extractor.new(64, path).extract!
|
||||
Dir["#{Emoji.images_path}/emoji/*.png"].each do |png|
|
||||
Dir["#{Emoji.images_path}/*.png"].each do |png|
|
||||
FileUtils.cp(png, File.join(path, File.basename(png)))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ require 'digest/md5'
|
||||
class IntegrityTest < TestCase
|
||||
test "images on disk correlate 1-1 with emojis" do
|
||||
images_on_disk = Dir["#{Emoji.images_path}/**/*.png"].map {|f| f.sub(Emoji.images_path, '') }
|
||||
expected_images = Emoji.all.map { |emoji| '/emoji/%s' % emoji.image_filename }
|
||||
expected_images = Emoji.all.map { |emoji| '/%s' % emoji.image_filename }
|
||||
|
||||
missing_images = expected_images - images_on_disk
|
||||
assert_equal 0, missing_images.size, "these images are missing on disk:\n #{missing_images.join("\n ")}\n"
|
||||
@@ -17,7 +17,7 @@ class IntegrityTest < TestCase
|
||||
test "images on disk have no duplicates" do
|
||||
hashes = Hash.new { |h,k| h[k] = [] }
|
||||
Emoji.all.each do |emoji|
|
||||
checksum = Digest::MD5.file(File.join(Emoji.images_path, 'emoji', emoji.image_filename)).to_s
|
||||
checksum = Digest::MD5.file(File.join(Emoji.images_path, emoji.image_filename)).to_s
|
||||
hashes[checksum] << emoji
|
||||
end
|
||||
|
||||
@@ -42,7 +42,7 @@ class IntegrityTest < TestCase
|
||||
]
|
||||
end
|
||||
end
|
||||
assert_equal ["/emoji/shipit.png: 75x75"], mismatches
|
||||
assert_equal ["/shipit.png: 75x75"], mismatches
|
||||
end
|
||||
|
||||
test "missing or incorrect unicodes" do
|
||||
|
||||