Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/github/gemoji.git
π₯ extractor logic
We no longer ship any images to extract.
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
040aebef64
ΠΠΎΠΌΠΌΠΈΡ
0f9400398e
|
@ -1,5 +1,4 @@
|
|||
/bin/*
|
||||
!/bin/gemoji
|
||||
.bundle
|
||||
.ruby-version
|
||||
Gemfile.lock
|
||||
|
|
13
README.md
13
README.md
|
@ -1,8 +1,7 @@
|
|||
gemoji
|
||||
======
|
||||
|
||||
This library contains character information about native emoji, as well as image
|
||||
files for a few custom emoji.
|
||||
This library contains character information about native emojis.
|
||||
|
||||
|
||||
Installation
|
||||
|
@ -14,16 +13,6 @@ Add `gemoji` to your Gemfile.
|
|||
gem 'gemoji'
|
||||
```
|
||||
|
||||
### Extract images
|
||||
|
||||
``` sh
|
||||
bundle exec gemoji extract public/images/emoji
|
||||
```
|
||||
|
||||
This will extract images into filenames such as:
|
||||
|
||||
* `public/images/emoji/octocat.png`
|
||||
|
||||
|
||||
Example Rails Helper
|
||||
--------------------
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'emoji/cli'
|
||||
|
||||
exit_code = Emoji::CLI.dispatch(ARGV)
|
||||
exit exit_code
|
|
@ -3,7 +3,6 @@ Gem::Specification.new do |s|
|
|||
s.version = "3.0.1"
|
||||
s.summary = "Emoji library"
|
||||
s.description = "Character information and metadata for standard and custom emoji."
|
||||
s.executables = ["gemoji"]
|
||||
|
||||
s.required_ruby_version = '> 1.9'
|
||||
|
||||
|
@ -14,8 +13,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.files = Dir[
|
||||
"README.md",
|
||||
"bin/gemoji",
|
||||
"images/*.png",
|
||||
"LICENSE",
|
||||
"db/emoji.json",
|
||||
"lib/**/*.rb",
|
||||
]
|
||||
|
|
|
@ -11,10 +11,6 @@ module Emoji
|
|||
File.expand_path('../../db/emoji.json', __FILE__)
|
||||
end
|
||||
|
||||
def images_path
|
||||
File.expand_path("../../images", __FILE__)
|
||||
end
|
||||
|
||||
def all
|
||||
return @all if defined? @all
|
||||
@all = []
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'fileutils'
|
||||
require 'optparse'
|
||||
|
||||
module Emoji
|
||||
module CLI
|
||||
extend self
|
||||
|
||||
InvalidUsage = Class.new(RuntimeError)
|
||||
|
||||
def dispatch(argv)
|
||||
cmd = argv[0]
|
||||
argv = argv[1..-1]
|
||||
|
||||
case cmd
|
||||
when "extract"
|
||||
public_send(cmd, argv)
|
||||
when "help", "--help", "-h"
|
||||
help
|
||||
else
|
||||
raise InvalidUsage
|
||||
end
|
||||
|
||||
return 0
|
||||
rescue InvalidUsage, OptionParser::InvalidArgument, OptionParser::InvalidOption => err
|
||||
unless err.message == err.class.to_s
|
||||
$stderr.puts err.message
|
||||
$stderr.puts
|
||||
end
|
||||
$stderr.puts usage_text
|
||||
return 1
|
||||
end
|
||||
|
||||
def help
|
||||
puts usage_text
|
||||
end
|
||||
|
||||
def extract(argv)
|
||||
# OptionParser.new do |opts|
|
||||
# opts.on("--size=64", Integer) do |size|
|
||||
# end.parse!(argv)
|
||||
|
||||
raise InvalidUsage unless argv.size == 1
|
||||
path = argv[0]
|
||||
|
||||
Dir["#{Emoji.images_path}/*.png"].each do |png|
|
||||
FileUtils.cp(png, File.join(path, File.basename(png)))
|
||||
end
|
||||
end
|
||||
|
||||
def usage_text
|
||||
<<EOF
|
||||
Usage: gemoji extract <path>
|
||||
EOF
|
||||
end
|
||||
end
|
||||
end
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅