gemojione 3.2.0 → 3.3.0

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: 4d8b9116de3119085b28ef81bf5e6de01c6a80e7
4
- data.tar.gz: 3da8d28d3037e223337088f0543d957a0e0d5b10
3
+ metadata.gz: 8aab09e3236a7c0dd58128746e1d216f23353203
4
+ data.tar.gz: 7945255d95f9cfc1b0d4ff5d4c5c7c0c1dc0bc70
5
5
  SHA512:
6
- metadata.gz: 5a312ad089855a0c35f1a8f09c5221e231cbf635507b35dee45150c98f646b077da017c6c6b5b75dfe83a5ffbc9b46db9ad08fd48a8ec56b68cfe96ec23647ce
7
- data.tar.gz: 2d97873bbcaea8ec1abdd9cd78dbdf5b18bfb4e61f21bc1e18b7442608b0df890ffa9ffc560ef59937969d68442af3a4aadf37c7337fc8e45e1f8fac75f3d05c
6
+ metadata.gz: 5003f6e18f3a5e44662530d6b0a53893bba029cdbe02ec8f236914b050c821eec52f8b85333c3441347465fdce9f6e7e138ae82f43e2e81ab75207090b208fee
7
+ data.tar.gz: acb844802acb12c5bea30f89dd922bee0e40dc56284ba66c534c583a56844549a9c839868220e9db6f8881c9c96301a5e49e9757e2b1e3d79ee6f26398b57717
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.1.0
6
6
  - 2.2.5
7
7
  - 2.3.1
8
+ - 2.4.0
8
9
  - rbx-2
9
10
  - ruby-head
10
11
  - jruby-head
@@ -13,3 +14,10 @@ matrix:
13
14
  allow_failures:
14
15
  - rvm: ruby-head
15
16
  - rvm: jruby-head
17
+ - rvm: rbx-2
18
+
19
+ addons:
20
+ code_climate:
21
+ repo_token: 418bd243b301fd0d29e8762626cc63ee2b3d2c41124c2d880e0e00d59057f639
22
+ after_success:
23
+ - bundle exec codeclimate-test-reporter
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.3.0](https://github.com/jonathanwiesel/gemojione/tree/v3.3.0) (2017-07-14)
4
+
5
+ [Full Changelog](https://github.com/jonathanwiesel/gemojione/compare/v3.2.0...v3.3.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add aliases search support in `replace_named_moji_with_images`.
10
+ - Add emoji finder by shortname.
11
+ - Add access to emoji list.
12
+ - Add emoji finder by category.
13
+
14
+ **Fixed bugs:**
15
+
16
+ - Remove trailing comma from `cartwheel_tone4`.
17
+
18
+ **Merged pull requests:**
19
+
20
+ - Add aliases search support in replace_named_moji_with_images [\#38](https://github.com/jonathanwiesel/gemojione/pull/38) ([jonathanwiesel](https://github.com/jonathanwiesel))
21
+
22
+ - Enable emoji retrieval by shortname [\#42](https://github.com/jonathanwiesel/gemojione/pull/42) ([amyspark](https://github.com/amyspark))
23
+
24
+ - Remove misplaced comma [\#49](https://github.com/jonathanwiesel/gemojione/pull/49) ([connorshea](https://github.com/connorshea))
25
+
26
+ - Enable emoji access to emoji list [\#43](https://github.com/jonathanwiesel/gemojione/pull/43) ([ryosuke-endo](https://github.com/ryosuke-endo))
27
+
28
+ - emoji group find by category [\#44](https://github.com/jonathanwiesel/gemojione/pull/44) ([ryosuke-endo](https://github.com/ryosuke-endo))
29
+
30
+ - Be clearer about spritesheet sizing [\#47](https://github.com/jonathanwiesel/gemojione/pull/47) ([gnclmorais](https://github.com/gnclmorais))
31
+
3
32
  ## [v3.2.0](https://github.com/jonathanwiesel/gemojione/tree/v3.2.0) (2016-08-22)
4
33
 
5
34
  [Full Changelog](https://github.com/jonathanwiesel/gemojione/compare/v3.1.0...v3.2.0)
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in gemojione.gemspec
4
- gemspec
4
+ gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gemojione
2
2
 
3
- [![Build Status][travisUrl]][travisProject] [![Downloads][downs]][rubyUrl] [![Version][version]][rubyUrl] [![Dependencies][gemnasiumDeps]][gemnasiumProject]
3
+ [![Build Status][travisUrl]][travisProject] [![Downloads][downs]][rubyUrl] [![Version][version]][rubyUrl] [![Dependencies][gemnasiumDeps]][gemnasiumProject] [![Coverage][coverage]][codeclimate] [![GPA][gpa]][codeClimate]
4
4
 
5
5
  A gem for EmojiOne
6
6
 
@@ -157,7 +157,7 @@ gem 'escape_utils'
157
157
  ```
158
158
 
159
159
  ## Spritesheet scaling
160
- Default size for sprite tag is 64px x 64px, [zoom](http://caniuse.com/#feat=css-zoom) or [transform: scale()](http://caniuse.com/#feat=transforms2d) can be used for custom scaling. transform: scale() is more widely supported.
160
+ If you’re using spritesheets, customising `Gemojione.default_size` at `config/initializers/gemojione.rb` won’t work. Default size for sprite tag is 64px x 64px, but [`zoom`](http://caniuse.com/#feat=css-zoom) or [`transform: scale()`](http://caniuse.com/#feat=transforms2d) can be used for custom scaling. transform: scale() is more widely supported.
161
161
 
162
162
  ```css
163
163
  .emojione{
@@ -190,6 +190,10 @@ This gem is a former fork of the [emoji](https://github.com/wpeterson/emoji) gem
190
190
  * [@kendrikat](https://github.com/kendrikat): Railtie dependecy checker, default size option support and new `replace_named_moji_with_images` feature.
191
191
  * [@gnclmorais](https://github.com/gnclmorais): Add `replace_named_moji_with_images ` missing ext helper.
192
192
  * [@naveed-ahmad](https://github.com/naveed-ahmad): ASCII replacement API and Spritesheet support.
193
+ * [@Eric-Guo](https://github.com/Eric-Guo): Usage of `.ruby-version` instead of `.rvmrc`.
194
+ * [@amyspark](https://github.com/amyspark): Add `find_by_shortname`
195
+ * [@ryosuke-endo](https://github.com/ryosuke-endo): Access to emoji list and `find_by_category`.
196
+ * [@connorshea](https://github.com/connorshea): Bugfixing.
193
197
 
194
198
  ## Contributing
195
199
 
@@ -211,3 +215,6 @@ Run `rake resprite` to regenerate the spritesheets if you're adding new images
211
215
  [rubyUrl]: https://rubygems.org/gems/gemojione
212
216
  [gemnasiumDeps]: https://img.shields.io/gemnasium/jonathanwiesel/gemojione.svg
213
217
  [gemnasiumProject]: https://gemnasium.com/jonathanwiesel/gemojione
218
+ [coverage]: https://img.shields.io/codeclimate/coverage/github/jonathanwiesel/gemojione.svg
219
+ [codeclimate]: https://codeclimate.com/github/jonathanwiesel/gemojione
220
+ [gpa]: https://img.shields.io/codeclimate/github/jonathanwiesel/gemojione.svg
data/config/index.json CHANGED
@@ -4023,7 +4023,7 @@
4023
4023
  ],
4024
4024
  "aliases_ascii": [],
4025
4025
  "keywords": [],
4026
- "moji": "🤸🏾,"
4026
+ "moji": "🤸🏾"
4027
4027
  },
4028
4028
  "cartwheel_tone5": {
4029
4029
  "unicode": "1F938-1F3FF",
data/gemojione.gemspec CHANGED
@@ -24,5 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "minitest"
26
26
  spec.add_development_dependency "sprite-factory"
27
- spec.add_development_dependency 'rmagick'
27
+ spec.add_development_dependency "rmagick"
28
+ spec.add_development_dependency "simplecov"
29
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
28
30
  end
@@ -1,5 +1,7 @@
1
1
  module Gemojione
2
2
  class Index
3
+ attr_reader :all
4
+
3
5
  def initialize(emoji_list=nil)
4
6
  emoji_list ||= begin
5
7
  emoji_json = File.read(File.absolute_path(File.dirname(__FILE__) + '/../../config/index.json'))
@@ -11,6 +13,8 @@ module Gemojione
11
13
  @emoji_by_ascii = {}
12
14
  @emoji_by_code = {}
13
15
  @emoji_by_keyword = {}
16
+ @emoji_by_category = {}
17
+ @all = emoji_list
14
18
 
15
19
  emoji_list.each do |key, emoji_hash|
16
20
 
@@ -21,6 +25,7 @@ module Gemojione
21
25
  emoji_hash["aliases"].each do |emoji_alias|
22
26
  aliased = emoji_alias.tr(':','')
23
27
  @emoji_by_name[aliased] = emoji_hash if aliased
28
+ @emoji_by_code[emoji_alias] = emoji_hash if aliased
24
29
  end
25
30
 
26
31
  emoji_hash['aliases_ascii'].each do |emoji_ascii|
@@ -37,6 +42,12 @@ module Gemojione
37
42
  @emoji_by_keyword[emoji_keyword] ||= []
38
43
  @emoji_by_keyword[emoji_keyword] << emoji_hash
39
44
  end
45
+
46
+ category = emoji_hash['category']
47
+ if category
48
+ @emoji_by_category[category] ||= {}
49
+ @emoji_by_category[category][key] = emoji_hash
50
+ end
40
51
  end
41
52
 
42
53
  @emoji_code_regex = /#{@emoji_by_code.keys.map{|ec| Regexp.escape(ec)}.join('|')}/
@@ -60,6 +71,14 @@ module Gemojione
60
71
  @emoji_by_keyword[keyword]
61
72
  end
62
73
 
74
+ def find_by_category(category)
75
+ @emoji_by_category[category]
76
+ end
77
+
78
+ def find_by_shortname(shortname)
79
+ @emoji_by_code[shortname]
80
+ end
81
+
63
82
  def unicode_moji_regex
64
83
  @emoji_moji_regex
65
84
  end
@@ -1,3 +1,3 @@
1
1
  module Gemojione
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
3
3
  end
@@ -186,6 +186,12 @@ describe Gemojione do
186
186
  assert_equal "I <img alt=\"❤\" class=\"emoji\" src=\"http://localhost:3000/2764.png\"> Emoji", replaced_string
187
187
  end
188
188
 
189
+ it 'should replace aliased moji with img tag' do
190
+ base_string = "Good one :+1:"
191
+ replaced_string = Gemojione.replace_named_moji_with_images(base_string)
192
+ assert_equal "Good one <img alt=\"👍\" class=\"emoji\" src=\"http://localhost:3000/1F44D.png\">", replaced_string
193
+ end
194
+
189
195
  it 'should handle nil string' do
190
196
  assert_equal nil, Gemojione.replace_named_moji_with_images(nil)
191
197
  end
data/test/index_test.rb CHANGED
@@ -5,6 +5,12 @@ require File.absolute_path File.dirname(__FILE__) + '/test_helper'
5
5
  describe Gemojione::Index do
6
6
  let(:index) { Gemojione::Index.new }
7
7
 
8
+ describe "all" do
9
+ it "return emoji_list" do
10
+ assert index.all, index.instance_variable_get(:@emoji_by_name)
11
+ end
12
+ end
13
+
8
14
  describe "find_by_name" do
9
15
  it 'should find cyclone emoji' do
10
16
  assert index.find_by_name('cyclone')
@@ -33,6 +39,18 @@ describe Gemojione::Index do
33
39
  assert index.find_by_ascii('<3')['unicode'] == "2764"
34
40
  end
35
41
  end
42
+
43
+ describe 'find by shortname' do
44
+ it 'returns the heart emoji' do
45
+ assert index.find_by_shortname(':heart:')['unicode'] == '2764'
46
+ end
47
+ end
48
+
49
+ describe 'find by category' do
50
+ it 'should find people category by category name' do
51
+ assert index.find_by_category('people')
52
+ end
53
+ end
36
54
 
37
55
  describe "unicode_moji_regex" do
38
56
  it "should return complex moji regex" do
data/test/test_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
1
4
  require 'rubygems'
2
5
  require 'bundler/setup'
3
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemojione
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Klabnik
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-22 00:00:00.000000000 Z
13
+ date: 2017-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -96,6 +96,34 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
+ - !ruby/object:Gem::Dependency
100
+ name: simplecov
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: codeclimate-test-reporter
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 1.0.0
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 1.0.0
99
127
  description: A gem for EmojiOne
100
128
  email:
101
129
  - steve@steveklabnik.com
@@ -106,7 +134,7 @@ extensions: []
106
134
  extra_rdoc_files: []
107
135
  files:
108
136
  - ".gitignore"
109
- - ".rvmrc"
137
+ - ".ruby-version"
110
138
  - ".travis.yml"
111
139
  - CHANGELOG.md
112
140
  - Gemfile
@@ -3735,7 +3763,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
3735
3763
  version: '0'
3736
3764
  requirements: []
3737
3765
  rubyforge_project:
3738
- rubygems_version: 2.4.8
3766
+ rubygems_version: 2.5.1
3739
3767
  signing_key:
3740
3768
  specification_version: 4
3741
3769
  summary: A gem for EmojiOne
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ruby-2.0.0-p247@gemojione --create