spritely 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spritely/sass_functions.rb +6 -1
- data/lib/spritely/sprite_map.rb +0 -2
- data/lib/spritely/version.rb +1 -1
- data/spec/integration/precompilation_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- data/spec/spritely/sass_functions_spec.rb +1 -0
- data/spec/spritely/sprite_map_spec.rb +10 -7
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b90bec681ab9efe494b5e246a9e7b036bd9e5998
|
4
|
+
data.tar.gz: 424ccf4da0ca02416f9f9f7cb9a63ec86ab1fe89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e836ffa7fd997b44b44d0f81d71373a581f1dab757c9c2e3aa006d74096a524bb6853ebd3b273d44fe801153c9c0fd8fa64dd307d37261bc8cdc6304e659ea1
|
7
|
+
data.tar.gz: 63ffcfa28376d8bbd936dcfda0063677112e2b9b772ab56abf86600f5db41ee05ad8564f316b41a1f7e55dc38c4d749ba4f424fa3343cc29726417aeb4504411
|
@@ -3,7 +3,12 @@ require 'spritely/sprite_map'
|
|
3
3
|
module Spritely
|
4
4
|
module SassFunctions
|
5
5
|
def spritely_map(glob, kwargs = {})
|
6
|
-
SpriteMap.create(glob.value, kwargs)
|
6
|
+
SpriteMap.create(glob.value, kwargs).tap do |sprite_map|
|
7
|
+
sprite_map.files.each do |file|
|
8
|
+
sprockets_context.depend_on(file)
|
9
|
+
sprockets_context.depend_on_asset(file)
|
10
|
+
end
|
11
|
+
end
|
7
12
|
end
|
8
13
|
|
9
14
|
::Sass::Script::Functions.declare :spritely_map, [:glob], var_kwargs: true
|
data/lib/spritely/sprite_map.rb
CHANGED
data/lib/spritely/version.rb
CHANGED
@@ -4,7 +4,7 @@ require 'active_support/core_ext/string'
|
|
4
4
|
describe 'Precompilation', :integration do
|
5
5
|
it 'should create the sprite in the right location' do
|
6
6
|
render_asset('sprites.css')
|
7
|
-
expect(File.exist?(File.join('app', 'assets', 'images', 'sprites', 'application.png'))).to
|
7
|
+
expect(File.exist?(File.join('app', 'assets', 'images', 'sprites', 'application.png'))).to be_truthy
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should compile the correct-looking sprite file' do
|
@@ -17,13 +17,13 @@ describe 'Precompilation', :integration do
|
|
17
17
|
it 'should compile all of the assets necessary' do
|
18
18
|
compile_assets
|
19
19
|
sprite_files = Dir.glob(File.join('public', 'assets', 'sprites', 'application-*.png'))
|
20
|
-
expect(sprite_files).to
|
20
|
+
expect(sprite_files.length).to eq(1)
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should compile all of the assets necessary when sprites have been pre-generated' do
|
24
24
|
render_asset('sprites.css')
|
25
25
|
compile_assets
|
26
26
|
sprite_files = Dir.glob(File.join('public', 'assets', 'sprites', 'application-*.png'))
|
27
|
-
expect(sprite_files).to
|
27
|
+
expect(sprite_files.length).to eq(1)
|
28
28
|
end
|
29
29
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rspec'
|
2
|
+
require 'rspec/its'
|
2
3
|
require 'spritely'
|
3
4
|
|
4
5
|
require 'pry-byebug'
|
@@ -9,7 +10,6 @@ RSpec.configure do |config|
|
|
9
10
|
config.expect_with :rspec do |c|
|
10
11
|
c.syntax = :expect
|
11
12
|
end
|
12
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
13
|
|
14
14
|
config.include RailsAppHelpers, :integration
|
15
15
|
config.around(:each, :integration) { |example| within_rails_app(&example) }
|
@@ -7,7 +7,8 @@ describe Spritely::SpriteMap do
|
|
7
7
|
subject { Spritely::SpriteMap.new('test/*.png', options_hash) }
|
8
8
|
|
9
9
|
before do
|
10
|
-
Spritely.
|
10
|
+
allow(Spritely).to receive_message_chain(:environment, :paths).and_return(["#{__dir__}/../fixtures"])
|
11
|
+
allow(Spritely).to receive(:directory).and_return(File)
|
11
12
|
allow(Spritely::Options).to receive(:new).with(options_hash).and_return(options_object)
|
12
13
|
end
|
13
14
|
|
@@ -38,10 +39,7 @@ describe Spritely::SpriteMap do
|
|
38
39
|
describe '#collection' do
|
39
40
|
let(:collection) { double(find: 'find value', width: 'width value', height: 'height value', images: 'images value') }
|
40
41
|
|
41
|
-
before
|
42
|
-
Spritely.stub_chain(:environment, :paths).and_return(["#{__dir__}/../fixtures"])
|
43
|
-
allow(Spritely::Collection).to receive(:create).with(["#{__dir__}/../fixtures/test/foo.png"], options_object).and_return(collection)
|
44
|
-
end
|
42
|
+
before { allow(Spritely::Collection).to receive(:create).with(["#{__dir__}/../fixtures/test/foo.png"], options_object).and_return(collection) }
|
45
43
|
|
46
44
|
its(:collection) { should eq(collection) }
|
47
45
|
|
@@ -65,7 +63,7 @@ describe Spritely::SpriteMap do
|
|
65
63
|
|
66
64
|
before { allow(File).to receive(:exist?).with('test.png').and_return(file_exists) }
|
67
65
|
|
68
|
-
its(:needs_generation?) { should
|
66
|
+
its(:needs_generation?) { should be_truthy }
|
69
67
|
|
70
68
|
context 'the sprite file already exists' do
|
71
69
|
let(:file_exists) { true }
|
@@ -75,7 +73,12 @@ describe Spritely::SpriteMap do
|
|
75
73
|
allow(Spritely::Cache).to receive(:busted?).with('test.png', 'value').and_return(true)
|
76
74
|
end
|
77
75
|
|
78
|
-
its(:needs_generation?) { should
|
76
|
+
its(:needs_generation?) { should be_truthy }
|
79
77
|
end
|
80
78
|
end
|
79
|
+
|
80
|
+
describe '#files' do
|
81
|
+
its('files.length') { should eq(1) }
|
82
|
+
its('files.first') { should match(/\.\.\/fixtures\/test\/foo\.png$/) }
|
83
|
+
end
|
81
84
|
end
|
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.0.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chunky_png
|
@@ -102,6 +102,20 @@ dependencies:
|
|
102
102
|
version: '0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rspec
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3.0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rspec-its
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
106
120
|
requirements:
|
107
121
|
- - ">="
|