compass 1.1.0.alpha.0 → 1.1.0.alpha.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b0e11394a4a7495a64db83a9afc00ce06f99ba4
4
- data.tar.gz: 263711a8362fc18ef3dae40ec5d4a3b1b23dcb36
3
+ metadata.gz: 5d27e0749bc3350ca12f3aab14eed3b6bdf56fe0
4
+ data.tar.gz: d2e42399d751703ab7e07d304e0511eeeadf726f
5
5
  SHA512:
6
- metadata.gz: 2dbd35310a0b37c7f63328dda852aad3bd30d92a67f51359136ce2484d985b49fa31dd14a8bfd8c0e0e98ffbd55ac2a886338bbc1e6c3c812a8a61a9f318dbdf
7
- data.tar.gz: 214cd21fe3ff5245f4c9cff5a48ff0bf8db05bc447efccf0d83aa9d0a45a13ceeea2f32ed6510269d4bec5d4dce2ed9e767262f95be90cd6001c1ec125f14ce5
6
+ metadata.gz: 2b94391e2752fbd8042bc5b6bdb37a82feac4bbfc33152e65210a20e123514ffee8d13bda35e46d7effc8a7a23f94fce3cf79529a8b9aebb9363ad29fd2b022e
7
+ data.tar.gz: 4a3015c121fbf930a321a0b9ccd159cc2dd77de21db22147c9a5506dffe441fc2dbb7d5ee509f50e785c0104e229ed72bab025bb163e1a211798479b28c135b4
@@ -1,4 +1,4 @@
1
1
  module Compass
2
- VERSION = "1.1.0.alpha.0"
2
+ VERSION = "1.1.0.alpha.1"
3
3
  VERSION_NAME = "Polaris"
4
4
  end
@@ -120,9 +120,7 @@ module Compass::SassExtensions::Functions::Sprites
120
120
  verify_map(map, "sprite")
121
121
  verify_sprite(sprite)
122
122
  if image = map.image_for(sprite.value)
123
- image_path = Pathname.new(File.expand_path(image.file))
124
- images_path = Pathname.new(File.expand_path(Compass.configuration.images_path))
125
- quoted_string(image_path.relative_path_from(images_path).to_s)
123
+ quoted_string(Compass.configuration.sprite_resolver.relative_path(:image, image.file))
126
124
  else
127
125
  missing_image!(map, sprite)
128
126
  end
@@ -30,12 +30,7 @@ module Compass
30
30
  end
31
31
 
32
32
  def find_file
33
- Compass.configuration.sprite_load_path.compact.each do |path|
34
- f = File.join(path, relative_file)
35
- if File.exists?(f)
36
- return f
37
- end
38
- end
33
+ Compass.configuration.sprite_resolver.find_asset(:image, relative_file)
39
34
  end
40
35
 
41
36
  # Width of the image
@@ -24,14 +24,7 @@ module Compass
24
24
  end
25
25
 
26
26
  def self.relative_name(sprite)
27
- sprite = File.expand_path(sprite)
28
- Compass.configuration.sprite_load_path.each do |path|
29
- path_with_slash = "#{File.expand_path(path)}/"
30
-
31
- if sprite.include?(path_with_slash)
32
- return sprite.gsub(path_with_slash, '')
33
- end
34
- end
27
+ Compass.configuration.sprite_resolver.relative_path(:image, sprite)
35
28
  end
36
29
 
37
30
  def initialize(sprites, path, name, context, kwargs)
@@ -5,35 +5,33 @@ module Compass
5
5
  VAILD_FILE_NAME = /\A#{Sass::SCSS::RX::IDENT}\Z/
6
6
  SPRITE_IMPORTER_REGEX = %r{((.+/)?([^\*.]+))/(.+?)\.png}
7
7
  VALID_EXTENSIONS = ['.png']
8
-
8
+
9
9
  TEMPLATE_FOLDER = File.join(File.expand_path('../', __FILE__), 'sprite_importer')
10
10
  CONTENT_TEMPLATE_FILE = File.join(TEMPLATE_FOLDER, 'content.erb')
11
11
  CONTENT_TEMPLATE = ERB.new(File.read(CONTENT_TEMPLATE_FILE))
12
12
 
13
-
14
-
15
13
  # finds all sprite files
16
14
  def self.find_all_sprite_map_files(path)
17
15
  hex = "[0-9a-f]"
18
16
  glob = "*-s#{hex*10}{#{VALID_EXTENSIONS.join(",")}}"
19
17
  Sass::Util.glob(File.join(path, "**", glob))
20
18
  end
21
-
19
+
22
20
  def find(uri, options)
23
21
  if uri =~ SPRITE_IMPORTER_REGEX
24
22
  return self.class.sass_engine(uri, self.class.sprite_name(uri), self, options)
25
23
  end
26
24
  nil
27
25
  end
28
-
26
+
29
27
  def find_relative(uri, base, options)
30
28
  nil
31
29
  end
32
-
30
+
33
31
  def to_s
34
32
  self.class.name
35
33
  end
36
-
34
+
37
35
  def hash
38
36
  self.class.name.hash
39
37
  end
@@ -41,13 +39,13 @@ module Compass
41
39
  def eql?(other)
42
40
  other.class == self.class
43
41
  end
44
-
42
+
45
43
  def mtime(uri, options)
46
44
  self.class.files(uri).sort.inject(Time.at(0)) do |max_time, file|
47
45
  (t = File.mtime(file)) > max_time ? t : max_time
48
46
  end
49
47
  end
50
-
48
+
51
49
  def key(uri, options={})
52
50
  [self.class.name + ":sprite:" + File.dirname(File.expand_path(uri)), File.basename(uri)]
53
51
  end
@@ -56,8 +54,7 @@ module Compass
56
54
  nil
57
55
  end
58
56
 
59
-
60
- def self.path_and_name(uri)
57
+ def self.path_and_name(uri)
61
58
  if uri =~ SPRITE_IMPORTER_REGEX
62
59
  [$1, $3]
63
60
  else
@@ -76,17 +73,22 @@ module Compass
76
73
  path, _ = path_and_name(uri)
77
74
  path
78
75
  end
79
-
76
+
80
77
  # Returns the Glob of image files for the uri
81
78
  def self.files(uri)
82
- Compass.configuration.sprite_load_path.compact.each do |folder|
83
- files = Sass::Util.glob(File.join(folder, uri)).sort
84
- next if files.empty?
85
- return files
86
- end
87
-
88
- path = Compass.configuration.sprite_load_path.to_a.join(', ')
89
- raise Compass::SpriteException, %Q{No files were found in the load path matching "#{uri}". Your current load paths are: #{path}}
79
+ resolved_files = Compass.configuration.sprite_resolver.glob(:image, uri, :match_all => true)
80
+ resolved_files = resolved_files.inject({}) do |basenames, file|
81
+ basename = File.basename(file, '.png')
82
+ unless basenames.has_key?(basename)
83
+ basenames[basename] = true
84
+ basenames[:files] ||= []
85
+ basenames[:files] << file
86
+ end
87
+ basenames
88
+ end[:files]
89
+ return resolved_files if resolved_files.any?
90
+ path = Compass.configuration.sprite_resolver.asset_collections.map{|ac| ac.images_path }.join(", ")
91
+ raise Compass::SpriteException, %Q{No images were found in the sprite path matching "#{uri}". Your current load paths are: #{path}}
90
92
  end
91
93
 
92
94
  # Returns an Array of image names without the file extension
@@ -95,12 +97,12 @@ module Compass
95
97
  File.basename(file, '.png')
96
98
  end
97
99
  end
98
-
100
+
99
101
  # Returns the sass_options for this sprite
100
102
  def self.sass_options(uri, importer, options)
101
103
  options.merge!(:filename => uri.gsub(%r{\*/},"*\\/"), :syntax => :scss, :importer => importer)
102
104
  end
103
-
105
+
104
106
  # Returns a Sass::Engine for this sprite object
105
107
  def self.sass_engine(uri, name, importer, options)
106
108
  content = content_for_images(uri, name, options[:skip_overrides])
@@ -162,7 +162,7 @@ class SpriteMapTest < Test::Unit::TestCase
162
162
  config.sprite_load_path = [@images_tmp_path, other_folder]
163
163
  Compass.add_configuration(config, "sprite_config")
164
164
  image = Compass::SassExtensions::Sprites::Image.new(@base, "foo/my.png", {})
165
- assert_equal File.join(other_folder, 'foo/my.png'), image.file
165
+ assert_equal File.expand_path(File.join(other_folder, 'foo/my.png')), image.file
166
166
  assert_equal 0, image.size
167
167
  end
168
168
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.alpha.0
4
+ version: 1.1.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Eppstein
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-08-26 00:00:00.000000000 Z
15
+ date: 2014-09-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: sass
@@ -40,14 +40,14 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 1.1.0.alpha.0
43
+ version: 1.1.0.alpha.1
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ~>
49
49
  - !ruby/object:Gem::Version
50
- version: 1.1.0.alpha.0
50
+ version: 1.1.0.alpha.1
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: compass-import-once
53
53
  requirement: !ruby/object:Gem::Requirement