From 7198a6990915b2b66cc87432df112867cc1baa59 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Mon, 30 Jan 2012 22:12:01 -0500 Subject: [PATCH] sprite importer will now error if it does not find the associated glob --- lib/compass/errors.rb | 1 + lib/compass/sass_extensions/sprites.rb | 1 - lib/compass/sprite_importer.rb | 3 +++ test/units/sprites/sprite_command_test.rb | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/compass/errors.rb b/lib/compass/errors.rb index 96695e34..de2ec60f 100644 --- a/lib/compass/errors.rb +++ b/lib/compass/errors.rb @@ -7,4 +7,5 @@ module Compass class MissingDependency < Error end + class SpriteException < Error; end end diff --git a/lib/compass/sass_extensions/sprites.rb b/lib/compass/sass_extensions/sprites.rb index 5047c74a..277bfa94 100644 --- a/lib/compass/sass_extensions/sprites.rb +++ b/lib/compass/sass_extensions/sprites.rb @@ -2,7 +2,6 @@ require 'digest/md5' require 'compass/sprite_importer' module Compass - class SpriteException < Exception; end module SassExtensions module Sprites end diff --git a/lib/compass/sprite_importer.rb b/lib/compass/sprite_importer.rb index 8af0ea0c..670f9323 100644 --- a/lib/compass/sprite_importer.rb +++ b/lib/compass/sprite_importer.rb @@ -79,6 +79,9 @@ module Compass next if files.empty? return files end + + path = Compass.configuration.sprite_load_path.to_a.join(', ') + raise Compass::SpriteException, %Q{No files were found in the load path matching "#{uri}". Your current load paths are: #{path}} end # Returns an Array of image names without the file extension diff --git a/test/units/sprites/sprite_command_test.rb b/test/units/sprites/sprite_command_test.rb index b1242b66..12a86786 100644 --- a/test/units/sprites/sprite_command_test.rb +++ b/test/units/sprites/sprite_command_test.rb @@ -47,7 +47,7 @@ class SpriteCommandTest < Test::Unit::TestCase end it "should create sprite file" do - assert_equal 0, run_compass_with_options(['sprite', "-f", 'stylesheet.scss', "'#{@images_tmp_path}/*.png'"]).to_i + assert_equal 0, run_compass_with_options(['sprite', "-f", 'stylesheet.scss', "squares/*.png"]).to_i assert File.exists?(File.join(test_dir, 'stylesheet.scss')) end