diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-07-13 08:43:42 -0600 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-07-18 10:40:16 -0600 |
commit | 6a06c5cfb92d7d4e390e63104fd42d24a9159048 (patch) | |
tree | c4c2697d47e403699fa973f9f5bc795238f51ac3 /lib/tasks | |
parent | 08264f4334ff48d1274f066cd5b03455bc4befdf (diff) | |
download | gitlab-ce-6a06c5cfb92d7d4e390e63104fd42d24a9159048.tar.gz |
Upgrade Gemojione from 2.6.1 to 3.0.1.
This adds the 2016 emoji as well as support for using SVG images instead of PNGs.
It also fixes a number of incorrectly categorized emoji and other minor issues.
Upgrade Rake task for Gemojione 3.0.0 and generate sprites.
Upgrade aliases.json by pulling down index.json from the gemojione repository and running the generate_aliases.rb file.
Changelog: https://github.com/jonathanwiesel/gemojione/blob/master/CHANGELOG.md#v301-2016-07-16
For the specific emoji added to the Unicode standard, see: http://emojione.com/releases/2.2.4/
Huge kudos to Jonathan Wiesel (@jonathanwiesel) for his work on the gemojione gem!
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gemojione.rake | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index e930ace1041..993112aee3b 100644 --- a/lib/tasks/gemojione.rake +++ b/lib/tasks/gemojione.rake @@ -4,7 +4,7 @@ namespace :gemojione do require 'digest/sha2' require 'json' - dir = Gemojione.index.images_path + dir = Gemojione.images_path digests = [] aliases = Hash.new { |hash, key| hash[key] = [] } aliases_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json') @@ -50,9 +50,14 @@ namespace :gemojione do SIZE = 20 RETINA = SIZE * 2 + # Update these values to the width and height of the spritesheet when + # new emoji are added. + SPRITESHEET_WIDTH = 860 + SPRITESHEET_HEIGHT = 840 + Dir.mktmpdir do |tmpdir| # Copy the Gemojione assets to the temporary folder for resizing - FileUtils.cp_r(Gemojione.index.images_path, tmpdir) + FileUtils.cp_r(Gemojione.images_path, tmpdir) Dir.chdir(tmpdir) do Dir["**/*.png"].each do |png| @@ -64,7 +69,7 @@ namespace :gemojione do # Combine the resized assets into a packed sprite and re-generate the SCSS SpriteFactory.cssurl = "image-url('$IMAGE')" - SpriteFactory.run!(File.join(tmpdir, 'images'), { + SpriteFactory.run!(File.join(tmpdir, 'png'), { output_style: style_path, output_image: "app/assets/images/emoji.png", selector: '.emoji-', @@ -97,7 +102,7 @@ namespace :gemojione do only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { background-image: image-url('emoji@2x.png'); - background-size: 840px 820px; + background-size: #{SPRITESHEET_WIDTH}px #{SPRITESHEET_HEIGHT}px; } } CSS @@ -107,7 +112,7 @@ namespace :gemojione do # Now do it again but for Retina Dir.mktmpdir do |tmpdir| # Copy the Gemojione assets to the temporary folder for resizing - FileUtils.cp_r(Gemojione.index.images_path, tmpdir) + FileUtils.cp_r(Gemojione.images_path, tmpdir) Dir.chdir(tmpdir) do Dir["**/*.png"].each do |png| @@ -116,7 +121,7 @@ namespace :gemojione do end # Combine the resized assets into a packed sprite and re-generate the SCSS - SpriteFactory.run!(File.join(tmpdir, 'images'), { + SpriteFactory.run!(File.join(tmpdir), { output_image: "app/assets/images/emoji@2x.png", style: false, nocomments: true, |