spritely 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spritely/cache.rb +2 -1
- data/lib/spritely/collection.rb +1 -1
- data/lib/spritely/version.rb +1 -1
- data/spec/fixtures/correct-sprite.png +0 -0
- data/spec/spritely/cache_spec.rb +3 -1
- data/spec/spritely/collection_spec.rb +3 -3
- data/spec/spritely/sprite_map_spec.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90447c2da39a04f55744534835e457eb6ccef146
|
4
|
+
data.tar.gz: b7e5df3bc4fc4133124b4ba24ca73c7bf015320b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b62886dded040842efeabc170544813946e89d7fb5664f432bacde4919ae1f9f1495dcedd6e8d59a390821bebc84e1be8052bd71306a98a5c35588a9294515d
|
7
|
+
data.tar.gz: 42cfd290b76bbab9092ea2a646718d4d16e9319c0b92c2f5695c5b2199fafc471b7f0d1eda8d5c1b5c7444509e13327a69a36a4b599ca4b0d4ae8ee6f43ba367
|
data/lib/spritely/cache.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'digest/md5'
|
2
|
+
require 'spritely/version'
|
2
3
|
|
3
4
|
module Spritely
|
4
5
|
# `Cache` is responsible for generating and fetching the current sprite cache
|
@@ -16,7 +17,7 @@ module Spritely
|
|
16
17
|
PNG_CRC_LENGTH = 4 # Cyclic Redundancy Check (CRC) byte-length; http://www.w3.org/TR/PNG/#5Chunk-layout
|
17
18
|
|
18
19
|
def self.generate(*objects)
|
19
|
-
Digest::MD5.hexdigest(objects.collect(&:cache_key).join)
|
20
|
+
Digest::MD5.hexdigest(VERSION + objects.collect(&:cache_key).join)
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.busted?(filename, expected_cache_key)
|
data/lib/spritely/collection.rb
CHANGED
data/lib/spritely/version.rb
CHANGED
Binary file
|
data/spec/spritely/cache_spec.rb
CHANGED
@@ -5,12 +5,14 @@ describe Spritely::Cache do
|
|
5
5
|
|
6
6
|
subject { Spritely::Cache.new(filename) }
|
7
7
|
|
8
|
+
before { stub_const('Spritely::VERSION', 'foobar') }
|
9
|
+
|
8
10
|
its(:filename) { should eq(filename) }
|
9
11
|
its(:key) { should eq('527272411fe99a8b5e9da254ac0aae88') }
|
10
12
|
|
11
13
|
describe '.generate' do
|
12
14
|
it 'should collect the cache_key values and digest them' do
|
13
|
-
expect(Spritely::Cache.generate(double(cache_key: 'asdf'), double(cache_key: 'hjkl'))).to eq('
|
15
|
+
expect(Spritely::Cache.generate(double(cache_key: 'asdf'), double(cache_key: 'hjkl'))).to eq('566ddc3d81de1f58fb37ecf29082d0f5')
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -72,11 +72,11 @@ describe Spritely::Collection do
|
|
72
72
|
|
73
73
|
describe '#cache_key' do
|
74
74
|
before do
|
75
|
-
allow(
|
76
|
-
allow(
|
75
|
+
allow(Digest::MD5).to receive(:file).with('file-1.png').and_return('foo')
|
76
|
+
allow(Digest::MD5).to receive(:file).with('file-2.png').and_return('bar')
|
77
77
|
end
|
78
78
|
|
79
|
-
its(:cache_key) { should eq('
|
79
|
+
its(:cache_key) { should eq('foobar') }
|
80
80
|
end
|
81
81
|
|
82
82
|
describe '#position!' do
|
@@ -31,9 +31,12 @@ describe Spritely::SpriteMap do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '#cache_key' do
|
34
|
-
before
|
34
|
+
before do
|
35
|
+
allow(subject).to receive(:collection).and_return('collection value')
|
36
|
+
allow(Spritely::Cache).to receive(:generate).with(options_object, 'collection value').and_return('cache value')
|
37
|
+
end
|
35
38
|
|
36
|
-
its(:cache_key) { should eq('
|
39
|
+
its(:cache_key) { should eq('cache value') }
|
37
40
|
end
|
38
41
|
|
39
42
|
describe '#collection' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spritely
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Robbin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|