emoji 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +4 -0
- data/emoji.gemspec +1 -1
- data/lib/emoji.rb +19 -4
- data/lib/emoji/version.rb +1 -1
- data/test/emoji_test.rb +18 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 174fb12d6b0501388fb5ff4017d09367b6aa5d03
|
4
|
+
data.tar.gz: 59ab1a8c80158fe30fe85589ef1dd16ffd5cabf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f16c86fcea49a221d4fe0e4945ade156f2c362907731568cd1d31f3cb7fe3be606638ac4413eafaac200e000ce00913ae25b7a9f28f3ad23b760539599e308
|
7
|
+
data.tar.gz: 45172ab36a11c69ab9709b0565354ca4c54bf89931a315cf96d79ebfd184276cc3b3c546aba9aa900042d0de0f0e618221e69d2b4e3e0e47c164ed4dee830b22
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -108,6 +108,10 @@ gem 'escape_utils'
|
|
108
108
|
```
|
109
109
|
## Contributors: :heart:
|
110
110
|
|
111
|
+
This project was spawned from conversation at the BurlingtonRB conference between Steve/Winfield. Together they built the initial gem. Huge thanks to everyone else who's submitted code and work to the project.
|
112
|
+
|
113
|
+
* [@steveklabnik](https://github.com/steveklabnik): Created this project and made it all happen
|
114
|
+
* [@wpeterson](https://github.com/wpeterson): gem implementation
|
111
115
|
* [@ryan-orr](https://github.com/ryan-orr): Granted the official `emoji` rubygems account
|
112
116
|
* [@mikowitz](https://github.com/mikowitz): `String` ext helpers
|
113
117
|
* [@semanticart](https://github.com/semanticart): Cleanup/Ruby 1.9.3 support
|
data/emoji.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["steve@steveklabnik.com", "winfield.peterson@gmail.com"]
|
11
11
|
spec.description = %q{A Ruby gem. For emoji. For everyone. :heart:}
|
12
12
|
spec.summary = %q{A Ruby gem. For emoji. For everyone. :heart:}
|
13
|
-
spec.homepage = "http://github.com/
|
13
|
+
spec.homepage = "http://github.com/wpeterson/emoji"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
data/lib/emoji.rb
CHANGED
@@ -28,16 +28,31 @@ module Emoji
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.parse_and_validate_asset_host(asset_host_spec)
|
31
|
-
|
32
|
-
|
31
|
+
unless asset_host_spec && asset_host_spec.size >= 1
|
32
|
+
return ''
|
33
|
+
end
|
34
|
+
|
35
|
+
# Special Case for 'hostname:port' style URIs, not parse properly by URI.parse
|
36
|
+
if asset_host_spec.match(/^[^:]+:\d+$/)
|
37
|
+
components = asset_host_spec.split(':')
|
38
|
+
scheme_string = 'http://'
|
39
|
+
hostname = components.first
|
40
|
+
port_string = ":#{components.last}"
|
41
|
+
else
|
42
|
+
uri = parse_asset_host_uri(asset_host_spec)
|
33
43
|
scheme_string = extract_uri_scheme_string(asset_host_spec, uri)
|
34
44
|
hostname = uri.hostname || uri.path
|
35
45
|
port_string = extract_port_string(uri)
|
46
|
+
end
|
36
47
|
|
37
|
-
|
48
|
+
"#{ scheme_string }#{ hostname }#{ port_string }"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.parse_asset_host_uri(asset_host_spec)
|
52
|
+
URI.parse(asset_host_spec)
|
53
|
+
|
38
54
|
rescue URI::InvalidURIError
|
39
55
|
raise 'Invalid Emoji.asset_host, should be a hostname or URL prefix'
|
40
|
-
end
|
41
56
|
end
|
42
57
|
|
43
58
|
def self.extract_uri_scheme_string(asset_host_spec, uri)
|
data/lib/emoji/version.rb
CHANGED
data/test/emoji_test.rb
CHANGED
@@ -7,6 +7,12 @@ describe Emoji do
|
|
7
7
|
it 'should generate url' do
|
8
8
|
assert_equal 'http://localhost:3000/cyclone.png', Emoji.image_url_for_name('cyclone')
|
9
9
|
end
|
10
|
+
|
11
|
+
it 'should allow empty asset_host' do
|
12
|
+
with_emoji_config(:asset_host, '') do
|
13
|
+
assert_equal '/cyclone.png', Emoji.image_url_for_name('cyclone')
|
14
|
+
end
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
describe "image_url_for_unicode_moji" do
|
@@ -20,6 +26,12 @@ describe Emoji do
|
|
20
26
|
assert_equal 'http://localhost:3000', Emoji.asset_host
|
21
27
|
end
|
22
28
|
|
29
|
+
it 'should allow hostname and port simple' do
|
30
|
+
with_emoji_config(:asset_host, 'emoji:3000') do
|
31
|
+
assert_equal 'http://emoji:3000', Emoji.asset_host
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
23
35
|
it 'should allow hostname only and default scheme to http' do
|
24
36
|
with_emoji_config(:asset_host, 'emoji') do
|
25
37
|
assert_equal 'http://emoji', Emoji.asset_host
|
@@ -45,9 +57,12 @@ describe Emoji do
|
|
45
57
|
|
46
58
|
end
|
47
59
|
|
48
|
-
it 'should
|
49
|
-
|
50
|
-
|
60
|
+
it 'should coerce nil/empty URI' do
|
61
|
+
with_emoji_config(:asset_host, nil) do
|
62
|
+
assert_equal '', Emoji.asset_host
|
63
|
+
end
|
64
|
+
with_emoji_config(:asset_host, '') do
|
65
|
+
assert_equal '', Emoji.asset_host
|
51
66
|
end
|
52
67
|
end
|
53
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emoji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Klabnik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -585,7 +585,7 @@ files:
|
|
585
585
|
- test/index_test.rb
|
586
586
|
- test/string_ext_test.rb
|
587
587
|
- test/test_helper.rb
|
588
|
-
homepage: http://github.com/
|
588
|
+
homepage: http://github.com/wpeterson/emoji
|
589
589
|
licenses:
|
590
590
|
- MIT
|
591
591
|
metadata: {}
|