emojidex 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/emojidex.gemspec +1 -1
- data/lib/emojidex/collection/asset_information.rb +4 -4
- data/lib/emojidex/collection/cache.rb +7 -0
- data/lib/emojidex/collection.rb +2 -2
- data/spec/collection_spec.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb0e58cdb8f56bba4804967288937ce8563117e
|
4
|
+
data.tar.gz: aa853515d11aa563914eeed11a204abba89ef509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ae6c083e875c9aec163fcfd7aed042bee6b23a1d060de5ecc46d1c2bf99bbb427b367de57d2f860988e3af13c6e3f7caa51410805aa80d1ba5c9f45df85f57
|
7
|
+
data.tar.gz: 5d13c8f7bbca590ee2155fe0f2aafe5d0f3245f9cfa7029b575be4b79ae7e275c64dc5e005b038057eab794063e8f3c559eca2b8ae1b886f31b80a93b40a7a97
|
data/emojidex.gemspec
CHANGED
@@ -11,11 +11,11 @@ module Emojidex
|
|
11
11
|
|
12
12
|
def get_checksums(moji, formats, sizes)
|
13
13
|
sums = {}
|
14
|
-
sums[:svg] = _checksum_for_file("#{@
|
14
|
+
sums[:svg] = _checksum_for_file("#{@vector_source_path}/#{moji.code}.svg") if formats.include? :svg
|
15
15
|
if formats.include? :png
|
16
16
|
sums[:png] = {}
|
17
17
|
sizes.keys.each do |size|
|
18
|
-
sums[:png][size] = _checksum_for_file("#{@
|
18
|
+
sums[:png][size] = _checksum_for_file("#{@raster_source_path}/#{size}/#{moji.code}.png")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
sums
|
@@ -29,12 +29,12 @@ module Emojidex
|
|
29
29
|
|
30
30
|
def get_paths(moji, formats, sizes)
|
31
31
|
paths = {}
|
32
|
-
path = "#{@
|
32
|
+
path = "#{@vector_source_path}/#{moji.code}.svg"
|
33
33
|
paths[:svg] = path if File.exist? path
|
34
34
|
if formats.include? :png
|
35
35
|
paths[:png] = {}
|
36
36
|
sizes.keys.each do |size|
|
37
|
-
path = "#{@
|
37
|
+
path = "#{@raster_source_path}/#{size}/#{moji.code}.png"
|
38
38
|
paths[:png][size] = path if File.exist? path
|
39
39
|
end
|
40
40
|
end
|
@@ -47,6 +47,13 @@ module Emojidex
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
def write_index(destination)
|
51
|
+
idx = @emoji.values.to_json
|
52
|
+
idx = JSON.parse idx
|
53
|
+
idx.each { |moji| moji.delete_if{ |k, v| v.nil? }}
|
54
|
+
File.open("#{destination}/emoji.json", 'w') { |f| f.write idx.to_json }
|
55
|
+
end
|
56
|
+
|
50
57
|
private
|
51
58
|
|
52
59
|
def _svg_check_copy(moji)
|
data/lib/emojidex/collection.rb
CHANGED
@@ -23,8 +23,8 @@ module Emojidex
|
|
23
23
|
# Loads an emoji collection on local storage
|
24
24
|
def load_local_collection(path)
|
25
25
|
@source_path = File.expand_path(path)
|
26
|
-
@
|
27
|
-
@
|
26
|
+
@vector_source_path = @source_path if @vector_source_path.nil?
|
27
|
+
@raster_source_path = @source_path if @raster_source_path.nil?
|
28
28
|
json = IO.read(@source_path + '/emoji.json')
|
29
29
|
list = JSON.parse(json, symbolize_names: true)
|
30
30
|
add_emoji(list)
|
data/spec/collection_spec.rb
CHANGED
@@ -82,6 +82,17 @@ describe Emojidex::Collection do
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
describe '.write_index' do
|
86
|
+
it 'writes a cleaned index to the specified location' do
|
87
|
+
tmp_cache_path = File.expand_path('../support/tmpcache', __FILE__)
|
88
|
+
FileUtils.mkdir_p(tmp_cache_path)
|
89
|
+
collection.cache_index tmp_cache_path
|
90
|
+
expect(File.exist? tmp_cache_path + '/emoji.json').to be_truthy
|
91
|
+
|
92
|
+
FileUtils.rm_rf tmp_cache_path
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
85
96
|
describe '.generate_checksums' do
|
86
97
|
it 'generates checksums for assets' do
|
87
98
|
expect(collection.generate_checksums).to be_an_instance_of(Array)
|