tanuki_emoji 0.7.0 → 0.9.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
  SHA256:
3
- metadata.gz: 31696b93726ca04628ec4659e4f0a0f41dafa4223791e1a51ec3ad08760c66af
4
- data.tar.gz: 9784c1d059e0a3cf8db903a97375636b5679e40ddb59dee450ceb721e0178a89
3
+ metadata.gz: 813531e905727359e63b0cc535a5c2e7f4f418536d1aa22c1fc93515f47fbbe9
4
+ data.tar.gz: fa5fe7bbeddee299620bc45ba7fe1fb387ae963b2e0d4f5c9b26d229732631e1
5
5
  SHA512:
6
- metadata.gz: df6ef5d255eef71dca9c1a17b2f67d01116d55cdc2c24ed1c26b62b04d9b8ac40c04c25b432d5cf64dd29043965457669906bbe57f57e9120e09a728b1011c35
7
- data.tar.gz: f2c23bfc342a090d801bd09d1e952cc9aa8cfdd9905b5fc6e3c7be96b75b16ccccd6b3e07cf5ccaf389775baaa34ecb801416d78beeb050441465a758454d4e5
6
+ metadata.gz: 7c0268dbd2f81f2994171dfc6aa42373537824fd7ce4568555a60ee8a5608241ace1386e6f2e063997e7d148261c386174427793d46ef4dd53675c57add48928
7
+ data.tar.gz: 46c771d114d9f0529dfcd47b161988ccf57f1f73674b12253b1d28241ca75445ce1e678aa801cdc96547cbf9a9e37911b0007a45421ddaa25df2d1f7600c3eaa
data/.gitlab-ci.yml CHANGED
@@ -17,7 +17,7 @@ workflow:
17
17
  - bundle install -j $(nproc) # Install dependencies into ./vendor/ruby
18
18
  parallel:
19
19
  matrix:
20
- - RUBY_VERSION: ['2.7', '3.0', '3.1', '3.2']
20
+ - RUBY_VERSION: ['3.0', '3.1', '3.2']
21
21
  image: "ruby:$RUBY_VERSION"
22
22
  cache:
23
23
  paths:
@@ -79,7 +79,7 @@ secret_detection:
79
79
 
80
80
  update-changelog:
81
81
  stage: deploy
82
- image: ruby:2.7
82
+ image: ruby:3.0
83
83
  rules:
84
84
  - if: '$GITLAB_API_TOKEN == null'
85
85
  when: never
@@ -93,4 +93,4 @@ update-changelog:
93
93
  - |
94
94
  version=$(ruby -e "print Gem::Specification.load('${GEMSPEC_FILE}').version")
95
95
  [ -n "${version}" ] || (echo "VERSION could not be parsed in ${GEMSPEC_FILE}!" && exit 1)
96
- - 'curl -X POST --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/changelog?version=${version}&branch=${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"'
96
+ - 'curl --fail --request POST --header "PRIVATE-TOKEN: ${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/changelog?version=${version}&branch=${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"'
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7
2
+ TargetRubyVersion: 3.0
3
3
  Exclude:
4
4
  - '*.gemspec'
5
5
  - 'vendor/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.5
1
+ 3.1.4
data/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.9.0 (2023-10-17)
8
+
9
+ ### Added (1 change)
10
+
11
+ - [Added ordering information to to `Character`](gitlab-org/ruby/gems/tanuki_emoji@c618fae04409067a38ddc454d3dfaee4678da520) ([merge request](gitlab-org/ruby/gems/tanuki_emoji!61))
12
+
13
+ ## 0.8.0 (2023-09-15)
14
+
15
+ ### Changed (1 change)
16
+
17
+ - [Bump Ruby version to 3.1.4](gitlab-org/ruby/gems/tanuki_emoji@c7853e7b6aa5000358a8c99e402614926d479ef8) ([merge request](gitlab-org/ruby/gems/tanuki_emoji!58))
18
+
19
+ ## 0.7.0 (2023-09-04)
20
+
21
+ ### Added (1 change)
22
+
23
+ - [Added EmojiData and EmojiDataParser](gitlab-org/ruby/gems/tanuki_emoji@8eba857db072e099fe10eeba6c93c6a7710e01a3) ([merge request](gitlab-org/ruby/gems/tanuki_emoji!2))
24
+
7
25
  ## 0.6.0 (2022-02-16)
8
26
 
9
27
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tanuki_emoji (0.7.0)
4
+ tanuki_emoji (0.9.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -97,9 +97,13 @@ To load an interactive console with the gem you can use `bin/console`.
97
97
  Before releasing a new gem, create a MR with the following changes:
98
98
 
99
99
  - Update the version number in `lib/tanuki_emoji/version.rb`.
100
+ - Run `bundle install` to update `Gemfile.lock` and commit it.
101
+ - Ensure that `CHANGELOG.md` is updated by the project bot in the MR.
100
102
 
101
- With that MR approved and merged, a [CI job](https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/gem-release.yml) will
102
- create a new release, generate the changelog, generate a new `.gem` file and publish into [rubygems.org](https://rubygems.org).
103
+ With that MR approved and merged, a [CI job](https://gitlab.com/gitlab-org/quality/pipeline-common/-/blob/master/ci/gem-release.yml):
104
+ - Creates a [new release](https://gitlab.com/gitlab-org/ruby/gems/tanuki_emoji/-/releases)
105
+ - Generates the changelog on the release page
106
+ - Publishes new gem into [rubygems.org](https://rubygems.org)
103
107
 
104
108
  ## Contributing
105
109
 
@@ -8,8 +8,8 @@ module TanukiEmoji
8
8
  class Character
9
9
  IMAGE_PREFIX = 'emoji_u'
10
10
  IMAGE_EXTENSION = '.png'
11
- FLAG_REGEXP = /[🇦-🇿]{2}/u.freeze
12
- ALPHA_CODE_REGEXP = /:(?<alpha_text>[_+\-a-z0-9]+):/.freeze
11
+ FLAG_REGEXP = /[🇦-🇿]{2}/u
12
+ ALPHA_CODE_REGEXP = /:(?<alpha_text>[_+\-a-z0-9]+):/
13
13
 
14
14
  # This denotes a "color" or "emoji" version
15
15
  EMOJI_VARIATION_SELECTOR = 0xFE0F
@@ -23,7 +23,7 @@ module TanukiEmoji
23
23
 
24
24
  attr_reader :name, :codepoints, :codepoints_alternates, :alpha_code, :aliases, :ascii_aliases, :description, :category
25
25
 
26
- attr_accessor :unicode_version
26
+ attr_accessor :unicode_version, :sort_key
27
27
 
28
28
  # @param [String] name
29
29
  # @param [String] codepoints
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TanukiEmoji
4
+ module Db
5
+ # Emoji Unicode Ordering database
6
+ class UnicodeOrdering
7
+ DATA_FILE = 'vendor/unicode/emoji-ordering.txt'
8
+
9
+ def self.data_file
10
+ File.expand_path(File.join(__dir__, '../../../', DATA_FILE))
11
+ end
12
+
13
+ attr_reader :data_file
14
+
15
+ def initialize(index:, data_file: nil)
16
+ @data_file = data_file || self.class.data_file
17
+ @index = index
18
+ end
19
+
20
+ def load!
21
+ db = {}
22
+ File.readlines(data_file, mode: 'r:UTF-8').each_with_index do |line, line_number|
23
+ next if line.start_with?('#')
24
+
25
+ tokens = line.split
26
+ semicolon_offset = tokens.index(';')
27
+ next if semicolon_offset.nil?
28
+
29
+ codepoints_array = tokens[0...semicolon_offset].map do |token|
30
+ token[2...token.length].hex
31
+ end
32
+ codepoints = codepoints_array.pack('U*')
33
+
34
+ db[codepoints] = line_number
35
+ end
36
+
37
+ db.each do |codepoints, sort_key|
38
+ emoji = @index.find_by_codepoints(codepoints)
39
+
40
+ next unless emoji
41
+
42
+ emoji.sort_key = sort_key
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -3,6 +3,7 @@
3
3
  module TanukiEmoji
4
4
  module Db
5
5
  autoload :Gemojione, 'tanuki_emoji/db/gemojione'
6
+ autoload :UnicodeOrdering, 'tanuki_emoji/db/unicode_ordering'
6
7
  autoload :UnicodeVersion, 'tanuki_emoji/db/unicode_version'
7
8
  autoload :EmojiData, 'tanuki_emoji/db/emoji_data'
8
9
  autoload :EmojiDataParser, 'tanuki_emoji/db/emoji_data_parser'
@@ -114,6 +114,7 @@ module TanukiEmoji
114
114
  def load_data_files
115
115
  Db::Gemojione.new(index: self).load!
116
116
  Db::UnicodeVersion.new(index: self).load!
117
+ Db::UnicodeOrdering.new(index: self).load!
117
118
  end
118
119
 
119
120
  # Order the codepoints to match the most specific (longest) sequences first,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TanukiEmoji
4
- VERSION = "0.7.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/tanuki_emoji.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = %q{Tanuki Emoji provides Emoji character information and metadata with support for Noto Emoji resources as fallback}
13
13
  spec.homepage = 'https://gitlab.com/gitlab-org/ruby/gems/tanuki_emoji'
14
14
  spec.licenses = %w[MIT Apache2]
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = spec.homepage