emoji 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a107032c52334744a9ea531dc52687ad3734542
4
- data.tar.gz: 02a61e602aafe01ed88f7f536f35e06846463854
3
+ metadata.gz: 174fb12d6b0501388fb5ff4017d09367b6aa5d03
4
+ data.tar.gz: 59ab1a8c80158fe30fe85589ef1dd16ffd5cabf6
5
5
  SHA512:
6
- metadata.gz: 109658ab8eb1bf45b80cbbe27e3eed081bb702d68b16f6e2a05e95a4de14811556ad915ffbc6e23fc5e19d37d335d8b77ae2f47554329dd1f4e149077ab09a73
7
- data.tar.gz: 1bdfd0c4687546ff3ba1a6676e93eab048471ac0e19220c576d5b1f9841db71279c97e4a078680938a5cccc6ac9c994c29737d4250c6689875e31b830603e902
6
+ metadata.gz: b6f16c86fcea49a221d4fe0e4945ade156f2c362907731568cd1d31f3cb7fe3be606638ac4413eafaac200e000ce00913ae25b7a9f28f3ad23b760539599e308
7
+ data.tar.gz: 45172ab36a11c69ab9709b0565354ca4c54bf89931a315cf96d79ebfd184276cc3b3c546aba9aa900042d0de0f0e618221e69d2b4e3e0e47c164ed4dee830b22
@@ -1,5 +1,13 @@
1
1
  # Releases / Changes
2
2
 
3
+ ## 1.0.4
4
+
5
+ * Moved Homepage/repo to wpeterson/emoji
6
+
7
+ ## 1.0.3
8
+
9
+ * Allow empty Emoji.asset_host and more asset_host formatting support
10
+
3
11
  ## 1.0.2
4
12
 
5
13
  * Improved Emoji.asset_host configuration/handling
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
@@ -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/steveklabnik/emoji"
13
+ spec.homepage = "http://github.com/wpeterson/emoji"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -28,16 +28,31 @@ module Emoji
28
28
  end
29
29
 
30
30
  def self.parse_and_validate_asset_host(asset_host_spec)
31
- begin
32
- uri = URI.parse(asset_host_spec)
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
- return "#{ scheme_string }#{ hostname }#{ port_string }"
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)
@@ -1,3 +1,3 @@
1
1
  module Emoji
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -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 validate hostname' do
49
- assert_raises(RuntimeError) do
50
- with_emoji_config(:asset_host, nil) {}
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.2
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-23 00:00:00.000000000 Z
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/steveklabnik/emoji
588
+ homepage: http://github.com/wpeterson/emoji
589
589
  licenses:
590
590
  - MIT
591
591
  metadata: {}