From f3d3a661515f55cf32ebdddf879137ace76e5df8 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 30 May 2010 07:32:58 -0700 Subject: [PATCH] [Command Line] Fix a bug in `compass stats` when using scss files. --- features/command_line.feature | 23 ++++++++++--------- lib/compass/stats.rb | 4 +++- .../stylesheets/compass/sass/utilities.sass | 7 ------ .../stylesheets/compass/sass/utilities.scss | 9 ++++++++ 4 files changed, 24 insertions(+), 19 deletions(-) delete mode 100644 test/fixtures/stylesheets/compass/sass/utilities.sass create mode 100644 test/fixtures/stylesheets/compass/sass/utilities.scss diff --git a/features/command_line.feature b/features/command_line.feature index 4db7d898..86552d66 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -91,7 +91,7 @@ Feature: Command Line And a sass file sass/layout.sass is reported compiled And a sass file sass/print.sass is reported compiled And a sass file sass/reset.sass is reported compiled - And a sass file sass/utilities.sass is reported compiled + And a sass file sass/utilities.scss is reported compiled And a css file tmp/layout.css is created And a css file tmp/print.css is created And a css file tmp/reset.css is created @@ -105,7 +105,7 @@ Feature: Command Line And a sass file tmp_compass/sass/layout.sass is reported compiled And a sass file tmp_compass/sass/print.sass is reported compiled And a sass file tmp_compass/sass/reset.sass is reported compiled - And a sass file tmp_compass/sass/utilities.sass is reported compiled + And a sass file tmp_compass/sass/utilities.scss is reported compiled And a css file tmp_compass/tmp/layout.css is created And a css file tmp_compass/tmp/print.css is created And a css file tmp_compass/tmp/reset.css is created @@ -118,7 +118,7 @@ Feature: Command Line And a sass file sass/layout.sass is reported compiled And a sass file sass/print.sass is reported compiled And a sass file sass/reset.sass is reported compiled - And a sass file sass/utilities.sass is reported compiled + And a sass file sass/utilities.scss is reported compiled And a css file tmp/layout.css is not created And a css file tmp/print.css is not created And a css file tmp/reset.css is not created @@ -135,26 +135,26 @@ Feature: Command Line Then a sass file sass/layout.sass is reported unchanged And a sass file sass/print.sass is reported unchanged And a sass file sass/reset.sass is reported unchanged - And a sass file sass/utilities.sass is reported unchanged + And a sass file sass/utilities.scss is reported unchanged Scenario: compiling a specific file in a project Given I am using the existing project in test/fixtures/stylesheets/compass - And I run: compass compile sass/utilities.sass + And I run: compass compile sass/utilities.scss Then a sass file sass/layout.sass is not mentioned And a sass file sass/print.sass is not mentioned And a sass file sass/reset.sass is not mentioned - And a sass file sass/utilities.sass is reported compiled + And a sass file sass/utilities.scss is reported compiled And a css file tmp/utilities.css is reported created And a css file tmp/utilities.css is created Scenario: Re-compiling a specific file in a project with no changes Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass compile - And I run: compass compile sass/utilities.sass + And I run: compass compile sass/utilities.scss Then a sass file sass/layout.sass is not mentioned And a sass file sass/print.sass is not mentioned And a sass file sass/reset.sass is not mentioned - And a sass file sass/utilities.sass is reported compiled + And a sass file sass/utilities.scss is reported compiled And a css file tmp/utilities.css is reported identical Scenario: Installing a pattern into a project @@ -195,7 +195,7 @@ Feature: Command Line Then a css file tmp/layout.css is reported identical And a sass file sass/print.sass is reported unchanged And a sass file sass/reset.sass is reported unchanged - And a sass file sass/utilities.sass is reported unchanged + And a sass file sass/utilities.scss is reported unchanged Scenario: Recompiling a project with changes Given I am using the existing project in test/fixtures/stylesheets/compass @@ -207,7 +207,7 @@ Feature: Command Line And a css file tmp/layout.css is reported overwritten And a sass file sass/print.sass is reported unchanged And a sass file sass/reset.sass is reported unchanged - And a sass file sass/utilities.sass is reported unchanged + And a sass file sass/utilities.scss is reported unchanged Scenario: Watching a project for changes Given I am using the existing project in test/fixtures/stylesheets/compass @@ -253,6 +253,7 @@ Feature: Command Line Then my css is validated And I am informed that my css is valid. + @stats Scenario: Get stats for my project Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass stats @@ -264,7 +265,7 @@ Feature: Command Line | sass/layout.sass | 0 | 0 | 0 | 1 | 5 | 10 | | sass/print.sass | 0 | 0 | 0 | 2 | 61 | 61 | | sass/reset.sass | 4 | 1 | 0 | 2 | 190 | 664 | - | sass/utilities.sass | 2 | 0 | 0 | 2 | 5 | 11 | + | sass/utilities.scss | 2 | 0 | 0 | 2 | 5 | 11 | | Total.* | 44 | 9 | 0 | 45 | 299 | 832 | Scenario: List frameworks registered with compass diff --git a/lib/compass/stats.rb b/lib/compass/stats.rb index e6c92927..5bf7bddc 100644 --- a/lib/compass/stats.rb +++ b/lib/compass/stats.rb @@ -62,7 +62,9 @@ module Compass @contents ||= File.read(path) end def tree - @tree = Sass::Engine.new(contents, Compass.configuration.to_sass_engine_options).to_tree + opts = Compass.configuration.to_sass_engine_options + opts[:syntax] = path[-4..-1].to_sym + @tree = Sass::Engine.new(contents, opts).to_tree end def visit_tree! @visitor = StatsVisitor.new diff --git a/test/fixtures/stylesheets/compass/sass/utilities.sass b/test/fixtures/stylesheets/compass/sass/utilities.sass deleted file mode 100644 index 57b62e8d..00000000 --- a/test/fixtures/stylesheets/compass/sass/utilities.sass +++ /dev/null @@ -1,7 +0,0 @@ -@import compass/utilities - -.clearfix - +clearfix - -.pie-clearfix - +pie-clearfix diff --git a/test/fixtures/stylesheets/compass/sass/utilities.scss b/test/fixtures/stylesheets/compass/sass/utilities.scss new file mode 100644 index 00000000..1565ed53 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/utilities.scss @@ -0,0 +1,9 @@ +@import "compass/utilities"; + +.clearfix { + @include clearfix; +} + +.pie-clearfix { + @include pie-clearfix; +}