Sha256: c3f45ffc76a1a0519289dd00756f8e80fdefed0e845a733c3c75bd7872f9ad65

Contents?: true

Size: 995 Bytes

Versions: 29

Compression:

Stored size: 995 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'fileutils'
require 'zip'

module TwitterCldr
  module Resources
    class CollationTestsImporter < Importer

      ZIP_FILE = 'CollationAuxiliary.zip'.freeze

      TEST_FILES = %w[
        CollationTest_CLDR_NON_IGNORABLE.txt
        CollationTest_CLDR_NON_IGNORABLE_SHORT.txt
      ].freeze

      requirement :uca, '6.1.0', [ZIP_FILE]
      output_path 'collation/spec'
      ruby_engine :mri

      private

      def execute
        FileUtils.mkdir_p(output_path)
        zip_path = requirements[:uca].source_path_for(ZIP_FILE)

        Zip::File.open(zip_path) do |zip|
          TEST_FILES.each do |test_file|
            File.open(File.join(output_path, test_file), 'w') do |file|
              file.write(zip.read("CollationAuxiliary/#{test_file}"))
            end
          end
        end
      end

      def output_path
        params[:output_path]
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
twitter_cldr-6.13.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.12.1 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.12.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.11.5 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.11.4 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.11.3 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.11.2 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.11.1 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.11.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.10.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.9.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.8.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.7.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.6.2 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.6.1 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.6.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.5.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.4.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.3.0 lib/twitter_cldr/resources/collation_tests_importer.rb
twitter_cldr-6.2.0 lib/twitter_cldr/resources/collation_tests_importer.rb