From 9888efdbc22f67c9ed6d54cd09a10a7c7d094f73 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 4 Nov 2011 16:16:22 -0700 Subject: [PATCH] We actually count css selectors, not rules in compass stats --- features/command_line.feature | 30 +++++++++++++-------------- lib/compass/commands/project_stats.rb | 14 ++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 56d52abb..52aff150 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -277,21 +277,21 @@ Feature: Command Line Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass stats Then I am told statistics for each file: - | Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Rules | CSS Properties | - | sass/border_radius.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/box.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/fonts.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/gradients.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/image_size.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/images.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/layout.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/legacy_clearfix.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/lists.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/print.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/reset.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | sass/utilities.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | - | ------------------------- | ----- | ---------- | -------------- | ----------- | --------- | -------------- | - | Total.* | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Selectors | CSS Properties | + | sass/border_radius.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/box.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/fonts.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/gradients.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/image_size.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/images.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/layout.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/legacy_clearfix.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/lists.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/print.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/reset.sass | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | sass/utilities.scss | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | + | ------------------------- | ----- | ---------- | -------------- | ----------- | ------------- | -------------- | + | Total.* | \d+ | \d+ | \d+ | \d+ | \d+ | \d+ | @listframeworks Scenario: List frameworks registered with compass diff --git a/lib/compass/commands/project_stats.rb b/lib/compass/commands/project_stats.rb index 7e7987a0..42ab579e 100644 --- a/lib/compass/commands/project_stats.rb +++ b/lib/compass/commands/project_stats.rb @@ -34,13 +34,13 @@ module Compass compiler = new_compiler_instance sass_files = sorted_sass_files(compiler) total_label = "Total (#{sass_files.size} files):" - rows = [[ :-, :-, :-, :-, :-, :-, :- ], - [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'CSS Rules', 'CSS Properties' ], - [ :-, :-, :-, :-, :-, :-, :- ]] - maximums = [ total_label.length, 5, 10, 14, 11, 9, 14 ] - alignments = [ :left, :right, :right, :right, :right, :right, :right ] - delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] - totals = [ total_label, 0, 0, 0, 0, 0, 0 ] + rows = [[ :-, :-, :-, :-, :-, :-, :- ], + [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'CSS Selectors', 'CSS Properties' ], + [ :-, :-, :-, :-, :-, :-, :- ]] + maximums = [ total_label.length, 5, 10, 14, 11, 13, 14 ] + alignments = [ :left, :right, :right, :right, :right, :right, :right ] + delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] + totals = [ total_label, 0, 0, 0, 0, 0, 0 ] sass_files.each do |sass_file| css_file = compiler.corresponding_css_file(sass_file) unless sass_file[0..0] == '_'