Sha256: 3a8343d3acf8d029c55ea1b2f5c09927498912050c6f27a62897f19dabfbea43

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "tanuki_emoji"

RSpec::Core::RakeTask.new(:spec) do |t|
  t.rspec_opts = %w[--format documentation --color --require spec_helper]
  t.rspec_opts += %w[--format RspecJunitFormatter --out rspec.xml] if ENV['GITLAB_CI']
end

RuboCop::RakeTask.new

desc 'Code coverage detail'
task :simplecov do
  ENV['COVERAGE'] = 'true'
  Rake::Task['spec'].execute
end

task default: %i[spec rubocop]

desc 'Update images from vendor/noto-emoji to app/assets folder'
task update_assets: ['noto_emoji:generate_flags'] do
  png_path = File.join(__dir__, 'vendor/noto-emoji/png/72')
  flag_path = File.join(__dir__, 'vendor/noto-emoji/build/flags')
  TanukiEmoji.index.all.each do |emoji|
    if emoji.flag?
      source_flag = File.join(flag_path, emoji.image_name)
      cp(source_flag, TanukiEmoji.images_path)

      next
    end

    source_png = File.join(png_path, emoji.image_name)
    cp(source_png, TanukiEmoji.images_path)
  end
end

namespace :noto_emoji do
  noto_emoji_path = File.join(__dir__, 'vendor/noto-emoji')

  task :generate_flags do
    chdir(File.expand_path(noto_emoji_path)) do
      Dir['third_party/region-flags/png/*.png'].each do |file|
        filename = File.basename(file)
        puts filename

        sh("make build/flags/#{filename}")
      end
    end
  end
end

Rake::Task[:build].enhance [:update_assets]

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tanuki_emoji-0.4.0 Rakefile
tanuki_emoji-0.3.0 Rakefile
tanuki_emoji-0.2.2 Rakefile
tanuki_emoji-0.2.1 Rakefile
tanuki_emoji-0.2.0 Rakefile