apropos 0.1.2 → 0.1.3
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/.travis.yml +2 -1
- data/CHANGELOG.md +8 -0
- data/lib/apropos/sass_functions.rb +5 -15
- data/lib/apropos/version.rb +1 -1
- data/spec/apropos/functions_spec.rb +9 -1
- data/spec/fixtures/images/kitten.jpg +0 -0
- data/spec/stylesheets_spec.rb +18 -1
- data/stylesheets/apropos/_core.sass +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a962f1179e0409d400951f76f62f6c27ecf3e718
|
4
|
+
data.tar.gz: a7514086b04b178327d6a14c89c6ffd036a466d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c755d4b4c123e5bddf399e4aefee29635724adf031a46ffdcdafd0857a1821690df4444f81f04b1cdfb48f9134de3d38564550618db98e624fefd8672f87f6
|
7
|
+
data.tar.gz: 031ddabc39cf60f8d590008e90eb465c0128ce72d23c6ad171a244420a1ea852b141ea1fc3709d70eef3e8233ccc7bd7d5dee906b1d5fb6160a6f8d6a6d189cb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.3 (2014-10-16)
|
4
|
+
|
5
|
+
Bug fix for compatiblity with Sass 3.3.
|
6
|
+
|
7
|
+
## 0.1.2 (2014-03-18)
|
8
|
+
|
9
|
+
Ignore and log invalid image variants (files that match a general pattern but aren't used by an Apropos rule).
|
10
|
+
|
3
11
|
## 0.1.1 (2013-11-18)
|
4
12
|
|
5
13
|
Minor fix release for full Compass compatibility.
|
@@ -16,9 +16,7 @@ module Apropos
|
|
16
16
|
::Sass::Script::Functions.declare :add_dpi_image_variant, []
|
17
17
|
::Sass::Script::Functions.declare :add_breakpoint_image_variant, []
|
18
18
|
::Sass::Script::Functions.declare :nth_polyfill, [:list, :index]
|
19
|
-
|
20
|
-
::Sass::Script::Functions.declare :str_index, [:string, :substring]
|
21
|
-
end
|
19
|
+
::Sass::Script::Functions.declare :str_contains, [:string, :substring]
|
22
20
|
end
|
23
21
|
|
24
22
|
def self.value(val)
|
@@ -58,18 +56,10 @@ module Apropos
|
|
58
56
|
list[index - 1]
|
59
57
|
end
|
60
58
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# backwards compatibility, however.
|
66
|
-
unless sass_function_exist? :str_index
|
67
|
-
def str_index(string, substring)
|
68
|
-
assert_type string, :String, :string
|
69
|
-
assert_type substring, :String, :substring
|
70
|
-
index = string.value.index(substring.value) || -1
|
71
|
-
::Sass::Script::Number.new(index + 1)
|
72
|
-
end
|
59
|
+
def str_contains(string, substring)
|
60
|
+
assert_type string, :String, :string
|
61
|
+
assert_type substring, :String, :substring
|
62
|
+
::Sass::Script::Bool.new(string.value.include?(substring.value))
|
73
63
|
end
|
74
64
|
end
|
75
65
|
end
|
data/lib/apropos/version.rb
CHANGED
@@ -10,6 +10,7 @@ describe Apropos do
|
|
10
10
|
let(:rules) { Apropos.image_variant_rules("foo.jpg") }
|
11
11
|
|
12
12
|
before do
|
13
|
+
Compass.configuration.stub(:http_images_path) { '/' }
|
13
14
|
Compass.configuration.stub(:images_path).and_return(images_dir) if images_dir
|
14
15
|
Compass.configuration.stub(:project_path).and_return(project_dir) if project_dir
|
15
16
|
Apropos.clear_image_variants
|
@@ -189,7 +190,14 @@ describe Apropos do
|
|
189
190
|
context "with images_path undefined" do
|
190
191
|
let(:images_dir) { nil }
|
191
192
|
let(:project_dir) { '/path/to/project' }
|
192
|
-
it
|
193
|
+
it 'uses the Compass default' do
|
194
|
+
expected = if Compass.configuration.respond_to?(:default_images_dir)
|
195
|
+
File.join(project_dir, Compass.configuration.default_images_dir)
|
196
|
+
else
|
197
|
+
project_dir
|
198
|
+
end
|
199
|
+
Apropos.images_dir.to_s.should == expected
|
200
|
+
end
|
193
201
|
end
|
194
202
|
end
|
195
203
|
end
|
Binary file
|
data/spec/stylesheets_spec.rb
CHANGED
@@ -12,7 +12,8 @@ describe 'stylesheets' do
|
|
12
12
|
}
|
13
13
|
|
14
14
|
before do
|
15
|
-
Compass.configuration.stub(:
|
15
|
+
Compass.configuration.stub(:http_images_path) { '/' }
|
16
|
+
Compass.configuration.stub(:images_path) { images_dir }
|
16
17
|
Compass.configuration.stub(:asset_cache_buster).and_return( lambda { |path| nil } )
|
17
18
|
end
|
18
19
|
|
@@ -35,6 +36,22 @@ describe 'stylesheets' do
|
|
35
36
|
css_file.strip.should == ".foo { background-image: url('/hero.jpg'); }"
|
36
37
|
end
|
37
38
|
|
39
|
+
context "with fixture images" do
|
40
|
+
before do
|
41
|
+
Compass.configuration.stub(:images_path) { File.expand_path('fixtures/images', File.dirname(__FILE__)) }
|
42
|
+
end
|
43
|
+
|
44
|
+
it "can generate heights" do
|
45
|
+
@scss_file = %Q{
|
46
|
+
@import "apropos";
|
47
|
+
.foo {
|
48
|
+
@include apropos-bg-variants('kitten.jpg', true);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
css_file.strip.should == ".foo { background-image: url('/kitten.jpg'); height: 286px; }"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
38
55
|
describe "hidpi stylesheet" do
|
39
56
|
it "generates default hidpi rules" do
|
40
57
|
stub_files(%w[hero.jpg hero.2x.jpg])
|
@@ -36,5 +36,5 @@
|
|
36
36
|
// ===========================================================================
|
37
37
|
=apropos-bg-image-with-height($path, $generate-height, $query: "")
|
38
38
|
background-image: image-url($path)
|
39
|
-
@if $generate-height and not (str-
|
39
|
+
@if $generate-height and not (str-contains($query, "dpi") or str-contains($query, "pixel-ratio"))
|
40
40
|
height: image-height($path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apropos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Gilder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: compass
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- spec/apropos/media_query_spec.rb
|
131
131
|
- spec/apropos/set_spec.rb
|
132
132
|
- spec/apropos/variant_spec.rb
|
133
|
+
- spec/fixtures/images/kitten.jpg
|
133
134
|
- spec/spec_helper.rb
|
134
135
|
- spec/stylesheets_spec.rb
|
135
136
|
- stylesheets/_apropos.sass
|
@@ -167,5 +168,6 @@ test_files:
|
|
167
168
|
- spec/apropos/media_query_spec.rb
|
168
169
|
- spec/apropos/set_spec.rb
|
169
170
|
- spec/apropos/variant_spec.rb
|
171
|
+
- spec/fixtures/images/kitten.jpg
|
170
172
|
- spec/spec_helper.rb
|
171
173
|
- spec/stylesheets_spec.rb
|