gemoji 3.0.0.rc2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/emoji/cli.rb +27 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 129cc87f6beaf861e6f886c5d2db15562225dde5
|
4
|
+
data.tar.gz: 9b310aaf5a6522824af665e8b88c04a023d2b708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c011fa25acb8922733993c64811adfac911e5661bf1ea587ea655e9ce28a82bdac5788c61fda8c3977dd2ee7938b462c95f1f839ed2b0a8f647d6692ff5f1bb3
|
7
|
+
data.tar.gz: 49cea6f72f419949b1e5b4b3d8199e48f96d9da92a338ac7d87bc337a0722f62d80da02ae3abe2af8f4a1bb1688c52473fa912e6a0c40accdbf28a9eadd46eca
|
data/lib/emoji/cli.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
require 'emoji/extractor'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'optparse'
|
3
4
|
|
4
5
|
module Emoji
|
5
6
|
module CLI
|
6
7
|
extend self
|
7
8
|
|
9
|
+
InvalidUsage = Class.new(RuntimeError)
|
10
|
+
|
8
11
|
def dispatch(argv)
|
9
12
|
cmd = argv[0]
|
10
13
|
argv = argv[1..-1]
|
@@ -15,11 +18,15 @@ module Emoji
|
|
15
18
|
when "help", "--help", "-h"
|
16
19
|
help
|
17
20
|
else
|
18
|
-
raise
|
21
|
+
raise InvalidUsage
|
19
22
|
end
|
20
23
|
|
21
24
|
return 0
|
22
|
-
rescue
|
25
|
+
rescue InvalidUsage, OptionParser::InvalidArgument, OptionParser::InvalidOption => err
|
26
|
+
unless err.message == err.class.to_s
|
27
|
+
$stderr.puts err.message
|
28
|
+
$stderr.puts
|
29
|
+
end
|
23
30
|
$stderr.puts usage_text
|
24
31
|
return 1
|
25
32
|
end
|
@@ -28,11 +35,25 @@ module Emoji
|
|
28
35
|
puts usage_text
|
29
36
|
end
|
30
37
|
|
38
|
+
VALID_SIZES = [ 20, 32, 40, 48, 64, 96, 160 ]
|
39
|
+
|
31
40
|
def extract(argv)
|
32
|
-
|
33
|
-
|
41
|
+
size = 64
|
42
|
+
|
43
|
+
OptionParser.new do |opts|
|
44
|
+
opts.on("--size=#{size}", Integer) do |val|
|
45
|
+
if VALID_SIZES.include?(val)
|
46
|
+
size = val
|
47
|
+
else
|
48
|
+
raise InvalidUsage, "size should be one of: #{VALID_SIZES.join(', ')}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end.parse!(argv)
|
52
|
+
|
53
|
+
raise InvalidUsage unless argv.size == 1
|
54
|
+
path = argv[0]
|
34
55
|
|
35
|
-
Emoji::Extractor.new(
|
56
|
+
Emoji::Extractor.new(size, path).extract!
|
36
57
|
Dir["#{Emoji.images_path}/*.png"].each do |png|
|
37
58
|
FileUtils.cp(png, File.join(path, File.basename(png)))
|
38
59
|
end
|
@@ -40,7 +61,7 @@ module Emoji
|
|
40
61
|
|
41
62
|
def usage_text
|
42
63
|
<<EOF
|
43
|
-
Usage: gemoji extract <path>
|
64
|
+
Usage: gemoji extract <path> [--size=64]
|
44
65
|
EOF
|
45
66
|
end
|
46
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Character information and metadata for standard and custom emoji.
|
14
14
|
email: support@github.com
|
@@ -58,9 +58,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '1.9'
|
59
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
66
|
rubygems_version: 2.4.5.1
|