Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d229bbf9
Commit
d229bbf9
authored
Oct 01, 2021
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tanuki_emoji rake to better display progress
parent
09cff847
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
16 deletions
+21
-16
lib/tasks/tanuki_emoji.rake
lib/tasks/tanuki_emoji.rake
+18
-13
spec/helpers/emoji_helper_spec.rb
spec/helpers/emoji_helper_spec.rb
+3
-3
No files found.
lib/tasks/tanuki_emoji.rake
View file @
d229bbf9
# frozen_string_literal: true
namespace
:tanuki_emoji
do
desc
'Generates Emoji SHA256 digests'
desc
'Generates Emoji aliases fixtures'
task
aliases: :environment
do
aliases
=
{}
...
...
@@ -18,6 +17,7 @@ namespace :tanuki_emoji do
end
end
desc
'Generates Emoji SHA256 digests'
task
digests: :environment
do
require
'digest/sha2'
...
...
@@ -84,15 +84,15 @@ namespace :tanuki_emoji do
end
puts
puts
"Done!"
puts
'Done!'
end
# This task will generate a standard and Retina sprite of all of the current
#
Gemojione
Emojis, with the accompanying SCSS map.
#
TanukiEmoji
Emojis, with the accompanying SCSS map.
#
# It will not appear in `rake -T` output, and the dependent gems are not
# included in the Gemfile by default, because this task will only be needed
# occasionally, such as when new Emojis are added to
Gemojione
.
# occasionally, such as when new Emojis are added to
TanukiEmoji
.
task
sprite: :environment
do
begin
require
'sprite_factory'
...
...
@@ -124,15 +124,16 @@ namespace :tanuki_emoji do
Dir
[
"**/*.png"
].
each
do
|
png
|
tmp_image_path
=
File
.
join
(
tmpdir
,
png
)
resize!
(
tmp_image_path
,
SIZE
)
print
emoji
.
codepoints
print
'.'
end
end
puts
' Done!'
puts
puts
"
\n
"
style_path
=
Rails
.
root
.
join
(
*
%w(app assets stylesheets emoji_sprites.scss)
)
p
uts
"Compiling sprites regular sprites..."
p
rint
'Compiling sprites regular sprites... '
# Combine the resized assets into a packed sprite and re-generate the SCSS
SpriteFactory
.
cssurl
=
"image-url('$IMAGE')"
...
...
@@ -179,25 +180,29 @@ namespace :tanuki_emoji do
CSS
end
end
puts
'Done!'
puts
"
\n
"
puts
"Preparing sprites for HiDPI size:
#{
RETINA
}
px..."
# Now do it again but for Retina
Dir
.
mktmpdir
do
|
tmpdir
|
# Copy the
Gemojione
assets to the temporary folder for resizing
# Copy the
TanukiEmoji
assets to the temporary folder for resizing
FileUtils
.
cp_r
(
File
.
join
(
emoji_dir
,
'.'
),
tmpdir
)
Dir
.
chdir
(
tmpdir
)
do
Dir
[
"**/*.png"
].
each
do
|
png
|
tmp_image_path
=
File
.
join
(
tmpdir
,
png
)
resize!
(
tmp_image_path
,
RETINA
)
print
emoji
.
codepoints
print
'.'
end
end
puts
' Done!'
puts
puts
"
\n
"
p
uts
"Compiling HiDPI sprites..."
p
rint
'Compiling HiDPI sprites...'
# Combine the resized assets into a packed sprite and re-generate the SCSS
SpriteFactory
.
run!
(
tmpdir
,
{
...
...
@@ -209,7 +214,7 @@ namespace :tanuki_emoji do
})
end
puts
"Done!"
puts
' Done!'
end
def
check_requirements!
...
...
spec/helpers/emoji_helper_spec.rb
View file @
d229bbf9
...
...
@@ -6,7 +6,7 @@ RSpec.describe EmojiHelper do
describe
'#emoji_icon'
do
let
(
:options
)
{
{}
}
let
(
:emoji_text
)
{
'rocket'
}
let
(
:
emoji
_version
)
{
'6.0'
}
let
(
:
unicode
_version
)
{
'6.0'
}
let
(
:aria_hidden_option
)
{
"aria-hidden=
\"
true
\"
"
}
subject
{
helper
.
emoji_icon
(
emoji_text
,
options
)
}
...
...
@@ -15,7 +15,7 @@ RSpec.describe EmojiHelper do
is_expected
.
to
include
(
'<gl-emoji'
,
"title=
\"
#{
emoji_text
}
\"
"
,
"data-name=
\"
#{
emoji_text
}
\"
"
,
"data-unicode-version=
\"
#{
emoji
_version
}
\"
"
)
"data-unicode-version=
\"
#{
unicode
_version
}
\"
"
)
is_expected
.
not_to
include
(
aria_hidden_option
)
end
...
...
@@ -26,7 +26,7 @@ RSpec.describe EmojiHelper do
is_expected
.
to
include
(
'<gl-emoji'
,
"title=
\"
#{
emoji_text
}
\"
"
,
"data-name=
\"
#{
emoji_text
}
\"
"
,
"data-unicode-version=
\"
#{
emoji
_version
}
\"
"
,
"data-unicode-version=
\"
#{
unicode
_version
}
\"
"
,
aria_hidden_option
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment