From 6ff877cbd366892489ef2ded2987d56d6a6323c8 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Mon, 21 Mar 2011 17:14:41 -0400 Subject: [PATCH 1/2] chunky_png gemfile change --- Gemfile | 1 - Gemfile.lock | 77 ++++++++++++++++++++++---------------------- compass.gemspec | 2 +- spec/sprites_spec.rb | 2 +- 4 files changed, 40 insertions(+), 42 deletions(-) diff --git a/Gemfile b/Gemfile index 47b93610..1dab3f61 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,6 @@ gem "haml", "~> 3.1.0.alpha" gem "rcov" gem "rubyzip" gem "livereload" -gem "chunky_png", "~> 0.12.0" gem "ruby-prof" unless RUBY_PLATFORM == "java" diff --git a/Gemfile.lock b/Gemfile.lock index 3a28704c..e6e7f6fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,44 +1,44 @@ PATH remote: . specs: - compass (0.11.beta.2.0d29379) - chunky_png (~> 0.12.0) + compass (0.11.beta.3.0fdf606) + chunky_png (~> 1.1.0) sass (>= 3.1.0.alpha.249) GEM remote: http://rubygems.org/ specs: abstract (1.0.0) - actionmailer (3.0.3) - actionpack (= 3.0.3) - mail (~> 2.2.9) - actionpack (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) + actionmailer (3.0.5) + actionpack (= 3.0.5) + mail (~> 2.2.15) + actionpack (3.0.5) + activemodel (= 3.0.5) + activesupport (= 3.0.5) builder (~> 2.1.2) erubis (~> 2.6.6) i18n (~> 0.4) rack (~> 1.2.1) rack-mount (~> 0.6.13) - rack-test (~> 0.5.6) + rack-test (~> 0.5.7) tzinfo (~> 0.3.23) - activemodel (3.0.3) - activesupport (= 3.0.3) + activemodel (3.0.5) + activesupport (= 3.0.5) builder (~> 2.1.2) i18n (~> 0.4) - activerecord (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) + activerecord (3.0.5) + activemodel (= 3.0.5) + activesupport (= 3.0.5) arel (~> 2.0.2) tzinfo (~> 0.3.23) - activeresource (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) - activesupport (3.0.3) - addressable (2.2.2) - arel (2.0.6) + activeresource (3.0.5) + activemodel (= 3.0.5) + activesupport (= 3.0.5) + activesupport (3.0.5) + addressable (2.2.4) + arel (2.0.9) builder (2.1.2) - chunky_png (0.12.0) + chunky_png (1.1.0) compass-validator (3.0.0) css_parser (1.0.1) cucumber (0.9.4) @@ -49,7 +49,7 @@ GEM term-ansicolor (~> 1.0.5) diff-lcs (1.1.2) em-dir-watcher (0.9.4) - em-websocket (0.1.4) + em-websocket (0.2.1) addressable (>= 2.1.1) eventmachine (>= 0.12.9) erubis (2.6.6) @@ -58,36 +58,36 @@ GEM gherkin (2.2.9) json (~> 1.4.6) term-ansicolor (~> 1.0.5) - haml (3.1.0.alpha.36) + haml (3.1.0.alpha.147) i18n (0.5.0) json (1.4.6) - livereload (1.4) + livereload (1.6) em-dir-watcher (>= 0.1) em-websocket (>= 0.1.2) ruby-json (>= 1.1.2) - mail (2.2.12) + mail (2.2.15) activesupport (>= 2.3.6) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) polyglot (0.3.1) - rack (1.2.1) + rack (1.2.2) rack-mount (0.6.13) rack (>= 1.0.0) - rack-test (0.5.6) + rack-test (0.5.7) rack (>= 1.0) - rails (3.0.3) - actionmailer (= 3.0.3) - actionpack (= 3.0.3) - activerecord (= 3.0.3) - activeresource (= 3.0.3) - activesupport (= 3.0.3) + rails (3.0.5) + actionmailer (= 3.0.5) + actionpack (= 3.0.5) + activerecord (= 3.0.5) + activeresource (= 3.0.5) + activesupport (= 3.0.5) bundler (~> 1.0) - railties (= 3.0.3) - railties (3.0.3) - actionpack (= 3.0.3) - activesupport (= 3.0.3) + railties (= 3.0.5) + railties (3.0.5) + actionpack (= 3.0.5) + activesupport (= 3.0.5) rake (>= 0.8.7) thor (~> 0.14.4) rake (0.8.7) @@ -110,13 +110,12 @@ GEM thor (0.14.6) treetop (1.4.9) polyglot (>= 0.3.1) - tzinfo (0.3.23) + tzinfo (0.3.25) PLATFORMS ruby DEPENDENCIES - chunky_png (~> 0.12.0) compass! compass-validator (= 3.0.0) css_parser (~> 1.0.1) diff --git a/compass.gemspec b/compass.gemspec index 0003448a..d491b294 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |gemspec| gemspec.summary = %q{A Real Stylesheet Framework} gemspec.add_dependency 'sass', '>= 3.1.0.alpha.249' - gemspec.add_dependency 'chunky_png', '~> 0.12.0' + gemspec.add_dependency 'chunky_png', '~> 1.1.0' gemspec.files = %w(README.markdown LICENSE.markdown VERSION.yml Rakefile) gemspec.files += Dir.glob("bin/*") diff --git a/spec/sprites_spec.rb b/spec/sprites_spec.rb index 94349518..3a9668d0 100644 --- a/spec/sprites_spec.rb +++ b/spec/sprites_spec.rb @@ -7,7 +7,7 @@ describe Compass::Sprites do before :each do @images_src_path = File.join(File.dirname(__FILE__), 'test_project', 'public', 'images') @images_tmp_path = File.join(File.dirname(__FILE__), 'test_project', 'public', 'images-tmp') - FileUtils.cp_r @images_src_path, @images_tmp_path + ::FileUtils.cp_r @images_src_path, @images_tmp_path file = StringIO.new("images_path = #{@images_tmp_path.inspect}\n") Compass.add_configuration(file, "sprite_config") Compass.configure_sass_plugin! From 2bf3d8f453f93dafaf747470133957ad22aec293 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Fri, 25 Mar 2011 00:54:47 -0400 Subject: [PATCH 2/2] reverted chunky_png version pushed that by mistake and patched a bug that was causing callbacks to register twice --- Gemfile.lock | 6 +++--- compass.gemspec | 2 +- lib/compass/configuration/helpers.rb | 13 ++++++++----- spec/sprites_spec.rb | 28 +++++++++++++++++++++++++++- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e6e7f6fb..812473f3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ PATH remote: . specs: - compass (0.11.beta.3.0fdf606) - chunky_png (~> 1.1.0) + compass (0.11.beta.3.6ff877c) + chunky_png (~> 0.12) sass (>= 3.1.0.alpha.249) GEM @@ -38,7 +38,7 @@ GEM addressable (2.2.4) arel (2.0.9) builder (2.1.2) - chunky_png (1.1.0) + chunky_png (0.12.0) compass-validator (3.0.0) css_parser (1.0.1) cucumber (0.9.4) diff --git a/compass.gemspec b/compass.gemspec index d491b294..e5758060 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |gemspec| gemspec.summary = %q{A Real Stylesheet Framework} gemspec.add_dependency 'sass', '>= 3.1.0.alpha.249' - gemspec.add_dependency 'chunky_png', '~> 1.1.0' + gemspec.add_dependency 'chunky_png', '~> 0.12' gemspec.files = %w(README.markdown LICENSE.markdown VERSION.yml Rakefile) gemspec.files += Dir.glob("bin/*") diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index 37fc478a..c10bfffa 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -65,11 +65,14 @@ module Compass Sass::Plugin.add_template_location sass_dir, css_dir end end - Sass::Plugin.on_updating_stylesheet do |sass_file, css_file| - Compass.configuration.run_callback(:stylesheet_saved, css_file) - end - Sass::Plugin.on_compilation_error do |e, filename, css| - Compass.configuration.run_callback(:stylesheet_error, filename, e.message) + unless defined?(CallbacksSetup) + Sass::Plugin.on_updating_stylesheet do |sass_file, css_file| + Compass.configuration.run_callback(:stylesheet_saved, css_file) + end + Sass::Plugin.on_compilation_error do |e, filename, css| + Compass.configuration.run_callback(:stylesheet_error, filename, e.message) + end + const_set('CallbacksSetup', true) end end diff --git a/spec/sprites_spec.rb b/spec/sprites_spec.rb index 3a9668d0..d8944c03 100644 --- a/spec/sprites_spec.rb +++ b/spec/sprites_spec.rb @@ -1,5 +1,4 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') -require "compass/sprites" require 'digest/md5' describe Compass::Sprites do @@ -440,5 +439,32 @@ describe Compass::Sprites do } CSS end + + it "should calculate corret sprite demsions when givin spacing via issue#253" do + css = render <<-SCSS + $squares-spacing: 10px; + @import "squares/*.png"; + .foo { + @include sprite-background-position($squares-sprites, "twenty-by-twenty"); + } + .bar { + @include sprite-background-position($squares-sprites, "ten-by-ten"); + } + SCSS + image_size('squares-*.png').should == [20, 40] + css.should == <<-CSS + .squares-sprite { + background: url('/squares-e3c68372d9.png') no-repeat; + } + + .foo { + background-position: 0 -20px; + } + + .bar { + background-position: 0 0; + } + CSS + end end \ No newline at end of file