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 | |
| 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')
| -rw-r--r-- | lib/gitlab/award_emoji.rb | 24 | ||||
| -rw-r--r-- | lib/tasks/gemojione.rake | 17 | 
2 files changed, 18 insertions, 23 deletions
| diff --git a/lib/gitlab/award_emoji.rb b/lib/gitlab/award_emoji.rb index c94bfc0e65f..39b43ab5489 100644 --- a/lib/gitlab/award_emoji.rb +++ b/lib/gitlab/award_emoji.rb @@ -1,24 +1,14 @@  module Gitlab    class AwardEmoji      CATEGORIES = { -      other: "Other",        objects: "Objects", -      places: "Places", -      travel_places: "Travel", -      emoticons: "Emoticons", -      objects_symbols: "Symbols", +      travel: "Travel", +      symbols: "Symbols",        nature: "Nature", -      celebration: "Celebration",        people: "People",        activity: "Activity",        flags: "Flags", -      food_drink: "Food" -    }.with_indifferent_access - -    CATEGORY_ALIASES = { -      symbols: "objects_symbols", -      foods: "food_drink", -      travel: "travel_places" +      food: "Food"      }.with_indifferent_access      def self.normalize_emoji_name(name) @@ -35,7 +25,7 @@ module Gitlab            # Skip Fitzpatrick(tone) modifiers            next if data["category"] == "modifier" -          category = CATEGORY_ALIASES[data["category"]] || data["category"] +          category = data["category"]            @emoji_by_category[category] << data          end @@ -57,9 +47,9 @@ module Gitlab      def self.aliases        @aliases ||=          begin -         json_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json' ) -         JSON.parse(File.read(json_path)) -       end +          json_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json') +          JSON.parse(File.read(json_path)) +        end      end      # Returns an Array of Emoji names and their asset URLs. 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, | 
