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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afdb0ce6c5a3d4ee39e589c275a08792d19451ac
4
- data.tar.gz: e0a57c9e6b613413a0b8a722217fc5a8831c3859
3
+ metadata.gz: 90447c2da39a04f55744534835e457eb6ccef146
4
+ data.tar.gz: b7e5df3bc4fc4133124b4ba24ca73c7bf015320b
5
5
  SHA512:
6
- metadata.gz: f258b1330dd8cf6c4c1923dd09d75ac0c3ac406268a956f42b31c610d2d64993c56372d7adf5832e16950766df495d999f8af2efffd3ac687c89afa0d2ed7a9d
7
- data.tar.gz: fcb594854102456fa9aca4b28cca288af2c6aec98e84ce3b93111b079a9b377fd60feda1150f345da00a0f7f168a426608e6370fa177bdf99a63983319898642
6
+ metadata.gz: 7b62886dded040842efeabc170544813946e89d7fb5664f432bacde4919ae1f9f1495dcedd6e8d59a390821bebc84e1be8052bd71306a98a5c35588a9294515d
7
+ data.tar.gz: 42cfd290b76bbab9092ea2a646718d4d16e9319c0b92c2f5695c5b2199fafc471b7f0d1eda8d5c1b5c7444509e13327a69a36a4b599ca4b0d4ae8ee6f43ba367
@@ -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)
@@ -19,7 +19,7 @@ module Spritely
19
19
  end
20
20
 
21
21
  def cache_key
22
- files.collect { |file| File.mtime(file) }.join
22
+ files.collect { |file| Digest::MD5.file(file) }.join
23
23
  end
24
24
 
25
25
  # Returns the width of the to-be-generated sprite image. When none of the
@@ -1,3 +1,3 @@
1
1
  module Spritely
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.6"
3
3
  end
Binary file
@@ -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('527272411fe99a8b5e9da254ac0aae88')
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(File).to receive(:mtime).with('file-1.png').and_return(10)
76
- allow(File).to receive(:mtime).with('file-2.png').and_return(100)
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('10100') }
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 { allow(subject).to receive(:collection).and_return(double(cache_key: 'collection value')) }
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('dfc047d12e4c6404e9dae98bc2851e5c') }
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
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-13 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png