diff --git a/Gemfile b/Gemfile index e3d3d58..bd8c3d1 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,8 @@ source 'https://rubygems.org' gemspec +gem 'emojidex', '~> 0.2.0' + group :development do gem 'rspec' gem 'rubocop' diff --git a/lib/emojidex_static_collector.rb b/lib/emojidex_static_collector.rb index 7bfbef0..88f43ea 100644 --- a/lib/emojidex_static_collector.rb +++ b/lib/emojidex_static_collector.rb @@ -1,15 +1,17 @@ require 'emojidex-vectors' require 'emojidex_converter' -require 'emojidex/categories' +require 'emojidex/data/categories' +require 'emojidex/data/utf' +require 'emojidex/data/extended' require 'fileutils' # Generates static collections of emojidex assets class EmojidexStaticCollector def initialize - @utf = Emojidex::UTF.new - @extended = Emojidex::Extended.new - @categories = Emojidex::Categories.new + @utf = Emojidex::Data::UTF.new + @extended = Emojidex::Data::Extended.new + @categories = Emojidex::Data::Categories.new end # Generates a static collection @@ -26,7 +28,7 @@ def generate(path = './', size = 64, utf_only = false, code_type = :en, clean_ca cache_dir = File.join(path, '.cache') @utf.cache!(cache_path: cache_dir, formats: [:svg]) @extended.cache!(cache_path: cache_dir, formats: [:svg]) unless utf_only - collection = Emojidex::Collection.new(nil, cache_dir) + collection = Emojidex::Data::Collection.new(local_load_path: "#{cache_dir}/emoji") _generate_categories(collection, path, size, utf_only, code_type) FileUtils.rm_rf(cache_dir) if clean_cache end diff --git a/spec/emojidex_static_collector_spec.rb b/spec/emojidex_static_collector_spec.rb index 649c379..4ff8c5d 100644 --- a/spec/emojidex_static_collector_spec.rb +++ b/spec/emojidex_static_collector_spec.rb @@ -32,7 +32,7 @@ it 'generates a collection of UTF only, extended emoji is not exist' do collector.generate(@tmpdir + '/UTF_only', 8, true, :en) expect(File.exist?(@tmpdir + '/UTF_only/Faces/angry.png')).to be_truthy - expect(File.exist?(@tmpdir + '/UTF_only/Faces/angry(bk).png')).to be_falsey + expect(File.exist?(@tmpdir + '/UTF_only/Faces/angry_face(smiley).png')).to be_falsey end end end