From 24d4ff41460515df3f18d15fbcb9079f2db8db00 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 11 Jul 2009 11:08:04 -0700 Subject: [PATCH 001/118] [Blueprint] Make the primary blueprint mixins easier to use by allowing them to be nested when passing true as the first argument. The old approach of passing a selector as the first argument is now deprecated in favor of a simple flag to indicate nesting or not. --- .../blueprint/stylesheets/blueprint/_ie.sass | 38 +++++++++++-------- .../stylesheets/blueprint/_print.sass | 37 ++++++++++-------- .../stylesheets/blueprint/_screen.sass | 14 +++++++ .../stylesheets/blueprint/modules/_rtl.sass | 32 ++++++++++++---- .../blueprint/modules/_typography.sass | 33 +++++++++------- .../blueprint/templates/project/ie.sass | 23 +++++------ .../blueprint/templates/project/print.sass | 7 +++- .../blueprint/templates/project/screen.sass | 2 +- 8 files changed, 121 insertions(+), 65 deletions(-) diff --git a/frameworks/blueprint/stylesheets/blueprint/_ie.sass b/frameworks/blueprint/stylesheets/blueprint/_ie.sass index 9421d908..13db8a22 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_ie.sass +++ b/frameworks/blueprint/stylesheets/blueprint/_ie.sass @@ -1,27 +1,33 @@ // The blueprint IE mixins should be mixed into a stylesheet that gets conditionally included // into IE like so: -// -// The +blueprint-ie mixin must be mixed into the top level of your stylesheet. -// However, you can customize the body selector if you wish to control the scope -// of this mixin. Examples: -// Apply to any page including the stylesheet: -// +blueprint-ie -// Scoped by a single presentational body class: -// +blueprint-ie("body.blueprint") -// Semantically: -// +blueprint-ie("body#page-1, body#page-2, body.a-special-page-type") -// Alternatively, you can use the +blueprint-ie-body and +blueprint-ie-defaults -// mixins to construct your own semantic style rules. +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint-ie +// Scoped by a presentational class: +// body.blueprint +// +blueprint-ie(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint-ie(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint-ie("body#page-1, body#page-2, body.a-special-page-type") =blueprint-ie(!body_selector = "body") - #{!body_selector} + @if !body_selector == true +blueprint-ie-body - @if !body_selector != "body" - +blueprint-ie-defaults - @if !body_selector == "body" +blueprint-ie-defaults + @else + #{!body_selector} + +blueprint-ie-body + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint-ie, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-ie-defaults + @if !body_selector == "body" + +blueprint-ie-defaults =blueprint-ie-body :text-align center diff --git a/frameworks/blueprint/stylesheets/blueprint/_print.sass b/frameworks/blueprint/stylesheets/blueprint/_print.sass index d147bf7a..7726339e 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_print.sass +++ b/frameworks/blueprint/stylesheets/blueprint/_print.sass @@ -1,25 +1,32 @@ @import modules/typography.sass @import compass/utilities/general/float.sass -// The +blueprint-print mixin must be mixed into the top level of your stylesheet. -// However, you can customize the body selector if you wish to control the scope -// of this mixin. Examples: -// Apply to any page including the stylesheet: -// +blueprint-print -// Scoped by a single presentational body class: -// +blueprint-print("body.blueprint") -// Semantically: -// +blueprint-print("body#page-1, body#page-2, body.a-special-page-type") -// Alternatively, you can use the +blueprint-print-body and +blueprint-print-defaults -// mixins to construct your own semantic style rules. + +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint-print +// Scoped by a presentational class: +// body.blueprint +// +blueprint-print(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint-print(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint-print("body#page-1, body#page-2, body.a-special-page-type") =blueprint-print(!body_selector = "body") - #{!body_selector} + @if !body_selector == true +blueprint-print-body - @if !body_selector != "body" - +blueprint-print-defaults - @if !body_selector == "body" +blueprint-print-defaults + @else + #{!body_selector} + +blueprint-print-body + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint-print, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-print-defaults + @if !body_selector == "body" + +blueprint-print-defaults // This style is in blueprint, but I think it's annoying and it doesn't work in all browsers. // Feel free to mix it into anchors where you want it. diff --git a/frameworks/blueprint/stylesheets/blueprint/_screen.sass b/frameworks/blueprint/stylesheets/blueprint/_screen.sass index 15762552..ce3509ea 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_screen.sass +++ b/frameworks/blueprint/stylesheets/blueprint/_screen.sass @@ -6,7 +6,21 @@ @import modules/interaction.sass @import modules/debug.sass +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +blueprint +// Scoped by a presentational class: +// body.blueprint +// +blueprint(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +blueprint("body#page-1, body#page-2, body.a-special-page-type") =blueprint(!body_selector = "body") + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint, pass true as the first argument and mix it into #{!body_selector}." +blueprint-typography(!body_selector) +blueprint-utilities +blueprint-grid diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass index 1efaa2dc..5c4599a3 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass @@ -70,14 +70,32 @@ :margin-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin)/2 :border-left 1px solid #eee +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: +// +rtl-typography +// Scoped by a presentational class: +// body.blueprint +// +rtl-typography(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +rtl-typography(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin +// +rtl-typography("body#page-1, body#page-2, body.a-special-page-type") =rtl-typography(!body_selector = "body") - html #{!body_selector} - :font-family Arial, sans-serif - @if !body_selector != "body" - +rtl-typography-defaults - @if !body_selector == "body" - body - +rtl-typography-defaults + @if !body_selector == true + html & + :font-family Arial, sans-serif + +rtl-typography-defaults + @else + html #{!body_selector} + :font-family Arial, sans-serif + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +rtl-typography, pass true as the first argument and mix it into #{!body_selector}." + +rtl-typography-defaults + @if !body_selector == "body" + body + +rtl-typography-defaults =rtl-typography-defaults h1, h2, h3, h4, h5, h6 diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass index bb11783e..049fd143 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass @@ -6,25 +6,30 @@ !blueprint_fixed_font_family ||= "'andale mono', 'lucida console', monospace" !blueprint_font_size ||= 12px -// The +blueprint-typography mixin must be mixed into the top level of your stylesheet. -// However, you can customize the body selector if you wish to control the scope -// of this mixin. Examples: -// Apply to any page including the stylesheet: +// Usage examples: +// As a top-level mixin, apply to any page that includes the stylesheet: // +blueprint-typography -// Scoped by a single presentational body class: -// +blueprint-typography("body.blueprint") -// Semantically: +// Scoped by a presentational class: +// body.blueprint +// +blueprint-typography(true) +// Scoped by semantic selectors: +// body#page-1, body#page-2, body.a-special-page-type +// +blueprint-typography(true) +// Deprecated: +// You can pass the body selector as the first argument when used as a top-level mixin // +blueprint-typography("body#page-1, body#page-2, body.a-special-page-type") -// Alternatively, you can use the +blueprint-typography-body and +blueprint-typography-defaults -// mixins to construct your own semantic style rules. - =blueprint-typography(!body_selector = "body") - #{!body_selector} + @if !body_selector == true +blueprint-typography-body - @if !body_selector != "body" - +blueprint-typography-defaults - @if !body_selector == "body" +blueprint-typography-defaults + @else + #{!body_selector} + +blueprint-typography-body + @if !body_selector != "body" + @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint-typography, pass true as the first argument and mix it into #{!body_selector}." + +blueprint-typography-defaults + @if !body_selector == "body" + +blueprint-typography-defaults =normal-text :font-family= !blueprint_font_family diff --git a/frameworks/blueprint/templates/project/ie.sass b/frameworks/blueprint/templates/project/ie.sass index fad09158..1ba6fd06 100644 --- a/frameworks/blueprint/templates/project/ie.sass +++ b/frameworks/blueprint/templates/project/ie.sass @@ -1,15 +1,16 @@ @import blueprint.sass -+blueprint-ie +// To generate css equivalent to the blueprint css but with your configuration applied, uncomment: +// +blueprint-ie -// Note : -// -// Compass will center text to fix IE6 container centering. -// This means all your texts will be centered under all version of IE by default. -// Please don't forget to restore the correct behavior to your main container (but not the body tag!) -// -// Example : -// -// .container, .footer -// :text-align left +//Recommended Blueprint configuration with scoping and semantic layout: +body.bp + +blueprint-ie(true) + // Note: Blueprint centers text to fix IE6 container centering. + // This means all your texts will be centered under all version of IE by default. + // If your container does not have the .container class, don't forget to restore + // the correct behavior to your main container (but not the body tag!) + // Example: + // .my-container + // :text-align left diff --git a/frameworks/blueprint/templates/project/print.sass b/frameworks/blueprint/templates/project/print.sass index 8e5d49d8..e3727d9e 100644 --- a/frameworks/blueprint/templates/project/print.sass +++ b/frameworks/blueprint/templates/project/print.sass @@ -1,3 +1,8 @@ @import blueprint.sass -+blueprint-print \ No newline at end of file +// To generate css equivalent to the blueprint css but with your configuration applied, uncomment: +// +blueprint-print + +//Recommended Blueprint configuration with scoping and semantic layout: +body.bp + +blueprint-print(true) \ No newline at end of file diff --git a/frameworks/blueprint/templates/project/screen.sass b/frameworks/blueprint/templates/project/screen.sass index e3588dcd..d3d9be68 100644 --- a/frameworks/blueprint/templates/project/screen.sass +++ b/frameworks/blueprint/templates/project/screen.sass @@ -11,9 +11,9 @@ // +blueprint //Recommended Blueprint configuration with scoping and semantic layout: -+blueprint-typography("body.bp") +blueprint-scaffolding("body.bp") body.bp + +blueprint-typography(true) +blueprint-utilities +blueprint-debug +blueprint-interaction From dafbd885881da7665ea81668d59efb484392e571 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 11 Jul 2009 12:27:04 -0700 Subject: [PATCH 002/118] Fixed some incorrect logic around the deprecation warning for the +blueprint mixin and eliminated the deprecation warnings for the examples. --- examples/blueprint_scoped/src/ie.sass | 3 ++- examples/blueprint_scoped/src/print.sass | 3 ++- examples/blueprint_scoped/src/screen.sass | 3 ++- examples/blueprint_semantic/src/liquid.sass | 3 +-- examples/blueprint_semantic/src/screen.sass | 3 +-- frameworks/blueprint/stylesheets/blueprint/_screen.sass | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/blueprint_scoped/src/ie.sass b/examples/blueprint_scoped/src/ie.sass index badeb777..455f7597 100644 --- a/examples/blueprint_scoped/src/ie.sass +++ b/examples/blueprint_scoped/src/ie.sass @@ -1,3 +1,4 @@ @import blueprint.sass -+blueprint-ie("body.bp") \ No newline at end of file +body.bp + +blueprint-ie(true) \ No newline at end of file diff --git a/examples/blueprint_scoped/src/print.sass b/examples/blueprint_scoped/src/print.sass index 949e578e..f08fa0fd 100644 --- a/examples/blueprint_scoped/src/print.sass +++ b/examples/blueprint_scoped/src/print.sass @@ -1,3 +1,4 @@ @import blueprint.sass -+blueprint-print("body.bp") \ No newline at end of file +body.bp + +blueprint-print(true) \ No newline at end of file diff --git a/examples/blueprint_scoped/src/screen.sass b/examples/blueprint_scoped/src/screen.sass index 400f3314..0367fa59 100644 --- a/examples/blueprint_scoped/src/screen.sass +++ b/examples/blueprint_scoped/src/screen.sass @@ -1,4 +1,5 @@ @import blueprint.sass @import compass/reset.sass -+blueprint("body.bp") \ No newline at end of file +body.bp + +blueprint(true) \ No newline at end of file diff --git a/examples/blueprint_semantic/src/liquid.sass b/examples/blueprint_semantic/src/liquid.sass index 04e500b9..85267c7c 100644 --- a/examples/blueprint_semantic/src/liquid.sass +++ b/examples/blueprint_semantic/src/liquid.sass @@ -7,9 +7,8 @@ .container +container -+blueprint-typography("body.blueprint") - body.blueprint + +blueprint-typography(true) +blueprint-scaffolding-body hr +colruler diff --git a/examples/blueprint_semantic/src/screen.sass b/examples/blueprint_semantic/src/screen.sass index 9ad7bd09..a348df2e 100644 --- a/examples/blueprint_semantic/src/screen.sass +++ b/examples/blueprint_semantic/src/screen.sass @@ -3,9 +3,8 @@ @import blueprint/modules/scaffolding.sass @import compass/reset.sass -+blueprint-typography("body.blueprint") - body.blueprint + +blueprint-typography(true) +blueprint-scaffolding-body .container +container diff --git a/frameworks/blueprint/stylesheets/blueprint/_screen.sass b/frameworks/blueprint/stylesheets/blueprint/_screen.sass index ce3509ea..824a62af 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_screen.sass +++ b/frameworks/blueprint/stylesheets/blueprint/_screen.sass @@ -19,7 +19,7 @@ // You can pass the body selector as the first argument when used as a top-level mixin // +blueprint("body#page-1, body#page-2, body.a-special-page-type") =blueprint(!body_selector = "body") - @if !body_selector != "body" + @if not (!body_selector == "body" or !body_selector == true) @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint, pass true as the first argument and mix it into #{!body_selector}." +blueprint-typography(!body_selector) +blueprint-utilities From 31bdbe815bcf9c881569c7f2a48c8a5704807b13 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Fri, 17 Jul 2009 20:57:23 -0500 Subject: [PATCH 003/118] [Compass Core] New mixin: +opacity(amount). Provides cross-browser css opacity. Amount should be between 0 and 1, where 0 is transparent and 1 is opaque. --- .../stylesheets/compass/utilities/_general.sass | 1 + .../compass/utilities/general/_opacity.sass | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_general.sass b/frameworks/compass/stylesheets/compass/utilities/_general.sass index a09b235a..8e593fec 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_general.sass +++ b/frameworks/compass/stylesheets/compass/utilities/_general.sass @@ -4,3 +4,4 @@ @import general/tag_cloud.sass @import general/inline_block.sass @import general/hacks.sass +@import general/opacity.sass \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass b/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass new file mode 100644 index 00000000..04b85ec4 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass @@ -0,0 +1,15 @@ +// expects a number from 0 to 1 +=opacity(!opacity = 1) + :opacity= !opacity + :-moz-opacity= !opacity + :-khtml-opacity= !opacity + :-ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + round(!opacity*100) + ")" + :filter= "alpha(opacity=" + round(!opacity*100) + ")" + +// Make an element completely transparent. +=transparent + +opacity(0) + +// Make an element completely opaque. +=opaque + +opacity(1) From 4abb59e98a04b8f28bd9317d6663c139e47a2027 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 13:14:41 -0700 Subject: [PATCH 004/118] Set the edge version. --- VERSION.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION.yml b/VERSION.yml index bdc26a46..f7330b54 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- -:patch: 12 +:patch: 0 :major: 0 -:minor: 8 +:minor: 9 From 74141399afd899d844ef17c1ee2429cc4cba84a6 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 17 Jul 2009 20:07:54 -0700 Subject: [PATCH 005/118] [Compass Core] +opaque and +transparent mixins for convenience. Built on top of the opacity mixin. --- .../stylesheets/compass/utilities/general/_opacity.sass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass b/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass index 04b85ec4..f8d2a056 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass +++ b/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass @@ -1,5 +1,8 @@ -// expects a number from 0 to 1 -=opacity(!opacity = 1) +//** + Provides cross-browser css opacity. + @param !opacity + A number between 0 and 1, where 0 is transparent and 1 is opaque. +=opacity(!opacity) :opacity= !opacity :-moz-opacity= !opacity :-khtml-opacity= !opacity From 390674ba83f7279a7ccc65267e00f35c1d482caa Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 3 Jul 2009 18:42:16 -0700 Subject: [PATCH 006/118] [Configuration] [Command Line] Whether to generate relative links to assets is now controlled by a separate configuration flag and can be set via a command-line switch. --- lib/compass/configuration.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index ae4f5b95..3b7989c5 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -120,6 +120,21 @@ module Compass end end + def relative_assets? + # the http_images_path is deprecated, but here for backwards compatibility. + relative_assets || http_images_path == :relative + end + + def comment_for_relative_assets + unless relative_assets + %q{# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true +} + else + "" + end + end + def default_output_style if environment == :development :expanded From bbe8366350f8aa01cca749b74b62b45203d82348 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 3 Jul 2009 18:45:19 -0700 Subject: [PATCH 007/118] [Configuration] A more logical and consistent approach to http path locations. --- lib/compass/configuration.rb | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index 3b7989c5..469c9fd3 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -120,21 +120,6 @@ module Compass end end - def relative_assets? - # the http_images_path is deprecated, but here for backwards compatibility. - relative_assets || http_images_path == :relative - end - - def comment_for_relative_assets - unless relative_assets - %q{# To enable relative paths to assets via compass helper functions. Uncomment: -# relative_assets = true -} - else - "" - end - end - def default_output_style if environment == :development :expanded @@ -159,9 +144,8 @@ module Compass end end - def root_relative(path) - hp = http_path || default_http_path - hp = hp[0..-2] if hp[-1..-1] == "/" + def mk_http_path(path) + hp = http_path[0..-2] if http_path[-1..-1] == "/" "#{hp}/#{path}" end From 48c7d45c3058a16adf32fb267d7f9fe6346a41e9 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 3 Jul 2009 22:00:18 -0700 Subject: [PATCH 008/118] [Compass Core] A new helper function stylesheet_url(path) can now be used to refer to assets that are relative to the css directory. --- lib/compass/configuration.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index 469c9fd3..ae4f5b95 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -144,8 +144,9 @@ module Compass end end - def mk_http_path(path) - hp = http_path[0..-2] if http_path[-1..-1] == "/" + def root_relative(path) + hp = http_path || default_http_path + hp = hp[0..-2] if hp[-1..-1] == "/" "#{hp}/#{path}" end From 851f00175657ce333e52c272c5ae9051719ae9e4 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Sun, 19 Jul 2009 16:37:38 -0500 Subject: [PATCH 009/118] the sprite mixin now has new functions which enable style grouping and require fewer arguments for non-default cases --- .../utilities/sprites/_sprite_img.sass | 60 +++++++++++++++---- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass b/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass index 2381dbd4..dadac12b 100644 --- a/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +++ b/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass @@ -1,12 +1,52 @@ -!sprite_image_default_width ||= 32px -!sprite_image_default_height ||= 32px -!sprite_image_default_margin ||= 0px - -// Simplest use: +sprite-img("icons-32.png", 1) -=sprite-img(!img, !col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_image_default_margin) - !x = ((!col - 1) * -!width) - ((!col - 1) * !margin) - !y = ((!row - 1) * -!height) - ((!row - 1) * !margin) - :background= image_url(!img) "no-repeat" !x !y +//** + Example 1: + a.twitter + +sprite-img("icons-32.png", 1) + a.facebook + +sprite-img("icons-32png", 2) + ... + Example 2: + a + +sprite-background("icons-32.png") + a.twitter + +sprite-column(1) + a.facebook + +sprite-row(2) + ... + +!sprite_default_size ||= 32px +!sprite_default_margin ||= 0px +!sprite_image_default_width ||= !sprite_default_size +!sprite_image_default_height ||= !sprite_default_size + + +// Sets all the rules for a sprite from a given sprite image to show just one of the sprites. +// To reduce duplication use a sprite-bg mixin for common properties and a sprite-select mixin for positioning. +=sprite-img(!img, !col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_default_margin) + +sprite-background(!img, !width, !height) + +sprite-position(!col, !row, !width, !height, !margin) + +// Sets rules common for all sprites, assumes you want a square, but allows a rectangular region. +=sprite-background(!img, !width = !sprite_default_size, !height = !width) + +sprite-background-rectangle(!img, !width, !height) + +// Sets rules common for all sprites, assumes a rectangular region. +=sprite-background-rectangle(!img, !width = !sprite_image_default_width, !height = !sprite_image_default_height) + :background= image_url(!img) "no-repeat" :width= !width :height= !height - :overflow hidden \ No newline at end of file + :overflow hidden + +// Allows horizontal sprite positioning optimized for a single row of sprites. +=sprite-column(!col, !width = !sprite_image_default_width, !margin = !sprite_default_margin) + +sprite-position(!col, 1, !width, 0px, !margin) + +// Allows vertical sprite positioning optimized for a single column of sprites. +=sprite-row(!row, !height = !sprite_image_default_height, !margin = !sprite_default_margin) + +sprite-position(1, !row, 0px, !height, !margin) + +// Allows vertical and horizontal sprite positioning from a grid of equal dimensioned sprites. +=sprite-position(!col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_default_margin) + !x = ((!col - 1) * -!width) - ((!col - 1) * !margin) + !y = ((!row - 1) * -!height) - ((!row - 1) * !margin) + :background-position= !x !y \ No newline at end of file From 0d3e5fb3017d866ebbad305a92937733ed7a38c4 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Sun, 19 Jul 2009 18:25:59 -0500 Subject: [PATCH 010/118] new rounded corners mixin makes rounded corners easy (for browsers that support them) and allows rounding all corners, corners on one side, or single corners. changed rounded corners mixin to border radius mixin, and changed the functions to match the border-radius CSS3 standard --- .../utilities/general/_border_radius.sass | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 frameworks/compass/stylesheets/compass/utilities/general/_border_radius.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_border_radius.sass b/frameworks/compass/stylesheets/compass/utilities/general/_border_radius.sass new file mode 100644 index 00000000..475b66d5 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/general/_border_radius.sass @@ -0,0 +1,47 @@ +!default_border_radius ||= 5px + +// Round all borders by amount +=border-radius(!radius = !default_border_radius) + border-radius= !radius + -moz-border-radius= !radius + -webkit-border-radius= !radius + +// Round radius at position by amount. +// values for !vert: "top", "bottom" +// values for !horz: "left", "right +=border-corner-radius(!vert, !horz, !radius = !default_border_radius) + border-#{!vert}-#{!horz}-radius= !radius + -moz-border-radius-#{!vert}#{!horz}= !radius + -webkit-border-#{!vert}-#{!horz}-radius= !radius + +=border-top-left-radius(!radius = !default_border_radius) + +border-corner-radius("top", "left", !radius) + +=border-top-right-radius(!radius = !default_border_radius) + +border-corner-radius("top", "right", !radius) + +=border-bottom-left-radius(!radius = !default_border_radius) + +border-corner-radius("bottom", "left", !radius) + +=border-bottom-right-radius(!radius = !default_border_radius) + +border-corner-radius("bottom", "right", !radius) + +// Round top corners by amount +=border-top-radius(!radius = !default_border_radius) + +border-top-left-radius(!radius) + +border-top-right-radius(!radius) + +// Round right corners by amount +=border-right-radius(!radius = !default_border_radius) + +border-top-right-radius(!radius) + +border-bottom-right-radius(!radius) + +// Round bottom corners by amount +=border-bottom-radius(!radius = !default_border_radius) + +border-bottom-left-radius(!radius) + +border-bottom-right-radius(!radius) + +// Round left corners by amount +=border-left-radius(!radius = !default_border_radius) + +border-top-left-radius(!radius) + +border-bottom-left-radius(!radius) \ No newline at end of file From 2eba93858bea02e305c0b0a6e6684b768c724b5e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 24 Jul 2009 09:05:22 -0700 Subject: [PATCH 011/118] [Compass Core] Extract css3 compatibility mixins from the general module to the new compass/utilities/css3 module. If you were explicitly importing compass/utilities/general, compass/utilities/general/inline_block or compass/utilities/general/opacity to access the opacity or inline-block mixins, you'll need to update your imports. --- .../blueprint/stylesheets/blueprint/modules/_buttons.sass | 2 +- frameworks/compass/stylesheets/compass/_utilities.sass | 1 + frameworks/compass/stylesheets/compass/utilities/_css3.sass | 3 +++ frameworks/compass/stylesheets/compass/utilities/_general.sass | 2 -- .../compass/utilities/{general => css3}/_border_radius.sass | 0 .../compass/utilities/{general => css3}/_inline_block.sass | 0 .../compass/utilities/{general => css3}/_opacity.sass | 0 7 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 frameworks/compass/stylesheets/compass/utilities/_css3.sass rename frameworks/compass/stylesheets/compass/utilities/{general => css3}/_border_radius.sass (100%) rename frameworks/compass/stylesheets/compass/utilities/{general => css3}/_inline_block.sass (100%) rename frameworks/compass/stylesheets/compass/utilities/{general => css3}/_opacity.sass (100%) diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass index a59338a3..a82e672e 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass @@ -1,4 +1,4 @@ -@import compass/utilities/general/inline_block.sass +@import compass/utilities/css3/inline_block.sass @import compass/utilities/general/float.sass // Button Font diff --git a/frameworks/compass/stylesheets/compass/_utilities.sass b/frameworks/compass/stylesheets/compass/_utilities.sass index 767001d5..ba76cf7b 100644 --- a/frameworks/compass/stylesheets/compass/_utilities.sass +++ b/frameworks/compass/stylesheets/compass/_utilities.sass @@ -1,3 +1,4 @@ +@import utilities/css3.sass @import utilities/general.sass @import utilities/links.sass @import utilities/lists.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_css3.sass b/frameworks/compass/stylesheets/compass/utilities/_css3.sass new file mode 100644 index 00000000..45174ab9 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/_css3.sass @@ -0,0 +1,3 @@ +@import css3/border_radius.sass +@import css3/inline_block.sass +@import css3/opacity.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_general.sass b/frameworks/compass/stylesheets/compass/utilities/_general.sass index 8e593fec..3b105f8a 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_general.sass +++ b/frameworks/compass/stylesheets/compass/utilities/_general.sass @@ -2,6 +2,4 @@ @import general/clearfix.sass @import general/float.sass @import general/tag_cloud.sass -@import general/inline_block.sass @import general/hacks.sass -@import general/opacity.sass \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_border_radius.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_border_radius.sass rename to frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass rename to frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_opacity.sass rename to frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass From 6870d21814d572f9336e896b5230059fa22d30cd Mon Sep 17 00:00:00 2001 From: Eric Meyer Date: Tue, 25 Aug 2009 21:06:59 -0600 Subject: [PATCH 012/118] css3 and inline-block patches --- .../stylesheets/compass/utilities/_css3.sass | 3 ++ .../compass/utilities/css3/_box_shadow.sass | 12 ++++++ .../compass/utilities/css3/_box_sizing.sass | 13 +++++++ .../compass/utilities/css3/_columns.sass | 37 +++++++++++++++++++ .../compass/utilities/css3/_inline_block.sass | 9 +++-- 5 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass create mode 100644 frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass create mode 100644 frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_css3.sass b/frameworks/compass/stylesheets/compass/utilities/_css3.sass index 45174ab9..9e39e053 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_css3.sass +++ b/frameworks/compass/stylesheets/compass/utilities/_css3.sass @@ -1,3 +1,6 @@ @import css3/border_radius.sass @import css3/inline_block.sass @import css3/opacity.sass +@import css3/box_shadow.sass +@import css3/columns.sass +@import css3/box_sizing.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass new file mode 100644 index 00000000..91e476d0 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass @@ -0,0 +1,12 @@ +//** + Provides cross-browser css box shadows + for Webkit and the future + arguments are horizontal offset, vertical offset, blur and color + +=box-shadow(!ho, !vo, !b, !c ) + /* Webkit (Safari, Chrome) + -webkit-box-shadow= !ho !vo !b !c + /* Mozilla (Firefox, Camino) + -moz-box-shadow= !ho !vo !b !c + /* CSS3 + box-shadow= !ho !vo !b !c diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass new file mode 100644 index 00000000..c63076d4 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass @@ -0,0 +1,13 @@ +//** + Change the box model for Mozilla, Webkit, IE8 and the future + @param !bs + [ content-box | border-box ] +=box-sizing(!bs) + /* Mozilla (FireFox, Camino) + -moz-box-sizing= !bs + /* Webkit (Safari, Chrome) + -webkit-box-sizing= !bs + /* IE (8) + -ms-box-sizing= !bs + /* CSS3 + box-sizing= !bs \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass new file mode 100644 index 00000000..31b22734 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass @@ -0,0 +1,37 @@ +//** + CSS3 columns for Mozilla, Webkit and the Future + +=column-count(!n) + :-moz-column-count= !n + :-webkit-column-count= !n + :column-count= !n + +=column-gap(!u) + :-moz-column-gap= !u + :-webkit-column-gap= !u + :column-gap= !u + +=column-width(!u) + :-moz-column-width= !u + :-webkit-column-width= !u + :column-width= !u + +=column-rule-width(!w) + :-moz-column-rule-width= !w + :-webkit-column-rule-width= !w + :column-rule-width= !w + +=column-rule-style(!s) + :-moz-column-rule-style= !s + :-webkit-column-rule-style= !s + :column-rule-style= !s + +=column-rule-color(!c) + :-moz-column-rule-color= !c + :-webkit-column-rule-color= !c + :column-rule-color= !c + +=column-rule(!w, !s = "solid", !c = " ") + +column-rule-width(!w) + +column-rule-style(!s) + +column-rule-color(!c) \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass b/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass index 94cd1357..4f9b3e15 100644 --- a/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass +++ b/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass @@ -1,6 +1,7 @@ -=inline-block - :zoom 1 - :display inline +=inline-block :display -moz-inline-box + :-moz-box-orient vertical :display inline-block - :vertical-align top + :vertical-align middle + :#display inline + :#vertical-align auto From d7636bae4d0234115ae518a64e4876cc2ad96e96 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 24 Jul 2009 09:03:37 -0700 Subject: [PATCH 013/118] [Compass Core] Use the elements_of_type() helper function to enumerate the elements of a particular display type. No functional change. --- .../compass/stylesheets/compass/utilities/_print.sass | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/utilities/_print.sass b/frameworks/compass/stylesheets/compass/utilities/_print.sass index fc1caf4d..71a82336 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_print.sass +++ b/frameworks/compass/stylesheets/compass/utilities/_print.sass @@ -7,16 +7,10 @@ .noprint, .no-print :display none - address, blockquote, center, dir, div, dd, dl, dt, - fieldset, form, frameset, h1, h2, h3, h4, h5, h6, hr, - isindex, li, menu, noframes, noscript, ol, p, pre, - table, tbody, td, tfoot, th, thead, tr, ul + #{elements_of_type("block")} &.print-only :display block - a, abbr, acronym, b, basefont, bdo, big, br, cite, - code, dfn, em, font, i, img, input, kbd, label, q, s, - samp, select, small, span, strike, strong, sub, sup, - textarea, tt, u, var + #{elements_of_type("inline")} &.print-only :display inline @else From 3681187e6c78c804892a017acd94d39bee9b51d9 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 3 Aug 2009 09:29:13 -0700 Subject: [PATCH 014/118] Just do a simple require for sass, haml-edge will have to be loaded by the user explicitly if they want that. Fall back to loading rubygems to load sass if it cannot be loaded. --- lib/compass/dependencies.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/compass/dependencies.rb b/lib/compass/dependencies.rb index 81eed158..dbc9c43d 100644 --- a/lib/compass/dependencies.rb +++ b/lib/compass/dependencies.rb @@ -1,10 +1,8 @@ unless defined?(Sass) - require 'rubygems' begin - gem 'haml-edge', '>= 2.3.0' - $stderr.puts "Loading haml-edge gem." - rescue Exception - #pass + require 'sass' + rescue LoadError + require 'rubygems' + require 'sass' end - require 'sass' end \ No newline at end of file From 4ffa08cc429056b68223b437f09ff6c624b3410e Mon Sep 17 00:00:00 2001 From: Jacques Crocker Date: Tue, 7 Jul 2009 22:47:27 -0700 Subject: [PATCH 015/118] Fixing Merb Integration (use Merb::Plugins.config instead of Merb::Config) --- Rakefile | 2 + lib/compass/app_integration/merb.rb | 73 +++++++++++++++++------------ 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/Rakefile b/Rakefile index ac940261..4f080678 100644 --- a/Rakefile +++ b/Rakefile @@ -89,6 +89,8 @@ end task :release => :commit_revision +task :gem => :build + desc "Compile Examples into HTML and CSS" task :examples do linked_haml = "tests/haml" diff --git a/lib/compass/app_integration/merb.rb b/lib/compass/app_integration/merb.rb index b8ff84b0..26cedfe5 100644 --- a/lib/compass/app_integration/merb.rb +++ b/lib/compass/app_integration/merb.rb @@ -1,43 +1,58 @@ # To configure Merb to use compass do the following: -# Merb::BootLoader.after_app_loads do -# require 'merb-haml' -# require 'compass' -# end -# +# +# Add dependencies to config/dependencies.rb +# +# dependency "haml", ">=2.2.0" +# dependency "merb-haml", merb_gems_version +# dependency "chriseppstein-compass", :require_as => 'compass' +# +# # To use a different sass stylesheets locations as is recommended by compass # add this configuration to your configuration block: # -# Merb::Config.use do |c| -# c[:compass] = { -# :stylesheets => 'app/stylesheets', -# :compiled_stylesheets => 'public/stylesheets/compiled' +# Merb::BootLoader.before_app_loads do +# Merb::Plugins.config[:compass] = { +# :stylesheets => "app/stylesheets", +# :compiled_stylesheets => "public/stylesheets/compiled" # } # end +# + +module Compass + def self.setup_template_location + # default the compass configuration if they didn't set it up yet. + Merb::Plugins.config[:compass] ||= {} + + # default sass stylesheet location unless configured to something else + Merb::Plugins.config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass" + + # default sass css location unless configured to something else + Merb::Plugins.config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet) + + #define the template hash for the project stylesheets as well as the framework stylesheets. + template_location = { + Merb::Plugins.config[:compass][:stylesheets] => Merb::Plugins.config[:compass][:compiled_stylesheets] + } + Compass::Frameworks::ALL.each do |framework| + template_location[framework.stylesheets_directory] = Merb::Plugins.config[:compass][:compiled_stylesheets] + end + + #configure Sass to know about all these sass locations. + Sass::Plugin.options[:template_location] = template_location + end +end Merb::BootLoader.after_app_loads do #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location. unless defined?(Sass::Plugin) require "sass/plugin" - Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass] + if Merb::Plugins.config[:sass] + Sass::Plugin.options = Merb::Plugins.config[:sass] + # support old (deprecatd Merb::Config[:sass] option) + elsif Merb::Config[:sass] + Sass::Plugin.options = Merb::Config[:sass] + end end - # default the compass configuration if they didn't set it up yet. - Merb::Config[:compass] ||= {} - - # default sass stylesheet location unless configured to something else - Merb::Config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass" - - # default sass css location unless configured to something else - Merb::Config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet) - - #define the template hash for the project stylesheets as well as the framework stylesheets. - template_location = { - Merb::Config[:compass][:stylesheets] => Merb::Config[:compass][:compiled_stylesheets] - } - Compass::Frameworks::ALL.each do |framework| - template_location[framework.stylesheets_directory] = Merb::Config[:compass][:compiled_stylesheets] - end - - #configure Sass to know about all these sass locations. - Sass::Plugin.options[:template_location] = template_location + Compass.setup_template_location end From 73158b4c3e490e90fd377559b7280652c2ff7cc4 Mon Sep 17 00:00:00 2001 From: Jacques Crocker Date: Wed, 29 Jul 2009 02:45:35 -0700 Subject: [PATCH 016/118] #36 Retain existing Merb::Plugins.config[:sass][:template_location] settings when setting Sass::Plugin.options[:template_location] with Compass defined paths --- lib/compass/app_integration/merb.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/compass/app_integration/merb.rb b/lib/compass/app_integration/merb.rb index 26cedfe5..90b9f826 100644 --- a/lib/compass/app_integration/merb.rb +++ b/lib/compass/app_integration/merb.rb @@ -37,6 +37,12 @@ module Compass template_location[framework.stylesheets_directory] = Merb::Plugins.config[:compass][:compiled_stylesheets] end + # merge existing template locations if present + if Merb::Plugins.config[:sass][:template_location].is_a?(Hash) + template_location.merge!(Merb::Plugins.config[:sass][:template_location]) + Merb::Plugins.config[:sass][:template_location] = template_location + end + #configure Sass to know about all these sass locations. Sass::Plugin.options[:template_location] = template_location end From f8834532ceaa5bc584224c6ac702d788fdee8b11 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 3 Aug 2009 09:52:06 -0700 Subject: [PATCH 017/118] Added missing class in the semantic blueprint example. --- examples/blueprint_semantic/parts/fancy_type.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/blueprint_semantic/parts/fancy_type.html.haml b/examples/blueprint_semantic/parts/fancy_type.html.haml index 8aabaca2..6265521c 100644 --- a/examples/blueprint_semantic/parts/fancy_type.html.haml +++ b/examples/blueprint_semantic/parts/fancy_type.html.haml @@ -37,7 +37,7 @@ %hr.space #main %p - %img#test{ :src => "test.jpg", :alt => "test" } + %img#test.left{ :src => "test.jpg", :alt => "test" } Lorem ipsum dolor sit amet, %em consectetuer adipiscing elit From 1a9156c01046fc68b02ba7fab4422a40cc13605d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 9 Aug 2009 21:33:48 -0700 Subject: [PATCH 018/118] [Extensions] Compass extensions can now deliver html into a compass project which can be authored in haml if they prefer. --- .../templates/project/welcome.html.haml | 12 ++++++++++++ lib/compass/installers/base.rb | 19 +++++++++++++++++++ lib/compass/installers/manifest.rb | 1 + lib/compass/installers/rails.rb | 4 ++++ 4 files changed, 36 insertions(+) create mode 100644 frameworks/blueprint/templates/project/welcome.html.haml diff --git a/frameworks/blueprint/templates/project/welcome.html.haml b/frameworks/blueprint/templates/project/welcome.html.haml new file mode 100644 index 00000000..ed7c989d --- /dev/null +++ b/frameworks/blueprint/templates/project/welcome.html.haml @@ -0,0 +1,12 @@ +!!! Transition +/ Feel free to delete this, it's just here to act as an example +%html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en") + %head + %title Welcome to Compass & Blueprint + %link(rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen, projection") + %link(href="stylesheets/print.css" media="print" rel="stylesheet" type="text/css") + /[if lt IE 8] + %link(href="stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css") + %body#welcome.bp + #container + %h1 Welcome to Compass! \ No newline at end of file diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index fb1e26c3..eab60e54 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -125,6 +125,25 @@ module Compass "#{pattern_name_as_dir}#{to}" end + installer :html do |to| + "#{pattern_name_as_dir}#{to}" + end + + alias install_html_without_haml install_html + def install_html(from, to, options) + if to =~ /\.haml$/ + require 'haml' + html = Haml::Engine.new(File.read(templatize(from)), :filename => templatize(from)).render + to = to[0..-(".haml".length+1)] + if respond_to?(:install_location_for_html) + to = install_location_for_html(to, options) + end + write_file(targetize(to), html, options) + else + install_html_without_haml(from, to, options) + end + end + # returns an absolute path given a path relative to the current installation target. # Paths can use unix style "/" and will be corrected for the current platform. def targetize(path) diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index bd5d9a34..7c780f40 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -34,6 +34,7 @@ module Compass type :image type :javascript type :file + type :html # Enumerates over the manifest files def each diff --git a/lib/compass/installers/rails.rb b/lib/compass/installers/rails.rb index 9f2a3e36..f2b7df40 100644 --- a/lib/compass/installers/rails.rb +++ b/lib/compass/installers/rails.rb @@ -65,6 +65,10 @@ NEXTSTEPS "/stylesheets" end + def install_location_for_html(to, options) + separate("public/#{pattern_name_as_dir}#{to}") + end + def prompt_sass_dir recommended_location = separate('app/stylesheets') default_location = separate('public/stylesheets/sass') From f27e184c7fd8000c108dbaa828b2982835f3208c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 12 Aug 2009 17:46:48 -0700 Subject: [PATCH 019/118] [Core] The compass configuration class is no longer a singleton. This allows other projects to manage multiple compass projects by creating multiple configurations within the same ruby process. --- lib/compass/configuration.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index ae4f5b95..bf12d98f 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -2,7 +2,6 @@ require 'singleton' module Compass class Configuration - include Singleton ATTRIBUTES = [ :project_type, @@ -295,10 +294,11 @@ module Compass module ConfigHelpers def configuration + @configuration ||= Configuration.new if block_given? - yield Configuration.instance + yield @configuration end - Configuration.instance + @configuration end def sass_plugin_configuration From c9454190e7bf97bb4d4a4e77d33498d683b0ca28 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 16 Aug 2009 16:55:04 -0700 Subject: [PATCH 020/118] [Compass Core] Fixed the append_selector function to allow comma-delimited selectors for both arguments instead of just the first. --- TODO.md | 2 ++ lib/compass/installers/template_context.rb | 22 +++++++++++++++++++ .../sass_extensions/functions/selectors.rb | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 TODO.md create mode 100644 lib/compass/installers/template_context.rb diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..82cc0ff1 --- /dev/null +++ b/TODO.md @@ -0,0 +1,2 @@ +* vendored plugins should override default plugins. + diff --git a/lib/compass/installers/template_context.rb b/lib/compass/installers/template_context.rb new file mode 100644 index 00000000..a86d9142 --- /dev/null +++ b/lib/compass/installers/template_context.rb @@ -0,0 +1,22 @@ +module Compass + module Installers + class TemplateContext + def self.ctx(*arguments) + new(*arguments).get_binding + end + def initialize(locals = {}) + @locals = locals + end + def get_binding + @locals.each do |k, v| + eval("#{k} = v") + end + binding + end + def config + Compass.configuration + end + alias configuration config + end + end +end \ No newline at end of file diff --git a/lib/compass/sass_extensions/functions/selectors.rb b/lib/compass/sass_extensions/functions/selectors.rb index fecaab73..34de7508 100644 --- a/lib/compass/sass_extensions/functions/selectors.rb +++ b/lib/compass/sass_extensions/functions/selectors.rb @@ -33,7 +33,10 @@ module Compass::SassExtensions::Functions::Selectors # #{append_selector(!selector, !to_append)} # width: 2px def append_selector(selector, to_append) - Sass::Script::String.new(selector.value.split(COMMA_SEPARATOR).map{|s| "#{s}#{to_append}"}.join(", ")) + ancestors = selector.value.split(COMMA_SEPARATOR) + descendants = to_append.value.split(COMMA_SEPARATOR) + nested = ancestors.map{|a| descendants.map{|d| "#{a}#{d}"}.join(", ")}.join(", ") + Sass::Script::String.new(nested) end end \ No newline at end of file From b7ba05f7c1c018ff318888eaea1cf7d21216c48c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 16 Aug 2009 18:12:59 -0700 Subject: [PATCH 021/118] [Extensions] Compass extensions can now process the content they deliver through ERB. --- lib/compass/actions.rb | 6 ++++ lib/compass/installers/base.rb | 7 ++++- lib/compass/installers/template_context.rb | 34 ++++++++++++++++++---- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/compass/actions.rb b/lib/compass/actions.rb index 3959f7a2..0c7c2cae 100644 --- a/lib/compass/actions.rb +++ b/lib/compass/actions.rb @@ -32,6 +32,7 @@ module Compass def write_file(file_name, contents, options = nil, binary = false) options ||= self.options if self.respond_to?(:options) skip_write = options[:dry_run] + contents = process_erb(contents, options[:erb]) if options[:erb] if File.exists?(file_name) existing_contents = IO.read(file_name) if existing_contents == contents @@ -57,6 +58,11 @@ module Compass end end + def process_erb(contents, ctx = nil) + ctx = Object.new.instance_eval("binding") unless ctx.is_a? Binding + ERB.new(contents).result(ctx) + end + # Compile one Sass file def compile(sass_filename, css_filename, options) if options[:force] || Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename) diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index eab60e54..6d9b6295 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -133,11 +133,16 @@ module Compass def install_html(from, to, options) if to =~ /\.haml$/ require 'haml' - html = Haml::Engine.new(File.read(templatize(from)), :filename => templatize(from)).render to = to[0..-(".haml".length+1)] if respond_to?(:install_location_for_html) to = install_location_for_html(to, options) end + contents = File.read(templatize(from)) + if options.delete(:erb) + ctx = TemplateContext.ctx(:to => to, :options => options) + contents = process_erb(contents, ctx) + end + html = Haml::Engine.new(contents, :filename => templatize(from)).render write_file(targetize(to), html, options) else install_html_without_haml(from, to, options) diff --git a/lib/compass/installers/template_context.rb b/lib/compass/installers/template_context.rb index a86d9142..4df933fa 100644 --- a/lib/compass/installers/template_context.rb +++ b/lib/compass/installers/template_context.rb @@ -1,22 +1,44 @@ module Compass module Installers class TemplateContext + def self.ctx(*arguments) - new(*arguments).get_binding + new(*arguments).send(:get_binding) end - def initialize(locals = {}) + + def initialize(template, locals = {}) + @template = template @locals = locals end + + def http_stylesheets_path + config.http_stylesheets_path || + config.default_for(:http_stylesheets_path) || + config.http_root_relative(config.css_dir) + end + + Compass::Configuration::ATTRIBUTES.each do |attribute| + unless instance_methods.include?(attribute.to_s) + define_method attribute do + config.send(attribute) || config.default_for(attribute) + end + end + end + + def config + Compass.configuration + end + + alias configuration config + + protected + def get_binding @locals.each do |k, v| eval("#{k} = v") end binding end - def config - Compass.configuration - end - alias configuration config end end end \ No newline at end of file From 1450f39d8cbd8e7f830d72fa644b07ed0de86340 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 16 Aug 2009 18:14:08 -0700 Subject: [PATCH 022/118] Renamed the configuration helper method root_relative to http_root_relative for consistency. --- lib/compass/configuration.rb | 2 +- lib/compass/sass_extensions/functions/urls.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index bf12d98f..eaa5b8a4 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -143,7 +143,7 @@ module Compass end end - def root_relative(path) + def http_root_relative(path) hp = http_path || default_http_path hp = hp[0..-2] if hp[-1..-1] == "/" "#{hp}/#{path}" diff --git a/lib/compass/sass_extensions/functions/urls.rb b/lib/compass/sass_extensions/functions/urls.rb index 06103623..d37e8044 100644 --- a/lib/compass/sass_extensions/functions/urls.rb +++ b/lib/compass/sass_extensions/functions/urls.rb @@ -8,7 +8,7 @@ module Compass::SassExtensions::Functions::Urls elsif Compass.configuration.http_stylesheets_path Compass.configuration.http_stylesheets_path else - Compass.configuration.root_relative(Compass.configuration.css_dir) + Compass.configuration.http_root_relative(Compass.configuration.css_dir) end url("#{http_stylesheets_path}/#{path}") @@ -28,7 +28,7 @@ module Compass::SassExtensions::Functions::Urls elsif Compass.configuration.http_images_path Compass.configuration.http_images_path else - Compass.configuration.root_relative(Compass.configuration.images_dir) + Compass.configuration.http_root_relative(Compass.configuration.images_dir) end # Compute the real path to the image on the file stystem if the images_dir is set. From ac264606c8f4912df11571fc390c9ef664698275 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 16 Aug 2009 18:15:23 -0700 Subject: [PATCH 023/118] DRY up the loading of the installer modules. --- lib/compass/installers.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/compass/installers.rb b/lib/compass/installers.rb index a92f1a3f..dbb2be41 100644 --- a/lib/compass/installers.rb +++ b/lib/compass/installers.rb @@ -1,5 +1,3 @@ -require File.join(File.dirname(__FILE__), 'installers', 'manifest') -require File.join(File.dirname(__FILE__), 'installers', 'base') -require File.join(File.dirname(__FILE__), 'installers', 'stand_alone') -require File.join(File.dirname(__FILE__), 'installers', 'rails') - +%w(manifest template_context base stand_alone rails).each do |f| + require File.join(File.dirname(__FILE__), 'installers', f) +end From 2cfc9ef1f9622bfaf0e4535157c186e77a84fcec Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 16 Aug 2009 18:24:16 -0700 Subject: [PATCH 024/118] [Blueprint] Make a welcome page for blueprint that works with the stylesheets to provide a complete working example. --- frameworks/blueprint/templates/project/manifest.rb | 2 ++ frameworks/blueprint/templates/project/screen.sass | 7 +++++++ frameworks/blueprint/templates/project/welcome.html.haml | 9 +++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frameworks/blueprint/templates/project/manifest.rb b/frameworks/blueprint/templates/project/manifest.rb index 853b59b7..fa700632 100644 --- a/frameworks/blueprint/templates/project/manifest.rb +++ b/frameworks/blueprint/templates/project/manifest.rb @@ -4,3 +4,5 @@ stylesheet 'print.sass', :media => 'print' stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8" image 'grid.png' + +html 'welcome.html.haml', :erb => true diff --git a/frameworks/blueprint/templates/project/screen.sass b/frameworks/blueprint/templates/project/screen.sass index d3d9be68..87b36a52 100644 --- a/frameworks/blueprint/templates/project/screen.sass +++ b/frameworks/blueprint/templates/project/screen.sass @@ -38,3 +38,10 @@ body.three-col !content_columns = ceil(2 * !blueprint_grid_columns / 3) // true means it's the last column in the row +column(!content_columns, true) + +// This is just here to style the welcome page, please delete it. +body#welcome + #container + +container + h1 + +column(24) \ No newline at end of file diff --git a/frameworks/blueprint/templates/project/welcome.html.haml b/frameworks/blueprint/templates/project/welcome.html.haml index ed7c989d..460eac03 100644 --- a/frameworks/blueprint/templates/project/welcome.html.haml +++ b/frameworks/blueprint/templates/project/welcome.html.haml @@ -3,10 +3,11 @@ %html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en") %head %title Welcome to Compass & Blueprint - %link(rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen, projection") - %link(href="stylesheets/print.css" media="print" rel="stylesheet" type="text/css") + %link(rel="stylesheet" href="<%= http_stylesheets_path %>/screen.css" type="text/css" media="screen, projection") + %link(href="<%= http_stylesheets_path %>/print.css" media="print" rel="stylesheet" type="text/css") /[if lt IE 8] - %link(href="stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css") + %link(href="<%= http_stylesheets_path %>/ie.css" media="screen, projection" rel="stylesheet" type="text/css") %body#welcome.bp #container - %h1 Welcome to Compass! \ No newline at end of file + %h1 Welcome to Compass! + %p This is <%= "ERB" %> \ No newline at end of file From f59ca512ce56c222bb37e93a5985e9f6f56f9015 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 25 Aug 2009 14:18:58 -0700 Subject: [PATCH 025/118] Refactor of the internal datastructures used to access project configuration. Configuration is now a singly linked list of configuration objects that inherit values and defaults from the next configuration instance. All instances hold a reference to the top of the configuration chain. There is now a consistent API for reading configuration property values: : Reads the fully-resolved attribute after taking configuration inheritance and defaults into account. raw_: reads attribute from a configuration object without inheritance or defaults. default_for(): reads the default value for an attribute default_for_: specifies the default value for an attribute. _without_default: reads the inherited attribute without applying defaults. comment_for_: Specifies a comment that will be emitted above the property when serializing the configuration to a file. Additionally, method_missing and respond_to both work down the configuration chain, so any method that is added to a configuration instance, can be accessed from the top level. The distinction between default and explicitly set values allows compass to more correctly manage the serialization of attributes when creating configuration files for projects. The compass configuration can still be accessed via Compass.configuration, however, the configuration object is no longer a singleton. This means that you can build several configuration chains to track several projects at once. This should ease the use of compass in other frameworks and plugins that want to use compass internally. --- lib/compass/app_integration/stand_alone.rb | 0 .../stand_alone/configuration.rb | 0 lib/compass/commands/installer_command.rb | 6 +- lib/compass/commands/project_base.rb | 6 +- lib/compass/configuration.rb | 326 +----------------- lib/compass/configuration/adapters.rb | 59 ++++ lib/compass/configuration/comments.rb | 22 ++ lib/compass/configuration/data.rb | 103 ++++++ lib/compass/configuration/defaults.rb | 92 +++++ lib/compass/configuration/helpers.rb | 61 ++++ lib/compass/configuration/inheritance.rb | 170 +++++++++ lib/compass/configuration/serialization.rb | 82 +++++ lib/compass/installers/base.rb | 6 +- lib/compass/installers/rails.rb | 61 ++-- lib/compass/installers/stand_alone.rb | 27 +- test/command_line_helper.rb | 8 - test/command_line_test.rb | 3 +- test/compass_test.rb | 4 +- test/configuration_test.rb | 52 +-- test/io_helper.rb | 19 + test/rails_integration_test.rb | 3 +- test/test_helper.rb | 1 + 22 files changed, 732 insertions(+), 379 deletions(-) create mode 100644 lib/compass/app_integration/stand_alone.rb create mode 100644 lib/compass/app_integration/stand_alone/configuration.rb create mode 100644 lib/compass/configuration/adapters.rb create mode 100644 lib/compass/configuration/comments.rb create mode 100644 lib/compass/configuration/data.rb create mode 100644 lib/compass/configuration/defaults.rb create mode 100644 lib/compass/configuration/helpers.rb create mode 100644 lib/compass/configuration/inheritance.rb create mode 100644 lib/compass/configuration/serialization.rb create mode 100644 test/io_helper.rb diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb new file mode 100644 index 00000000..e69de29b diff --git a/lib/compass/app_integration/stand_alone/configuration.rb b/lib/compass/app_integration/stand_alone/configuration.rb new file mode 100644 index 00000000..e69de29b diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index b59d451b..8d3c2441 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -6,10 +6,10 @@ module Compass include Compass::Installers def configure! + Compass.add_configuration(installer.default_configuration) read_project_configuration - Compass.configuration.set_maybe(options) - Compass.configuration.default_all(installer.configuration_defaults) - Compass.configuration.set_defaults! + Compass.add_configuration(options) + Compass.add_configuration(installer.completed_configuration) end def installer diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index dc082eeb..0065721a 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -23,8 +23,6 @@ module Compass def configure! read_project_configuration - Compass.configuration.set_maybe(options) - Compass.configuration.set_defaults! end def projectize(path) @@ -49,8 +47,8 @@ module Compass # Read the configuration file for this project def read_project_configuration - if file = detect_configuration_file - Compass.configuration.parse(file) if File.readable?(file) + if (file = detect_configuration_file) && File.readable?(file) + Compass.add_configuration(file) end end diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index eaa5b8a4..a495a1fa 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -1,324 +1,36 @@ -require 'singleton' - module Compass - class Configuration + module Configuration ATTRIBUTES = [ :project_type, :project_path, - :http_path, :css_dir, :sass_dir, :images_dir, :javascripts_dir, - :output_style, - :environment, - :relative_assets, + :css_path, + :sass_path, + :images_path, + :javascripts_path, + :http_path, + :http_images_dir, + :http_stylesheets_dir, + :http_javascripts_dir, :http_images_path, :http_stylesheets_path, :http_javascripts_path, + :output_style, + :environment, + :relative_assets, :additional_import_paths, - :sass_options + :sass_options, + :asset_host, + :asset_cache_buster ] - attr_accessor *ATTRIBUTES - - attr_accessor :required_libraries - - def initialize - self.required_libraries = [] - end - - # parses a manifest file which is a ruby script - # evaluated in a Manifest instance context - def parse(config_file) - open(config_file) do |f| - parse_string(f.read, config_file) - end - end - - def parse_string(contents, filename) - bind = binding - eval(contents, bind, filename) - ATTRIBUTES.each do |prop| - value = eval(prop.to_s, bind) rescue nil - self.send("#{prop}=", value) if value - end - if @added_import_paths - self.additional_import_paths ||= [] - self.additional_import_paths += @added_import_paths - end - issue_deprecation_warnings - end - - def set_all(options) - ATTRIBUTES.each do |a| - self.send("#{a}=", options[a]) if options.has_key?(a) - end - end - - def set_maybe(options) - ATTRIBUTES.each do |a| - self.send("#{a}=", options[a]) if options[a] - end - end - - def default_all(options) - ATTRIBUTES.each do |a| - set_default_unless_set(a, options[a]) - end - end - - def set_default_unless_set(attribute, value) - self.send("#{attribute}=", value) unless self.send(attribute) - end - - def set_defaults! - ATTRIBUTES.each do |a| - set_default_unless_set(a, default_for(a)) - end - end - - def default_for(attribute) - method = "default_#{attribute}".to_sym - self.send(method) if respond_to?(method) - end - - def default_sass_dir - "src" - end - - def default_css_dir - "stylesheets" - end - - def default_images_dir - "images" - end - - def default_http_path - "/" - end - - def comment_for_http_path - "# Set this to the root of your project when deployed:\n" - end - - def relative_assets? - # the http_images_path is deprecated, but here for backwards compatibility. - relative_assets || http_images_path == :relative - end - - def comment_for_relative_assets - unless relative_assets - %q{# To enable relative paths to assets via compass helper functions. Uncomment: -# relative_assets = true -} - else - "" - end - end - - def default_output_style - if environment == :development - :expanded - else - :compact - end - end - - def default_line_comments - environment == :development - end - - def sass_path - if project_path && sass_dir - File.join(project_path, sass_dir) - end - end - - def css_path - if project_path && css_dir - File.join(project_path, css_dir) - end - end - - def http_root_relative(path) - hp = http_path || default_http_path - hp = hp[0..-2] if hp[-1..-1] == "/" - "#{hp}/#{path}" - end - - def add_import_path(*paths) - # The @added_import_paths variable works around an issue where - # the additional_import_paths gets overwritten during parse - @added_import_paths ||= [] - @added_import_paths += paths - self.additional_import_paths ||= [] - self.additional_import_paths += paths - end - - # When called with a block, defines the asset host url to be used. - # The block must return a string that starts with a protocol (E.g. http). - # The block will be passed the root-relative url of the asset. - # When called without a block, returns the block that was previously set. - def asset_host(&block) - if block_given? - @asset_host = block - else - @asset_host - end - end - - # When called with a block, defines the cache buster strategy to be used. - # The block must return nil or a string that can be appended to a url as a query parameter. - # The returned string must not include the starting '?'. - # The block will be passed the root-relative url of the asset. - # If the block accepts two arguments, it will also be passed a File object - # that points to the asset on disk -- which may or may not exist. - # When called without a block, returns the block that was previously set. - def asset_cache_buster(&block) - if block_given? - @asset_cache_buster = block - else - @asset_cache_buster - end - end - - - def serialize - if asset_cache_buster - raise Compass::Error, "Cannot serialize a configuration with asset_cache_buster set." - end - if asset_host - raise Compass::Error, "Cannot serialize a configuration with asset_host set." - end - contents = "" - required_libraries.each do |lib| - contents << %Q{require '#{lib}'\n} - end - contents << "# Require any additional compass plugins here.\n" - contents << "\n" if required_libraries.any? - ATTRIBUTES.each do |prop| - value = send(prop) - if respond_to?("comment_for_#{prop}") - contents << send("comment_for_#{prop}") - end - if block_given? && (to_emit = yield(prop, value)) - contents << to_emit - else - contents << Configuration.serialize_property(prop, value) unless value.nil? - end - end - contents - end - - def self.serialize_property(prop, value) - %Q(#{prop} = #{value.inspect}\n) - end - - def to_compiler_arguments(additional_options) - [project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)] - end - - def to_sass_plugin_options - locations = {} - locations[sass_path] = css_path if sass_path && css_path - Compass::Frameworks::ALL.each do |framework| - locations[framework.stylesheets_directory] = css_path || css_dir || "." - end - resolve_additional_import_paths.each do |additional_path| - locations[additional_path] = File.join(css_path || css_dir || ".", File.basename(additional_path)) - end - plugin_opts = {:template_location => locations} - plugin_opts[:style] = output_style if output_style - plugin_opts[:line_comments] = default_line_comments if environment - plugin_opts.merge!(sass_options || {}) - plugin_opts - end - - def resolve_additional_import_paths - (additional_import_paths || []).map do |path| - if project_path && !absolute_path?(path) - File.join(project_path, path) - else - path - end - end - end - - def to_sass_engine_options - engine_opts = {:load_paths => sass_load_paths} - engine_opts[:style] = output_style if output_style - engine_opts[:line_comments] = default_line_comments if environment - engine_opts.merge!(sass_options || {}) - end - - def sass_load_paths - load_paths = [] - load_paths << sass_path if sass_path - Compass::Frameworks::ALL.each do |framework| - load_paths << framework.stylesheets_directory - end - load_paths += resolve_additional_import_paths - load_paths - end - - # Support for testing. - def reset! - ATTRIBUTES.each do |attr| - send("#{attr}=", nil) - end - @asset_cache_buster = nil - @asset_host = nil - @added_import_paths = nil - self.required_libraries = [] - end - - def issue_deprecation_warnings - if http_images_path == :relative - puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths." - end - end - - def require(lib) - required_libraries << lib - super - end - - def absolute_path?(path) - # This is only going to work on unix, gonna need a better implementation. - path.index(File::SEPARATOR) == 0 - end end - - module ConfigHelpers - def configuration - @configuration ||= Configuration.new - if block_given? - yield @configuration - end - @configuration - end - - def sass_plugin_configuration - configuration.to_sass_plugin_options - end - - def configure_sass_plugin! - @sass_plugin_configured = true - Sass::Plugin.options.merge!(sass_plugin_configuration) - end - - def sass_plugin_configured? - @sass_plugin_configured - end - - def sass_engine_options - configuration.to_sass_engine_options - end - end - - extend ConfigHelpers - +end + +['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'data'].each do |lib| + require File.join(File.dirname(__FILE__), 'configuration', lib) end diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb new file mode 100644 index 00000000..e2dbf7d1 --- /dev/null +++ b/lib/compass/configuration/adapters.rb @@ -0,0 +1,59 @@ +module Compass + module Configuration + # The adapters module provides methods that make configuration data from a compass project + # adapt to various consumers of configuration data + module Adapters + def to_compiler_arguments(additional_options) + [project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)] + end + + def to_sass_plugin_options + locations = {} + locations[sass_path] = css_path if sass_path && css_path + Compass::Frameworks::ALL.each do |framework| + locations[framework.stylesheets_directory] = css_path || css_dir || "." + end + resolve_additional_import_paths.each do |additional_path| + locations[additional_path] = File.join(css_path || css_dir || ".", File.basename(additional_path)) + end + plugin_opts = {:template_location => locations} + plugin_opts[:style] = output_style if output_style + plugin_opts[:line_comments] = line_comments if environment + plugin_opts.merge!(sass_options || {}) + plugin_opts + end + + def resolve_additional_import_paths + (additional_import_paths || []).map do |path| + if project_path && !absolute_path?(path) + File.join(project_path, path) + else + path + end + end + end + + def absolute_path?(path) + # This is only going to work on unix, gonna need a better implementation. + path.index(File::SEPARATOR) == 0 + end + + def to_sass_engine_options + engine_opts = {:load_paths => sass_load_paths} + engine_opts[:style] = output_style if output_style + engine_opts[:line_comments] = line_comments if environment + engine_opts.merge!(sass_options || {}) + end + + def sass_load_paths + load_paths = [] + load_paths << sass_path if sass_path + Compass::Frameworks::ALL.each do |framework| + load_paths << framework.stylesheets_directory + end + load_paths += resolve_additional_import_paths + load_paths + end + end + end +end diff --git a/lib/compass/configuration/comments.rb b/lib/compass/configuration/comments.rb new file mode 100644 index 00000000..b62f6a92 --- /dev/null +++ b/lib/compass/configuration/comments.rb @@ -0,0 +1,22 @@ +module Compass + module Configuration + # Comments are emitted into the configuration file when serialized and make it easier to understand for new users. + module Comments + + def comment_for_http_path + "# Set this to the root of your project when deployed:\n" + end + + def comment_for_relative_assets + unless relative_assets + %q{# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true +} + else + "" + end + end + + end + end +end diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb new file mode 100644 index 00000000..755ccfd1 --- /dev/null +++ b/lib/compass/configuration/data.rb @@ -0,0 +1,103 @@ +module Compass + module Configuration + # The Compass configuration data storage class manages configuration data that comes from a variety of + # different sources and aggregates them together into a consistent API + # Some of the possible sources of configuration data: + # * Compass default project structure for stand alone projects + # * App framework specific project structures for rails, etc. + # * User supplied explicit configuration + # * Configuration data provided via the command line interface + # + # There are two kinds of configuration data that doesn't come from the user: + # + # 1. Configuration data that is defaulted as if the user had provided it themselves. + # This is useful for providing defaults that the user is likely to want to edit + # but shouldn't have to provide explicitly when getting started + # 2. Configuration data that is defaulted behind the scenes because _some_ value is + # required. + class Data + + attr_accessor :required_libraries + + include Compass::Configuration::Inheritance + include Compass::Configuration::Serialization + include Compass::Configuration::Adapters + + inherited_accessor *ATTRIBUTES + + def initialize(attr_hash = nil) + self.required_libraries = [] + set_all(attr_hash) if attr_hash + self.top_level = self + end + + def set_all(attr_hash) + # assert_valid_keys!(attr_hash) + attr_hash.each do |a, v| + if self.respond_to?("#{a}=") + self.send("#{a}=", v) + end + end + end + + def add_import_path(*paths) + # The @added_import_paths variable works around an issue where + # the additional_import_paths gets overwritten during parse + @added_import_paths ||= [] + @added_import_paths += paths + self.additional_import_paths ||= [] + self.additional_import_paths += paths + end + + # When called with a block, defines the asset host url to be used. + # The block must return a string that starts with a protocol (E.g. http). + # The block will be passed the root-relative url of the asset. + # When called without a block, returns the block that was previously set. + def asset_host(&block) + if block_given? + @asset_host = block + else + @asset_host + end + end + + # When called with a block, defines the cache buster strategy to be used. + # The block must return nil or a string that can be appended to a url as a query parameter. + # The returned string must not include the starting '?'. + # The block will be passed the root-relative url of the asset. + # If the block accepts two arguments, it will also be passed a File object + # that points to the asset on disk -- which may or may not exist. + # When called without a block, returns the block that was previously set. + def asset_cache_buster(&block) + if block_given? + @asset_cache_buster = block + else + @asset_cache_buster + end + end + + # Require a compass plugin and capture that it occured so that the configuration serialization works next time. + def require(lib) + required_libraries << lib + super + end + + def relative_assets? + # the http_images_path is deprecated, but here for backwards compatibility. + relative_assets || http_images_path == :relative + end + + private + + def assert_valid_keys!(attr_hash) + illegal_attrs = attr_hash.keys - ATTRIBUTES + if illegal_attrs.size == 1 + raise Error, "#{illegal_attrs.first.inspect} is not a valid configuration attribute." + elsif illegal_attrs.size > 0 + raise Error, "Illegal configuration attributes: #{illegal_attrs.map{|a| a.inspect}.join(", ")}" + end + end + + end + end +end \ No newline at end of file diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb new file mode 100644 index 00000000..b646a412 --- /dev/null +++ b/lib/compass/configuration/defaults.rb @@ -0,0 +1,92 @@ +module Compass + module Configuration + module Defaults + + def http_path_without_default + "/" + end + + def default_output_style + if top_level.environment == :development + :expanded + else + :compact + end + end + + def default_line_comments + top_level.environment == :development + end + + def default_sass_path + if (pp = top_level.project_path) && (dir = top_level.sass_dir) + File.join(pp, dir) + end + end + + def default_css_path + if (pp = top_level.project_path) && (dir = top_level.css_dir) + File.join(pp, dir) + end + end + + def default_images_path + if (pp = top_level.project_path) && (dir = top_level.images_dir) + File.join(pp, dir) + end + end + + def default_javascripts_path + if (pp = top_level.project_path) && (dir = top_level.javascripts_dir) + File.join(pp, dir) + end + end + + def default_http_images_dir + top_level.images_dir + end + + def default_http_images_path + http_root_relative top_level.http_images_dir + end + + def default_http_stylesheets_dir + top_level.css_dir + end + + def default_http_stylesheets_path + http_root_relative top_level.http_stylesheets_dir + end + + def default_http_javascripts_dir + top_level.javascripts_dir + end + + def default_http_javascripts_path + http_root_relative top_level.http_javascripts_dir + end + + # helper functions + + def http_join(*segments) + segments.map do |segment| + segment = http_pathify(segment) + segment[-1..-1] == "/" ? segment[0..-2] : segment + end.join("/") + end + + def http_pathify(path) + if File::SEPARATOR == "/" + path + else + path.gsub(File::SEPARATOR, "/") + end + end + + def http_root_relative(path) + http_join top_level.http_path, path + end + + end + end +end \ No newline at end of file diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb new file mode 100644 index 00000000..ea8ad504 --- /dev/null +++ b/lib/compass/configuration/helpers.rb @@ -0,0 +1,61 @@ +module Compass + module Configuration + # The helpers are available as methods on the Compass module. E.g. Compass.configuration + module Helpers + def configuration + @configuration ||= default_configuration + if block_given? + yield @configuration + end + @configuration + end + + def default_configuration + Data.new.extend(Defaults).extend(Comments) + end + + def add_configuration(config, filename = nil) + return if config.nil? + data = if config.is_a?(Compass::Configuration::Data) + config + elsif config.respond_to?(:read) + Compass::Configuration::Data.new_from_string(config.read, filename) + elsif config.is_a?(Hash) + Compass::Configuration::Data.new(config) + elsif config.is_a?(String) + Compass::Configuration::Data.new_from_file(config) + else + raise "I don't know what to do with: #{config.inspect}" + end + data.inherit_from!(configuration) + data.on_top! + @configuration = data + end + + # Support for testing. + def reset_configuration! + @configuration = nil + end + + def sass_plugin_configuration + configuration.to_sass_plugin_options + end + + def configure_sass_plugin! + @sass_plugin_configured = true + Sass::Plugin.options.merge!(sass_plugin_configuration) + end + + def sass_plugin_configured? + @sass_plugin_configured + end + + def sass_engine_options + configuration.to_sass_engine_options + end + end + end + + extend Configuration::Helpers + +end diff --git a/lib/compass/configuration/inheritance.rb b/lib/compass/configuration/inheritance.rb new file mode 100644 index 00000000..fd030172 --- /dev/null +++ b/lib/compass/configuration/inheritance.rb @@ -0,0 +1,170 @@ +module Compass + module Configuration + # The inheritance module makes it easy for configuration data to inherit from + # other instances of configuration data. This makes it easier for external code to layer + # bits of configuration from various sources. + module Inheritance + + def self.included(base) + # inherited_data stores configuration data that this configuration object will + # inherit if not provided explicitly. + base.send :attr_accessor, :inherited_data, :set_attributes, :top_level + + base.send(:include, InstanceMethods) + base.extend(ClassMethods) + end + + module ClassMethods + def inherited_writer(*attributes) + attributes.each do |attribute| + line = __LINE__ + 1 + class_eval %Q{ + def #{attribute}=(value) # def css_dir=(value) + @set_attributes ||= {} # @set_attributes ||= {} + @set_attributes[#{attribute.inspect}] = true # @set_attributes[:css_dir] = true + @#{attribute} = value # @css_dir = value + end # end + + def unset_#{attribute}! # def unset_css_dir! + unset!(#{attribute.inspect}) # unset!(:css_dir) + end # end + + def #{attribute}_set? # def css_dir_set? + set?(#{attribute.inspect}) # set?(:css_dir) + end # end + }, __FILE__, line + end + end + + # Defines the default reader to be an inherited_reader that will look at the inherited_data for its + # value when not set. The inherited reader calls to a raw reader that acts like a normal attribute + # reader but prefixes the attribute name with "raw_". + def inherited_reader(*attributes) + attributes.each do |attribute| + line = __LINE__ + 1 + class_eval %Q{ + def raw_#{attribute} # def raw_css_dir + @#{attribute} # @css_dir + end # end + def #{attribute}_without_default # def css_dir_without_default + read_without_default(#{attribute.inspect}) # read_without_default(:css_dir) + end # end + def #{attribute} # def css_dir + read(#{attribute.inspect}) # read(:css_dir) + end # end + }, __FILE__, line + end + end + + def inherited_accessor(*attributes) + inherited_reader(*attributes) + inherited_writer(*attributes) + end + + + end + + module InstanceMethods + + def on_top! + self.set_top_level(self) + end + + def set_top_level(new_top) + self.top_level = new_top + if self.inherited_data.respond_to?(:set_top_level) + self.inherited_data.set_top_level(new_top) + end + end + + + def inherit_from!(data) + if self.inherited_data + self.inherited_data.inherit_from!(data) + else + self.inherited_data = data + end + self + end + + def unset!(attribute) + @set_attributes ||= {} + send("#{attribute}=", nil) + @set_attributes.delete(attribute) + nil + end + + def set?(attribute) + @set_attributes ||= {} + @set_attributes[attribute] + end + + def default_for(attribute) + method = "default_#{attribute}".to_sym + if respond_to?(method) + send(method) + end + end + + # Read an explicitly set value that is either inherited or set on this instance + def read_without_default(attribute) + if set?(attribute) + send("raw_#{attribute}") + elsif inherited_data.respond_to?("#{attribute}_without_default") + inherited_data.send("#{attribute}_without_default") + elsif inherited_data.respond_to?(attribute) + inherited_data.send(attribute) + end + end + + # Read a value that is either inherited or set on this instance, if we get to the bottom-most configuration instance, + # we ask for the default starting at the top level. + def read(attribute) + if !(v = send("#{attribute}_without_default")).nil? + v + else + top_level.default_for(attribute) + end + end + + def method_missing(meth) + if inherited_data + inherited_data.send(meth) + else + raise NoMethodError, meth.to_s + end + end + + def respond_to?(meth) + if super + true + elsif inherited_data + inherited_data.respond_to?(meth) + else + false + end + end + + def debug + instances = [self] + instances << instances.last.inherited_data while instances.last.inherited_data + normalized_attrs = {} + ATTRIBUTES.each do |prop| + values = [] + instances.each do |instance| + values << { + :raw => (instance.send("raw_#{prop}") rescue nil), + :value => (instance.send("#{prop}_without_default") rescue nil), + :default => (instance.send("default_#{prop}") rescue nil), + :resoved => instance.send(prop) + } + end + normalized_attrs[prop] = values + end + normalized_attrs + end + + end + end + end +end diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb new file mode 100644 index 00000000..4a0e1c0d --- /dev/null +++ b/lib/compass/configuration/serialization.rb @@ -0,0 +1,82 @@ +module Compass + module Configuration + # The serialization module manages reading and writing the configuration file(s). + module Serialization + def self.included(base) + base.send(:include, InstanceMethods) + base.extend ClassMethods + end + + module ClassMethods + def new_from_file(config_file) + data = Data.new + data.parse(config_file) + data + end + def new_from_string(contents, filename) + data = Data.new + data.parse_string(contents, filename) + data + end + end + + module InstanceMethods + # parses a configuration file which is a ruby script + def parse(config_file) + open(config_file) do |f| + parse_string(f.read, config_file) + end + end + + def parse_string(contents, filename) + bind = binding + eval(contents, bind, filename) + ATTRIBUTES.each do |prop| + value = eval(prop.to_s, bind) rescue nil + self.send("#{prop}=", value) if value + end + if @added_import_paths + self.additional_import_paths ||= [] + self.additional_import_paths += @added_import_paths + end + issue_deprecation_warnings + end + + def serialize + contents = "" + required_libraries.each do |lib| + contents << %Q{require '#{lib}'\n} + end + contents << "# Require any additional compass plugins here.\n" + contents << "\n" if required_libraries.any? + ATTRIBUTES.each do |prop| + value = send("#{prop}_without_default") + if value.is_a?(Proc) + $stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself." + end + if respond_to?("comment_for_#{prop}") + contents << send("comment_for_#{prop}") + end + if block_given? && (to_emit = yield(prop, value)) + contents << to_emit + else + contents << serialize_property(prop, value) unless value.nil? + end + end + contents + end + + def serialize_property(prop, value) + %Q(#{prop} = #{value.inspect}\n) + end + + def issue_deprecation_warnings + if http_images_path == :relative + $stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths." + end + end + + end + end + end +end diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index 6d9b6295..67120b40 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -26,12 +26,16 @@ module Compass define_method dir do Compass.configuration.send(dir) end + define_method "#{dir}_without_default" do + Compass.configuration.send("#{dir}_without_default") + end end # Initializes the project to work with compass def init dirs = manifest.map do |entry| - File.dirname(send("install_location_for_#{entry.type}", entry.to, entry.options)) + loc = send("install_location_for_#{entry.type}", entry.to, entry.options) + File.dirname(loc) end if manifest.has_stylesheet? diff --git a/lib/compass/installers/rails.rb b/lib/compass/installers/rails.rb index f2b7df40..cce33d9e 100644 --- a/lib/compass/installers/rails.rb +++ b/lib/compass/installers/rails.rb @@ -3,16 +3,38 @@ module Compass class RailsInstaller < Base - def configuration_defaults - { - :sass_dir => (sass_dir || prompt_sass_dir), - :css_dir => (css_dir || prompt_css_dir), - :images_dir => default_images_dir, - :javascripts_dir => default_javascripts_dir, - :http_stylesheets_path => default_http_stylesheets_path, - :http_javascripts_path => default_http_javascripts_path, - :http_images_path => default_http_images_path - } + module ConfigurationDefaults + def default_images_dir + File.join("public", "images") + end + + def default_javascripts_dir + File.join("public", "javascripts") + end + + def default_http_images_path + "/images" + end + + def default_http_javascripts_path + "/javascripts" + end + + def default_http_stylesheets_path + "/stylesheets" + end + + end + + def default_configuration + Compass::Configuration::Data.new.extend(ConfigurationDefaults) + end + + def completed_configuration + config = {} + config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default + config[:css_dir] = prompt_css_dir unless css_dir_without_default + config unless config.empty? end def write_configuration_files(config_file = nil) @@ -45,25 +67,6 @@ NEXTSTEPS puts "\n(You are using haml, aren't you?)" end - def default_images_dir - separate("public/images") - end - - def default_javascripts_dir - separate("public/javascripts") - end - - def default_http_images_path - "/images" - end - - def default_http_javascripts_path - "/javascripts" - end - - def default_http_stylesheets_path - "/stylesheets" - end def install_location_for_html(to, options) separate("public/#{pattern_name_as_dir}#{to}") diff --git a/lib/compass/installers/stand_alone.rb b/lib/compass/installers/stand_alone.rb index 5ae61d5d..053670b3 100644 --- a/lib/compass/installers/stand_alone.rb +++ b/lib/compass/installers/stand_alone.rb @@ -3,6 +3,24 @@ module Compass class StandAloneInstaller < Base + module ConfigurationDefaults + def sass_dir_without_default + "src" + end + + def javascripts_dir_without_default + "javascripts" + end + + def css_dir_without_default + "stylesheets" + end + + def images_dir_without_default + "images" + end + end + def init directory targetize("") super @@ -28,9 +46,12 @@ module Compass write_configuration_files unless config_files_exist? end - # We want to rely on the defaults provided by Configuration - def configuration_defaults - {} + def default_configuration + Compass::Configuration::Data.new.extend(ConfigurationDefaults) + end + + def completed_configuration + nil end def finalize(options = {}) diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index 029994c3..d74b191a 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -88,14 +88,6 @@ module Compass::CommandLineHelper FileUtils.rm_rf(d) end - def capture_output - real_stdout, $stdout = $stdout, StringIO.new - yield - $stdout.string - ensure - $stdout = real_stdout - end - def execute(*arguments) Compass::Exec::Compass.new(arguments).run! end diff --git a/test/command_line_test.rb b/test/command_line_test.rb index 8e621deb..d02ecae7 100644 --- a/test/command_line_test.rb +++ b/test/command_line_test.rb @@ -7,9 +7,10 @@ require 'timeout' class CommandLineTest < Test::Unit::TestCase include Compass::TestCaseHelper include Compass::CommandLineHelper + include Compass::IoHelper def teardown - Compass.configuration.reset! + Compass.reset_configuration! end def test_print_version diff --git a/test/compass_test.rb b/test/compass_test.rb index 89e3f988..e22eec31 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -5,7 +5,7 @@ require 'compass' class CompassTest < Test::Unit::TestCase include Compass::TestCaseHelper def setup - Compass.configuration.reset! + Compass.reset_configuration! end def teardown @@ -90,7 +90,7 @@ private def within_project(project_name) @current_project = project_name - Compass.configuration.parse(configuration_file(project_name)) if File.exists?(configuration_file(project_name)) + Compass.add_configuration(configuration_file(project_name)) if File.exists?(configuration_file(project_name)) Compass.configuration.project_path = project_path(project_name) args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new) if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path) diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 0191d9a6..5974274c 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -1,71 +1,75 @@ require File.dirname(__FILE__)+'/test_helper' require 'compass' +require 'stringio' class ConfigurationTest < Test::Unit::TestCase + include Compass::IoHelper def setup - Compass.configuration.reset! + Compass.reset_configuration! end def test_parse_and_serialize - contents = <<-CONFIG + contents = StringIO.new(<<-CONFIG) require 'compass' # Require any additional compass plugins here. project_type = :stand_alone - # Set this to the root of your project when deployed: - http_path = "/" css_dir = "css" sass_dir = "sass" images_dir = "img" javascripts_dir = "js" + # Set this to the root of your project when deployed: + http_path = "/" output_style = :nested # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true CONFIG - Compass.configuration.parse_string(contents, "test_parse") + Compass.add_configuration(contents, "test_parse") assert_equal 'sass', Compass.configuration.sass_dir assert_equal 'css', Compass.configuration.css_dir assert_equal 'img', Compass.configuration.images_dir assert_equal 'js', Compass.configuration.javascripts_dir - expected_lines = contents.split("\n").map{|l|l.strip} + expected_lines = contents.string.split("\n").map{|l|l.strip} actual_lines = Compass.configuration.serialize.split("\n").map{|l|l.strip} assert_equal expected_lines, actual_lines end - def test_serialization_fails_with_asset_host_set - contents = <<-CONFIG + def test_serialization_warns_with_asset_host_set + contents = StringIO.new(<<-CONFIG) asset_host do |path| "http://example.com" end CONFIG - Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_host_set") + Compass.add_configuration(contents, "test_serialization_warns_with_asset_host_set") - assert_raise Compass::Error do + warning = capture_warning do Compass.configuration.serialize end + assert_equal "WARNING: asset_host is code and cannot be written to a file. You'll need to copy it yourself.\n", warning end - def test_serialization_fails_with_asset_cache_buster_set - contents = <<-CONFIG + def test_serialization_warns_with_asset_cache_buster_set + contents = StringIO.new(<<-CONFIG) asset_cache_buster do |path| "http://example.com" end CONFIG - Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_cache_buster_set") + Compass.add_configuration(contents, "test_serialization_warns_with_asset_cache_buster_set") - assert_raise Compass::Error do + warning = capture_warning do Compass.configuration.serialize end + assert_equal "WARNING: asset_cache_buster is code and cannot be written to a file. You'll need to copy it yourself.\n", warning end def test_additional_import_paths - contents = <<-CONFIG + contents = StringIO.new(<<-CONFIG) http_path = "/" project_path = "/home/chris/my_compass_project" css_dir = "css" @@ -73,7 +77,7 @@ class ConfigurationTest < Test::Unit::TestCase add_import_path "/path/to/my/framework" CONFIG - Compass.configuration.parse_string(contents, "test_additional_import_paths") + Compass.add_configuration(contents, "test_additional_import_paths") assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo") assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect @@ -83,30 +87,38 @@ class ConfigurationTest < Test::Unit::TestCase expected_serialization = < 'bar'} CONFIG - Compass.configuration.parse_string(contents, "test_sass_options") + Compass.add_configuration(contents, "test_sass_options") assert_equal 'bar', Compass.configuration.to_sass_engine_options[:foo] assert_equal 'bar', Compass.configuration.to_sass_plugin_options[:foo] expected_serialization = <"bar"} diff --git a/test/io_helper.rb b/test/io_helper.rb new file mode 100644 index 00000000..499dec93 --- /dev/null +++ b/test/io_helper.rb @@ -0,0 +1,19 @@ +module Compass + module IoHelper + def capture_output + real_stdout, $stdout = $stdout, StringIO.new + yield + $stdout.string + ensure + $stdout = real_stdout + end + + def capture_warning + real_stderr, $stderr = $stderr, StringIO.new + yield + $stderr.string + ensure + $stderr = real_stderr + end + end +end \ No newline at end of file diff --git a/test/rails_integration_test.rb b/test/rails_integration_test.rb index df144c7a..9f689a1b 100644 --- a/test/rails_integration_test.rb +++ b/test/rails_integration_test.rb @@ -7,9 +7,10 @@ require 'timeout' class RailsIntegrationTest < Test::Unit::TestCase include Compass::TestCaseHelper include Compass::CommandLineHelper + include Compass::IoHelper def setup - Compass.configuration.reset! + Compass.reset_configuration! end def test_rails_install diff --git a/test/test_helper.rb b/test/test_helper.rb index 30ee1245..d731494b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -18,4 +18,5 @@ require 'compass' require 'test/unit' require File.join(File.dirname(__FILE__), 'test_case_helper') +require File.join(File.dirname(__FILE__), 'io_helper') require File.join(File.dirname(__FILE__), 'command_line_helper') From dd867d668a5d0ec7189a823d7f5625048763617b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 11:57:13 -0700 Subject: [PATCH 026/118] Use the http_stylesheets_path instead of hard coding. --- lib/compass/installers/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index 67120b40..c3d32d24 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -22,7 +22,7 @@ module Compass @manifest_file ||= File.join(template_path, "manifest.rb") end - [:css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |dir| + [:css_dir, :sass_dir, :images_dir, :javascripts_dir, :http_stylesheets_path].each do |dir| define_method dir do Compass.configuration.send(dir) end @@ -173,7 +173,7 @@ module Compass media = if stylesheet.options[:media] %Q{ media="#{stylesheet.options[:media]}"} end - ss_line = %Q{ } + ss_line = %Q{ } if stylesheet.options[:condition] ss_line = " " end From 379118cb1e54aa532dddd67acf217884a85c2820 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 12:09:32 -0700 Subject: [PATCH 027/118] Don't set the project type explicitly, instead default it to :stand_alone via the configuration object. --- lib/compass/commands/installer_command.rb | 2 +- lib/compass/configuration/defaults.rb | 4 ++++ lib/compass/exec.rb | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 8d3c2441..c76c7b88 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -13,7 +13,7 @@ module Compass end def installer - @installer ||= case options[:project_type] + @installer ||= case Compass.configuration.project_type when :stand_alone StandAloneInstaller.new *installer_args when :rails diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index b646a412..400cccde 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -2,6 +2,10 @@ module Compass module Configuration module Defaults + def default_project_type + :stand_alone + end + def http_path_without_default "/" end diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 9877e629..6596d2cf 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -68,7 +68,6 @@ module Compass end self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project self.options[:framework] ||= :compass - self.options[:project_type] ||= :stand_alone end def trim_trailing_separator(path) From a1bb1a96918fda9845e6e7f1ea26496ef78311f5 Mon Sep 17 00:00:00 2001 From: Gabriel Mansour Date: Tue, 4 Aug 2009 13:52:56 -0400 Subject: [PATCH 028/118] [Compass Core] There is no longer any outline on unstyled links in the :active and :focused states. --- .../stylesheets/compass/utilities/links/_unstyled_link.sass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass b/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass index 5f25ce39..122ac4ed 100644 --- a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +++ b/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass @@ -3,3 +3,5 @@ :color inherit :text-decoration inherit :cursor inherit + &:active, &:focus + :outline none \ No newline at end of file From 8679a926f19f0aa121c001c08272fab19e0babe8 Mon Sep 17 00:00:00 2001 From: John Debs Date: Thu, 20 Aug 2009 11:34:26 -0400 Subject: [PATCH 029/118] [Compass Core] Fixes to +sticky-footer mixin for IE6. Added two rules (':height auto !important' and ':height 100%') to the !root_selector of the sticky-footer mixin so that it also works with IE6. Tested and working with Firefox 3.5, Safari 4, Chrome 3, and IE6. --- .../compass/stylesheets/compass/layout/_sticky_footer.sass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass b/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass index 8b8c4b04..cca39ea6 100644 --- a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +++ b/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass @@ -8,6 +8,8 @@ :height 100% #{!root_selector} :min-height 100% + :height auto !important + :height 100% :margin-bottom= -!footer_height #{!root_footer_selector} :height= !footer_height From 3d67927ad6a609a3cf1ba046af3e98f48633274b Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Sat, 20 Jun 2009 19:49:06 -0700 Subject: [PATCH 030/118] [YUI] Update for YUI Grids 2.7.0 --- .../yui/stylesheets/yui/modules/_base.sass | 56 ++-- .../yui/stylesheets/yui/modules/_fonts.sass | 9 +- .../yui/stylesheets/yui/modules/_grids.sass | 308 ++++++++++-------- 3 files changed, 217 insertions(+), 156 deletions(-) diff --git a/frameworks/yui/stylesheets/yui/modules/_base.sass b/frameworks/yui/stylesheets/yui/modules/_base.sass index 7f95b886..f457131d 100644 --- a/frameworks/yui/stylesheets/yui/modules/_base.sass +++ b/frameworks/yui/stylesheets/yui/modules/_base.sass @@ -1,4 +1,7 @@ =yui-base + body + :margin 10px + h1 :font-size 138.5% @@ -11,9 +14,12 @@ h1, h2, h3 :margin 1em 0 - h1,h2, h3, h4, h5, h6, strong + h1,h2, h3, h4, h5, h6, strong, dt :font-weight bold + optgroup + :font-weight normal + abbr, acronym :border-bottom 1px dotted #000 :cursor help @@ -21,40 +27,44 @@ em :font-style italic - blockquote + del + :text-decoration line-through + + blockquote, ul, ol, dl :margin 1em - ul - :margin 1em + ol,ul,dl :margin-left 2em - li - :list-style disc outside - ol - :margin 1em - :margin-left 2em - li - :list-style decimal outside + ol li + :list-style decimal outside - dl - :margin 1em - :margin-left 2em - dd - :margin-left 1em + ul li + :list-style disc outside + + dl dd + :margin-left 1em + + th, td + :border 1px solid #000 + :padding .5em th - :border 1px solid #000 - :padding .5em :font-weight bold :text-align center - td - :border 1px solid #000 - :padding .5em - caption :margin-bottom .5em :text-align center - p, fieldset, table + sup + :vertical-align super + + sub + :vertical-align sub + + p, fieldset, table, pre :margin-bottom 1em + + button, input[type="checkbox"], input[type="radio"], input[type="reset"], input[type="submit"] + padding: 1px \ No newline at end of file diff --git a/frameworks/yui/stylesheets/yui/modules/_fonts.sass b/frameworks/yui/stylesheets/yui/modules/_fonts.sass index d84284ab..708458ce 100644 --- a/frameworks/yui/stylesheets/yui/modules/_fonts.sass +++ b/frameworks/yui/stylesheets/yui/modules/_fonts.sass @@ -13,7 +13,7 @@ // +font-size(18px) // .big .bigger // +font-size(18px, 16px) -// +// // For more information see the table found at http://developer.yahoo.com/yui/fonts/#fontsize =font-size(!size, !base_font_size = !yui_default_base_font_size) :font-size= percentage(!size / !base_font_size) @@ -28,6 +28,13 @@ :*font-size small :*font x-small + select, + input, + button, + textarea, + button + :font 99% arial,helvetica,clean,sans-serif + table :font-size inherit :font 100% diff --git a/frameworks/yui/stylesheets/yui/modules/_grids.sass b/frameworks/yui/stylesheets/yui/modules/_grids.sass index aa9a9c9d..a90f26b5 100644 --- a/frameworks/yui/stylesheets/yui/modules/_grids.sass +++ b/frameworks/yui/stylesheets/yui/modules/_grids.sass @@ -18,6 +18,7 @@ +yui-document("fluid") #doc4 +yui-document(974px) + /* Section: Preset Template Rules (.yui-t[1-6]) .yui-t1 +yui-two-column-left-template(160px) .yui-t2 @@ -30,22 +31,31 @@ +yui-two-column-right-template(240px) .yui-t6 +yui-two-column-right-template(300px) + .yui-t7 + +yui-one-column-template -=yui-grids-footer - clear: both +=yui-group-clearing + zoom: 1 + &:after + content: "." + display: block + height: 0 + clear: both + visibility: hidden -=yui-grids-body - +clearfix - -=yui-grids-init(!footer = "#ft", !body = "#bd") +=yui-grids-init(!header = "#hd", !footer = "#ft", !body = "#bd") + /* Section: General Rules body :text-align center + @if !header + #{!header} + +yui-group-clearing @if !footer #{!footer} - +yui-grids-footer + +yui-group-clearing @if !body #{!body} - +yui-grids-body + +yui-group-clearing =em-size(!style, !px_size, !base_font_size = !yui_default_base_font_size) :#{!style}= 1em * !px_size / !base_font_size @@ -54,8 +64,8 @@ +em-size(!style, !px_size, !base_font_size) +em-size("*"+!style, !px_size * 39 / 40, !base_font_size) -// All documents must have these styles. Setting a min-width is optional, but recommended. To omit it, pass false as the min_width value. -=yui-document-base(!min_width = 750px) +// All documents must have these styles +=yui-document-base(!min_width = false) :margin auto :text-align left @if !min_width @@ -66,14 +76,12 @@ :_position static =yui-main-block - :position static :float none :width auto - // Creates a fixed width document container // Pass "fluid" for the width to create a document that grows with the width of the browser. -=yui-document(!width, !min_width = 750px, !base_font_size = !yui_default_base_font_size) +=yui-document(!width, !min_width = false, !base_font_size = !yui_default_base_font_size) +yui-document-base(!min_width) @if !width == "fluid" :margin auto 10px @@ -81,85 +89,163 @@ @else +em-size-hacked("width", !width, !base_font_size) -=yui-two-column-left-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size) +=yui-two-column-left-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = false, !base_font_size = !yui_default_base_font_size) +yui-document(!document_width, !min_width, !base_font_size) - #{!main_selector} - :width 100% - :float right - +em-size("margin-left", -!column_width - 10px, !base_font_size) - #{!block_selector} - +yui-main-block - +em-size-hacked("margin-left", !column_width, !base_font_size) #{!block_selector} +yui-block-base :float left +em-size-hacked("width", !column_width, !base_font_size) - -=yui-two-column-right-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) #{!main_selector} :width 100% - :float left - +em-size("margin-right", -!column_width - 10px, !base_font_size) + :float right + :margin-left -25em #{!block_selector} +yui-main-block - +em-size-hacked("margin-right", !column_width, !base_font_size) + +em-size("margin-left", !column_width + 13px, !base_font_size) + // t3 is 15px for IE for some reason - seems like this should be some formula based on the column width and not a fixed number - need to do more research + @if !column_width > 180px + +em-size("*margin-left", (!column_width + 15px) * 39 / 40, !base_font_size) + @else + +em-size("*margin-left", (!column_width + 14px) * 39 / 40, !base_font_size) + +=yui-two-column-right-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = false, !base_font_size = !yui_default_base_font_size) + +yui-document(!document_width, !min_width, !base_font_size) #{!block_selector} +yui-block-base :float right +em-size-hacked("width", !column_width, !base_font_size) - -=yui-one-column-template(!main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) #{!main_selector} :width 100% + :float left + :margin-right -25em + #{!block_selector} + +yui-main-block + +em-size("margin-right", !column_width + 13px, !base_font_size) + // t5 is 15px for IE for some reason - seems like this should be some formula based on the column width and not a fixed number - need to do more research + @if !column_width > 180px + +em-size("*margin-right", (!column_width + 15px) * 39 / 40, !base_font_size) + @else + +em-size("*margin-right", (!column_width + 14px) * 39 / 40, !base_font_size) + +=yui-one-column-template(!main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = false, !base_font_size = !yui_default_base_font_size) + +yui-document(!document_width, !min_width, !base_font_size) + #{!main_selector} #{!block_selector} +yui-main-block :display block :margin 0 0 1em 0 - #{!block_selector} - +yui-block-base =yui-custom-template(!main_selector = "#yui-main", !block_selector = ".yui-b") + #{!block_selector} + +yui-block-base #{!main_selector} :width 100% #{!block_selector} +yui-main-block - #{!block_selector} - +yui-block-base =yui-grid-divisions(!unit = ".yui-u", !g_50_50 = ".yui-g", !g_33_33_33 = ".yui-gb", !g_67_33 = ".yui-gc", !g_33_67 = ".yui-gd", !g_75_25 = ".yui-ge", !g_25_75 = ".yui-gf") + + /* Section: Grids and Nesting Grids + + /* from #yui-main, .yui-g .yui-u .yui-g + #{nest(!g_50_50, !unit, !g_50_50)} + width: 100% + + /* Children generally take half the available space + #{nest(!g_33_33_33, !unit)}, #{nest(!g_50_50, !g_33_33_33, !unit)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_67_33, !g_50_50)}, - #{nest(!g_33_67, !unit)}, #{nest(!g_33_33_33, !g_50_50)}, #{nest(!g_33_33_33, !g_33_33_33)}, #{nest(!g_33_33_33, !g_67_33)}, #{nest(!g_33_33_33, !g_33_67)}, #{nest(!g_33_33_33, !g_75_25)}, #{nest(!g_33_33_33, !g_25_75)}, - #{nest(!g_33_33_33, !unit)} + #{nest(!g_67_33, !unit)}, + #{nest(!g_67_33, !g_50_50)}, + #{nest(!g_33_67, !unit)} float: left - margin-left: 2% - width: 32% - #{!g_33_33_33} - #{!g_33_33_33}, - #{!g_67_33} - #{!unit} - *margin-left: 1.8% - _margin-left: 4% - - #{nest(!g_50_50, !g_33_33_33, !unit)} - _margin-left: .8% - - #{nest(!g_33_33_33, !unit)} + /* Float units (and sub grids) to the right + #{nest(!g_50_50, !unit)}, + #{nest(!g_50_50, !g_50_50)}, + #{nest(!g_50_50, !g_33_33_33)}, + #{nest(!g_50_50, !g_67_33)}, + #{nest(!g_50_50, !g_33_67)}, + #{nest(!g_50_50, !g_75_25)}, + #{nest(!g_50_50, !g_25_75)}, + #{nest(!g_67_33, !unit)}, + #{nest(!g_33_67, !g_50_50)}, + #{nest(!g_50_50, !g_67_33, !unit)}, + #{nest(!g_75_25, !unit)}, + #{nest(!g_75_25, !g_50_50)}, + #{nest(!g_25_75, !g_50_50)}, + #{nest(!g_25_75, !unit)} float: right - #{nest(!g_33_33_33, "div.first")} - margin-left: 0 - float: left + /* Float units (and sub grids) to the left + #{!g_50_50}, + #{!g_33_33_33}, + #{!g_67_33}, + #{!g_33_67}, + #{!g_75_25}, + #{!g_25_75}, + #{nest(!g_50_50, !g_67_33)}, + #{nest(!g_50_50, !g_75_25)}, + #{nest(!g_67_33, "div.first")} + div.first + float: left + + #{!g_50_50} + #{!unit}, + #{!g_50_50}, + #{!g_33_33_33}, + #{!g_67_33}, + #{!g_33_67}, + #{!g_75_25}, + #{!g_25_75} + width: 49.1% + + #{nest(!g_33_33_33, !unit)}, + #{nest(!g_50_50, !g_33_33_33, !unit)}, + #{nest(!g_33_33_33, !g_50_50)}, + #{nest(!g_33_33_33, !g_33_33_33)}, + #{nest(!g_33_33_33, !g_67_33)}, + #{nest(!g_33_33_33, !g_33_67)}, + #{nest(!g_33_33_33, !g_75_25)}, + #{nest(!g_33_33_33, !g_25_75)}, + #{nest(!g_67_33, !unit)}, + #{nest(!g_67_33, !g_50_50)}, + #{nest(!g_33_67, !unit)} + width: 32% + margin-left: 1.99% + + /* Give IE some extra breathing room for 1/3-based rounding issues + #{nest(!g_33_33_33, !unit)} + *margin-left: 1.9% + *width: 31.9% + + #{nest(!g_50_50, !g_33_33_33)}, + #{!g_33_33_33}, + #{!g_67_33}, + #{!g_33_67} + div.first + margin-left: 0 + + /* Section: Deep Nesting + #{!g_50_50}, + #{!g_33_33_33}, + #{!g_67_33}, + #{!g_33_67}, + #{!g_75_25}, + #{!g_25_75} + #{!g_50_50} + #{!unit} + width: 49% + *width: 48.1% + *margin-left: 0 + + #{nest(!g_50_50, !g_50_50, !unit)} + width: 48.1% #{!g_50_50}, #{!g_33_33_33} @@ -169,12 +255,32 @@ *width: 32% _width: 31.7% + #{nest(!g_50_50, !g_67_33, "div.first")}, + #{nest(!g_67_33, "div.first")}, + #{nest(!g_33_67, !g_50_50)}, + #{nest(!g_33_67, !unit)} + width: 66% + + #{nest(!g_33_33_33, !g_50_50, "div.first")} + *margin-right: 4% + _margin-right: 1.3% + #{!g_33_33_33} #{!g_67_33}, #{!g_33_67} div.first *margin-right: 0 + #{!g_33_33_33} + #{!g_33_33_33}, + #{!g_67_33} + #{!unit} + *margin-left: 1.8% + _margin-left: 4% + + #{nest(!g_50_50, !g_33_33_33, !unit)} + _margin-left: 1.0% + #{nest(!g_33_33_33, !g_33_67, !unit)} *width: 66% _width: 61.2% @@ -203,52 +309,6 @@ #{!unit} margin: 0 - #{nest(!g_50_50, !unit)}, - #{nest(!g_50_50, !g_50_50)}, - #{nest(!g_50_50, !g_33_33_33)}, - #{nest(!g_50_50, !g_67_33)}, - #{nest(!g_50_50, !g_33_67)}, - #{nest(!g_50_50, !g_75_25)}, - #{nest(!g_50_50, !g_25_75)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_33_67, !g_50_50)}, - #{nest(!g_50_50, !g_67_33, !unit)}, - #{nest(!g_75_25, !unit)}, - #{nest(!g_75_25, !g_50_50)}, - #{nest(!g_25_75, !g_50_50)}, - #{nest(!g_25_75, !unit)} - float: right - - #{nest(!g_50_50, !g_67_33)}, - #{nest(!g_50_50, !g_75_25)}, - #{!g_50_50}, - #{!g_67_33}, - #{nest(!g_67_33, "div.first")}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - div.first - float: left - - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - #{!g_50_50} - #{!unit} - width: 49% - *width: 48.1% - *margin-left: 0 - - #{nest(!g_50_50, !g_50_50, "div.first")} - *margin: 0 - - #{nest(!g_33_33_33, !g_50_50, "div.first")} - *margin-right: 4% - _margin-right: 1.3% - #{nest(!g_33_33_33, !g_33_33_33, !unit)} _margin-left: .7% @@ -264,29 +324,6 @@ *width: 48.1% *margin-left: 0 - #{!g_50_50} - #{!unit}, - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - width: 49.1% - - #{nest(!g_50_50, !g_33_33_33)}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67} - div.first - margin-left: 0 - - #{nest(!g_50_50, !g_67_33, "div.first")}, - #{nest(!g_67_33, "div.first")}, - #{nest(!g_33_67, !g_50_50)}, - #{nest(!g_33_67, !unit)} - width: 66% - #{!g_33_67}, #{nest(!g_33_33_33, !g_33_67)} div.first @@ -300,6 +337,11 @@ #{nest(!g_25_75, "div.first")} width: 24% + #{nest(!g_75_25, "div.first")}, + #{nest(!g_25_75, !g_50_50)}, + #{nest(!g_25_75, !unit)} + width: 74.2% + #{!g_33_33_33} #{!g_75_25}, #{!g_25_75} @@ -312,30 +354,32 @@ div.first float: left - #{nest(!g_75_25, "div.first")}, - #{nest(!g_25_75, !g_50_50)}, - #{nest(!g_25_75, !unit)} - width: 74.2% - + /* Width Accommodation for Nested Contexts #{!g_33_33_33} #{nest(!g_75_25, !unit)}, #{nest(!g_25_75, "div.first")} *width: 24% _width: 20% + /* Width Accommodation for Nested Contexts #{!g_33_33_33} #{nest(!g_75_25, "div.first")}, #{nest(!g_25_75, !unit)} *width: 73.5% _width: 65.5% + /* Patch for GD within GE + #{nest(!g_75_25, "div.first", !g_33_67, !unit)} + width: 65% + + #{nest(!g_75_25, "div.first", !g_33_67, "div.first")} + width: 32% + + /* @group Clearing #{!g_50_50}, #{!g_33_33_33}, #{!g_67_33}, #{!g_33_67}, #{!g_75_25}, #{!g_25_75} - +clearfix - - #{nest(!g_33_33_33, !unit)} - float: left + +yui-group-clearing From bb089384d43e1e2d5b95447f1fe12e2f6b7f3e13 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 13:57:34 -0700 Subject: [PATCH 031/118] Extracted YUI to it's own plugin. --- frameworks/yui.rb | 2 - frameworks/yui/COPYRIGHT | 15 - frameworks/yui/stylesheets/_yui.sass | 7 - .../yui/stylesheets/yui/modules/_base.sass | 70 ---- .../yui/stylesheets/yui/modules/_fonts.sass | 45 -- .../yui/stylesheets/yui/modules/_grids.sass | 385 ------------------ .../yui/stylesheets/yui/modules/_reset.sass | 61 --- frameworks/yui/templates/project/manifest.rb | 1 - frameworks/yui/templates/project/screen.sass | 4 - 9 files changed, 590 deletions(-) delete mode 100644 frameworks/yui.rb delete mode 100644 frameworks/yui/COPYRIGHT delete mode 100644 frameworks/yui/stylesheets/_yui.sass delete mode 100644 frameworks/yui/stylesheets/yui/modules/_base.sass delete mode 100644 frameworks/yui/stylesheets/yui/modules/_fonts.sass delete mode 100644 frameworks/yui/stylesheets/yui/modules/_grids.sass delete mode 100644 frameworks/yui/stylesheets/yui/modules/_reset.sass delete mode 100644 frameworks/yui/templates/project/manifest.rb delete mode 100644 frameworks/yui/templates/project/screen.sass diff --git a/frameworks/yui.rb b/frameworks/yui.rb deleted file mode 100644 index 00b41003..00000000 --- a/frameworks/yui.rb +++ /dev/null @@ -1,2 +0,0 @@ -yui_dir = File.join(Compass.base_directory, 'frameworks', 'yui') -Compass::Frameworks.register('yui', yui_dir) diff --git a/frameworks/yui/COPYRIGHT b/frameworks/yui/COPYRIGHT deleted file mode 100644 index a3971ceb..00000000 --- a/frameworks/yui/COPYRIGHT +++ /dev/null @@ -1,15 +0,0 @@ -Whatever parts of this port of YUI to Sass that are copyrightable, are Copyright (c) 2008, Christopher Eppstein. All Rights Reserved. - -The original CSS required this copyright notice to be present in redistributions, so to be on the safe side: - -Copyright (c) 2008, Yahoo! Inc. -All rights reserved. - -Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the - following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/frameworks/yui/stylesheets/_yui.sass b/frameworks/yui/stylesheets/_yui.sass deleted file mode 100644 index acc2006e..00000000 --- a/frameworks/yui/stylesheets/_yui.sass +++ /dev/null @@ -1,7 +0,0 @@ -@import yui/modules/base.sass -@import yui/modules/fonts.sass -@import yui/modules/grids.sass -=yui - +yui-base - +yui-base-fonts - +yui-grids \ No newline at end of file diff --git a/frameworks/yui/stylesheets/yui/modules/_base.sass b/frameworks/yui/stylesheets/yui/modules/_base.sass deleted file mode 100644 index f457131d..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_base.sass +++ /dev/null @@ -1,70 +0,0 @@ -=yui-base - body - :margin 10px - - h1 - :font-size 138.5% - - h2 - :font-size 123.1% - - h3 - :font-size 108% - - h1, h2, h3 - :margin 1em 0 - - h1,h2, h3, h4, h5, h6, strong, dt - :font-weight bold - - optgroup - :font-weight normal - - abbr, acronym - :border-bottom 1px dotted #000 - :cursor help - - em - :font-style italic - - del - :text-decoration line-through - - blockquote, ul, ol, dl - :margin 1em - - ol,ul,dl - :margin-left 2em - - ol li - :list-style decimal outside - - ul li - :list-style disc outside - - dl dd - :margin-left 1em - - th, td - :border 1px solid #000 - :padding .5em - - th - :font-weight bold - :text-align center - - caption - :margin-bottom .5em - :text-align center - - sup - :vertical-align super - - sub - :vertical-align sub - - p, fieldset, table, pre - :margin-bottom 1em - - button, input[type="checkbox"], input[type="radio"], input[type="reset"], input[type="submit"] - padding: 1px \ No newline at end of file diff --git a/frameworks/yui/stylesheets/yui/modules/_fonts.sass b/frameworks/yui/stylesheets/yui/modules/_fonts.sass deleted file mode 100644 index 708458ce..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_fonts.sass +++ /dev/null @@ -1,45 +0,0 @@ -!yui_default_base_font_size ||= 13px -!yui_default_base_line_height ||= 1.231 -!yui_default_font_family ||= "arial,helvetica,clean,sans-serif" - -// Sets the font size specified in pixels using percents so that the base -// font size changes and 1em has the correct value. When nesting font size -// declarations, within the DOM tree, the base_font_size must be the parent's -// effective font-size in pixels. -// Usage Examples: -// .big -// +font-size(16px) -// .bigger -// +font-size(18px) -// .big .bigger -// +font-size(18px, 16px) -// -// For more information see the table found at http://developer.yahoo.com/yui/fonts/#fontsize -=font-size(!size, !base_font_size = !yui_default_base_font_size) - :font-size= percentage(!size / !base_font_size) - -// Sets the base fonts for a page, this should be mixed into the top level of a stylesheet. -=yui-base-fonts(!family = !yui_default_font_family, !size = !yui_default_base_font_size, !line_height = !yui_default_base_line_height) - body - :font - :size= !size - :family= !family - :line-height= !line_height - :*font-size small - :*font x-small - - select, - input, - button, - textarea, - button - :font 99% arial,helvetica,clean,sans-serif - - table - :font-size inherit - :font 100% - - pre, code, kbd, samp, tt - :font-family monospace - :*font-size 108% - :line-height 100% diff --git a/frameworks/yui/stylesheets/yui/modules/_grids.sass b/frameworks/yui/stylesheets/yui/modules/_grids.sass deleted file mode 100644 index a90f26b5..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_grids.sass +++ /dev/null @@ -1,385 +0,0 @@ -// This is a port of YUI Grids version 2.6.0 -// Note: This is not really tested yet. Use at your own risk. - -@import compass/utilities/general/float.sass -@import fonts.sass - -=yui-grids - +yui-grids-init - +yui-grid-templates - +yui-grid-divisions - -=yui-grid-templates - #doc - +yui-document(750px) - #doc2 - +yui-document(950px) - #doc3 - +yui-document("fluid") - #doc4 - +yui-document(974px) - /* Section: Preset Template Rules (.yui-t[1-6]) - .yui-t1 - +yui-two-column-left-template(160px) - .yui-t2 - +yui-two-column-left-template(180px) - .yui-t3 - +yui-two-column-left-template(300px) - .yui-t4 - +yui-two-column-right-template(180px) - .yui-t5 - +yui-two-column-right-template(240px) - .yui-t6 - +yui-two-column-right-template(300px) - .yui-t7 - +yui-one-column-template - -=yui-group-clearing - zoom: 1 - &:after - content: "." - display: block - height: 0 - clear: both - visibility: hidden - -=yui-grids-init(!header = "#hd", !footer = "#ft", !body = "#bd") - /* Section: General Rules - body - :text-align center - @if !header - #{!header} - +yui-group-clearing - @if !footer - #{!footer} - +yui-group-clearing - @if !body - #{!body} - +yui-group-clearing - -=em-size(!style, !px_size, !base_font_size = !yui_default_base_font_size) - :#{!style}= 1em * !px_size / !base_font_size - -=em-size-hacked(!style, !px_size, !base_font_size = !yui_default_base_font_size) - +em-size(!style, !px_size, !base_font_size) - +em-size("*"+!style, !px_size * 39 / 40, !base_font_size) - -// All documents must have these styles -=yui-document-base(!min_width = false) - :margin auto - :text-align left - @if !min_width - :min-width= !min_width - -=yui-block-base - :position relative - :_position static - -=yui-main-block - :float none - :width auto - -// Creates a fixed width document container -// Pass "fluid" for the width to create a document that grows with the width of the browser. -=yui-document(!width, !min_width = false, !base_font_size = !yui_default_base_font_size) - +yui-document-base(!min_width) - @if !width == "fluid" - :margin auto 10px - :width auto - @else - +em-size-hacked("width", !width, !base_font_size) - -=yui-two-column-left-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = false, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) - #{!block_selector} - +yui-block-base - :float left - +em-size-hacked("width", !column_width, !base_font_size) - #{!main_selector} - :width 100% - :float right - :margin-left -25em - #{!block_selector} - +yui-main-block - +em-size("margin-left", !column_width + 13px, !base_font_size) - // t3 is 15px for IE for some reason - seems like this should be some formula based on the column width and not a fixed number - need to do more research - @if !column_width > 180px - +em-size("*margin-left", (!column_width + 15px) * 39 / 40, !base_font_size) - @else - +em-size("*margin-left", (!column_width + 14px) * 39 / 40, !base_font_size) - -=yui-two-column-right-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = false, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) - #{!block_selector} - +yui-block-base - :float right - +em-size-hacked("width", !column_width, !base_font_size) - #{!main_selector} - :width 100% - :float left - :margin-right -25em - #{!block_selector} - +yui-main-block - +em-size("margin-right", !column_width + 13px, !base_font_size) - // t5 is 15px for IE for some reason - seems like this should be some formula based on the column width and not a fixed number - need to do more research - @if !column_width > 180px - +em-size("*margin-right", (!column_width + 15px) * 39 / 40, !base_font_size) - @else - +em-size("*margin-right", (!column_width + 14px) * 39 / 40, !base_font_size) - -=yui-one-column-template(!main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = false, !base_font_size = !yui_default_base_font_size) - +yui-document(!document_width, !min_width, !base_font_size) - #{!main_selector} - #{!block_selector} - +yui-main-block - :display block - :margin 0 0 1em 0 - -=yui-custom-template(!main_selector = "#yui-main", !block_selector = ".yui-b") - #{!block_selector} - +yui-block-base - #{!main_selector} - :width 100% - #{!block_selector} - +yui-main-block - -=yui-grid-divisions(!unit = ".yui-u", !g_50_50 = ".yui-g", !g_33_33_33 = ".yui-gb", !g_67_33 = ".yui-gc", !g_33_67 = ".yui-gd", !g_75_25 = ".yui-ge", !g_25_75 = ".yui-gf") - - /* Section: Grids and Nesting Grids - - /* from #yui-main, .yui-g .yui-u .yui-g - #{nest(!g_50_50, !unit, !g_50_50)} - width: 100% - - /* Children generally take half the available space - #{nest(!g_33_33_33, !unit)}, - #{nest(!g_50_50, !g_33_33_33, !unit)}, - #{nest(!g_33_33_33, !g_50_50)}, - #{nest(!g_33_33_33, !g_33_33_33)}, - #{nest(!g_33_33_33, !g_67_33)}, - #{nest(!g_33_33_33, !g_33_67)}, - #{nest(!g_33_33_33, !g_75_25)}, - #{nest(!g_33_33_33, !g_25_75)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_67_33, !g_50_50)}, - #{nest(!g_33_67, !unit)} - float: left - - /* Float units (and sub grids) to the right - #{nest(!g_50_50, !unit)}, - #{nest(!g_50_50, !g_50_50)}, - #{nest(!g_50_50, !g_33_33_33)}, - #{nest(!g_50_50, !g_67_33)}, - #{nest(!g_50_50, !g_33_67)}, - #{nest(!g_50_50, !g_75_25)}, - #{nest(!g_50_50, !g_25_75)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_33_67, !g_50_50)}, - #{nest(!g_50_50, !g_67_33, !unit)}, - #{nest(!g_75_25, !unit)}, - #{nest(!g_75_25, !g_50_50)}, - #{nest(!g_25_75, !g_50_50)}, - #{nest(!g_25_75, !unit)} - float: right - - /* Float units (and sub grids) to the left - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75}, - #{nest(!g_50_50, !g_67_33)}, - #{nest(!g_50_50, !g_75_25)}, - #{nest(!g_67_33, "div.first")} - div.first - float: left - - #{!g_50_50} - #{!unit}, - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - width: 49.1% - - #{nest(!g_33_33_33, !unit)}, - #{nest(!g_50_50, !g_33_33_33, !unit)}, - #{nest(!g_33_33_33, !g_50_50)}, - #{nest(!g_33_33_33, !g_33_33_33)}, - #{nest(!g_33_33_33, !g_67_33)}, - #{nest(!g_33_33_33, !g_33_67)}, - #{nest(!g_33_33_33, !g_75_25)}, - #{nest(!g_33_33_33, !g_25_75)}, - #{nest(!g_67_33, !unit)}, - #{nest(!g_67_33, !g_50_50)}, - #{nest(!g_33_67, !unit)} - width: 32% - margin-left: 1.99% - - /* Give IE some extra breathing room for 1/3-based rounding issues - #{nest(!g_33_33_33, !unit)} - *margin-left: 1.9% - *width: 31.9% - - #{nest(!g_50_50, !g_33_33_33)}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67} - div.first - margin-left: 0 - - /* Section: Deep Nesting - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - #{!g_50_50} - #{!unit} - width: 49% - *width: 48.1% - *margin-left: 0 - - #{nest(!g_50_50, !g_50_50, !unit)} - width: 48.1% - - #{!g_50_50}, - #{!g_33_33_33} - #{!g_33_33_33} - div.first - *margin-right: 0 - *width: 32% - _width: 31.7% - - #{nest(!g_50_50, !g_67_33, "div.first")}, - #{nest(!g_67_33, "div.first")}, - #{nest(!g_33_67, !g_50_50)}, - #{nest(!g_33_67, !unit)} - width: 66% - - #{nest(!g_33_33_33, !g_50_50, "div.first")} - *margin-right: 4% - _margin-right: 1.3% - - #{!g_33_33_33} - #{!g_67_33}, - #{!g_33_67} - div.first - *margin-right: 0 - - #{!g_33_33_33} - #{!g_33_33_33}, - #{!g_67_33} - #{!unit} - *margin-left: 1.8% - _margin-left: 4% - - #{nest(!g_50_50, !g_33_33_33, !unit)} - _margin-left: 1.0% - - #{nest(!g_33_33_33, !g_33_67, !unit)} - *width: 66% - _width: 61.2% - - #{nest(!g_33_33_33, !g_33_67, "div.first")} - *width: 31% - _width: 29.5% - - #{!g_50_50}, - #{!g_33_33_33} - #{!g_67_33} - #{!unit} - width: 32% - _float: right - margin-right: 0 - _margin-left: 0 - - #{nest(!g_33_33_33, !g_67_33, "div.first")} - width: 66% - *float: left - *margin-left: 0 - - #{!g_33_33_33} - #{!g_75_25}, - #{!g_25_75} - #{!unit} - margin: 0 - - #{nest(!g_33_33_33, !g_33_33_33, !unit)} - _margin-left: .7% - - #{nest(!g_33_33_33, !g_50_50)}, - #{nest(!g_33_33_33, !g_33_33_33)} - div.first - *margin-left: 0 - - #{!g_67_33}, - #{!g_33_67} - #{!g_50_50} - #{!unit} - *width: 48.1% - *margin-left: 0 - - #{!g_33_67}, - #{nest(!g_33_33_33, !g_33_67)} - div.first - width: 32% - - #{nest(!g_50_50, !g_33_67, "div.first")} - _width: 29.9% - - #{nest(!g_75_25, !unit)}, - #{nest(!g_75_25, !g_50_50)}, - #{nest(!g_25_75, "div.first")} - width: 24% - - #{nest(!g_75_25, "div.first")}, - #{nest(!g_25_75, !g_50_50)}, - #{nest(!g_25_75, !unit)} - width: 74.2% - - #{!g_33_33_33} - #{!g_75_25}, - #{!g_25_75} - div#{!unit} - float: right - - #{!g_33_33_33} - #{!g_75_25}, - #{!g_25_75} - div.first - float: left - - /* Width Accommodation for Nested Contexts - #{!g_33_33_33} - #{nest(!g_75_25, !unit)}, - #{nest(!g_25_75, "div.first")} - *width: 24% - _width: 20% - - /* Width Accommodation for Nested Contexts - #{!g_33_33_33} - #{nest(!g_75_25, "div.first")}, - #{nest(!g_25_75, !unit)} - *width: 73.5% - _width: 65.5% - - /* Patch for GD within GE - #{nest(!g_75_25, "div.first", !g_33_67, !unit)} - width: 65% - - #{nest(!g_75_25, "div.first", !g_33_67, "div.first")} - width: 32% - - /* @group Clearing - #{!g_50_50}, - #{!g_33_33_33}, - #{!g_67_33}, - #{!g_33_67}, - #{!g_75_25}, - #{!g_25_75} - +yui-group-clearing diff --git a/frameworks/yui/stylesheets/yui/modules/_reset.sass b/frameworks/yui/stylesheets/yui/modules/_reset.sass deleted file mode 100644 index bf706e81..00000000 --- a/frameworks/yui/stylesheets/yui/modules/_reset.sass +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (c) 2008, Yahoo! Inc. All rights reserved. - Code licensed under the BSD License: - http://developer.yahoo.net/yui/license.txt - version: 3.0.0pr2 - -=reset - html - :color #000 - :background #FFF - - body, div, dl, dt, dd, ul, ol, li, - h1, h2, h3, h4, h5, h6, pre, code, - form, fieldset, legend,input, - textarea, p, blockquote, th, td - :margin 0 - :padding 0 - - li - :list-style none - - h1, h2, h3, h4, h5, h6 - :font-size 100% - :font-weight normal - - code, th, address, caption, - cite, dfn, em, strong, var - :font-style normal - :font-weight normal - - fieldset, img, abbr, acronym - :border 0 - - legend - :color #000 - - input, textarea, select - :font-family inherit - :font-size inherit - :font-weight inherit - :*font-size 100% - - th, caption - :text-align left - - table - :border-collapse collapse - :border-spacing 0 - - q - &:before, &:after - :content '' - - abbr, acronym - :font-variant normal - - sup - :vertical-align text-top - - sub - :vertical-align text-bottom diff --git a/frameworks/yui/templates/project/manifest.rb b/frameworks/yui/templates/project/manifest.rb deleted file mode 100644 index c7af4356..00000000 --- a/frameworks/yui/templates/project/manifest.rb +++ /dev/null @@ -1 +0,0 @@ -stylesheet 'screen.sass', :media => "screen, projection" diff --git a/frameworks/yui/templates/project/screen.sass b/frameworks/yui/templates/project/screen.sass deleted file mode 100644 index 40dab7fa..00000000 --- a/frameworks/yui/templates/project/screen.sass +++ /dev/null @@ -1,4 +0,0 @@ -@import yui.sass -@import compass/reset.sass - -+yui From 373ac11329c5da402f18b92a088fc67a3f31721d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 14:52:30 -0700 Subject: [PATCH 032/118] Removes some tests about YUI. --- test/command_line_test.rb | 2 +- test/compass_test.rb | 11 +---------- test/fixtures/stylesheets/yui/config.rb | 9 --------- test/fixtures/stylesheets/yui/css/mixins.css | 13 ------------- test/fixtures/stylesheets/yui/sass/base.sass | 3 --- test/fixtures/stylesheets/yui/sass/fonts.sass | 3 --- test/fixtures/stylesheets/yui/sass/grids.sass | 3 --- test/fixtures/stylesheets/yui/sass/mixins.sass | 16 ---------------- 8 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 test/fixtures/stylesheets/yui/config.rb delete mode 100644 test/fixtures/stylesheets/yui/css/mixins.css delete mode 100644 test/fixtures/stylesheets/yui/sass/base.sass delete mode 100644 test/fixtures/stylesheets/yui/sass/fonts.sass delete mode 100644 test/fixtures/stylesheets/yui/sass/grids.sass delete mode 100644 test/fixtures/stylesheets/yui/sass/mixins.sass diff --git a/test/command_line_test.rb b/test/command_line_test.rb index d02ecae7..b23ad2b0 100644 --- a/test/command_line_test.rb +++ b/test/command_line_test.rb @@ -20,7 +20,7 @@ class CommandLineTest < Test::Unit::TestCase def test_list_frameworks compass "--list-frameworks" - assert_equal(%w(blueprint compass yui), @last_result.split.sort) + assert_equal(%w(blueprint compass), @last_result.split.sort) end def test_basic_install diff --git a/test/compass_test.rb b/test/compass_test.rb index e22eec31..1ed50411 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -9,7 +9,7 @@ class CompassTest < Test::Unit::TestCase end def teardown - teardown_fixtures :blueprint, :yui, :empty, :compass, :image_urls + teardown_fixtures :blueprint, :empty, :compass, :image_urls end def teardown_fixtures(*project_names) @@ -37,15 +37,6 @@ class CompassTest < Test::Unit::TestCase end end - def test_yui - within_project('yui') do |proj| - each_css_file(proj.css_path) do |css_file| - assert_no_errors css_file, 'yui' - end - assert_renders_correctly :mixins - end - end - def test_compass within_project('compass') do |proj| each_css_file(proj.css_path) do |css_file| diff --git a/test/fixtures/stylesheets/yui/config.rb b/test/fixtures/stylesheets/yui/config.rb deleted file mode 100644 index 1b3ad842..00000000 --- a/test/fixtures/stylesheets/yui/config.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Require any additional compass plugins here. -project_type = :stand_alone -css_dir = "tmp" -sass_dir = "sass" -images_dir = "images" -output_style = :nested -# To enable relative image paths using the images_url() function: -# http_images_path = :relative -http_images_path = "/images" diff --git a/test/fixtures/stylesheets/yui/css/mixins.css b/test/fixtures/stylesheets/yui/css/mixins.css deleted file mode 100644 index 7037c3ef..00000000 --- a/test/fixtures/stylesheets/yui/css/mixins.css +++ /dev/null @@ -1,13 +0,0 @@ -.font-size-26px { - font-size: 200%; } - -.font-size-baseline { - font-size: 300%; } - -.em-sizing { - width: 1em; - margin: 9em; } - -.em-sizing-hack { - width: 1em; - *width: 0.975em; } \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/base.sass b/test/fixtures/stylesheets/yui/sass/base.sass deleted file mode 100644 index 8c0bc40b..00000000 --- a/test/fixtures/stylesheets/yui/sass/base.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import yui/modules/base.sass - -+yui-base \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/fonts.sass b/test/fixtures/stylesheets/yui/sass/fonts.sass deleted file mode 100644 index a73ec8e9..00000000 --- a/test/fixtures/stylesheets/yui/sass/fonts.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import yui/modules/fonts.sass - -+yui-base-fonts \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/grids.sass b/test/fixtures/stylesheets/yui/sass/grids.sass deleted file mode 100644 index e751fae8..00000000 --- a/test/fixtures/stylesheets/yui/sass/grids.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import yui/modules/grids.sass - -+yui-grids \ No newline at end of file diff --git a/test/fixtures/stylesheets/yui/sass/mixins.sass b/test/fixtures/stylesheets/yui/sass/mixins.sass deleted file mode 100644 index d0dbea12..00000000 --- a/test/fixtures/stylesheets/yui/sass/mixins.sass +++ /dev/null @@ -1,16 +0,0 @@ -@import yui/modules/fonts.sass -@import yui/modules/grids.sass - -.font-size-26px - +font-size(26px) - -.font-size-baseline - +font-size(30px, 10px) - -.em-sizing - +em-size("width", 13px) - +em-size("margin", 99px, 11px) - -.em-sizing-hack - +em-size-hacked("width", 13px) - From 5d8e8cae0297384d3b8d5ede51b2b88aff70855a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 15:13:51 -0700 Subject: [PATCH 033/118] Fixed bug related to how the project_type was defaulted. --- lib/compass/commands/installer_command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index c76c7b88..4e19e4c0 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -13,7 +13,7 @@ module Compass end def installer - @installer ||= case Compass.configuration.project_type + @installer ||= case (options[:project_type] || Compass.configuration.project_type) when :stand_alone StandAloneInstaller.new *installer_args when :rails From d5147591e836e2a45de842692453f2aecb3c298a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 15:14:14 -0700 Subject: [PATCH 034/118] Fixed some broken tests after pulling in changesets. --- test/configuration_test.rb | 7 ------- test/fixtures/stylesheets/compass/css/layout.css | 2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 5974274c..1ba96327 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -88,9 +88,6 @@ class ConfigurationTest < Test::Unit::TestCase # Require any additional compass plugins here. project_path = "/home/chris/my_compass_project" css_dir = "css" -sass_dir = "src" -images_dir = "images" -javascripts_dir = "javascripts" # Set this to the root of your project when deployed: http_path = "/" # To enable relative paths to assets via compass helper functions. Uncomment: @@ -113,10 +110,6 @@ EXPECTED expected_serialization = < Date: Wed, 22 Jul 2009 09:34:50 -0700 Subject: [PATCH 035/118] remove some blank lines. --- lib/compass.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/compass.rb b/lib/compass.rb index d09dd6df..0956ff87 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -19,5 +19,3 @@ end require File.join(File.dirname(__FILE__), 'compass', 'configuration') require File.join(File.dirname(__FILE__), 'compass', 'frameworks') require File.join(File.dirname(__FILE__), 'compass', 'app_integration') - - From bc275413781e1f20d05c23e1af65a5647b5079dc Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 26 Jul 2009 18:10:07 -0700 Subject: [PATCH 036/118] New framework discovery mechanism: Compass can now load any number of frameworks by passing a directory that contains those frameworks. Each framework can choose to adhere to the naming convention of providing a 'stylesheets' directory and a 'templates' directory, or it can register itself by providing a ruby file at one of the following locations: /compass_init.rb /lib/.rb /.rb The first file found in the above order will be required. The framework should register itself there using the Compass::Frameworks.register method. --- frameworks/blueprint.rb | 2 -- frameworks/compass.rb | 2 -- .../compass/templates/extension/manifest.rb | 0 lib/compass/frameworks.rb | 36 +++++++++++++++---- 4 files changed, 30 insertions(+), 10 deletions(-) delete mode 100644 frameworks/blueprint.rb delete mode 100644 frameworks/compass.rb create mode 100644 frameworks/compass/templates/extension/manifest.rb diff --git a/frameworks/blueprint.rb b/frameworks/blueprint.rb deleted file mode 100644 index 47b3c87b..00000000 --- a/frameworks/blueprint.rb +++ /dev/null @@ -1,2 +0,0 @@ -blueprint_dir = File.join(Compass.base_directory, 'frameworks', 'blueprint') -Compass::Frameworks.register('blueprint', blueprint_dir) diff --git a/frameworks/compass.rb b/frameworks/compass.rb deleted file mode 100644 index 3ad82710..00000000 --- a/frameworks/compass.rb +++ /dev/null @@ -1,2 +0,0 @@ -compass_dir = File.join(Compass.base_directory, 'frameworks', 'compass') -Compass::Frameworks.register('compass', compass_dir) diff --git a/frameworks/compass/templates/extension/manifest.rb b/frameworks/compass/templates/extension/manifest.rb new file mode 100644 index 00000000..e69de29b diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index e74c4529..b34597bc 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -1,6 +1,10 @@ module Compass module Frameworks + extend self + ALL = [] + DEFAULT_FRAMEWORKS_PATH = File.join(Compass.base_directory, 'frameworks') + class Framework attr_accessor :name attr_accessor :templates_directory, :stylesheets_directory @@ -12,18 +16,38 @@ module Compass @stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets') end end + def register(name, *arguments) ALL << Framework.new(name, *arguments) end + def [](name) ALL.detect{|f| f.name.to_s == name.to_s} end - module_function :register, :[] + + def discover(frameworks_directory) + frameworks_directory = DEFAULT_FRAMEWORKS_PATH if frameworks_directory == :defaults + frameworks_directory = Dir.new(frameworks_directory) unless frameworks_directory.is_a?(Dir) + frameworks_directory.entries.reject{|e| e[0] == ?.}.each do |framework| + register_directory File.join(frameworks_directory.path, framework) + end + end + + def register_directory(directory) + loaders = [ + File.join(directory, "compass_init.rb"), + File.join(directory, 'lib', File.basename(directory)+".rb"), + File.join(directory, File.basename(directory)+".rb") + ] + loader = loaders.detect{|l| File.exists?(l)} + if loader + require loader + else + register File.basename(directory), directory + end + end + end end -# Import all of the default frameworks. -default_frameworks_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'frameworks')) -Dir.glob(File.join(default_frameworks_directory, "*.rb")).each do |framework| - require framework -end +Compass::Frameworks.discover(:defaults) From 44e810e8405935b3fc582d6889eff68a043ddb6c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 26 Jul 2009 22:47:59 -0700 Subject: [PATCH 037/118] Allow stand-alone projects to have their own extensions directory. --- lib/compass/commands/installer_command.rb | 3 +++ lib/compass/commands/list_frameworks.rb | 4 ++-- lib/compass/commands/project_base.rb | 5 ++++- lib/compass/configuration.rb | 2 ++ lib/compass/configuration/defaults.rb | 11 +++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 4e19e4c0..41915d36 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -10,6 +10,9 @@ module Compass read_project_configuration Compass.add_configuration(options) Compass.add_configuration(installer.completed_configuration) + if File.exists?(Compass.configuration.extensions_path) + Compass::Frameworks.discover(Compass.configuration.extensions_path) + end end def installer diff --git a/lib/compass/commands/list_frameworks.rb b/lib/compass/commands/list_frameworks.rb index 27801945..e9ffb409 100644 --- a/lib/compass/commands/list_frameworks.rb +++ b/lib/compass/commands/list_frameworks.rb @@ -1,9 +1,9 @@ module Compass module Commands - class ListFrameworks + class ListFrameworks < ProjectBase attr_accessor :options def initialize(working_path, options) - self.options = options + super end def execute diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 0065721a..21776373 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -12,10 +12,10 @@ module Compass super(working_path, options) self.project_name = determine_project_name(working_path, options) Compass.configuration.project_path = determine_project_directory(working_path, options) + configure! end def execute - configure! super end @@ -23,6 +23,9 @@ module Compass def configure! read_project_configuration + if File.exists?(Compass.configuration.extensions_path) + Compass::Frameworks.discover(Compass.configuration.extensions_path) + end end def projectize(path) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index a495a1fa..1d8203c9 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -8,10 +8,12 @@ module Compass :sass_dir, :images_dir, :javascripts_dir, + :extensions_dir, :css_path, :sass_path, :images_path, :javascripts_path, + :extensions_path, :http_path, :http_images_dir, :http_stylesheets_dir, diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index 400cccde..83da5c2e 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -10,6 +10,10 @@ module Compass "/" end + def default_extensions_dir + "extensions" + end + def default_output_style if top_level.environment == :development :expanded @@ -46,6 +50,13 @@ module Compass end end + def default_extensions_path + if (pp = top_level.project_path) && (dir = top_level.extensions_dir) + File.join(pp, dir) + end + end + + def default_http_images_dir top_level.images_dir end From 9105d5a8de19fe741067fb5acc7c80442988aaed Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 26 Jul 2009 22:57:22 -0700 Subject: [PATCH 038/118] Added an example for the ninesixty plugin using local extensions. --- .gitignore | 1 + Rakefile | 3 +++ examples/ninesixty/bootstrap.rb | 39 ++++++++++++++++++++++++++++++++ examples/ninesixty/config.rb | 9 ++++++++ examples/ninesixty/src/grid.sass | 16 +++++++++++++ examples/ninesixty/src/text.sass | 10 ++++++++ 6 files changed, 78 insertions(+) create mode 100644 examples/ninesixty/bootstrap.rb create mode 100644 examples/ninesixty/config.rb create mode 100644 examples/ninesixty/src/grid.sass create mode 100644 examples/ninesixty/src/text.sass diff --git a/.gitignore b/.gitignore index 81e3a86b..b6cd7a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ tmp/* examples/*/stylesheets/* examples/*/*.html examples/*/*/*.html +examples/*/extensions/* examples/*/src/.sass-cache test/tmp test/fixtures/stylesheets/*/tmp diff --git a/Rakefile b/Rakefile index 4f080678..47d77d7d 100644 --- a/Rakefile +++ b/Rakefile @@ -58,6 +58,7 @@ begin gemspec.files += Dir.glob("examples/**/*.*") gemspec.files -= Dir.glob("examples/**/*.css") gemspec.files -= Dir.glob("examples/**/*.html") + gemspec.files -= Dir.glob("examples/*/extensions/**") gemspec.files += Dir.glob("frameworks/**/*.*") gemspec.files += Dir.glob("lib/**/*") gemspec.files += Dir.glob("test/**/*.*") @@ -107,6 +108,8 @@ task :examples do next unless File.directory?(example) puts "\nCompiling #{example}" puts "=" * "Compiling #{example}".length + bootstrap_file = File.join(example, "bootstrap.rb") + load bootstrap_file if File.exists?(bootstrap_file) # compile any haml templates to html FileList["#{example}/**/*.haml"].each do |haml_file| basename = haml_file[0..-6] diff --git a/examples/ninesixty/bootstrap.rb b/examples/ninesixty/bootstrap.rb new file mode 100644 index 00000000..633640fe --- /dev/null +++ b/examples/ninesixty/bootstrap.rb @@ -0,0 +1,39 @@ +require 'net/http' +require 'fileutils' +require 'rubygems' +require 'zip/zip' + +extdir = File.join(File.dirname(__FILE__),'extensions') +download_link = "http://github.com/chriseppstein/compass-960-plugin/zipball/master" + +def fetch(uri_str, limit = 10) + raise ArgumentError, 'HTTP redirect too deep' if limit == 0 + + response = Net::HTTP.get_response(URI.parse(uri_str)) + case response + when Net::HTTPSuccess then response + when Net::HTTPRedirection then fetch(response['location'], limit - 1) + else + response.error! + end +end + + +if !File.exists?(extdir) + puts "Downloading and unpacking the ninesixty plugin." + FileUtils.mkdir(extdir) + zipfile = File.join(extdir, "ninesixty.zip") + open(zipfile, "wb") do |tgz| + tgz << fetch(download_link).body + end + Zip::ZipFile::open(zipfile) { |zf| + zf.each { |e| + fpath = File.join(extdir, e.name) + FileUtils.mkdir_p(File.dirname(fpath)) + zf.extract(e, fpath) + } + } + File.unlink(zipfile) + funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0] + FileUtils.mv(funky_directory, File.join(extdir,'ninesixty')) +end diff --git a/examples/ninesixty/config.rb b/examples/ninesixty/config.rb new file mode 100644 index 00000000..9f6e6154 --- /dev/null +++ b/examples/ninesixty/config.rb @@ -0,0 +1,9 @@ +project_type = :stand_alone +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "stylesheets" +sass_dir = "src" +images_dir = "images" +output_style = :compact +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true diff --git a/examples/ninesixty/src/grid.sass b/examples/ninesixty/src/grid.sass new file mode 100644 index 00000000..4198d85b --- /dev/null +++ b/examples/ninesixty/src/grid.sass @@ -0,0 +1,16 @@ +/* + 960 Grid System ~ Core CSS. + Learn more ~ http://960.gs/ + + Licensed under GPL and MIT. + +@import compass/utilities/general/reset.sass +@import 960/grid.sass + ++global-reset + +.container_12 + +grid-system(12) + +.container_16 + +grid-system(16) diff --git a/examples/ninesixty/src/text.sass b/examples/ninesixty/src/text.sass new file mode 100644 index 00000000..0b69854a --- /dev/null +++ b/examples/ninesixty/src/text.sass @@ -0,0 +1,10 @@ +/* + 960 Grid System ~ Text CSS. + Learn more ~ http://960.gs/ + + Licensed under GPL and MIT. + + +@import 960/text.sass + ++text From 92464c5f6abf60d50fcc6b4cf4d1fb5cb27e1bd1 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 27 Jul 2009 00:12:36 -0700 Subject: [PATCH 039/118] More flexible manifests that can see the installation options and might not even have any stylesheets or require a project configuration file. --- lib/compass/installers/base.rb | 2 +- lib/compass/installers/manifest.rb | 22 +++++++++++++++++++++- lib/compass/installers/rails.rb | 8 +++++--- lib/compass/installers/stand_alone.rb | 10 ++++++---- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index c3d32d24..c47d609c 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -14,7 +14,7 @@ module Compass @target_path = target_path @working_path = Dir.getwd @options = options - @manifest = Manifest.new(manifest_file) if template_path + @manifest = Manifest.new(manifest_file, options) if template_path self.logger = options[:logger] end diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index 7c780f40..0f1978f5 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -11,8 +11,12 @@ module Compass end end - def initialize(manifest_file = nil) + attr_reader :options + def initialize(manifest_file = nil, options = {}) @entries = [] + @options = options + @generate_config = true + @compile_after_generation = true parse(manifest_file) if manifest_file end @@ -41,8 +45,24 @@ module Compass @entries.each {|e| yield e} end + def generate_config? + @generate_config + end + + def compile? + @compile_after_generation + end protected + + def no_configuration_file! + @generate_config = false + end + + def skip_compilation! + @compile_after_generation = false + end + # parses a manifest file which is a ruby script # evaluated in a Manifest instance context def parse(manifest_file) diff --git a/lib/compass/installers/rails.rb b/lib/compass/installers/rails.rb index cce33d9e..9be2a44d 100644 --- a/lib/compass/installers/rails.rb +++ b/lib/compass/installers/rails.rb @@ -62,9 +62,11 @@ page request and keep them up to date when they change. Make sure you restart your server! NEXTSTEPS end - puts "\nNext add these lines to the head of your layouts:\n\n" - puts stylesheet_links - puts "\n(You are using haml, aren't you?)" + if manifest.has_stylesheet? + puts "\nNext add these lines to the head of your layouts:\n\n" + puts stylesheet_links + puts "\n(You are using haml, aren't you?)" + end end diff --git a/lib/compass/installers/stand_alone.rb b/lib/compass/installers/stand_alone.rb index 053670b3..a0113a66 100644 --- a/lib/compass/installers/stand_alone.rb +++ b/lib/compass/installers/stand_alone.rb @@ -43,7 +43,7 @@ module Compass end def prepare - write_configuration_files unless config_files_exist? + write_configuration_files unless config_files_exist? || !@manifest.generate_config? end def default_configuration @@ -69,12 +69,14 @@ This can be done in one of the following ways: compass --watch [path/to/project] NEXTSTEPS end - puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" - puts stylesheet_links + if manifest.has_stylesheet? + puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" + puts stylesheet_links + end end def compilation_required? - true + @manifest.compile? end end end From cb9672bd9ec1cdfa01fa5c5ffedd5979cdf07f73 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 27 Jul 2009 00:14:29 -0700 Subject: [PATCH 040/118] An extension template for helping to generate a compass extension: compass -p extension my_ext_name This will provide the basic structure for creating a basic compass plugin. --- frameworks/compass/templates/extension/manifest.rb | 6 ++++++ .../compass/templates/extension/stylesheets/main.sass | 1 + .../templates/extension/templates/project/manifest.rb | 2 ++ .../templates/extension/templates/project/screen.sass | 2 ++ 4 files changed, 11 insertions(+) create mode 100644 frameworks/compass/templates/extension/stylesheets/main.sass create mode 100644 frameworks/compass/templates/extension/templates/project/manifest.rb create mode 100644 frameworks/compass/templates/extension/templates/project/screen.sass diff --git a/frameworks/compass/templates/extension/manifest.rb b/frameworks/compass/templates/extension/manifest.rb index e69de29b..577f7b77 100644 --- a/frameworks/compass/templates/extension/manifest.rb +++ b/frameworks/compass/templates/extension/manifest.rb @@ -0,0 +1,6 @@ +file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:project_name])}.sass" +file 'templates/project/manifest.rb' +file 'templates/project/screen.sass' + +no_configuration_file! +skip_compilation! \ No newline at end of file diff --git a/frameworks/compass/templates/extension/stylesheets/main.sass b/frameworks/compass/templates/extension/stylesheets/main.sass new file mode 100644 index 00000000..bcccf41f --- /dev/null +++ b/frameworks/compass/templates/extension/stylesheets/main.sass @@ -0,0 +1 @@ +// This is your framework's main stylesheet. Use it to import all default modules. diff --git a/frameworks/compass/templates/extension/templates/project/manifest.rb b/frameworks/compass/templates/extension/templates/project/manifest.rb new file mode 100644 index 00000000..61591194 --- /dev/null +++ b/frameworks/compass/templates/extension/templates/project/manifest.rb @@ -0,0 +1,2 @@ +# Make sure you list all the project template files here in the manifest. +stylesheet 'screen.sass', :media => 'screen, projection' diff --git a/frameworks/compass/templates/extension/templates/project/screen.sass b/frameworks/compass/templates/extension/templates/project/screen.sass new file mode 100644 index 00000000..4558d133 --- /dev/null +++ b/frameworks/compass/templates/extension/templates/project/screen.sass @@ -0,0 +1,2 @@ +// This is where you put the contents of the main stylesheet for the user's project. +// It should import your sass stylesheets and demonstrate how to use them. \ No newline at end of file From d4971fcfaae9d1c7f9ae5f2dcd6e8d9af807c24e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 14:47:50 -0700 Subject: [PATCH 041/118] Slightly more robust extension downloader. --- examples/ninesixty/bootstrap.rb | 36 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/examples/ninesixty/bootstrap.rb b/examples/ninesixty/bootstrap.rb index 633640fe..9ed36e28 100644 --- a/examples/ninesixty/bootstrap.rb +++ b/examples/ninesixty/bootstrap.rb @@ -20,20 +20,26 @@ end if !File.exists?(extdir) - puts "Downloading and unpacking the ninesixty plugin." - FileUtils.mkdir(extdir) - zipfile = File.join(extdir, "ninesixty.zip") - open(zipfile, "wb") do |tgz| - tgz << fetch(download_link).body + begin + puts "Downloading the ninesixty plugin." + FileUtils.mkdir(extdir) + zipfile = File.join(extdir, "ninesixty.zip") + open(zipfile, "wb") do |tgz| + tgz << fetch(download_link).body + end + puts "Unzipping the ninesixty plugin." + Zip::ZipFile::open(zipfile) { |zf| + zf.each { |e| + fpath = File.join(extdir, e.name) + FileUtils.mkdir_p(File.dirname(fpath)) + zf.extract(e, fpath) + } + } + File.unlink(zipfile) + funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0] + FileUtils.mv(funky_directory, File.join(extdir,'ninesixty')) + rescue Exception => e + FileUtils.rmdir(extdir) + raise end - Zip::ZipFile::open(zipfile) { |zf| - zf.each { |e| - fpath = File.join(extdir, e.name) - FileUtils.mkdir_p(File.dirname(fpath)) - zf.extract(e, fpath) - } - } - File.unlink(zipfile) - funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0] - FileUtils.mv(funky_directory, File.join(extdir,'ninesixty')) end From 3b7637f1e596fd4d8cc66a7dfb1714582f7d846d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 29 Aug 2009 15:52:21 -0700 Subject: [PATCH 042/118] Bootstrap download the yui plugin for the examples. --- Rakefile | 9 +++--- examples/downloader.rb | 57 +++++++++++++++++++++++++++++++++ examples/ninesixty/bootstrap.rb | 45 ++------------------------ examples/yui/bootstrap.rb | 3 ++ 4 files changed, 66 insertions(+), 48 deletions(-) create mode 100644 examples/downloader.rb create mode 100644 examples/yui/bootstrap.rb diff --git a/Rakefile b/Rakefile index 47d77d7d..b53706ce 100644 --- a/Rakefile +++ b/Rakefile @@ -108,8 +108,10 @@ task :examples do next unless File.directory?(example) puts "\nCompiling #{example}" puts "=" * "Compiling #{example}".length - bootstrap_file = File.join(example, "bootstrap.rb") - load bootstrap_file if File.exists?(bootstrap_file) + Dir.chdir example do + load "bootstrap.rb" if File.exists?("bootstrap.rb") + Compass::Exec::Compass.new(["--force"]).run! + end # compile any haml templates to html FileList["#{example}/**/*.haml"].each do |haml_file| basename = haml_file[0..-6] @@ -119,9 +121,6 @@ task :examples do output.write(engine.render) output.close end - Dir.chdir example do - Compass::Exec::Compass.new(["--force"]).run! - end end end diff --git a/examples/downloader.rb b/examples/downloader.rb new file mode 100644 index 00000000..eef35e4e --- /dev/null +++ b/examples/downloader.rb @@ -0,0 +1,57 @@ +require 'net/http' +require 'fileutils' +require 'rubygems' +require 'zip/zip' + + +def fetch(uri_str, limit = 10) + raise ArgumentError, 'HTTP redirect too deep' if limit == 0 + + url = URI.parse(uri_str) + http = Net::HTTP.new(url.host, url.port) + http.open_timeout = 2 + http.read_timeout = 30 + response = http.start do |http| + puts "getting #{url.path}" + http.request_get(url.path) + end + + case response + when Net::HTTPSuccess then response + when Net::HTTPRedirection then fetch(response['location'], limit - 1) + else + response.error! + end +end + +def install_from_github(user, project, ext_name, working_directory = Dir.pwd) + download_link = "http://github.com/#{user}/#{project}/zipball/master" + extdir = File.join(working_directory,'extensions') + + if !File.exists?(extdir) + begin + puts "Downloading the #{ext_name} plugin into #{extdir}." + FileUtils.mkdir(extdir) + zipfile = File.join(extdir, "#{ext_name}.zip") + open(zipfile, "wb") do |tgz| + tgz << fetch(download_link).body + end + puts "Unzipping the #{ext_name} plugin." + Zip::ZipFile::open(zipfile) { |zf| + zf.each { |e| + fpath = File.join(extdir, e.name) + FileUtils.mkdir_p(File.dirname(fpath)) + zf.extract(e, fpath) + } + } + File.unlink(zipfile) + funky_directory = Dir.glob(File.join(extdir,"#{user}-#{project}-*"))[0] + FileUtils.mv(funky_directory, File.join(extdir, ext_name)) + puts "#{ext_name} installed." + rescue Exception => e + FileUtils.rm_rf(extdir) + raise + end + end + +end diff --git a/examples/ninesixty/bootstrap.rb b/examples/ninesixty/bootstrap.rb index 9ed36e28..b2b52d70 100644 --- a/examples/ninesixty/bootstrap.rb +++ b/examples/ninesixty/bootstrap.rb @@ -1,45 +1,4 @@ -require 'net/http' -require 'fileutils' -require 'rubygems' -require 'zip/zip' +require File.join(File.dirname(__FILE__), '..', 'downloader') -extdir = File.join(File.dirname(__FILE__),'extensions') -download_link = "http://github.com/chriseppstein/compass-960-plugin/zipball/master" +install_from_github('chriseppstein', 'compass-960-plugin', 'ninesixty') -def fetch(uri_str, limit = 10) - raise ArgumentError, 'HTTP redirect too deep' if limit == 0 - - response = Net::HTTP.get_response(URI.parse(uri_str)) - case response - when Net::HTTPSuccess then response - when Net::HTTPRedirection then fetch(response['location'], limit - 1) - else - response.error! - end -end - - -if !File.exists?(extdir) - begin - puts "Downloading the ninesixty plugin." - FileUtils.mkdir(extdir) - zipfile = File.join(extdir, "ninesixty.zip") - open(zipfile, "wb") do |tgz| - tgz << fetch(download_link).body - end - puts "Unzipping the ninesixty plugin." - Zip::ZipFile::open(zipfile) { |zf| - zf.each { |e| - fpath = File.join(extdir, e.name) - FileUtils.mkdir_p(File.dirname(fpath)) - zf.extract(e, fpath) - } - } - File.unlink(zipfile) - funky_directory = Dir.glob(File.join(extdir,'chriseppstein-compass-960-plugin-*'))[0] - FileUtils.mv(funky_directory, File.join(extdir,'ninesixty')) - rescue Exception => e - FileUtils.rmdir(extdir) - raise - end -end diff --git a/examples/yui/bootstrap.rb b/examples/yui/bootstrap.rb new file mode 100644 index 00000000..fcc0c7c4 --- /dev/null +++ b/examples/yui/bootstrap.rb @@ -0,0 +1,3 @@ +require File.join(File.dirname(__FILE__), '..', 'downloader') + +install_from_github('chriseppstein', 'yui-compass-plugin', 'yui') \ No newline at end of file From 8fa32acf79a86fa35be753e5bc894f4ec915f4d2 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 30 Aug 2009 02:22:52 -0700 Subject: [PATCH 043/118] The extension pattern works better when using the pattern name instead of the project name for the target sass file. --- frameworks/compass/templates/extension/manifest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/compass/templates/extension/manifest.rb b/frameworks/compass/templates/extension/manifest.rb index 577f7b77..cdfea4d3 100644 --- a/frameworks/compass/templates/extension/manifest.rb +++ b/frameworks/compass/templates/extension/manifest.rb @@ -1,4 +1,4 @@ -file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:project_name])}.sass" +file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:pattern_name])}.sass" file 'templates/project/manifest.rb' file 'templates/project/screen.sass' From ae47d7b0d8e4a13d3387905c408d2e21fcc1b2ce Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 30 Aug 2009 02:23:16 -0700 Subject: [PATCH 044/118] Documentation for compass extensions. --- EXTENSIONS.markdown | 183 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 EXTENSIONS.markdown diff --git a/EXTENSIONS.markdown b/EXTENSIONS.markdown new file mode 100644 index 00000000..745ad5e5 --- /dev/null +++ b/EXTENSIONS.markdown @@ -0,0 +1,183 @@ +Compass Extensions +================== + +Compass, at it's heart, is a framework upon which sass-based stylesheet frameworks are built. It provides the tools for building, installing and using reusable stylesheets that provide anything from full-fledged layout frameworks to designs for widgets or even full page designs. All using the power of sass to keep the semantic meaning of the html pages clear and free of design details. + +This document describes the compass extension toolset so that you can build your own compass extension. + +Basic Extension Layout +---------------------- + +
+an_extension
+|
+|- stylesheets (this directory will be on the sass load path)
+|  |
+|  |- an_extension (not technically required, but it's good to scope imports by the name of the extension)
+|  |  |
+|  |  |- _module_one.sass (this file would be imported using @import an_extension/module_one.sass)
+|  |  |- _module_two.sass (this file would be imported using @import an_extension/module_two.sass)
+|  |  |- ...
+|  |
+|  |- _an_extension.sass (This file will import the entire extension using @import an_extension.sass)
+|
+|- templates (this is where templates/patterns go)
+|  |
+|  |- project (this should be provided if you'd like people to be able to base their project on the extension)
+|  |  |
+|  |  |- manifest.rb (this file should declare the contents of the template)
+|  |  |- screen.sass (this would be the main stylesheet, importing from your extension and demonstrating its use)
+|  |  |- print.sass (this file would set up basic print styles)
+|  |  |- ie.sass (if you want, you can provide custom styles for IE)
+|  |
+|  |- some_pattern
+|     |
+|     |- manifest.rb
+|     |- some.sass (some sass is probably in order, always import from the extension library as much as possible)
+|     |- some_script.js (yes, you can provide javascript code)
+|     |- some_image.png (and images)
+|     |- some_content.html.haml (and even html and haml)
+|     |- some_other_file.txt (and other arbitrary files)
+|
+|- lib (optional ruby code)
+   |
+   |- an_extension.rb (this code can register your framework if you deviate from conventions and require sass extensions, etc.)
+   |
+   |- an_extension
+      |
+      |- sass_extensions.rb (this is the standard location to place sass functions)
+
+ +Names in bold are part of the extension naming convention. + +Generating an Extension +----------------------- + +If you want a leg up to get started working on your extension, you can use compass to generate an extension with the following command: + + compass -p extension -n an_extension . + +This will create a few basic files and folders to get you started, use the -n option to specify the name of your extension. + +Advanced Layout Options +----------------------- + +### Library File Location + +The extension library file referenced above as `an_extension/lib/an_extension.rb` can actually be stored at any of the following three locations: + +1. `an_extension/compass_init.rb` +2. `an_extension/lib/an_extension.rb` +3. `an_extension/an_extension.rb` + +The first of those locations found (in the above order) will be loaded. The compass_init.rb file takes priority, so that extensions that want to work differently as compass extensions than they do as normal ruby libraries, have a way of targeting compass. + +### Stylesheet and Template Locations + +If you'd like to store your stylesheets and/or templates in a non-standard location within your extension, +you must provide a library file and register the extension explicitly like so: + + base_directory = File.join(File.dirname(__FILE__), '..') # assuming you're in the lib directory + stylesheets_dir = File.join(base_directory, 'my', 'stylesheets') # always use File.join for support on unix and windows + templates_dir = File.join(base_directory, 'my', 'templates') # always use File.join for support on unix and windows + Compass::Frameworks.register('an_extension', :stylesheets_directory => stylesheets_dir, :templates_directory => templates_dir) + +If you're following the standard naming convention, but the stylesheet and template directories are not at the top level, you can just do this instead: + + base_directory = File.join(File.dirname(__FILE__), '..', 'compass') # path from the library file to where you're keeping your compass stuff. + Compass::Frameworks.register('an_extension', :path => base_directory) + +Conventions to Follow +--------------------- + +The following are not required, but are standards that your framework should attempt to adhere to unless there's a good reason not to do so. + +1. Have a single import for your framework. +2. Break up your framework into modules so that people can import just smaller pieces for faster load times when they're not using everything. +3. Use partials (files starting with an underscore) for stylesheets that are meant to be imported. If you do not Sass will generate css + files for your libaries in some configurations. +4. Provide a project template. If you do not, your project should only be providing widgets or page designs, etc. + +Building a Template (a.k.a. Pattern) +==================================== + +Manifest Files +-------------- + +The manifest file declares the template contents and tells compass information about the files in the template. + +### An Example Manifest File + + stylesheet 'screen.sass', :media => 'screen, projection' + stylesheet 'partials/_base.sass' + stylesheet 'print.sass', :media => 'print' + stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8" + + image 'grid.png' + javascript 'script.js' + + html 'welcome.html.haml', :erb => true + file 'README' + +### Manifest Declarations + +There are five kinds of manifest declarations: + +1. `stylesheet` - Declares a sass file. +2. `image` - Declares an image. +3. `javascript` - Declares a javascript file. +4. `html` - Declares an html file. +5. `file` - Decares a random file. + +All declarations take the path to the file as their first argument. Note that the normal slash `/` can and should be used in a manifest. Compass will take care of the cross platform issues. The path to the file will be reproduced in the user's project, so please keep that in mind when creating folders. The location where files are going to be installed is dictated by the user's project configuration, however, a template can place things into subdirectories relative to + +Common options: + +* `:erb` - When set to true, the file will be processed via the ERB templating language. See the "Advanced Manifests" section below for more details. +* `:to` - The location where the file should be installed relative to the type-specific location. +* `:like` - Most often used with a `file` declaration, this option allows you to install into the location of another manifest type (and also :css). E.g. :like => :css + +Stylesheet options: + +* `:media` - this is used as a hint to the user about the media attribute of the stylesheet link tag. +* `:condition` - this is used to hint the user that a conditional comment should be used to import the stylesheet with the given condition. + +HTML files: + +You can provide html as haml or as plain html. If you provide haml, the haml will be converted to html when it is installed, unless the project allows haml files. Providing html files is usually done to demonstrate how to use a more complicated design and to get the user started off with working product. + +### Advanced Manifests and Templates + +* ERB Processing - This can be used to customize the contents of the file in an extension template. The template will be processed in the context of a TemplateContext instance, which gives you access to the full project configuration information as well as the command line options. Since it's unlikely many templates will need this functionality, I leave it as an exercise of the user to figure it out and if they can't to contact the compass-devs mailing list for assistance. +* `no_configuration_file!` - calling this method within the manifest will tell the installer to skip the creation of a configuration file. +* `skip_compilation!` - calling this method within the manifest will tell the installer to skip compilation of sass files to css. + +Distributing Extensions as Ruby Gems +------------------------------------ + +How to build and distribute ruby gems is outside the scope of this document. But delivering an extension as a ruby gem makes it easier to manage software dependencies, install, and uninstall. + +Tips for Developing Extensions +------------------------------ + +* If you're developing a simple extension, you may find it convenient to place your extension within an existing compass project in the extension folder. + +Installing Extensions +--------------------- + +TBD: How to install extensions that are not managed via ruby gems and when there's no existing project. Maybe in ~/.compass/extensions? + +TBD: How to install extensions for rails projects? Maybe in vendor/plugins/compass_extensions? + +To install via ruby gems: + + sudo gem install an-extension + compass -r `an_extension` -f an_extension my_project + +To install into an existing project, simply place the extension into a project's extension directory. This could be done via a git clone or by extracting an archive. + +To install via rubygems into an existing project: + + sudo gem install an-extension + # edit the project configuration file and add: + require 'an_extension' \ No newline at end of file From dac4aa9723fc7b1955f9225578605e6eb7661bf9 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 30 Aug 2009 10:08:35 -0700 Subject: [PATCH 045/118] Fix a minor punctuation error in EXTENSIONS.markdown. --- EXTENSIONS.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EXTENSIONS.markdown b/EXTENSIONS.markdown index 745ad5e5..a3b4d8d3 100644 --- a/EXTENSIONS.markdown +++ b/EXTENSIONS.markdown @@ -1,7 +1,7 @@ Compass Extensions ================== -Compass, at it's heart, is a framework upon which sass-based stylesheet frameworks are built. It provides the tools for building, installing and using reusable stylesheets that provide anything from full-fledged layout frameworks to designs for widgets or even full page designs. All using the power of sass to keep the semantic meaning of the html pages clear and free of design details. +Compass, at its heart, is a framework upon which sass-based stylesheet frameworks are built. It provides the tools for building, installing and using reusable stylesheets that provide anything from full-fledged layout frameworks to designs for widgets or even full page designs. All using the power of sass to keep the semantic meaning of the html pages clear and free of design details. This document describes the compass extension toolset so that you can build your own compass extension. @@ -180,4 +180,4 @@ To install via rubygems into an existing project: sudo gem install an-extension # edit the project configuration file and add: - require 'an_extension' \ No newline at end of file + require 'an_extension' From cd77436c85d732b2468c5b6fd53f36efc5867197 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 1 Sep 2009 09:12:50 -0700 Subject: [PATCH 046/118] New link to the Sass Website. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 77c8de67..6cbae5f6 100644 --- a/README.markdown +++ b/README.markdown @@ -25,7 +25,7 @@ Copyright (c) 2008-2009 Christopher M. Eppstein
All Rights Reserved.
Released under a [slightly modified MIT License][license]. -[sass]: http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html "Syntactically Awesome StyleSheets" +[sass]: http://sass-lang.com/ "Syntactically Awesome StyleSheets" [compass_core_website]: http://github.com/chriseppstein/compass/tree/master/frameworks/compass [compass_core_wiki]: http://github.com/chriseppstein/compass/wikis/compass-core-documentation [blueprint_website]: http://blueprintcss.org/ From 1ea8c9d57918ca673f04f95e37e915c3b1bab179 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 1 Sep 2009 09:18:02 -0700 Subject: [PATCH 047/118] Link to the plugins page on the wiki. --- README.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.markdown b/README.markdown index 6cbae5f6..be93d85f 100644 --- a/README.markdown +++ b/README.markdown @@ -5,6 +5,7 @@ A [Sass][sass]-based CSS Meta-Framework that allows you to mix and match any of - [Blueprint][blueprint_website] - [Wiki Documentation][bleuprint_wiki] - [YUI][yui_website] - [Wiki Documentation][yui_wiki] - [960][ninesixty_website] - [Wiki Documentation][ninesixty_wiki] +- New frameworks and extensions are [tracked on the wiki][plugins_wiki] as they are created. - Other frameworks can be added relatively easily. Create your own! ## Compass Provides @@ -32,6 +33,7 @@ Released under a [slightly modified MIT License][license]. [bleuprint_wiki]: http://github.com/chriseppstein/compass/wikis/blueprint-documentation [yui_website]: http://developer.yahoo.com/yui/grids/ [yui_wiki]: http://github.com/chriseppstein/compass/wikis/yui-documentation +[plugins_wiki]: http://github.com/chriseppstein/compass/wikis/compass-plugins [ninesixty_website]: http://960.gs/ [ninesixty_wiki]: http://github.com/chriseppstein/compass/wikis/960gs-documentation [command_line_wiki]: http://wiki.github.com/chriseppstein/compass/command-line-tool From cb45b6d4384f53e410ff796a19f86154fcceee38 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 1 Sep 2009 17:22:26 -0700 Subject: [PATCH 048/118] Generalized application framework integration. There are three that ship with compass: Merb, Rails, and StandAlone. All application specific behavior is now centralized within the app integration modules. Plugins can now provide app integration using the --app command line option and by adding the appropriate classes to the compass module tree. --- lib/compass/app_integration.rb | 8 +- lib/compass/app_integration/merb.rb | 65 +------- lib/compass/app_integration/merb/runtime.rb | 63 ++++++++ lib/compass/app_integration/rails.rb | 18 +-- .../rails/configuration_defaults.rb | 29 ++++ .../app_integration/rails/installer.rb | 127 +++++++++++++++ lib/compass/app_integration/rails/runtime.rb | 14 ++ lib/compass/app_integration/stand_alone.rb | 3 + .../stand_alone/configuration.rb | 0 .../stand_alone/configuration_defaults.rb | 24 +++ .../app_integration/stand_alone/installer.rb | 71 +++++++++ lib/compass/commands/installer_command.rb | 16 +- lib/compass/exec.rb | 6 +- lib/compass/installers.rb | 2 +- lib/compass/installers/rails.rb | 144 ------------------ lib/compass/installers/stand_alone.rb | 83 ---------- test/command_line_helper.rb | 6 +- test/rails_integration_test.rb | 4 +- 18 files changed, 362 insertions(+), 321 deletions(-) create mode 100644 lib/compass/app_integration/merb/runtime.rb create mode 100644 lib/compass/app_integration/rails/configuration_defaults.rb create mode 100644 lib/compass/app_integration/rails/installer.rb create mode 100644 lib/compass/app_integration/rails/runtime.rb delete mode 100644 lib/compass/app_integration/stand_alone/configuration.rb create mode 100644 lib/compass/app_integration/stand_alone/configuration_defaults.rb create mode 100644 lib/compass/app_integration/stand_alone/installer.rb delete mode 100644 lib/compass/installers/rails.rb delete mode 100644 lib/compass/installers/stand_alone.rb diff --git a/lib/compass/app_integration.rb b/lib/compass/app_integration.rb index 58e55913..9e81105d 100644 --- a/lib/compass/app_integration.rb +++ b/lib/compass/app_integration.rb @@ -1,5 +1,3 @@ -# If we're running inside Rails -require File.join(File.dirname(__FILE__), 'app_integration', 'rails') if defined?(ActionController::Base) - -# If we're running inside Merb -require File.join(File.dirname(__FILE__), 'app_integration', 'merb') if defined?(Merb::Plugins) +%w(stand_alone rails merb).each do |lib| + require File.join(File.dirname(__FILE__), 'app_integration', lib) +end diff --git a/lib/compass/app_integration/merb.rb b/lib/compass/app_integration/merb.rb index 90b9f826..bb460dc9 100644 --- a/lib/compass/app_integration/merb.rb +++ b/lib/compass/app_integration/merb.rb @@ -1,64 +1 @@ -# To configure Merb to use compass do the following: -# -# Add dependencies to config/dependencies.rb -# -# dependency "haml", ">=2.2.0" -# dependency "merb-haml", merb_gems_version -# dependency "chriseppstein-compass", :require_as => 'compass' -# -# -# To use a different sass stylesheets locations as is recommended by compass -# add this configuration to your configuration block: -# -# Merb::BootLoader.before_app_loads do -# Merb::Plugins.config[:compass] = { -# :stylesheets => "app/stylesheets", -# :compiled_stylesheets => "public/stylesheets/compiled" -# } -# end -# - -module Compass - def self.setup_template_location - # default the compass configuration if they didn't set it up yet. - Merb::Plugins.config[:compass] ||= {} - - # default sass stylesheet location unless configured to something else - Merb::Plugins.config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass" - - # default sass css location unless configured to something else - Merb::Plugins.config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet) - - #define the template hash for the project stylesheets as well as the framework stylesheets. - template_location = { - Merb::Plugins.config[:compass][:stylesheets] => Merb::Plugins.config[:compass][:compiled_stylesheets] - } - Compass::Frameworks::ALL.each do |framework| - template_location[framework.stylesheets_directory] = Merb::Plugins.config[:compass][:compiled_stylesheets] - end - - # merge existing template locations if present - if Merb::Plugins.config[:sass][:template_location].is_a?(Hash) - template_location.merge!(Merb::Plugins.config[:sass][:template_location]) - Merb::Plugins.config[:sass][:template_location] = template_location - end - - #configure Sass to know about all these sass locations. - Sass::Plugin.options[:template_location] = template_location - end -end - -Merb::BootLoader.after_app_loads do - #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location. - unless defined?(Sass::Plugin) - require "sass/plugin" - if Merb::Plugins.config[:sass] - Sass::Plugin.options = Merb::Plugins.config[:sass] - # support old (deprecatd Merb::Config[:sass] option) - elsif Merb::Config[:sass] - Sass::Plugin.options = Merb::Config[:sass] - end - end - - Compass.setup_template_location -end +require File.join(File.dirname(__FILE__), 'merb', 'runtime') if defined?(Merb::Plugins) diff --git a/lib/compass/app_integration/merb/runtime.rb b/lib/compass/app_integration/merb/runtime.rb new file mode 100644 index 00000000..883c4de7 --- /dev/null +++ b/lib/compass/app_integration/merb/runtime.rb @@ -0,0 +1,63 @@ +# To configure Merb to use compass do the following: +# +# Add dependencies to config/dependencies.rb +# +# dependency "haml", ">=2.2.0" +# dependency "merb-haml", merb_gems_version +# dependency "chriseppstein-compass", :require_as => 'compass' +# +# +# To use a different sass stylesheets locations as is recommended by compass +# add this configuration to your configuration block: +# +# Merb::BootLoader.before_app_loads do +# Merb::Plugins.config[:compass] = { +# :stylesheets => "app/stylesheets", +# :compiled_stylesheets => "public/stylesheets/compiled" +# } +# end +# +module Compass + def self.setup_template_location + # default the compass configuration if they didn't set it up yet. + Merb::Plugins.config[:compass] ||= {} + + # default sass stylesheet location unless configured to something else + Merb::Plugins.config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass" + + # default sass css location unless configured to something else + Merb::Plugins.config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet) + + #define the template hash for the project stylesheets as well as the framework stylesheets. + template_location = { + Merb::Plugins.config[:compass][:stylesheets] => Merb::Plugins.config[:compass][:compiled_stylesheets] + } + Compass::Frameworks::ALL.each do |framework| + template_location[framework.stylesheets_directory] = Merb::Plugins.config[:compass][:compiled_stylesheets] + end + + # merge existing template locations if present + if Merb::Plugins.config[:sass][:template_location].is_a?(Hash) + template_location.merge!(Merb::Plugins.config[:sass][:template_location]) + Merb::Plugins.config[:sass][:template_location] = template_location + end + + #configure Sass to know about all these sass locations. + Sass::Plugin.options[:template_location] = template_location + end +end + +Merb::BootLoader.after_app_loads do + #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location. + unless defined?(Sass::Plugin) + require "sass/plugin" + if Merb::Plugins.config[:sass] + Sass::Plugin.options = Merb::Plugins.config[:sass] + # support old (deprecatd Merb::Config[:sass] option) + elsif Merb::Config[:sass] + Sass::Plugin.options = Merb::Config[:sass] + end + end + + Compass.setup_template_location +end diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index 904be241..c095e889 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -1,12 +1,8 @@ -unless defined?(Compass::RAILS_LOADED) - Compass::RAILS_LOADED = true - require File.join(File.dirname(__FILE__), 'rails', 'action_controller') - require File.join(File.dirname(__FILE__), 'rails', 'sass_plugin') - require File.join(File.dirname(__FILE__), 'rails', 'urls') - # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? - class Sass::Script::Functions::EvaluationContext - include Sass::Script::Functions - private - include ActionView::Helpers::AssetTagHelper - end +%w(configuration_defaults installer).each do |lib| + require File.join(File.dirname(__FILE__), 'rails', lib) end + +require File.join(File.dirname(__FILE__), 'rails', 'runtime') if defined?(ActionController::Base) + + + diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb new file mode 100644 index 00000000..be44f13d --- /dev/null +++ b/lib/compass/app_integration/rails/configuration_defaults.rb @@ -0,0 +1,29 @@ +module Compass + module AppIntegration + module Rails + module ConfigurationDefaults + + def default_images_dir + File.join("public", "images") + end + + def default_javascripts_dir + File.join("public", "javascripts") + end + + def default_http_images_path + "/images" + end + + def default_http_javascripts_path + "/javascripts" + end + + def default_http_stylesheets_path + "/stylesheets" + end + + end + end + end +end diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb new file mode 100644 index 00000000..3023c33f --- /dev/null +++ b/lib/compass/app_integration/rails/installer.rb @@ -0,0 +1,127 @@ +module Compass + module Installers + class Base + end + end + + module AppIntegration + module Rails + class Installer < Compass::Installers::Base + + def default_configuration + Compass::Configuration::Data.new.extend(ConfigurationDefaults) + end + + def completed_configuration + config = {} + config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default + config[:css_dir] = prompt_css_dir unless css_dir_without_default + config unless config.empty? + end + + def write_configuration_files(config_file = nil) + config_file ||= targetize('config/compass.config') + write_file config_file, config_contents + write_file targetize('config/initializers/compass.rb'), initializer_contents + end + + def config_files_exist? + File.exists?(targetize('config/compass.config')) && + File.exists?(targetize('config/initializers/compass.rb')) + end + + def prepare + write_configuration_files unless config_files_exist? + end + + def finalize(options = {}) + if options[:create] + puts <<-NEXTSTEPS + + Congratulations! Your rails project has been configured to use Compass. + Sass will automatically compile your stylesheets during the next + page request and keep them up to date when they change. + Make sure you restart your server! + NEXTSTEPS + end + if manifest.has_stylesheet? + puts "\nNext add these lines to the head of your layouts:\n\n" + puts stylesheet_links + puts "\n(You are using haml, aren't you?)" + end + end + + + def install_location_for_html(to, options) + separate("public/#{pattern_name_as_dir}#{to}") + end + + def prompt_sass_dir + recommended_location = separate('app/stylesheets') + default_location = separate('public/stylesheets/sass') + print %Q{Compass recommends that you keep your stylesheets in #{recommended_location} + instead of the Sass default location of #{default_location}. + Is this OK? (Y/n) } + answer = gets.downcase[0] + answer == ?n ? default_location : recommended_location + end + + def prompt_css_dir + recommended_location = separate("public/stylesheets/compiled") + default_location = separate("public/stylesheets") + puts + print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/ + instead the Sass default of #{default_location}/. + However, if you're exclusively using Sass, then #{default_location}/ is recommended. + Emit compiled stylesheets to #{recommended_location}/? (Y/n) } + answer = gets.downcase[0] + answer == ?n ? default_location : recommended_location + end + + def config_contents + Compass.configuration.serialize do |prop, value| + if prop == :project_path + "project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n" + elsif prop == :output_style + "" + end + end + end + + def initializer_contents + %Q{require 'compass' + # If you have any compass plugins, require them here. + Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.config")) + Compass.configuration.environment = RAILS_ENV.to_sym + Compass.configure_sass_plugin! + } + end + + def stylesheet_prefix + if css_dir.length >= 19 + "#{css_dir[19..-1]}/" + else + nil + end + end + + def stylesheet_links + html = "%head\n" + manifest.each_stylesheet do |stylesheet| + # Skip partials. + next if File.basename(stylesheet.from)[0..0] == "_" + ss_line = " = stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'" + if stylesheet.options[:media] + ss_line += ", :media => '#{stylesheet.options[:media]}'" + end + if stylesheet.options[:condition] + ss_line = " /[if #{stylesheet.options[:condition]}]\n " + ss_line + end + html << ss_line + "\n" + end + html + end + end + end + end +end diff --git a/lib/compass/app_integration/rails/runtime.rb b/lib/compass/app_integration/rails/runtime.rb new file mode 100644 index 00000000..8cc3b061 --- /dev/null +++ b/lib/compass/app_integration/rails/runtime.rb @@ -0,0 +1,14 @@ +unless defined?(Compass::RAILS_LOADED) + Compass::RAILS_LOADED = true + + %w(action_controller sass_plugin urls).each do |lib| + require File.join(File.dirname(__FILE__), lib) + end + + # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? + class Sass::Script::Functions::EvaluationContext + include Sass::Script::Functions + private + include ActionView::Helpers::AssetTagHelper + end +end diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb index e69de29b..f5cc3c21 100644 --- a/lib/compass/app_integration/stand_alone.rb +++ b/lib/compass/app_integration/stand_alone.rb @@ -0,0 +1,3 @@ +['configuration_defaults', 'installer'].each do |lib| + require File.join(File.dirname(__FILE__), 'stand_alone', lib) +end \ No newline at end of file diff --git a/lib/compass/app_integration/stand_alone/configuration.rb b/lib/compass/app_integration/stand_alone/configuration.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/compass/app_integration/stand_alone/configuration_defaults.rb b/lib/compass/app_integration/stand_alone/configuration_defaults.rb new file mode 100644 index 00000000..a9ed92dc --- /dev/null +++ b/lib/compass/app_integration/stand_alone/configuration_defaults.rb @@ -0,0 +1,24 @@ +module Compass + module AppIntegration + module StandAlone + module ConfigurationDefaults + def sass_dir_without_default + "src" + end + + def javascripts_dir_without_default + "javascripts" + end + + def css_dir_without_default + "stylesheets" + end + + def images_dir_without_default + "images" + end + end + + end + end +end \ No newline at end of file diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb new file mode 100644 index 00000000..4480cc46 --- /dev/null +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -0,0 +1,71 @@ +module Compass + module Installers + class Base + end + end + + module AppIntegration + module StandAlone + class Installer < Compass::Installers::Base + + def init + directory targetize("") + super + end + + def write_configuration_files(config_file = nil) + config_file ||= targetize('config.rb') + write_file config_file, config_contents + end + + def config_files_exist? + File.exists? targetize('config.rb') + end + + def config_contents + project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil + Compass.configuration.serialize + ensure + Compass.configuration.project_path = project_path + end + + def prepare + write_configuration_files unless config_files_exist? || !@manifest.generate_config? + end + + def default_configuration + Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults) + end + + def completed_configuration + nil + end + + def finalize(options = {}) + if options[:create] + puts <<-NEXTSTEPS + + Congratulations! Your compass project has been created. + You must recompile your sass stylesheets when they change. + This can be done in one of the following ways: + 1. From within your project directory run: + compass + 2. From any directory run: + compass -u path/to/project + 3. To monitor your project for changes and automatically recompile: + compass --watch [path/to/project] + NEXTSTEPS + end + if manifest.has_stylesheet? + puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" + puts stylesheet_links + end + end + + def compilation_required? + @manifest.compile? + end + end + end + end +end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 41915d36..f63f5acc 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -16,14 +16,14 @@ module Compass end def installer - @installer ||= case (options[:project_type] || Compass.configuration.project_type) - when :stand_alone - StandAloneInstaller.new *installer_args - when :rails - RailsInstaller.new *installer_args - else - raise "Unknown project type: #{options[:project_type].inspect}" - end + project_type = options[:project_type] || Compass.configuration.project_type + installer_class = "Compass::AppIntegration::#{camelize(project_type)}::Installer" + @installer = eval("#{installer_class}.new *installer_args") + end + + # Stolen from ActiveSupport + def camelize(s) + s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } end def installer_args diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 6596d2cf..12cdc29c 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -146,10 +146,14 @@ END self.options[:pattern_name] = name end - opts.on('--rails', "Sets the project type to a rails project.") do + opts.on('--rails', "Sets the app type to a rails project (same as --app rails).") do self.options[:project_type] = :rails end + opts.on('--app APP_TYPE', 'Specify the kind of application to integrate with.') do |project_type| + self.options[:project_type] = project_type.to_sym + end + opts.separator '' opts.separator 'Configuration Options:' diff --git a/lib/compass/installers.rb b/lib/compass/installers.rb index dbb2be41..7ae1b400 100644 --- a/lib/compass/installers.rb +++ b/lib/compass/installers.rb @@ -1,3 +1,3 @@ -%w(manifest template_context base stand_alone rails).each do |f| +%w(manifest template_context base).each do |f| require File.join(File.dirname(__FILE__), 'installers', f) end diff --git a/lib/compass/installers/rails.rb b/lib/compass/installers/rails.rb deleted file mode 100644 index 9be2a44d..00000000 --- a/lib/compass/installers/rails.rb +++ /dev/null @@ -1,144 +0,0 @@ -module Compass - module Installers - - class RailsInstaller < Base - - module ConfigurationDefaults - def default_images_dir - File.join("public", "images") - end - - def default_javascripts_dir - File.join("public", "javascripts") - end - - def default_http_images_path - "/images" - end - - def default_http_javascripts_path - "/javascripts" - end - - def default_http_stylesheets_path - "/stylesheets" - end - - end - - def default_configuration - Compass::Configuration::Data.new.extend(ConfigurationDefaults) - end - - def completed_configuration - config = {} - config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default - config[:css_dir] = prompt_css_dir unless css_dir_without_default - config unless config.empty? - end - - def write_configuration_files(config_file = nil) - config_file ||= targetize('config/compass.config') - write_file config_file, config_contents - write_file targetize('config/initializers/compass.rb'), initializer_contents - end - - def config_files_exist? - File.exists?(targetize('config/compass.config')) && - File.exists?(targetize('config/initializers/compass.rb')) - end - - def prepare - write_configuration_files unless config_files_exist? - end - - def finalize(options = {}) - if options[:create] - puts <<-NEXTSTEPS - -Congratulations! Your rails project has been configured to use Compass. -Sass will automatically compile your stylesheets during the next -page request and keep them up to date when they change. -Make sure you restart your server! -NEXTSTEPS - end - if manifest.has_stylesheet? - puts "\nNext add these lines to the head of your layouts:\n\n" - puts stylesheet_links - puts "\n(You are using haml, aren't you?)" - end - end - - - def install_location_for_html(to, options) - separate("public/#{pattern_name_as_dir}#{to}") - end - - def prompt_sass_dir - recommended_location = separate('app/stylesheets') - default_location = separate('public/stylesheets/sass') - print %Q{Compass recommends that you keep your stylesheets in #{recommended_location} -instead of the Sass default location of #{default_location}. -Is this OK? (Y/n) } - answer = gets.downcase[0] - answer == ?n ? default_location : recommended_location - end - - def prompt_css_dir - recommended_location = separate("public/stylesheets/compiled") - default_location = separate("public/stylesheets") - puts - print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/ -instead the Sass default of #{default_location}/. -However, if you're exclusively using Sass, then #{default_location}/ is recommended. -Emit compiled stylesheets to #{recommended_location}/? (Y/n) } - answer = gets.downcase[0] - answer == ?n ? default_location : recommended_location - end - - def config_contents - Compass.configuration.serialize do |prop, value| - if prop == :project_path - "project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n" - elsif prop == :output_style - "" - end - end - end - - def initializer_contents - %Q{require 'compass' -# If you have any compass plugins, require them here. -Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.config")) -Compass.configuration.environment = RAILS_ENV.to_sym -Compass.configure_sass_plugin! -} - end - - def stylesheet_prefix - if css_dir.length >= 19 - "#{css_dir[19..-1]}/" - else - nil - end - end - - def stylesheet_links - html = "%head\n" - manifest.each_stylesheet do |stylesheet| - # Skip partials. - next if File.basename(stylesheet.from)[0..0] == "_" - ss_line = " = stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'" - if stylesheet.options[:media] - ss_line += ", :media => '#{stylesheet.options[:media]}'" - end - if stylesheet.options[:condition] - ss_line = " /[if #{stylesheet.options[:condition]}]\n " + ss_line - end - html << ss_line + "\n" - end - html - end - end - end -end diff --git a/lib/compass/installers/stand_alone.rb b/lib/compass/installers/stand_alone.rb deleted file mode 100644 index a0113a66..00000000 --- a/lib/compass/installers/stand_alone.rb +++ /dev/null @@ -1,83 +0,0 @@ -module Compass - module Installers - - class StandAloneInstaller < Base - - module ConfigurationDefaults - def sass_dir_without_default - "src" - end - - def javascripts_dir_without_default - "javascripts" - end - - def css_dir_without_default - "stylesheets" - end - - def images_dir_without_default - "images" - end - end - - def init - directory targetize("") - super - end - - def write_configuration_files(config_file = nil) - config_file ||= targetize('config.rb') - write_file config_file, config_contents - end - - def config_files_exist? - File.exists? targetize('config.rb') - end - - def config_contents - project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil - Compass.configuration.serialize - ensure - Compass.configuration.project_path = project_path - end - - def prepare - write_configuration_files unless config_files_exist? || !@manifest.generate_config? - end - - def default_configuration - Compass::Configuration::Data.new.extend(ConfigurationDefaults) - end - - def completed_configuration - nil - end - - def finalize(options = {}) - if options[:create] - puts <<-NEXTSTEPS - -Congratulations! Your compass project has been created. -You must recompile your sass stylesheets when they change. -This can be done in one of the following ways: - 1. From within your project directory run: - compass - 2. From any directory run: - compass -u path/to/project - 3. To monitor your project for changes and automatically recompile: - compass --watch [path/to/project] -NEXTSTEPS - end - if manifest.has_stylesheet? - puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" - puts stylesheet_links - end - end - - def compilation_required? - @manifest.compile? - end - end - end -end diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index d74b191a..077caaf4 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -17,9 +17,11 @@ module Compass::CommandLineHelper else eof_at = nil timeout(1) do - output << io.readpartial(1024) + partial_output = io.readpartial(1024) + # puts "))))#{partial_output}(((((" + output << partial_output end - prompt = output.split("\n").last + prompt = output.split("\n").last.strip if response = responder.response_for(prompt) io.puts response end diff --git a/test/rails_integration_test.rb b/test/rails_integration_test.rb index 9f689a1b..f57c8a97 100644 --- a/test/rails_integration_test.rb +++ b/test/rails_integration_test.rb @@ -18,8 +18,8 @@ class RailsIntegrationTest < Test::Unit::TestCase generate_rails_app_directories("compass_rails") Dir.chdir "compass_rails" do compass("--rails", '--trace', ".") do |responder| - responder.respond_to "Is this OK? (Y/n) ", :with => "Y", :required => true - responder.respond_to "Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n) ", :with => "Y", :required => true + responder.respond_to "Is this OK? (Y/n)", :with => "Y", :required => true + responder.respond_to "Emit compiled stylesheets to public/stylesheets/compiled/? (Y/n)", :with => "Y", :required => true end # puts ">>>#{@last_result}<<<" assert_action_performed :create, "./app/stylesheets/screen.sass" From 54a459f28ea090d62c472bd08e31e0fa2790034b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 1 Sep 2009 20:20:53 -0700 Subject: [PATCH 049/118] Allow specification of a height for the grid image. --- lib/compass/commands/generate_grid_background.rb | 13 +++++++++++-- lib/compass/exec.rb | 8 ++------ lib/compass/grid_builder.rb | 9 +++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index d294d030..0494a420 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -9,11 +9,20 @@ module Compass def initialize(working_path, options) super assert_project_directory_exists! + Compass.add_configuration(options) end def perform - column_width, gutter_width = options[:grid_dimensions].split(/\+/).map{|d| d.to_i} - unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :output_path => projectize(project_images_subdirectory), :working_path => self.working_path)).generate! + unless options[:grid_dimensions] =~ /^(\d+)\+(\d+)(?:x(\d+))?$/ + puts "ERROR: '#{options[:grid_dimensions]}' is not valid." + puts "Dimensions should be specified like: 30+10x20" + puts "where 30 is the column width, 10 is the gutter width, and 20 is the (optional) height." + return + end + column_width = $1.to_i + gutter_width = $2.to_i + height = $3.to_i if $3 + unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :height => height, :output_path => projectize(project_images_subdirectory), :working_path => self.working_path)).generate! puts "ERROR: Some library dependencies appear to be missing." puts "Have you installed rmagick? If not, please run:" puts "sudo gem install rmagick" diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 12cdc29c..f7a7ba90 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -124,13 +124,9 @@ END end opts.on('--grid-img [DIMENSIONS]', 'Generate a background image to test grid alignment.', - ' Dimension is given as +.', - ' Defaults to 30+10.') do |dimensions| + ' Dimension is given as +x.', + ' Defaults to 30+10x20. Height is optional.') do |dimensions| self.options[:grid_dimensions] = dimensions || "30+10" - unless self.options[:grid_dimensions] =~ /^\d+\+\d+$/ - puts "Please enter your dimensions as +. E.g. 20+5 or 30+10." - exit - end self.options[:command] = :generate_grid_background end diff --git a/lib/compass/grid_builder.rb b/lib/compass/grid_builder.rb index 0c91f60f..8112b1bc 100644 --- a/lib/compass/grid_builder.rb +++ b/lib/compass/grid_builder.rb @@ -22,12 +22,14 @@ module Compass # * options # * :column_width -- Width (in pixels) of current grid column # * :gutter_width -- Width (in pixels) of current grid gutter + # * :height -- Height (in pixels) of a row # * :output_path -- Output path of grid.png file def initialize(options={}) @able_to_generate = Magick::Long_version rescue false return unless @able_to_generate @column_width = options[:column_width] @gutter_width = options[:gutter_width] + @height = options[:height] || 20 @output_path = options[:output_path] @options = options end @@ -40,18 +42,17 @@ module Compass def generate! return false unless self.able_to_generate total_width = self.column_width + self.gutter_width - height = 20 RVG::dpi = 100 - rvg = RVG.new((total_width.to_f/RVG::dpi).in, (height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, height) do |canvas| + rvg = RVG.new((total_width.to_f/RVG::dpi).in, (@height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, @height) do |canvas| canvas.background_fill = 'white' canvas.g do |column| - column.rect(self.column_width, height).styles(:fill => "#e8effb") + column.rect(self.column_width, @height).styles(:fill => "#e8effb") end canvas.g do |baseline| - baseline.line(0, (height - 1), total_width, (height- 1)).styles(:fill => "#e9e9e9") + baseline.line(0, (@height - 1), total_width, (@height- 1)).styles(:fill => "#e9e9e9") end end From 60ad1e24253d108eb0bd23bd40fd79289ca42096 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 2 Sep 2009 10:47:21 -0700 Subject: [PATCH 050/118] Move project configuration reading out of the command infrastructure and into the configuration helpers. --- lib/compass/commands/installer_command.rb | 2 +- lib/compass/commands/project_base.rb | 33 ++++----------------- lib/compass/commands/write_configuration.rb | 4 +++ lib/compass/configuration/helpers.rb | 22 ++++++++++++++ lib/compass/configuration/serialization.rb | 4 +++ 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index f63f5acc..7385c7f8 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -7,7 +7,7 @@ module Compass def configure! Compass.add_configuration(installer.default_configuration) - read_project_configuration + Compass.add_project_configuration Compass.add_configuration(options) Compass.add_configuration(installer.completed_configuration) if File.exists?(Compass.configuration.extensions_path) diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 21776373..335c403a 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -22,14 +22,18 @@ module Compass protected def configure! - read_project_configuration + add_project_configuration if File.exists?(Compass.configuration.extensions_path) Compass::Frameworks.discover(Compass.configuration.extensions_path) end end + def add_project_configuration + Compass.add_project_configuration(options[:configuration_file]) + end + def projectize(path) - File.join(project_directory, separate(path)) + Compass.projectize(path) end def project_directory @@ -48,31 +52,6 @@ module Compass Compass.configuration.images_dir end - # Read the configuration file for this project - def read_project_configuration - if (file = detect_configuration_file) && File.readable?(file) - Compass.add_configuration(file) - end - end - - def explicit_config_file_must_be_readable? - true - end - - # TODO: Deprecate the src/config.rb location. - KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] - - # Finds the configuration file, if it exists in a known location. - def detect_configuration_file - if options[:configuration_file] - if explicit_config_file_must_be_readable? && !File.readable?(options[:configuration_file]) - raise Compass::Error, "Configuration file, #{file}, not found or not readable." - end - return options[:configuration_file] - end - KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)} - end - def assert_project_directory_exists! if File.exists?(project_directory) && !File.directory?(project_directory) raise Compass::FilesystemConflict.new("#{project_directory} is not a directory.") diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index 1c8c28fc..7d9604aa 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -11,6 +11,10 @@ module Compass assert_project_directory_exists! end + def add_project_configuration + Compass.add_project_configuration + end + def perform installer.write_configuration_files(options[:configuration_file]) end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index ea8ad504..f779a973 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -53,6 +53,28 @@ module Compass def sass_engine_options configuration.to_sass_engine_options end + + # Read the configuration file for this project + def add_project_configuration(configuration_file_path = nil) + configuration_file_path ||= detect_configuration_file + Compass.add_configuration(configuration_file_path) if configuration_file_path + end + + # Returns a full path to the relative path to the project directory + def projectize(path, project_path = nil) + project_path ||= configuration.project_path + File.join(project_path, *path.split('/')) + end + + # TODO: Deprecate the src/config.rb location. + KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] + + # Finds the configuration file, if it exists in a known location. + def detect_configuration_file(project_path = nil) + possible_files = KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f, project_path) } + possible_files.detect{|f| File.exists?(f)} + end + end end diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index 4a0e1c0d..4d8af6c0 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -13,6 +13,7 @@ module Compass data.parse(config_file) data end + def new_from_string(contents, filename) data = Data.new data.parse_string(contents, filename) @@ -23,6 +24,9 @@ module Compass module InstanceMethods # parses a configuration file which is a ruby script def parse(config_file) + unless File.readable?(config_file) + raise Compass::Error, "Configuration file, #{config_file}, not found or not readable." + end open(config_file) do |f| parse_string(f.read, config_file) end From b13fd43a2e504b0cd0cb859b51fc6c92e8c1597a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 2 Sep 2009 19:47:01 -0700 Subject: [PATCH 051/118] Require relative to the load path instead of using the more convoluted approach of File.join(File.dirname(__FILE__), ...). Also, don't ever muck with the load paths or rubygems without first trying to require the library without doing so. --- Rakefile | 3 ++- bin/compass | 15 +++++++++++++-- lib/compass.rb | 10 +++++----- lib/compass/app_integration.rb | 2 +- lib/compass/app_integration/merb.rb | 2 +- lib/compass/app_integration/rails.rb | 4 ++-- lib/compass/app_integration/rails/runtime.rb | 2 +- lib/compass/app_integration/stand_alone.rb | 4 ++-- lib/compass/commands/create_project.rb | 3 +-- lib/compass/commands/generate_grid_background.rb | 6 +++--- lib/compass/commands/installer_command.rb | 2 +- lib/compass/commands/project_base.rb | 4 ++-- lib/compass/commands/stamp_pattern.rb | 4 ++-- lib/compass/commands/update_project.rb | 4 ++-- lib/compass/commands/validate_project.rb | 6 +++--- lib/compass/commands/watch_project.rb | 11 ++++++++--- lib/compass/commands/write_configuration.rb | 2 +- lib/compass/configuration.rb | 2 +- lib/compass/dependencies.rb | 14 ++++++-------- lib/compass/exec.rb | 14 ++++++++------ lib/compass/installers.rb | 2 +- lib/compass/sass_extensions.rb | 4 ++-- lib/compass/sass_extensions/functions.rb | 4 ++-- lib/compass/sass_extensions/monkey_patches.rb | 4 ++-- lib/vendor/fssm.rb | 2 -- test/test_helper.rb | 3 +++ 26 files changed, 75 insertions(+), 58 deletions(-) diff --git a/Rakefile b/Rakefile index b53706ce..7fa6ca31 100644 --- a/Rakefile +++ b/Rakefile @@ -12,7 +12,8 @@ end require 'rubygems' require 'rake' -require 'lib/compass' +$:.unshift File.join(File.dirname(__FILE__), 'lib') +require 'compass' # ----- Default: Testing ------ diff --git a/bin/compass b/bin/compass index fb94e65f..b8af02d8 100755 --- a/bin/compass +++ b/bin/compass @@ -1,8 +1,19 @@ #!/usr/bin/env ruby # The compass command line utility -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass')) -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'compass', 'exec')) +begin + retried = false + require 'compass' + require 'compass/exec' +rescue LoadError + if retried + raise + else + $: << File.join(File.dirname(__FILE__), '..', 'lib') + retried = true + retry + end +end command = Compass::Exec::Compass.new(ARGV) exit command.run! diff --git a/lib/compass.rb b/lib/compass.rb index 0956ff87..edc23581 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -1,8 +1,8 @@ module Compass end -['dependencies', 'sass_extensions', 'core_ext', 'version', 'errors'].each do |file| - require File.join(File.dirname(__FILE__), 'compass', file) +%w(dependencies sass_extensions core_ext version errors).each do |lib| + require "compass/#{lib}" end module Compass @@ -16,6 +16,6 @@ module Compass module_function :base_directory, :lib_directory end -require File.join(File.dirname(__FILE__), 'compass', 'configuration') -require File.join(File.dirname(__FILE__), 'compass', 'frameworks') -require File.join(File.dirname(__FILE__), 'compass', 'app_integration') +%w(configuration frameworks app_integration).each do |lib| + require "compass/#{lib}" +end diff --git a/lib/compass/app_integration.rb b/lib/compass/app_integration.rb index 9e81105d..8d7ec37b 100644 --- a/lib/compass/app_integration.rb +++ b/lib/compass/app_integration.rb @@ -1,3 +1,3 @@ %w(stand_alone rails merb).each do |lib| - require File.join(File.dirname(__FILE__), 'app_integration', lib) + require "compass/app_integration/#{lib}" end diff --git a/lib/compass/app_integration/merb.rb b/lib/compass/app_integration/merb.rb index bb460dc9..546ac987 100644 --- a/lib/compass/app_integration/merb.rb +++ b/lib/compass/app_integration/merb.rb @@ -1 +1 @@ -require File.join(File.dirname(__FILE__), 'merb', 'runtime') if defined?(Merb::Plugins) +require 'compass/app_integration/merb/runtime' if defined?(Merb::Plugins) diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index c095e889..28bef715 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -1,8 +1,8 @@ %w(configuration_defaults installer).each do |lib| - require File.join(File.dirname(__FILE__), 'rails', lib) + require "compass/app_integration/rails/#{lib}" end -require File.join(File.dirname(__FILE__), 'rails', 'runtime') if defined?(ActionController::Base) +require 'compass/app_integration/rails/runtime' if defined?(ActionController::Base) diff --git a/lib/compass/app_integration/rails/runtime.rb b/lib/compass/app_integration/rails/runtime.rb index 8cc3b061..82a353d1 100644 --- a/lib/compass/app_integration/rails/runtime.rb +++ b/lib/compass/app_integration/rails/runtime.rb @@ -2,7 +2,7 @@ unless defined?(Compass::RAILS_LOADED) Compass::RAILS_LOADED = true %w(action_controller sass_plugin urls).each do |lib| - require File.join(File.dirname(__FILE__), lib) + require "compass/app_integration/rails/#{lib}" end # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb index f5cc3c21..4e5d0722 100644 --- a/lib/compass/app_integration/stand_alone.rb +++ b/lib/compass/app_integration/stand_alone.rb @@ -1,3 +1,3 @@ -['configuration_defaults', 'installer'].each do |lib| - require File.join(File.dirname(__FILE__), 'stand_alone', lib) +%w(configuration_defaults installer).each do |lib| + require "compass/app_integration/stand_alone/#{lib}" end \ No newline at end of file diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index 3605af1e..45cf2706 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -1,6 +1,5 @@ require 'fileutils' -require File.join(File.dirname(__FILE__), 'stamp_pattern') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/stamp_pattern' module Compass module Commands diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index 0494a420..646c8d0a 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -1,6 +1,6 @@ -require File.join(File.dirname(__FILE__), 'project_base') -require File.join(File.dirname(__FILE__), 'update_project') -require File.join(File.dirname(__FILE__), '..', 'grid_builder') +require 'compass/commands/project_base' +require 'compass/commands/update_project' +require 'compass/grid_builder' module Compass module Commands diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 7385c7f8..35bc0af3 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -1,4 +1,4 @@ -require File.join(Compass.lib_directory, 'compass', 'installers') +require 'compass/installers' module Compass module Commands diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 335c403a..3567682e 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -1,7 +1,7 @@ require 'fileutils' require 'pathname' -require File.join(File.dirname(__FILE__), 'base') -require File.join(File.dirname(__FILE__), 'installer_command') +require 'compass/commands/base' +require 'compass/commands/installer_command' module Compass module Commands diff --git a/lib/compass/commands/stamp_pattern.rb b/lib/compass/commands/stamp_pattern.rb index 47f02b84..e091c153 100644 --- a/lib/compass/commands/stamp_pattern.rb +++ b/lib/compass/commands/stamp_pattern.rb @@ -1,6 +1,6 @@ require 'fileutils' -require File.join(File.dirname(__FILE__), 'base') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/base' +require 'compass/commands/update_project' module Compass module Commands diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index e00e7a8f..709dd2aa 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -1,5 +1,5 @@ -require File.join(File.dirname(__FILE__), 'project_base') -require File.join(Compass.lib_directory, 'compass', 'compiler') +require 'compass/commands/project_base' +require 'compass/compiler' module Compass module Commands diff --git a/lib/compass/commands/validate_project.rb b/lib/compass/commands/validate_project.rb index 13c06da9..cd19ce60 100644 --- a/lib/compass/commands/validate_project.rb +++ b/lib/compass/commands/validate_project.rb @@ -1,5 +1,5 @@ -require File.join(File.dirname(__FILE__), 'project_base') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/project_base' +require 'compass/commands/update_project' module Compass module Commands @@ -11,7 +11,7 @@ module Compass end def perform - require File.join(File.dirname(__FILE__), '..', 'validator') + require 'compass/validator' UpdateProject.new(working_path, options).perform Validator.new(project_css_subdirectory).validate() end diff --git a/lib/compass/commands/watch_project.rb b/lib/compass/commands/watch_project.rb index ee0528d8..9841b3a9 100644 --- a/lib/compass/commands/watch_project.rb +++ b/lib/compass/commands/watch_project.rb @@ -1,7 +1,7 @@ require 'fileutils' require 'pathname' -require File.join(File.dirname(__FILE__), 'base') -require File.join(File.dirname(__FILE__), 'update_project') +require 'compass/commands/base' +require 'compass/commands/update_project' module Compass module Commands @@ -19,7 +19,12 @@ module Compass puts ">>> Compass is watching for changes. Press Ctrl-C to Stop." - require File.join(Compass.lib_directory, 'vendor', 'fssm') + begin + require 'fssm' + rescue LoadError + $: << File.join(Compass.lib_directory, 'vendor') + retry + end FSSM.monitor do |monitor| Compass.configuration.sass_load_paths.each do |load_path| diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index 7d9604aa..2aaefb69 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__), 'project_base') +require 'compass/commands/project_base' module Compass module Commands diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index 1d8203c9..fdf686eb 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -34,5 +34,5 @@ module Compass end ['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'data'].each do |lib| - require File.join(File.dirname(__FILE__), 'configuration', lib) + require "compass/configuration/#{lib}" end diff --git a/lib/compass/dependencies.rb b/lib/compass/dependencies.rb index dbc9c43d..5c697b3c 100644 --- a/lib/compass/dependencies.rb +++ b/lib/compass/dependencies.rb @@ -1,8 +1,6 @@ -unless defined?(Sass) - begin - require 'sass' - rescue LoadError - require 'rubygems' - require 'sass' - end -end \ No newline at end of file +begin + require 'sass' +rescue LoadError + require 'rubygems' + require 'sass' +end diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index f7a7ba90..571c3713 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -1,8 +1,8 @@ -require File.join(Compass.lib_directory, 'compass', 'dependencies') +require 'compass/dependencies' require 'optparse' -require File.join(Compass.lib_directory, 'compass', 'logger') -require File.join(Compass.lib_directory, 'compass', 'errors') -require File.join(Compass.lib_directory, 'compass', 'actions') +require 'compass/logger' +require 'compass/errors' +require 'compass/actions' module Compass module Exec @@ -245,6 +245,8 @@ END end end -Dir.glob(File.join(File.dirname(__FILE__), 'commands', "*.rb")).each do |file| - require file +%w(base generate_grid_background list_frameworks project_base + update_project watch_project create_project installer_command + print_version stamp_pattern validate_project write_configuration).each do |lib| + require "compass/commands/#{lib}" end diff --git a/lib/compass/installers.rb b/lib/compass/installers.rb index 7ae1b400..84598af7 100644 --- a/lib/compass/installers.rb +++ b/lib/compass/installers.rb @@ -1,3 +1,3 @@ %w(manifest template_context base).each do |f| - require File.join(File.dirname(__FILE__), 'installers', f) + require "compass/installers/#{f}" end diff --git a/lib/compass/sass_extensions.rb b/lib/compass/sass_extensions.rb index 986be47f..182717b1 100644 --- a/lib/compass/sass_extensions.rb +++ b/lib/compass/sass_extensions.rb @@ -1,5 +1,5 @@ module Compass::SassExtensions end -require File.join(File.dirname(__FILE__), 'sass_extensions', 'functions') -require File.join(File.dirname(__FILE__), 'sass_extensions', 'monkey_patches') +require 'compass/sass_extensions/functions' +require 'compass/sass_extensions/monkey_patches' diff --git a/lib/compass/sass_extensions/functions.rb b/lib/compass/sass_extensions/functions.rb index 75c8eb2f..a945b59d 100644 --- a/lib/compass/sass_extensions/functions.rb +++ b/lib/compass/sass_extensions/functions.rb @@ -1,8 +1,8 @@ module Compass::SassExtensions::Functions end -['selectors', 'enumerate', 'urls', 'display', 'inline_image'].each do |func| - require File.join(File.dirname(__FILE__), 'functions', func) +%w(selectors enumerate urls display inline_image).each do |func| + require "compass/sass_extensions/functions/#{func}" end module Sass::Script::Functions diff --git a/lib/compass/sass_extensions/monkey_patches.rb b/lib/compass/sass_extensions/monkey_patches.rb index de54a75c..04cc8a72 100644 --- a/lib/compass/sass_extensions/monkey_patches.rb +++ b/lib/compass/sass_extensions/monkey_patches.rb @@ -1,3 +1,3 @@ -['stylesheet_updating'].each do |patch| - require File.join(File.dirname(__FILE__), 'monkey_patches', patch) +%w(stylesheet_updating).each do |patch| + require "compass/sass_extensions/monkey_patches/#{patch}" end \ No newline at end of file diff --git a/lib/vendor/fssm.rb b/lib/vendor/fssm.rb index d04b32aa..245fa5d0 100644 --- a/lib/vendor/fssm.rb +++ b/lib/vendor/fssm.rb @@ -16,7 +16,6 @@ module FSSM end end -$:.unshift(File.dirname(__FILE__)) require 'pathname' require 'fssm/ext' require 'fssm/support' @@ -26,5 +25,4 @@ require 'fssm/monitor' require "fssm/backends/#{FSSM::Support.backend.downcase}" FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend) -$:.shift diff --git a/test/test_helper.rb b/test/test_helper.rb index d731494b..d1c32c4a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,8 @@ need_gems = false +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) +$:.unshift(lib_dir) unless $:.include?(lib_dir) + # allows testing with edge Haml by creating a test/haml symlink linked_haml = File.dirname(__FILE__) + '/haml' From e6b14cf5bb7d8b3b5a026c1c0af1abb88cfcd5cb Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 2 Sep 2009 20:40:44 -0700 Subject: [PATCH 052/118] Provide a Compass::VERSION constant. --- lib/compass.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compass.rb b/lib/compass.rb index edc23581..aeae12dd 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -7,6 +7,7 @@ end module Compass extend Compass::Version + VERSION = "#{version[:major]}.#{version[:minor]}.#{version[:patch]}" def base_directory File.expand_path(File.join(File.dirname(__FILE__), '..')) end From 6e7f658f3bc9f5c91c8870911c57ce3f4447f77c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 2 Sep 2009 21:44:15 -0700 Subject: [PATCH 053/118] Move the frameworks directory into lib/compass per gem packaging best practices. --- Rakefile | 1 - lib/compass/frameworks.rb | 2 +- .../blueprint/stylesheets/_blueprint.sass | 0 .../blueprint/stylesheets/blueprint/_ie.sass | 0 .../blueprint/stylesheets/blueprint/_print.sass | 0 .../blueprint/stylesheets/blueprint/_reset.sass | 0 .../blueprint/stylesheets/blueprint/_screen.sass | 0 .../stylesheets/blueprint/modules/_buttons.sass | 0 .../stylesheets/blueprint/modules/_colors.sass | 0 .../stylesheets/blueprint/modules/_debug.sass | 0 .../stylesheets/blueprint/modules/_fancy_type.sass | 0 .../stylesheets/blueprint/modules/_form.sass | 0 .../stylesheets/blueprint/modules/_grid.sass | 0 .../stylesheets/blueprint/modules/_interaction.sass | 0 .../stylesheets/blueprint/modules/_link_icons.sass | 0 .../stylesheets/blueprint/modules/_liquid.sass | 0 .../stylesheets/blueprint/modules/_reset.sass | 0 .../stylesheets/blueprint/modules/_rtl.sass | 0 .../stylesheets/blueprint/modules/_scaffolding.sass | 0 .../stylesheets/blueprint/modules/_typography.sass | 0 .../stylesheets/blueprint/modules/_utilities.sass | 0 .../blueprint/templates/buttons/buttons.sass | 0 .../blueprint/templates/buttons/buttons/cross.png | Bin .../blueprint/templates/buttons/buttons/key.png | Bin .../blueprint/templates/buttons/buttons/tick.png | Bin .../blueprint/templates/buttons/manifest.rb | 0 .../blueprint/templates/link_icons/link_icons.sass | 0 .../templates/link_icons/link_icons/doc.png | Bin .../templates/link_icons/link_icons/email.png | Bin .../templates/link_icons/link_icons/external.png | Bin .../templates/link_icons/link_icons/feed.png | Bin .../templates/link_icons/link_icons/im.png | Bin .../templates/link_icons/link_icons/pdf.png | Bin .../templates/link_icons/link_icons/visited.png | Bin .../templates/link_icons/link_icons/xls.png | Bin .../blueprint/templates/link_icons/manifest.rb | 0 .../blueprint/templates/project/grid.png | Bin .../frameworks}/blueprint/templates/project/ie.sass | 0 .../blueprint/templates/project/manifest.rb | 0 .../blueprint/templates/project/partials/_base.sass | 0 .../blueprint/templates/project/print.sass | 0 .../blueprint/templates/project/screen.sass | 0 .../blueprint/templates/project/welcome.html.haml | 0 .../frameworks}/compass/stylesheets/_compass.sass | 0 .../compass/stylesheets/compass/_layout.sass | 0 .../compass/stylesheets/compass/_misc.sass | 0 .../compass/stylesheets/compass/_reset.sass | 0 .../compass/stylesheets/compass/_utilities.sass | 0 .../stylesheets/compass/layout/_sticky_footer.sass | 0 .../stylesheets/compass/utilities/_css3.sass | 0 .../stylesheets/compass/utilities/_general.sass | 0 .../stylesheets/compass/utilities/_links.sass | 0 .../stylesheets/compass/utilities/_lists.sass | 0 .../stylesheets/compass/utilities/_print.sass | 0 .../stylesheets/compass/utilities/_sprites.sass | 0 .../stylesheets/compass/utilities/_tables.sass | 0 .../stylesheets/compass/utilities/_text.sass | 0 .../compass/utilities/css3/_border_radius.sass | 0 .../compass/utilities/css3/_box_shadow.sass | 0 .../compass/utilities/css3/_box_sizing.sass | 0 .../compass/utilities/css3/_columns.sass | 0 .../compass/utilities/css3/_inline_block.sass | 0 .../compass/utilities/css3/_opacity.sass | 0 .../compass/utilities/general/_clearfix.sass | 0 .../compass/utilities/general/_float.sass | 0 .../compass/utilities/general/_hacks.sass | 0 .../compass/utilities/general/_reset.sass | 0 .../compass/utilities/general/_tabs.sass | 0 .../compass/utilities/general/_tag_cloud.sass | 0 .../compass/utilities/links/_hover_link.sass | 0 .../compass/utilities/links/_link_colors.sass | 0 .../compass/utilities/links/_unstyled_link.sass | 0 .../compass/utilities/lists/_bullets.sass | 0 .../compass/utilities/lists/_horizontal_list.sass | 0 .../compass/utilities/lists/_inline_list.sass | 0 .../compass/utilities/sprites/_sprite_img.sass | 0 .../tables/_alternating_rows_and_columns.sass | 0 .../compass/utilities/tables/_borders.sass | 0 .../compass/utilities/tables/_scaffolding.sass | 0 .../compass/utilities/text/_ellipsis.sass | 0 .../stylesheets/compass/utilities/text/_nowrap.sass | 0 .../compass/utilities/text/_replacement.sass | 0 .../compass/templates/ellipsis/ellipsis.sass | 0 .../compass/templates/ellipsis/manifest.rb | 0 .../compass/templates/ellipsis/xml/ellipsis.xml | 0 .../compass/templates/extension/manifest.rb | 0 .../templates/extension/stylesheets/main.sass | 0 .../extension/templates/project/manifest.rb | 0 .../extension/templates/project/screen.sass | 0 .../frameworks}/compass/templates/project/ie.sass | 0 .../compass/templates/project/manifest.rb | 0 .../compass/templates/project/print.sass | 0 .../compass/templates/project/screen.sass | 0 93 files changed, 1 insertion(+), 2 deletions(-) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/_blueprint.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/_ie.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/_print.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/_reset.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/_screen.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_buttons.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_colors.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_debug.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_fancy_type.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_form.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_grid.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_interaction.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_link_icons.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_liquid.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_reset.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_rtl.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_scaffolding.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_typography.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/stylesheets/blueprint/modules/_utilities.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/buttons/buttons.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/buttons/buttons/cross.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/buttons/buttons/key.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/buttons/buttons/tick.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/buttons/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/doc.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/email.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/external.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/feed.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/im.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/pdf.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/visited.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/link_icons/xls.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/link_icons/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/grid.png (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/ie.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/partials/_base.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/print.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/screen.sass (100%) rename {frameworks => lib/compass/frameworks}/blueprint/templates/project/welcome.html.haml (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/_compass.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/_layout.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/_misc.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/_reset.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/_utilities.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/layout/_sticky_footer.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_css3.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_general.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_links.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_lists.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_print.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_sprites.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_tables.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/_text.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/css3/_border_radius.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/css3/_box_shadow.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/css3/_box_sizing.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/css3/_columns.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/css3/_inline_block.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/css3/_opacity.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/general/_clearfix.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/general/_float.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/general/_hacks.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/general/_reset.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/general/_tabs.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/general/_tag_cloud.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/links/_hover_link.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/links/_link_colors.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/links/_unstyled_link.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/lists/_bullets.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/lists/_inline_list.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/tables/_borders.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/tables/_scaffolding.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/text/_ellipsis.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/text/_nowrap.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/stylesheets/compass/utilities/text/_replacement.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/ellipsis/ellipsis.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/ellipsis/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/ellipsis/xml/ellipsis.xml (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/extension/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/extension/stylesheets/main.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/extension/templates/project/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/extension/templates/project/screen.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/project/ie.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/project/manifest.rb (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/project/print.sass (100%) rename {frameworks => lib/compass/frameworks}/compass/templates/project/screen.sass (100%) diff --git a/Rakefile b/Rakefile index 7fa6ca31..f45d0411 100644 --- a/Rakefile +++ b/Rakefile @@ -60,7 +60,6 @@ begin gemspec.files -= Dir.glob("examples/**/*.css") gemspec.files -= Dir.glob("examples/**/*.html") gemspec.files -= Dir.glob("examples/*/extensions/**") - gemspec.files += Dir.glob("frameworks/**/*.*") gemspec.files += Dir.glob("lib/**/*") gemspec.files += Dir.glob("test/**/*.*") gemspec.files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*") diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index b34597bc..9d6b2d7c 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -3,7 +3,7 @@ module Compass extend self ALL = [] - DEFAULT_FRAMEWORKS_PATH = File.join(Compass.base_directory, 'frameworks') + DEFAULT_FRAMEWORKS_PATH = File.join(Compass.lib_directory, 'compass', 'frameworks') class Framework attr_accessor :name diff --git a/frameworks/blueprint/stylesheets/_blueprint.sass b/lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass similarity index 100% rename from frameworks/blueprint/stylesheets/_blueprint.sass rename to lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/_ie.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/_ie.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/_print.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/_print.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/_reset.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/_reset.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/_screen.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/_screen.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_form.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass similarity index 100% rename from frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass rename to lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass diff --git a/frameworks/blueprint/templates/buttons/buttons.sass b/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons.sass rename to lib/compass/frameworks/blueprint/templates/buttons/buttons.sass diff --git a/frameworks/blueprint/templates/buttons/buttons/cross.png b/lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons/cross.png rename to lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png diff --git a/frameworks/blueprint/templates/buttons/buttons/key.png b/lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons/key.png rename to lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png diff --git a/frameworks/blueprint/templates/buttons/buttons/tick.png b/lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png similarity index 100% rename from frameworks/blueprint/templates/buttons/buttons/tick.png rename to lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png diff --git a/frameworks/blueprint/templates/buttons/manifest.rb b/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb similarity index 100% rename from frameworks/blueprint/templates/buttons/manifest.rb rename to lib/compass/frameworks/blueprint/templates/buttons/manifest.rb diff --git a/frameworks/blueprint/templates/link_icons/link_icons.sass b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons.sass rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass diff --git a/frameworks/blueprint/templates/link_icons/link_icons/doc.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/doc.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/email.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/email.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/external.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/external.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/feed.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/feed.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/im.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/im.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/pdf.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/pdf.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/visited.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/visited.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png diff --git a/frameworks/blueprint/templates/link_icons/link_icons/xls.png b/lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png similarity index 100% rename from frameworks/blueprint/templates/link_icons/link_icons/xls.png rename to lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png diff --git a/frameworks/blueprint/templates/link_icons/manifest.rb b/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb similarity index 100% rename from frameworks/blueprint/templates/link_icons/manifest.rb rename to lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb diff --git a/frameworks/blueprint/templates/project/grid.png b/lib/compass/frameworks/blueprint/templates/project/grid.png similarity index 100% rename from frameworks/blueprint/templates/project/grid.png rename to lib/compass/frameworks/blueprint/templates/project/grid.png diff --git a/frameworks/blueprint/templates/project/ie.sass b/lib/compass/frameworks/blueprint/templates/project/ie.sass similarity index 100% rename from frameworks/blueprint/templates/project/ie.sass rename to lib/compass/frameworks/blueprint/templates/project/ie.sass diff --git a/frameworks/blueprint/templates/project/manifest.rb b/lib/compass/frameworks/blueprint/templates/project/manifest.rb similarity index 100% rename from frameworks/blueprint/templates/project/manifest.rb rename to lib/compass/frameworks/blueprint/templates/project/manifest.rb diff --git a/frameworks/blueprint/templates/project/partials/_base.sass b/lib/compass/frameworks/blueprint/templates/project/partials/_base.sass similarity index 100% rename from frameworks/blueprint/templates/project/partials/_base.sass rename to lib/compass/frameworks/blueprint/templates/project/partials/_base.sass diff --git a/frameworks/blueprint/templates/project/print.sass b/lib/compass/frameworks/blueprint/templates/project/print.sass similarity index 100% rename from frameworks/blueprint/templates/project/print.sass rename to lib/compass/frameworks/blueprint/templates/project/print.sass diff --git a/frameworks/blueprint/templates/project/screen.sass b/lib/compass/frameworks/blueprint/templates/project/screen.sass similarity index 100% rename from frameworks/blueprint/templates/project/screen.sass rename to lib/compass/frameworks/blueprint/templates/project/screen.sass diff --git a/frameworks/blueprint/templates/project/welcome.html.haml b/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml similarity index 100% rename from frameworks/blueprint/templates/project/welcome.html.haml rename to lib/compass/frameworks/blueprint/templates/project/welcome.html.haml diff --git a/frameworks/compass/stylesheets/_compass.sass b/lib/compass/frameworks/compass/stylesheets/_compass.sass similarity index 100% rename from frameworks/compass/stylesheets/_compass.sass rename to lib/compass/frameworks/compass/stylesheets/_compass.sass diff --git a/frameworks/compass/stylesheets/compass/_layout.sass b/lib/compass/frameworks/compass/stylesheets/compass/_layout.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_layout.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_layout.sass diff --git a/frameworks/compass/stylesheets/compass/_misc.sass b/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_misc.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_misc.sass diff --git a/frameworks/compass/stylesheets/compass/_reset.sass b/lib/compass/frameworks/compass/stylesheets/compass/_reset.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_reset.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_reset.sass diff --git a/frameworks/compass/stylesheets/compass/_utilities.sass b/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/_utilities.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass diff --git a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass b/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass rename to lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_css3.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_css3.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_general.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_general.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_links.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_links.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_lists.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_lists.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_print.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_print.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_sprites.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_sprites.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_tables.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_tables.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/_text.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/_text.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_float.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_float.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_reset.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass similarity index 100% rename from frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass rename to lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass diff --git a/frameworks/compass/templates/ellipsis/ellipsis.sass b/lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass similarity index 100% rename from frameworks/compass/templates/ellipsis/ellipsis.sass rename to lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass diff --git a/frameworks/compass/templates/ellipsis/manifest.rb b/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb similarity index 100% rename from frameworks/compass/templates/ellipsis/manifest.rb rename to lib/compass/frameworks/compass/templates/ellipsis/manifest.rb diff --git a/frameworks/compass/templates/ellipsis/xml/ellipsis.xml b/lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml similarity index 100% rename from frameworks/compass/templates/ellipsis/xml/ellipsis.xml rename to lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml diff --git a/frameworks/compass/templates/extension/manifest.rb b/lib/compass/frameworks/compass/templates/extension/manifest.rb similarity index 100% rename from frameworks/compass/templates/extension/manifest.rb rename to lib/compass/frameworks/compass/templates/extension/manifest.rb diff --git a/frameworks/compass/templates/extension/stylesheets/main.sass b/lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass similarity index 100% rename from frameworks/compass/templates/extension/stylesheets/main.sass rename to lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass diff --git a/frameworks/compass/templates/extension/templates/project/manifest.rb b/lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb similarity index 100% rename from frameworks/compass/templates/extension/templates/project/manifest.rb rename to lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb diff --git a/frameworks/compass/templates/extension/templates/project/screen.sass b/lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass similarity index 100% rename from frameworks/compass/templates/extension/templates/project/screen.sass rename to lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass diff --git a/frameworks/compass/templates/project/ie.sass b/lib/compass/frameworks/compass/templates/project/ie.sass similarity index 100% rename from frameworks/compass/templates/project/ie.sass rename to lib/compass/frameworks/compass/templates/project/ie.sass diff --git a/frameworks/compass/templates/project/manifest.rb b/lib/compass/frameworks/compass/templates/project/manifest.rb similarity index 100% rename from frameworks/compass/templates/project/manifest.rb rename to lib/compass/frameworks/compass/templates/project/manifest.rb diff --git a/frameworks/compass/templates/project/print.sass b/lib/compass/frameworks/compass/templates/project/print.sass similarity index 100% rename from frameworks/compass/templates/project/print.sass rename to lib/compass/frameworks/compass/templates/project/print.sass diff --git a/frameworks/compass/templates/project/screen.sass b/lib/compass/frameworks/compass/templates/project/screen.sass similarity index 100% rename from frameworks/compass/templates/project/screen.sass rename to lib/compass/frameworks/compass/templates/project/screen.sass From e744c1e0db0cd44f88aaa8bbf0d8c3d833495261 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 28 Sep 2009 21:52:49 -0700 Subject: [PATCH 054/118] Convert the compass core framework to css-style property syntax. --- .../compass/stylesheets/compass/_misc.sass | 24 ++++----- .../compass/layout/_sticky_footer.sass | 18 +++---- .../stylesheets/compass/utilities/_links.sass | 2 +- .../stylesheets/compass/utilities/_print.sass | 8 +-- .../compass/utilities/_sprites.sass | 2 +- .../compass/utilities/css3/_columns.sass | 38 +++++++------- .../compass/utilities/css3/_inline_block.sass | 12 ++--- .../compass/utilities/css3/_opacity.sass | 10 ++-- .../compass/utilities/general/_clearfix.sass | 14 ++--- .../compass/utilities/general/_float.sass | 4 +- .../compass/utilities/general/_hacks.sass | 4 +- .../compass/utilities/general/_reset.sass | 52 +++++++++---------- .../compass/utilities/general/_tag_cloud.sass | 18 +++---- .../compass/utilities/links/_hover_link.sass | 4 +- .../compass/utilities/links/_link_colors.sass | 12 ++--- .../utilities/links/_unstyled_link.sass | 8 +-- .../compass/utilities/lists/_bullets.sass | 12 ++--- .../utilities/lists/_horizontal_list.sass | 12 ++--- .../compass/utilities/lists/_inline_list.sass | 18 +++---- .../utilities/sprites/_sprite_img.sass | 10 ++-- .../tables/_alternating_rows_and_columns.sass | 16 +++--- .../compass/utilities/tables/_borders.sass | 22 ++++---- .../utilities/tables/_scaffolding.sass | 8 +-- .../compass/utilities/text/_nowrap.sass | 2 +- .../compass/utilities/text/_replacement.sass | 12 ++--- .../stylesheets/compass/css/reset.css | 4 +- 26 files changed, 173 insertions(+), 173 deletions(-) diff --git a/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass b/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass index ce332ca5..03a810d1 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/_misc.sass @@ -6,19 +6,19 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. =unobtrusive-logo(!size = 1em) - :font-family Monaco, Courier, "Lucida Sans Unicode", monospace - :font-size= !size - :color #888 + font-family: Monaco, Courier, "Lucida Sans Unicode", monospace + font-size= !size + color: #888 .selector - :vertical-align middle - :font-size= 1.3em + vertical-align: middle + font-size= 1.3em .brace - :vertical-align middle - :font bold 1.7em Georgia, "Times New Roman", serif - :color #CCC - :margin= 0 -0.2em + vertical-align: middle + font: bold 1.7em Georgia, "Times New Roman", serif + color: #CCC + margin= 0 -0.2em .rule - :vertical-align middle - :margin= 0 -0.2em + vertical-align: middle + margin= 0 -0.2em - \ No newline at end of file + diff --git a/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass b/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass index cca39ea6..7ab874ca 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass @@ -5,15 +5,15 @@ =sticky-footer(!footer_height, !root_selector = "#root", !root_footer_selector = "#root_footer", !footer_selector = "#footer") html, body - :height 100% + height: 100% #{!root_selector} - :min-height 100% - :height auto !important - :height 100% - :margin-bottom= -!footer_height + min-height: 100% + height: auto !important + height: 100% + margin-bottom= -!footer_height #{!root_footer_selector} - :height= !footer_height + height= !footer_height #{!footer_selector} - :clear both - :position relative - :height= !footer_height + clear: both + position: relative + height= !footer_height diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass index afd4e369..41b15b45 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass @@ -1,3 +1,3 @@ @import links/hover_link.sass @import links/link_colors.sass -@import links/unstyled_link.sass \ No newline at end of file +@import links/unstyled_link.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass index 71a82336..77c2a13c 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass @@ -6,13 +6,13 @@ @if !media == "print" .noprint, .no-print - :display none + display: none #{elements_of_type("block")} &.print-only - :display block + display: block #{elements_of_type("inline")} &.print-only - :display inline + display: inline @else .print-only - :display none + display: none diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass index 48b42433..b03e49c8 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass @@ -1 +1 @@ -@import sprites/sprite_img.sass \ No newline at end of file +@import sprites/sprite_img.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass index 31b22734..c2ef3c28 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass @@ -2,36 +2,36 @@ CSS3 columns for Mozilla, Webkit and the Future =column-count(!n) - :-moz-column-count= !n - :-webkit-column-count= !n - :column-count= !n + -moz-column-count= !n + -webkit-column-count= !n + column-count= !n =column-gap(!u) - :-moz-column-gap= !u - :-webkit-column-gap= !u - :column-gap= !u + -moz-column-gap= !u + -webkit-column-gap= !u + column-gap= !u =column-width(!u) - :-moz-column-width= !u - :-webkit-column-width= !u - :column-width= !u + -moz-column-width= !u + -webkit-column-width= !u + column-width= !u =column-rule-width(!w) - :-moz-column-rule-width= !w - :-webkit-column-rule-width= !w - :column-rule-width= !w + -moz-column-rule-width= !w + -webkit-column-rule-width= !w + column-rule-width= !w =column-rule-style(!s) - :-moz-column-rule-style= !s - :-webkit-column-rule-style= !s - :column-rule-style= !s + -moz-column-rule-style= !s + -webkit-column-rule-style= !s + column-rule-style= !s =column-rule-color(!c) - :-moz-column-rule-color= !c - :-webkit-column-rule-color= !c - :column-rule-color= !c + -moz-column-rule-color= !c + -webkit-column-rule-color= !c + column-rule-color= !c =column-rule(!w, !s = "solid", !c = " ") +column-rule-width(!w) +column-rule-style(!s) - +column-rule-color(!c) \ No newline at end of file + +column-rule-color(!c) diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass index 4f9b3e15..1ace87fd 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass @@ -1,7 +1,7 @@ =inline-block - :display -moz-inline-box - :-moz-box-orient vertical - :display inline-block - :vertical-align middle - :#display inline - :#vertical-align auto + display: -moz-inline-box + -moz-box-orient: vertical + display: inline-block + vertical-align: middle + #display: inline + #vertical-align: auto diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass index f8d2a056..e47ab9a7 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass @@ -3,11 +3,11 @@ @param !opacity A number between 0 and 1, where 0 is transparent and 1 is opaque. =opacity(!opacity) - :opacity= !opacity - :-moz-opacity= !opacity - :-khtml-opacity= !opacity - :-ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + round(!opacity*100) + ")" - :filter= "alpha(opacity=" + round(!opacity*100) + ")" + opacity= !opacity + -moz-opacity= !opacity + -khtml-opacity= !opacity + -ms-filter= "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + round(!opacity*100) + ")" + filter= "alpha(opacity=" + round(!opacity*100) + ")" // Make an element completely transparent. =transparent diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass index e64afef3..3399e591 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass @@ -6,7 +6,7 @@ Recommendations include using this in conjunction with a width: http://www.quirksmode.org/blog/archives/2005/03/clearing_floats.html =clearfix - :overflow hidden + overflow: hidden +has-layout //** @@ -15,10 +15,10 @@ http://www.positioniseverything.net/easyclearing.html =pie-clearfix &:after - :content " " - :display block - :height 0 - :clear both - :overflow hidden - :visibility hidden + content: " " + display: block + height: 0 + clear: both + overflow: hidden + visibility: hidden +has-layout diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass index a0d58713..616765f6 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass @@ -13,5 +13,5 @@ // Available as alternate syntax with just +float =float(!side = "left") - :display inline - :float= !side + display: inline + float= !side diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass index 19417ee1..e3c21fb5 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass @@ -1,6 +1,6 @@ =has-layout // This makes ie6 get layout - :display inline-block + display: inline-block // and this puts it back to block & - :display block + display: block diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass index 8d968e53..c52fc808 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass @@ -62,47 +62,47 @@ //Mixins partials =reset-box-model - :margin 0 - :padding 0 - :border 0 - :outline 0 + margin: 0 + padding: 0 + border: 0 + outline: 0 =reset-font - :font - :weight inherit - :style inherit - :size 100% - :family inherit - :vertical-align baseline + font: + weight: inherit + style: inherit + size: 100% + family: inherit + vertical-align: baseline =reset-focus - :outline 0 + outline: 0 =reset-body - :line-height 1em - :color = #000 - :background #fff + line-height: 1em + color: #000 + background: #fff =reset-list-style - :list-style none + list-style: none =reset-table - :border-collapse separate - :border-spacing 0 - :vertical-align middle + border-collapse: separate + border-spacing: 0 + vertical-align: middle =reset-table-cell - :text-align left - :font-weight normal - :vertical-align middle + text-align: left + font-weight: normal + vertical-align: middle =reset-quotation - :quotes "" "" + quotes: "" "" &:before, &:after - :content "" + content: "" =reset-image-anchor-border - :border none + border: none =reset-html5 section, article, aside, header, footer, nav, dialog, figure @@ -115,7 +115,7 @@ Usage Example: // Turn off the display for both of these classes .unregistered-only, .registered-only - :display none + display: none // Now turn only one of them back on depending on some other context. body.registered +reset-display(".registered-only") @@ -131,4 +131,4 @@ @if !important display: block !important @else - display: block \ No newline at end of file + display: block diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass index 3f6665dc..132cb4d1 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass @@ -1,19 +1,19 @@ // Emits styles for a tag cloud =tag-cloud(!base_size = 1em) - :font-size= !base_size - :line-height= 1.2 * !base_size + font-size= !base_size + line-height= 1.2 * !base_size .xxs, .xs, .s, .l, .xl, .xxl - :line-height= 1.2 * !base_size + line-height= 1.2 * !base_size .xxs - :font-size= !base_size / 2.0 + font-size= !base_size / 2.0 .xs - :font-size= 2.0 * !base_size / 3.0 + font-size= 2.0 * !base_size / 3.0 .s - :font-size= 3.0 * !base_size / 4.0 + font-size= 3.0 * !base_size / 4.0 .l - :font-size= 4.0 * !base_size / 3.0 + font-size= 4.0 * !base_size / 3.0 .xl - :font-size= 3.0 * !base_size / 2.0 + font-size= 3.0 * !base_size / 2.0 .xxl - :font-size= 2.0 * !base_size + font-size= 2.0 * !base_size diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass index a8b51545..44b99a63 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass @@ -1,5 +1,5 @@ // a link that only has an underline when you hover over it =hover-link - :text-decoration none + text-decoration: none &:hover - :text-decoration underline + text-decoration: underline diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass index dcdae06d..9d40d320 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass @@ -7,18 +7,18 @@ // +link-colors(#00c, #0cc, #c0c, #ccc, #cc0) =link-colors(!normal, !hover = false, !active = false, !visited = false, !focus = false) - :color= !normal + color= !normal @if !visited &:visited - :color= !visited + color= !visited @if !focus &:focus - :color= !focus + color= !focus @if !hover &:hover - :color= !hover + color= !hover @if !active &:active - :color= !active + color= !active - \ No newline at end of file + diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass index 122ac4ed..f274eb9e 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass @@ -1,7 +1,7 @@ // A link that looks and acts like the text it is contained within =unstyled-link - :color inherit - :text-decoration inherit - :cursor inherit + color: inherit + text-decoration: inherit + cursor: inherit &:active, &:focus - :outline none \ No newline at end of file + outline: none diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass index 86657098..fce89824 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass @@ -1,7 +1,7 @@ // Turn off the bullet for an element of a list =no-bullet - :list-style-type none - :margin-left 0px + list-style-type: none + margin-left: 0px // turns off the bullets for an entire list =no-bullets @@ -13,9 +13,9 @@ // ul.pretty // +pretty-bullets("my-icon.png", 5px, 7px) =pretty-bullets(!bullet_icon, !width, !height, !line_height = 18px, !padding = 14px) - :margin-left 0 + margin-left: 0 li - :padding-left= !padding - :background= image_url(!bullet_icon) "no-repeat" ((!padding - !width) / 2) ((!line_height - !height) / 2) - :list-style-type none + padding-left= !padding + background= image_url(!bullet_icon) "no-repeat" ((!padding - !width) / 2) ((!line_height - !height) / 2) + list-style-type: none diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass index 49d21c7d..8c601d6c 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass @@ -32,15 +32,15 @@ Used to implement +horizontal-list. =horizontal-list-item(!padding = 4px) +no-bullet - :white-space nowrap + white-space: nowrap +float-left - :padding - :left= !padding - :right= !padding + padding: + left= !padding + right= !padding &.first - :padding-left 0px + padding-left: 0px &.last - :padding-right 0px + padding-right: 0px //** A list(ol,ul) that is layed out such that the elements are floated left and won't wrap. diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass index e6d0a185..88ea604f 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass @@ -1,14 +1,14 @@ // makes a list inline. =inline-list - :list-style-type none - :margin 0px - :padding 0px - :display inline + list-style-type: none + margin: 0px + padding: 0px + display: inline li - :margin 0px - :padding 0px - :display inline + margin: 0px + padding: 0px + display: inline // makes an inlin list that is comma delimited. // use of this recipe is not recommended at this time due to browser support issues. @@ -23,7 +23,7 @@ +inline-list li &:after - :content ", " + content: ", " &:last-child, &.last &:after - :content "" + content: "" diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass index dadac12b..b6b3caec 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass @@ -32,10 +32,10 @@ // Sets rules common for all sprites, assumes a rectangular region. =sprite-background-rectangle(!img, !width = !sprite_image_default_width, !height = !sprite_image_default_height) - :background= image_url(!img) "no-repeat" - :width= !width - :height= !height - :overflow hidden + background= image_url(!img) "no-repeat" + width= !width + height= !height + overflow: hidden // Allows horizontal sprite positioning optimized for a single row of sprites. =sprite-column(!col, !width = !sprite_image_default_width, !margin = !sprite_default_margin) @@ -49,4 +49,4 @@ =sprite-position(!col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_default_margin) !x = ((!col - 1) * -!width) - ((!col - 1) * !margin) !y = ((!row - 1) * -!height) - ((!row - 1) * !margin) - :background-position= !x !y \ No newline at end of file + background-position= !x !y diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass index 4b0e9490..cb086792 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass @@ -1,20 +1,20 @@ =alternating-rows-and-columns(!even_row_color, !odd_row_color, !dark_intersection, !header_color = #FFF, !footer_color = #FFF) th - :background-color= !header_color + background-color= !header_color &.even - :background-color= !header_color - !dark_intersection + background-color= !header_color - !dark_intersection tr.odd td - :background-color= !odd_row_color + background-color= !odd_row_color &.even - :background-color= !odd_row_color - !dark_intersection + background-color= !odd_row_color - !dark_intersection tr.even td - :background-color= !even_row_color + background-color= !even_row_color &.even - :background-color= !even_row_color - !dark_intersection + background-color= !even_row_color - !dark_intersection tfoot th, td - :background-color= !footer_color + background-color= !footer_color &.even - :background-color= !footer_color - !dark_intersection + background-color= !footer_color - !dark_intersection diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass index 4073969c..7f21fecf 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass @@ -1,27 +1,27 @@ =outer-table-borders(!width = 2px, !color = black) - :border= !width "solid" !color + border= !width "solid" !color thead th - :border-bottom= !width "solid" !color + border-bottom= !width "solid" !color tfoot th, td - :border-top= !width "solid" !color + border-top= !width "solid" !color th &:first-child - :border-right= !width "solid" !color + border-right= !width "solid" !color =inner-table-borders(!width = 2px, !color = black) th, td - :border - :right= !width "solid" !color - :bottom= !width "solid" !color - :left-width 0px - :top-width 0px + border: + right= !width "solid" !color + bottom= !width "solid" !color + left-width: 0px + top-width: 0px &:last-child, &.last - :border-right-width 0px + border-right-width: 0px tbody, tfoot tr:last-child, tr.last th, td - :border-bottom-width 0px + border-bottom-width: 0px diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass index 96093fc0..f55e6b0d 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass @@ -1,9 +1,9 @@ =table-scaffolding th - :text-align center - :font-weight bold + text-align: center + font-weight: bold td, th - :padding 2px + padding: 2px &.numeric - :text-align right + text-align: right diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass index 1d5ada52..62294eac 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass @@ -1,3 +1,3 @@ // When remembering whether or not there's a hyphen in white-space is too hard =nowrap - :white-space nowrap + white-space: nowrap diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass index 52f28103..e7c6a1b5 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass @@ -9,9 +9,9 @@ @param y the y position of the background image. =replace-text( !img, !x = 50%, !y = 50% ) - :text-indent -9999em - :overflow hidden - :background - :image= image_url(!img) - :repeat no-repeat - :position= !x !y + text-indent: -9999em + overflow: hidden + background: + image= image_url(!img) + repeat: no-repeat + position= !x !y diff --git a/test/fixtures/stylesheets/compass/css/reset.css b/test/fixtures/stylesheets/compass/css/reset.css index e778b379..6b067e61 100644 --- a/test/fixtures/stylesheets/compass/css/reset.css +++ b/test/fixtures/stylesheets/compass/css/reset.css @@ -21,7 +21,7 @@ table, caption, tbody, tfoot, thead, tr, th, td { body { line-height: 1em; - color: black; + color: #000; background: #fff; } ol, ul { @@ -57,4 +57,4 @@ body.registered address.registered-only, body.registered blockquote.registered-o body.unregistered a.unregistered-only, body.unregistered abbr.unregistered-only, body.unregistered acronym.unregistered-only, body.unregistered b.unregistered-only, body.unregistered basefont.unregistered-only, body.unregistered bdo.unregistered-only, body.unregistered big.unregistered-only, body.unregistered br.unregistered-only, body.unregistered cite.unregistered-only, body.unregistered code.unregistered-only, body.unregistered dfn.unregistered-only, body.unregistered em.unregistered-only, body.unregistered font.unregistered-only, body.unregistered i.unregistered-only, body.unregistered img.unregistered-only, body.unregistered input.unregistered-only, body.unregistered kbd.unregistered-only, body.unregistered label.unregistered-only, body.unregistered q.unregistered-only, body.unregistered s.unregistered-only, body.unregistered samp.unregistered-only, body.unregistered select.unregistered-only, body.unregistered small.unregistered-only, body.unregistered span.unregistered-only, body.unregistered strike.unregistered-only, body.unregistered strong.unregistered-only, body.unregistered sub.unregistered-only, body.unregistered sup.unregistered-only, body.unregistered textarea.unregistered-only, body.unregistered tt.unregistered-only, body.unregistered u.unregistered-only, body.unregistered var.unregistered-only { display: inline; } body.unregistered address.unregistered-only, body.unregistered blockquote.unregistered-only, body.unregistered center.unregistered-only, body.unregistered dir.unregistered-only, body.unregistered div.unregistered-only, body.unregistered dd.unregistered-only, body.unregistered dl.unregistered-only, body.unregistered dt.unregistered-only, body.unregistered fieldset.unregistered-only, body.unregistered form.unregistered-only, body.unregistered frameset.unregistered-only, body.unregistered h1.unregistered-only, body.unregistered h2.unregistered-only, body.unregistered h3.unregistered-only, body.unregistered h4.unregistered-only, body.unregistered h5.unregistered-only, body.unregistered h6.unregistered-only, body.unregistered hr.unregistered-only, body.unregistered isindex.unregistered-only, body.unregistered menu.unregistered-only, body.unregistered noframes.unregistered-only, body.unregistered noscript.unregistered-only, body.unregistered ol.unregistered-only, body.unregistered p.unregistered-only, body.unregistered pre.unregistered-only, body.unregistered ul.unregistered-only { - display: block; } \ No newline at end of file + display: block; } From 772a58de413ccfbd0d5120cde9e5fdf02501abfa Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 28 Sep 2009 22:34:41 -0700 Subject: [PATCH 055/118] Converted the blueprint stylesheets to css-style properties. --- .../blueprint/stylesheets/blueprint/_ie.sass | 66 ++++----- .../stylesheets/blueprint/_print.sass | 70 +++++----- .../blueprint/modules/_buttons.sass | 52 +++---- .../stylesheets/blueprint/modules/_debug.sass | 4 +- .../blueprint/modules/_fancy_type.sass | 36 ++--- .../stylesheets/blueprint/modules/_form.sass | 44 +++--- .../stylesheets/blueprint/modules/_grid.sass | 66 ++++----- .../blueprint/modules/_interaction.sass | 42 +++--- .../blueprint/modules/_link_icons.sass | 18 +-- .../blueprint/modules/_liquid.sass | 56 ++++---- .../stylesheets/blueprint/modules/_reset.sass | 36 ++--- .../stylesheets/blueprint/modules/_rtl.sass | 68 +++++----- .../blueprint/modules/_scaffolding.sass | 8 +- .../blueprint/modules/_typography.sass | 128 +++++++++--------- .../blueprint/modules/_utilities.sass | 30 ++-- .../blueprint/templates/buttons/buttons.sass | 4 +- .../blueprint/templates/project/ie.sass | 2 +- 17 files changed, 365 insertions(+), 365 deletions(-) diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass index 13db8a22..5f732316 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass @@ -30,70 +30,70 @@ +blueprint-ie-defaults =blueprint-ie-body - :text-align center + text-align: center +blueprint-ie-hacks =blueprint-ie-hacks * html & legend - :margin 0px -8px 16px 0 - :padding 0 + margin: 0px -8px 16px 0 + padding: 0 html>& p code - :*white-space normal + *white-space: normal // Fixes for Blueprint "inline" forms in IE =blueprint-inline-form-ie div, p - :vertical-align middle + vertical-align: middle label - :position relative - :top -0.25em + position: relative + top: -0.25em input &.checkbox, &.radio, &.button, button - :margin 0.5em 0 + margin: 0.5em 0 =blueprint-ie-defaults .container - :text-align left + text-align: left ol - :margin-left 2em + margin-left: 2em sup - :vertical-align text-top + vertical-align: text-top sub - :vertical-align text-bottom + vertical-align: text-bottom hr - :margin -8px auto 11px + margin: -8px auto 11px img - :-ms-interpolation-mode bicubic + -ms-interpolation-mode: bicubic fieldset - :padding-top 0 + padding-top: 0 input &.text - :margin 0.5em 0 - :background-color #fff - :border 1px solid #bbb + margin: 0.5em 0 + background-color: #fff + border: 1px solid #bbb &:focus - :border 1px solid #666 + border: 1px solid #666 &.title - :margin 0.5em 0 - :background-color #fff - :border 1px solid #bbb + margin: 0.5em 0 + background-color: #fff + border: 1px solid #bbb &:focus - :border 1px solid #666 + border: 1px solid #666 &.checkbox - :position relative - :top 0.25em + position: relative + top: 0.25em &.radio - :position relative - :top 0.25em + position: relative + top: 0.25em &.button - :position relative - :top 0.25em + position: relative + top: 0.25em textarea - :margin 0.5em 0 + margin: 0.5em 0 select - :margin 0.5em 0 + margin: 0.5em 0 button - :position relative - :top 0.25em + position: relative + top: 0.25em diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass index 7726339e..566aaa95 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass @@ -32,59 +32,59 @@ // Feel free to mix it into anchors where you want it. =blueprint-show-link-urls &:after - :content " (" attr(href) ")" - :font-size 90% + content: " (" attr(href) ")" + font-size: 90% =blueprint-print-body - :line-height 1.5 - :font-family= !blueprint_font_family - :color #000 - :background none - :font-size 10pt + line-height: 1.5 + font-family= !blueprint_font_family + color: #000 + background: none + font-size: 10pt =blueprint-print-defaults .container - :background none + background: none hr - :background #ccc - :color #ccc - :width 100% - :height 2px - :margin 2em 0 - :padding 0 - :border none + background: #ccc + color: #ccc + width: 100% + height: 2px + margin: 2em 0 + padding: 0 + border: none &.space - :background #fff - :color #fff + background: #fff + color: #fff h1, h2, h3, h4, h5, h6 - :font-family= !blueprint_font_family + font-family= !blueprint_font_family code - :font - :size .9em - :family= !blueprint_fixed_font_family + font: + size: .9em + family= !blueprint_fixed_font_family img +float-left - :margin 1.5em 1.5em 1.5em 0 + margin: 1.5em 1.5em 1.5em 0 a img - :border none + border: none &:link, &:visited - :background transparent - :font-weight 700 - :text-decoration underline + background: transparent + font-weight: 700 + text-decoration: underline p img.top - :margin-top 0 + margin-top: 0 blockquote - :margin 1.5em - :padding 1em - :font-style italic - :font-size .9em + margin: 1.5em + padding: 1em + font-style: italic + font-size: .9em .small - :font-size .9em + font-size: .9em .large - :font-size 1.1em + font-size: 1.1em .quiet - :color #999 + color: #999 .hide - :display none + display: none diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass index a82e672e..b2b5e3e1 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass @@ -24,9 +24,9 @@ @param border_highlight_color The highlight color defaults to whatever is the value of the border_color but it's one shade lighter. =button-colors(!font_color = !blueprint_button_font_color, !bg_color = !blueprint_button_background_color, !border_color = !blueprint_button_border_color, !border_highlight_color = !border_color + #101010) - :background-color= !bg_color - :border-color= !border_highlight_color !border_color !border_color !border_highlight_color - :color= !font_color + background-color= !bg_color + border-color= !border_highlight_color !border_color !border_color !border_highlight_color + color= !font_color //** Sets the colors for a button in the active state @@ -46,39 +46,39 @@ =button-base(!float = false) @if !float - :display block + display: block +float(!float) @else +inline-block - :margin 0.7em 0.5em 0.7em 0 - :border-width 1px - :border-style solid - :font-family= !blueprint_button_font_family - :font-size 100% - :line-height 130% - :text-decoration none - :font-weight bold - :cursor pointer + margin: 0.7em 0.5em 0.7em 0 + border-width: 1px + border-style: solid + font-family= !blueprint_button_font_family + font-size: 100% + line-height: 130% + text-decoration: none + font-weight: bold + cursor: pointer img - :margin 0 3px -3px 0 !important - :padding 0 - :border none - :width 16px - :height 16px - :float none + margin: 0 3px -3px 0 !important + padding: 0 + border: none + width: 16px + height: 16px + float: none =anchor-button(!float = false) +button-base(!float) - :padding 5px 10px 5px 7px + padding: 5px 10px 5px 7px =button-button(!float = false) +button-base(!float) - :width auto - :overflow visible - :padding 4px 10px 3px 7px + width: auto + overflow: visible + padding: 4px 10px 3px 7px &[type] - :padding 4px 10px 4px 7px - :line-height 17px + padding: 4px 10px 4px 7px + line-height: 17px *:first-child+html &[type] - :padding 4px 10px 3px 7px + padding: 4px 10px 3px 7px diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass index 8a4b5bc8..4b93f23f 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass @@ -1,9 +1,9 @@ =showgrid(!image = "grid.png") - :background= image_url(!image) + background= image_url(!image) =blueprint-debug(!grid_image = "grid.png") // Use this class on any column or container to see the grid. // TODO: prefix this with the project path. .showgrid +showgrid(!grid_image) - \ No newline at end of file + diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass index 77ae86d1..71d8d6f0 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass @@ -18,11 +18,11 @@ // Indentation instead of line shifts for sibling paragraphs. Mixin to a style like p + p =sibling-indentation - :text-indent 2em - :margin-top -1.5em + text-indent: 2em + margin-top: -1.5em /* Don't want this in forms. form & - :text-indent 0 + text-indent: 0 // For great looking type, use this code instead of asdf: @@ -30,10 +30,10 @@ Best used on prepositions and ampersands. =alt - :color #666 - :font-family "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif - :font-style italic - :font-weight normal + color: #666 + font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif + font-style: italic + font-weight: normal // For great looking quote marks in titles, replace "asdf" with: @@ -41,7 +41,7 @@ (That is, when the title starts with a quote mark). (You may have to change this value depending on your font size). =dquo(!offset = 0.5em) - :margin-left -!offset + margin-left: -!offset // Reduced size type with incremental leading @@ -58,21 +58,21 @@ base_font_size - The base font size in pixels. Defaults to 12px old_line_height - The old line height. Defaults to 1.5 times the base_font_size =incr(!font_size = 10px, !base_font_size = !blueprint_font_size, !old_line_height = !base_font_size * 1.5) - :font-size= 1em * !font_size / !base_font_size - :line-height= 1em * !old_line_height / !font_size * 4 / 5 - :margin-bottom 1.5em + font-size= 1em * !font_size / !base_font_size + line-height= 1em * !old_line_height / !font_size * 4 / 5 + margin-bottom: 1.5em // Surround uppercase words and abbreviations with this class. Based on work by Jørgen Arnor Gårdsø Lom [http://twistedintellect.com/] =caps - :font-variant small-caps - :letter-spacing 1px - :text-transform lowercase - :font-size 1.2em - :line-height 1% - :font-weight bold - :padding 0 2px + font-variant: small-caps + letter-spacing: 1px + text-transform: lowercase + font-size: 1.2em + line-height: 1% + font-weight: bold + padding: 0 2px =fancy-paragraphs p + p diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass index 1862c44a..1ff6c040 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass @@ -2,9 +2,9 @@ // Mixin for producing Blueprint "inline" forms. Should be used with the blueprint-form mixin. =blueprint-inline-form - :line-height 3 + line-height: 3 p - :margin-bottom 0 + margin-bottom: 0 =blueprint-form +blueprint-form-layout @@ -13,43 +13,43 @@ =blueprint-form-layout label - :font-weight bold + font-weight: bold fieldset - :padding 1.4em - :margin 0 0 1.5em 0 + padding: 1.4em + margin: 0 0 1.5em 0 legend - :font-weight bold - :font-size 1.2em + font-weight: bold + font-size: 1.2em input &.text, &.title, &[type=text] - :margin 0.5em 0 - :background-color #fff - :padding 5px + margin: 0.5em 0 + background-color: #fff + padding: 5px &.title - :font-size 1.5em + font-size: 1.5em &[type=checkbox], &.checkbox, &[type=radio], &.radio - :position relative - :top 0.25em + position: relative + top: 0.25em textarea - :margin 0.5em 0 - :padding 5px + margin: 0.5em 0 + padding: 5px select - :margin 0.5em 0 + margin: 0.5em 0 =blueprint-form-sizes(!input_width = 300px, !textarea_width = 390px, !textarea_height = 250px) input.text, input.title - :width= !input_width + width= !input_width textarea - :width= !textarea_width - :height= !textarea_height + width= !textarea_width + height= !textarea_height =blueprint-form-borders(!unfocused_border_color = #bbb, !focus_border_color = #666, !fieldset_border_color = #ccc) fieldset - :border= 1px "solid" !fieldset_border_color + border= 1px "solid" !fieldset_border_color input.text, input.title, textarea, select - :border= 1px "solid" !unfocused_border_color + border= 1px "solid" !unfocused_border_color &:focus - :border= 1px "solid" !focus_border_color \ No newline at end of file + border= 1px "solid" !focus_border_color diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass index c9ca5bec..3edd3897 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass @@ -41,7 +41,7 @@ +span(!n) .span-#{!blueprint_grid_columns}, div.span-#{!blueprint_grid_columns} +span(!blueprint_grid_columns) - :margin 0 + margin: 0 input, textarea, select @for !n from 1 through !blueprint_grid_columns &.span-#{!n} @@ -76,30 +76,30 @@ // Note: If you use this mixin without the class and want to support ie6 // you must set text-align left on your container element in an IE stylesheet. =container - :width = !blueprint_container_size - :margin 0 auto + width= !blueprint_container_size + margin: 0 auto +clearfix // The last column in a row needs this mixin or it will end up on the next row. // TODO add this to span mixin when we have optional arguments =last - :margin-right 0 + margin-right: 0 =span(!n, !override = false) !width = !blueprint_grid_width * !n + (!blueprint_grid_margin * (!n - 1)) @if !override - :width = !width !important + width= !width !important @else - :width = !width + width= !width =column-base(!last = false) +float-left @if !last +last @else - :margin-right = !blueprint_grid_margin + margin-right= !blueprint_grid_margin * html & - :overflow-x hidden + overflow-x: hidden // Use this mixins to set the width of n columns. =column(!n, !last = false) @@ -109,27 +109,27 @@ // Mixin to a column to append n empty cols. =append(!n) - :padding-right = (!blueprint_grid_outer_width) * !n + padding-right= (!blueprint_grid_outer_width) * !n // Mixin to a column to prepend n empty cols. =prepend(!n) - :padding-left = (!blueprint_grid_outer_width) * !n + padding-left= (!blueprint_grid_outer_width) * !n =append-bottom(!amount = 1.5em) - :margin-bottom= !amount + margin-bottom= !amount =prepend-top(!amount = 1.5em) - :margin-top= !amount + margin-top= !amount =pull-base +float-left - :position relative + position: relative =pull-margins(!n, !last = false) @if !last - :margin-left = (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin + margin-left= (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin @else - :margin-left = -!blueprint_grid_outer_width * !n + margin-left= -!blueprint_grid_outer_width * !n // mixin to a column to move it n columns to the left =pull(!n, !last = false) @@ -138,10 +138,10 @@ =push-base +float-right - :position relative + position: relative =push-margins(!n) - :margin= 0 (-!blueprint_grid_outer_width * !n) 1.5em (!blueprint_grid_outer_width * !n) + margin= 0 (-!blueprint_grid_outer_width * !n) 1.5em (!blueprint_grid_outer_width * !n) // mixin to a column to push it n columns to the right =push(!n) @@ -150,29 +150,29 @@ // Border on right hand side of a column. =border(!border_color = #eee, !border_width = 1px) - :padding-right = !blueprint_grid_margin / 2 - !border_width - :margin-right = !blueprint_grid_margin / 2 - :border-right #{!border_width} solid #{!border_color} + padding-right= !blueprint_grid_margin / 2 - !border_width + margin-right= !blueprint_grid_margin / 2 + border-right: #{!border_width} solid #{!border_color} // Border with more whitespace, spans one column. =colborder(!border_color = #eee, !border_width = 1px) - :padding-right= floor((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) - :margin-right= ceil((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) - :border-right #{!border_width} solid #{!border_color} + padding-right= floor((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) + margin-right= ceil((!blueprint_grid_width + 2 * !blueprint_grid_margin - !border_width)/2) + border-right: #{!border_width} solid #{!border_color} // Mixin this to an hr to make a horizontal ruler across a column. =colruler(!border_color = #ddd) - :background= !border_color - :color= !border_color - :clear both - :float none - :width 100% - :height .1em - :margin 0 0 1.45em - :border none + background= !border_color + color= !border_color + clear: both + float: none + width: 100% + height: .1em + margin: 0 0 1.45em + border: none // Mixin this to an hr to make a horizontal spacer across a column. =colspacer +colruler - :background #fff - :color #fff + background: #fff + color: #fff diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass index c4b19f5f..ff5e4054 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass @@ -9,7 +9,7 @@ .success +success .hide - :display none + display: none .highlight +highlight .added @@ -18,41 +18,41 @@ +removed =feedback-base - :padding .8em - :margin-bottom 1em - :border= 2px "solid" !feedback_border_color + padding: .8em + margin-bottom: 1em + border= 2px "solid" !feedback_border_color =error +feedback-base - :background = !error_bg_color - :color = !error_color - :border-color = !error_border_color + background= !error_bg_color + color= !error_color + border-color= !error_border_color a - :color = !error_color + color= !error_color =notice +feedback-base - :background = !notice_bg_color - :color = !notice_color - :border-color = !notice_border_color + background= !notice_bg_color + color= !notice_color + border-color= !notice_border_color a - :color = !notice_color + color= !notice_color =success +feedback-base - :background = !success_bg_color - :color = !success_color - :border-color = !success_border_color + background= !success_bg_color + color= !success_color + border-color= !success_border_color a - :color = !success_color + color= !success_color =highlight - :background = !highlight_color + background= !highlight_color =added - :background = !added_bg_color - :color = !added_color + background= !added_bg_color + color= !added_color =removed - :background = !removed_bg_color - :color = !removed_color + background= !removed_bg_color + color= !removed_color diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass index dd50ebf7..58933fed 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass @@ -1,18 +1,18 @@ =no-link-icon - :background transparent none !important - :padding 0 !important - :margin 0 !important + background: transparent none !important + padding: 0 !important + margin: 0 !important =link-icon-base - :padding 2px 22px 2px 0 - :margin -2px 0 - :background-repeat no-repeat - :background-position right center + padding: 2px 22px 2px 0 + margin: -2px 0 + background-repeat: no-repeat + background-position: right center =link-icon(!name, !include_base = true) @if !include_base +link-icon-base - :background-image= image_url("link_icons/#{!name}") + background-image= image_url("link_icons/#{!name}") =link-icons a[href^="http:"], @@ -41,4 +41,4 @@ a[href$=".rdf"] +link-icon("feed.png", false) a[href^="aim:"] - +link-icon("im.png", false) \ No newline at end of file + +link-icon("im.png", false) diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass index 87043942..d21962a1 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass @@ -76,66 +76,66 @@ +push(!n) =container - :min-width= !blueprint_liquid_container_min_width - :width = !blueprint_liquid_container_width - :margin 0 auto + min-width= !blueprint_liquid_container_min_width + width= !blueprint_liquid_container_width + margin: 0 auto +clearfix =span(!n, !override = false) !width = (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) @if !override - :width = !width !important + width= !width !important @else - :width = !width + width= !width =last - :margin-right 0 + margin-right: 0 =column(!n, !last = false) +float-left - :overflow hidden + overflow: hidden +span(!n) @if !last +last @else - :margin-right = !blueprint_liquid_grid_margin + margin-right= !blueprint_liquid_grid_margin =append(!n) - :padding-right= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + padding-right= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) =prepend(!n) - :padding-left= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + padding-left= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) =pull(!n, !last = false) - :margin-left= (!blueprint_liquid_grid_push_pull * !n) + margin-left= (!blueprint_liquid_grid_push_pull * !n) =push(!n) +float-right - :margin - :top 0 - :left 1.5em - :right= (!blueprint_liquid_grid_push_pull * !n) - :bottom 0 + margin: + top: 0 + left: 1.5em + right= (!blueprint_liquid_grid_push_pull * !n) + bottom: 0 =border - :border-right 1px solid #eee + border-right: 1px solid #eee =colborder - :padding-right 2% - :margin-right 2% + padding-right: 2% + margin-right: 2% +border =colruler - :background #ddd - :color #ddd - :clear both - :width 100% - :height 0.083em - :margin 0 0 1.583em - :border none + background: #ddd + color: #ddd + clear: both + width: 100% + height: 0.083em + margin: 0 0 1.583em + border: none =colspacer +colruler - :background #fff - :color #fff + background: #fff + color: #fff diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass index fff5f3f5..2045a794 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass @@ -20,37 +20,37 @@ table +blueprint-reset-table a img - :border none + border: none =blueprint-reset-box-model - :margin 0 - :padding 0 - :border 0 + margin: 0 + padding: 0 + border: 0 =blueprint-reset +blueprint-reset-box-model - :font - :weight inherit - :style inherit - :size 100% - :family inherit - :vertical-align baseline + font: + weight: inherit + style: inherit + size: 100% + family: inherit + vertical-align: baseline =blueprint-reset-quotation +blueprint-reset - :quotes "" "" + quotes: "" "" &:before, &:after - :content "" + content: "" =blueprint-reset-table-cell +blueprint-reset - :text-align left - :font-weight normal - :vertical-align middle + text-align: left + font-weight: normal + vertical-align: middle =blueprint-reset-table +blueprint-reset - :border-collapse separate - :border-spacing 0 - :vertical-align middle + border-collapse: separate + border-spacing: 0 + vertical-align: middle diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass index 5c4599a3..616b92f0 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass @@ -13,62 +13,62 @@ // Note: If you use this mixin without the class and want to support ie6 // you must set text-align left on your container element in an IE stylesheet. =container - :width = !blueprint_container_size - :margin 0 auto - :direction rtl + width= !blueprint_container_size + margin: 0 auto + direction: rtl +clearfix // The last column in a row needs this mixin or it will end up on the next row. // TODO add this to span mixin when we have optional arguments =last - :margin-left 0 + margin-left: 0 =column-base(!last = false) +float-right @if !last +last @else - :margin-left = !blueprint_grid_margin + margin-left= !blueprint_grid_margin * html & - :overflow-x hidden + overflow-x: hidden // Mixin to a column to append n empty cols. =append(!n) - :padding-left = (!blueprint_grid_outer_width) * !n + padding-left= (!blueprint_grid_outer_width) * !n // Mixin to a column to prepend n empty cols. =prepend(!n) - :padding-right = (!blueprint_grid_outer_width) * !n + padding-right= (!blueprint_grid_outer_width) * !n // mixin to a column to move it n columns to the left =pull(!n, !last = false) - :position relative + position: relative @if !last - :margin-right = (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin + margin-right= (-!blueprint_grid_outer_width * !n) + !blueprint_grid_margin @else - :margin-right = -!blueprint_grid_outer_width * !n + margin-right= -!blueprint_grid_outer_width * !n // mixin to a column to push it n columns to the right =push(!n) +float-right - :position relative - :margin - :top 0 - :left = -!blueprint_grid_outer_width * !n - :bottom 1.5em - :right = !blueprint_grid_outer_width * !n + position: relative + margin: + top: 0 + left= -!blueprint_grid_outer_width * !n + bottom: 1.5em + right= !blueprint_grid_outer_width * !n // Border on left hand side of a column. =border - :padding-left = !blueprint_grid_margin / 2 - 1 - :margin-left = !blueprint_grid_margin / 2 - :border-left 1px solid #eee + padding-left= !blueprint_grid_margin / 2 - 1 + margin-left= !blueprint_grid_margin / 2 + border-left: 1px solid #eee // Border with more whitespace, spans one column. =colborder - :padding-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin - 1)/2 - :margin-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin)/2 - :border-left 1px solid #eee + padding-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin - 1)/2 + margin-left= (!blueprint_grid_width - 2 * !blueprint_grid_margin)/2 + border-left: 1px solid #eee // Usage examples: // As a top-level mixin, apply to any page that includes the stylesheet: @@ -85,11 +85,11 @@ =rtl-typography(!body_selector = "body") @if !body_selector == true html & - :font-family Arial, sans-serif + font-family: Arial, sans-serif +rtl-typography-defaults @else html #{!body_selector} - :font-family Arial, sans-serif + font-family: Arial, sans-serif @if !body_selector != "body" @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +rtl-typography, pass true as the first argument and mix it into #{!body_selector}." +rtl-typography-defaults @@ -99,24 +99,24 @@ =rtl-typography-defaults h1, h2, h3, h4, h5, h6 - :font-family Arial, sans-serif + font-family: Arial, sans-serif pre, code, tt - :font-family monospace + font-family: monospace p img.right +float-left - :margin 1.5em 1.5em 1.5em 0 - :padding 0 + margin: 1.5em 1.5em 1.5em 0 + padding: 0 img.left +float-right - :margin 1.5em 0 1.5em 1.5em - :padding 0 + margin: 1.5em 0 1.5em 1.5em + padding: 0 dd, ul, ol - :margin-left 0 - :margin-right 1.5em + margin-left: 0 + margin-right: 1.5em td, th - :text-align right + text-align: right diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass index a61c8ee8..fc597951 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass @@ -24,13 +24,13 @@ // The styles this mixin provides were deprecated in Blueprint 0.9 and is no longer part of the // main scaffolding, but the mixin is still available if you want to use it. =blueprint-scaffolding-body - :margin 1.5em 0 + margin: 1.5em 0 // Mixin +box to create a padded box inside a column. =box - :padding 1.5em - :margin-bottom 1.5em - :background #E5ECF9 + padding: 1.5em + margin-bottom: 1.5em + background: #E5ECF9 =blueprint-scaffolding-defaults .box diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass index 049fd143..6f230bfb 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass @@ -32,128 +32,128 @@ +blueprint-typography-defaults =normal-text - :font-family= !blueprint_font_family - :color= !font_color + font-family= !blueprint_font_family + color= !font_color =fixed-width-text - :font= 1em !blueprint_fixed_font_family - :line-height 1.5 + font= 1em !blueprint_fixed_font_family + line-height: 1.5 =header-text - :font-weight normal - :color= !header_color + font-weight: normal + color= !header_color =quiet - :color= !quiet_color + color= !quiet_color =loud - :color= !loud_color + color= !loud_color =blueprint-typography-body(!font_size = !blueprint_font_size) - :line-height 1.5 + line-height: 1.5 +normal-text - :font-size= 100% * !font_size / 16px + font-size= 100% * !font_size / 16px =blueprint-typography-defaults h1 +header-text - :font-size 3em - :line-height 1 - :margin-bottom 0.5em + font-size: 3em + line-height: 1 + margin-bottom: 0.5em img - :margin 0 + margin: 0 h2 +header-text - :font-size 2em - :margin-bottom 0.75em + font-size: 2em + margin-bottom: 0.75em h3 +header-text - :font-size 1.5em - :line-height 1 - :margin-bottom 1em + font-size: 1.5em + line-height: 1 + margin-bottom: 1em h4 +header-text - :font-size 1.2em - :line-height 1.25 - :margin-bottom 1.25em + font-size: 1.2em + line-height: 1.25 + margin-bottom: 1.25em h5 +header-text - :font-size 1em - :font-weight bold - :margin-bottom 1.5em + font-size: 1em + font-weight: bold + margin-bottom: 1.5em h6 +header-text - :font-size 1em - :font-weight bold + font-size: 1em + font-weight: bold h2 img, h3 img, h4 img, h5 img, h6 img - :margin 0 + margin: 0 p - :margin 0 0 1.5em + margin: 0 0 1.5em img.left +float-left - :margin 1.5em 1.5em 1.5em 0 - :padding 0 + margin: 1.5em 1.5em 1.5em 0 + padding: 0 img.right +float-right - :margin 1.5em 0 1.5em 1.5em - :padding 0 + margin: 1.5em 0 1.5em 1.5em + padding: 0 a - :text-decoration underline + text-decoration: underline +link-colors(!link_color, !link_hover_color, !link_active_color, !link_visited_color, !link_focus_color) blockquote - :margin 1.5em - :color #666 - :font-style italic + margin: 1.5em + color: #666 + font-style: italic strong - :font-weight bold + font-weight: bold em - :font-style italic + font-style: italic dfn - :font-style italic - :font-weight bold + font-style: italic + font-weight: bold sup, sub - :line-height 0 + line-height: 0 abbr, acronym - :border-bottom 1px dotted #666 + border-bottom: 1px dotted #666 address - :margin 0 0 1.5em - :font-style italic + margin: 0 0 1.5em + font-style: italic del - :color #666 + color: #666 pre - :margin 1.5em 0 - :white-space pre + margin: 1.5em 0 + white-space: pre pre, code, tt +fixed-width-text li ul, li ol - :margin 0 1.5em + margin: 0 1.5em ul - :margin 0 1.5em 1.5em 1.5em - :list-style-type disc + margin: 0 1.5em 1.5em 1.5em + list-style-type: disc ol - :margin 0 1.5em 1.5em 1.5em - :list-style-type decimal + margin: 0 1.5em 1.5em 1.5em + list-style-type: decimal dl - :margin 0 0 1.5em 0 + margin: 0 0 1.5em 0 dt - :font-weight bold + font-weight: bold dd - :margin-left 1.5em + margin-left: 1.5em table - :margin-bottom 1.4em - :width 100% + margin-bottom: 1.4em + width: 100% th - :font-weight bold + font-weight: bold thead th - :background= !blueprint_table_header_color + background= !blueprint_table_header_color th, td, caption - :padding 4px 10px 4px 5px + padding: 4px 10px 4px 5px tr.even td - :background= !blueprint_table_stripe_color + background= !blueprint_table_stripe_color tfoot - :font-style italic + font-style: italic caption - :background #eee + background: #eee .quiet +quiet .loud diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass index b46b9b50..e7812d2d 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass @@ -7,7 +7,7 @@ =blueprint-utilities // Regular clearing apply to column that should drop below previous ones. .clear - :clear both + clear: both // turn off text wrapping for the element. .nowrap +nowrap @@ -16,22 +16,22 @@ .clearfix +clearfix .small - :font-size .8em - :margin-bottom 1.875em - :line-height 1.875em + font-size: .8em + margin-bottom: 1.875em + line-height: 1.875em .large - :font-size 1.2em - :line-height 2.5em - :margin-bottom 1.25em + font-size: 1.2em + line-height: 2.5em + margin-bottom: 1.25em .first - :margin-left 0 - :padding-left 0 + margin-left: 0 + padding-left: 0 .last - :margin-right 0 - :padding-right 0 + margin-right: 0 + padding-right: 0 .top - :margin-top 0 - :padding-top 0 + margin-top: 0 + padding-top: 0 .bottom - :margin-bottom 0 - :padding-bottom 0 + margin-bottom: 0 + padding-bottom: 0 diff --git a/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass b/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass index e8ca96e6..3e616150 100644 --- a/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass +++ b/lib/compass/frameworks/blueprint/templates/buttons/buttons.sass @@ -38,12 +38,12 @@ button // We can change the colors for buttons of certain classes, etc. a.positive, button.positive - :color #529214 + color: #529214 +button-hover-colors(#529214, #E6EFC2, #C6D880) +button-active-colors(#FFF, #529214, #529214) a.negative, button.negative - :color #D12F19 + color: #D12F19 +button-hover-colors(#D12F19, #FBE3E4, #FBC2C4) +button-active-colors(#FFF, #D12F19, #D12F19) diff --git a/lib/compass/frameworks/blueprint/templates/project/ie.sass b/lib/compass/frameworks/blueprint/templates/project/ie.sass index 1ba6fd06..31aad76a 100644 --- a/lib/compass/frameworks/blueprint/templates/project/ie.sass +++ b/lib/compass/frameworks/blueprint/templates/project/ie.sass @@ -12,5 +12,5 @@ body.bp // the correct behavior to your main container (but not the body tag!) // Example: // .my-container - // :text-align left + // text-align: left From 4cc569586bb68b2fd7a5294537d9743431e81f5a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 29 Sep 2009 18:35:24 -0700 Subject: [PATCH 056/118] Restructure the existing command line code to allow for the new sub-command based CLI. --- Rakefile | 2 +- bin/compass | 29 ++-- lib/compass/commands.rb | 10 ++ lib/compass/commands/base.rb | 7 +- lib/compass/commands/registry.rb | 19 +++ lib/compass/exec.rb | 251 +---------------------------- lib/compass/exec/helpers.rb | 28 ++++ lib/compass/exec/sub_command_ui.rb | 0 lib/compass/exec/switch_ui.rb | 219 +++++++++++++++++++++++++ test/command_line_helper.rb | 4 +- 10 files changed, 310 insertions(+), 259 deletions(-) create mode 100644 lib/compass/commands.rb create mode 100644 lib/compass/commands/registry.rb create mode 100644 lib/compass/exec/helpers.rb create mode 100644 lib/compass/exec/sub_command_ui.rb create mode 100644 lib/compass/exec/switch_ui.rb diff --git a/Rakefile b/Rakefile index f45d0411..ee6c3cb0 100644 --- a/Rakefile +++ b/Rakefile @@ -110,7 +110,7 @@ task :examples do puts "=" * "Compiling #{example}".length Dir.chdir example do load "bootstrap.rb" if File.exists?("bootstrap.rb") - Compass::Exec::Compass.new(["--force"]).run! + Compass::Exec::SwitchUI.new(["--force"]).run! end # compile any haml templates to html FileList["#{example}/**/*.haml"].each do |haml_file| diff --git a/bin/compass b/bin/compass index b8af02d8..f816f3e9 100755 --- a/bin/compass +++ b/bin/compass @@ -1,19 +1,26 @@ #!/usr/bin/env ruby # The compass command line utility -begin +# This allows compass to run easily from a git checkout without install. +def fallback_load_path(path) retried = false - require 'compass' - require 'compass/exec' -rescue LoadError - if retried + begin + yield + rescue LoadError + unless retried + $: << path + retried = true + retry + end raise - else - $: << File.join(File.dirname(__FILE__), '..', 'lib') - retried = true - retry end end -command = Compass::Exec::Compass.new(ARGV) -exit command.run! +fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do + require 'compass' + require 'compass/exec' +end + + +command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(ARGV) +exit command_line_class.new(ARGV).run! diff --git a/lib/compass/commands.rb b/lib/compass/commands.rb new file mode 100644 index 00000000..227b405b --- /dev/null +++ b/lib/compass/commands.rb @@ -0,0 +1,10 @@ +module Compass::Commands +end + +require 'compass/commands/registry' + +%w(base generate_grid_background list_frameworks project_base + update_project watch_project create_project installer_command + print_version stamp_pattern validate_project write_configuration).each do |lib| + require "compass/commands/#{lib}" +end diff --git a/lib/compass/commands/base.rb b/lib/compass/commands/base.rb index 94c17d57..072ce7f5 100644 --- a/lib/compass/commands/base.rb +++ b/lib/compass/commands/base.rb @@ -1,6 +1,11 @@ module Compass module Commands class Base + def self.inherited(command_class) + if command_class.respond_to? :name + Compass::Commands[command_class.name] = command_class + end + end include Actions @@ -30,4 +35,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/registry.rb b/lib/compass/commands/registry.rb new file mode 100644 index 00000000..53e3db37 --- /dev/null +++ b/lib/compass/commands/registry.rb @@ -0,0 +1,19 @@ +module Compass::Commands + module Registry + def register(name, command_class) + @commands ||= Hash.new + @commands[name.to_sym] = command_class + end + def get(name) + @commands ||= Hash.new + @commands[name.to_sym] + end + def command_exists?(name) + @commands ||= Hash.new + @commands.has_key?(name.to_sym) + end + alias_method :[], :get + alias_method :[]=, :register + end + extend Registry +end diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 571c3713..105175ed 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -3,250 +3,13 @@ require 'optparse' require 'compass/logger' require 'compass/errors' require 'compass/actions' +require 'compass/commands' -module Compass - module Exec - - def report_error(e, options) - $stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}" - if options[:trace] - e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" } - else - $stderr.puts "Run with --trace to see the full backtrace" - end - end - - def get_file(exception) - exception.backtrace[0].split(/:/, 2)[0] - end - - def get_line(exception) - exception.backtrace[0].scan(/:(\d+)/)[0] - end - module_function :report_error, :get_file, :get_line - - class Compass - - attr_accessor :args, :options, :opts - - def initialize(args) - self.args = args - self.options = {} - parse! - end - - def run! - begin - perform! - rescue Exception => e - raise e if e.is_a? SystemExit - if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) - $stderr.puts e.message - else - ::Compass::Exec.report_error(e, @options) - end - return 1 - end - return 0 - end - - protected - - def perform! - if options[:command] - do_command(options[:command]) - else - puts self.opts - end - end - - def parse! - self.opts = OptionParser.new(&method(:set_opts)) - self.opts.parse!(self.args) - if self.args.size > 0 - self.options[:project_name] = trim_trailing_separator(self.args.shift) - end - self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project - self.options[:framework] ||= :compass - end - - def trim_trailing_separator(path) - path[-1..-1] == File::SEPARATOR ? path[0..-2] : path - end - - def set_opts(opts) - opts.banner = <+x.', - ' Defaults to 30+10x20. Height is optional.') do |dimensions| - self.options[:grid_dimensions] = dimensions || "30+10" - self.options[:command] = :generate_grid_background - end - - opts.separator '' - opts.separator 'Install/Pattern Options:' - - opts.on('-f FRAMEWORK', '--framework FRAMEWORK', 'Use the specified framework. Only one may be specified.') do |framework| - self.options[:framework] = framework - end - - opts.on('-n', '--pattern-name NAME', 'The name to use when stamping a pattern.', - ' Must be used in combination with -p.') do |name| - self.options[:pattern_name] = name - end - - opts.on('--rails', "Sets the app type to a rails project (same as --app rails).") do - self.options[:project_type] = :rails - end - - opts.on('--app APP_TYPE', 'Specify the kind of application to integrate with.') do |project_type| - self.options[:project_type] = project_type.to_sym - end - - opts.separator '' - opts.separator 'Configuration Options:' - - opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| - self.options[:configuration_file] = configuration_file - end - - opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| - self.options[:sass_dir] = sass_dir - end - - opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| - self.options[:css_dir] = css_dir - end - - opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| - self.options[:images_dir] = images_dir - end - - opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| - self.options[:javascripts_dir] = javascripts_dir - end - - opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', - ' One of: development, production (default)') do |env| - self.options[:environment] = env - end - - opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', - ' One of: nested, expanded, compact, compressed') do |style| - self.options[:output_style] = style - end - - opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do - self.options[:relative_assets] = true - end - - opts.separator '' - opts.separator 'General Options:' - - opts.on('-r LIBRARY', '--require LIBRARY', "Require the given ruby LIBRARY before running commands.", - " This is used to access compass plugins without having a", - " project configuration file.") do |library| - ::Compass.configuration.require library - end - - opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do - self.options[:quiet] = true - end - - opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do - self.options[:dry_run] = true - end - - opts.on('--trace', :NONE, 'Show a full stacktrace on error') do - self.options[:trace] = true - end - - opts.on('--force', :NONE, 'Force. Allows some failing commands to succeed instead.') do - self.options[:force] = true - end - - opts.on('--imports', :NONE, 'Emit an imports suitable for passing to the sass command-line.', - ' Example: sass `compass --imports`', - ' Note: Compass\'s Sass extensions will not be available.') do - print ::Compass::Frameworks::ALL.map{|f| "-I #{f.stylesheets_directory}"}.join(' ') - exit - end - - opts.on('--install-dir', :NONE, 'Emit the location where compass is installed.') do - puts ::Compass.base_directory - exit - end - - opts.on_tail("-?", "-h", "--help", "Show this message") do - puts opts - exit - end - - opts.on_tail("-v", "--version", "Print version") do - self.options[:command] = :print_version - end - - end - - def do_command(command) - command_class_name = command.to_s.split(/_/).map{|p| p.capitalize}.join('') - command_class = eval("::Compass::Commands::#{command_class_name}") - command_class.new(Dir.getwd, options).execute - end - - end - end +module Compass::Exec end -%w(base generate_grid_background list_frameworks project_base - update_project watch_project create_project installer_command - print_version stamp_pattern validate_project write_configuration).each do |lib| - require "compass/commands/#{lib}" -end +require 'compass/exec/helpers' +require 'compass/exec/switch_ui' +require 'compass/exec/sub_command_ui' + + diff --git a/lib/compass/exec/helpers.rb b/lib/compass/exec/helpers.rb new file mode 100644 index 00000000..b10e2311 --- /dev/null +++ b/lib/compass/exec/helpers.rb @@ -0,0 +1,28 @@ +module Compass::Exec + module Helpers + extend self + def select_appropriate_command_line_ui(arguments) + if Compass::Commands.command_exists? arguments.first + SubCommandUI + else + SwitchUI + end + end + def report_error(e, options) + $stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}" + if options[:trace] + e.backtrace[1..-1].each { |t| $stderr.puts " #{t}" } + else + $stderr.puts "Run with --trace to see the full backtrace" + end + end + + def get_file(exception) + exception.backtrace[0].split(/:/, 2)[0] + end + + def get_line(exception) + exception.backtrace[0].scan(/:(\d+)/)[0] + end + end +end diff --git a/lib/compass/exec/sub_command_ui.rb b/lib/compass/exec/sub_command_ui.rb new file mode 100644 index 00000000..e69de29b diff --git a/lib/compass/exec/switch_ui.rb b/lib/compass/exec/switch_ui.rb new file mode 100644 index 00000000..fe2f2b5e --- /dev/null +++ b/lib/compass/exec/switch_ui.rb @@ -0,0 +1,219 @@ +module Compass::Exec + class SwitchUI + + attr_accessor :args, :options, :opts + + def initialize(args) + self.args = args + self.options = {} + parse! + end + + def run! + begin + perform! + rescue Exception => e + raise e if e.is_a? SystemExit + if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) + $stderr.puts e.message + else + ::Compass::Exec::Helpers.report_error(e, @options) + end + return 1 + end + return 0 + end + + protected + + def perform! + if options[:command] + do_command(options[:command]) + else + puts self.opts + end + end + + def parse! + self.opts = OptionParser.new(&method(:set_opts)) + self.opts.parse!(self.args) + if self.args.size > 0 + self.options[:project_name] = trim_trailing_separator(self.args.shift) + end + self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project + self.options[:framework] ||= :compass + end + + def trim_trailing_separator(path) + path[-1..-1] == File::SEPARATOR ? path[0..-2] : path + end + + def set_opts(opts) + opts.banner = <+x.', + ' Defaults to 30+10x20. Height is optional.') do |dimensions| + self.options[:grid_dimensions] = dimensions || "30+10" + self.options[:command] = :generate_grid_background + end + + opts.separator '' + opts.separator 'Install/Pattern Options:' + + opts.on('-f FRAMEWORK', '--framework FRAMEWORK', 'Use the specified framework. Only one may be specified.') do |framework| + self.options[:framework] = framework + end + + opts.on('-n', '--pattern-name NAME', 'The name to use when stamping a pattern.', + ' Must be used in combination with -p.') do |name| + self.options[:pattern_name] = name + end + + opts.on('--rails', "Sets the app type to a rails project (same as --app rails).") do + self.options[:project_type] = :rails + end + + opts.on('--app APP_TYPE', 'Specify the kind of application to integrate with.') do |project_type| + self.options[:project_type] = project_type.to_sym + end + + opts.separator '' + opts.separator 'Configuration Options:' + + opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| + self.options[:configuration_file] = configuration_file + end + + opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| + self.options[:sass_dir] = sass_dir + end + + opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| + self.options[:css_dir] = css_dir + end + + opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| + self.options[:images_dir] = images_dir + end + + opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| + self.options[:javascripts_dir] = javascripts_dir + end + + opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', + ' One of: development, production (default)') do |env| + self.options[:environment] = env + end + + opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', + ' One of: nested, expanded, compact, compressed') do |style| + self.options[:output_style] = style + end + + opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do + self.options[:relative_assets] = true + end + + opts.separator '' + opts.separator 'General Options:' + + opts.on('-r LIBRARY', '--require LIBRARY', "Require the given ruby LIBRARY before running commands.", + " This is used to access compass plugins without having a", + " project configuration file.") do |library| + ::Compass.configuration.require library + end + + opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do + self.options[:quiet] = true + end + + opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do + self.options[:dry_run] = true + end + + opts.on('--trace', :NONE, 'Show a full stacktrace on error') do + self.options[:trace] = true + end + + opts.on('--force', :NONE, 'Force. Allows some failing commands to succeed instead.') do + self.options[:force] = true + end + + opts.on('--imports', :NONE, 'Emit an imports suitable for passing to the sass command-line.', + ' Example: sass `compass --imports`', + ' Note: Compass\'s Sass extensions will not be available.') do + print ::Compass::Frameworks::ALL.map{|f| "-I #{f.stylesheets_directory}"}.join(' ') + exit + end + + opts.on('--install-dir', :NONE, 'Emit the location where compass is installed.') do + puts ::Compass.base_directory + exit + end + + opts.on_tail("-?", "-h", "--help", "Show this message") do + puts opts + exit + end + + opts.on_tail("-v", "--version", "Print version") do + self.options[:command] = :print_version + end + + end + + def do_command(command) + command_class_name = command.to_s.split(/_/).map{|p| p.capitalize}.join('') + command_class = eval("::Compass::Commands::#{command_class_name}") + command_class.new(Dir.getwd, options).execute + end + + end +end diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index 077caaf4..2ecb0871 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -91,6 +91,6 @@ module Compass::CommandLineHelper end def execute(*arguments) - Compass::Exec::Compass.new(arguments).run! + Compass::Exec::SwitchUI.new(arguments).run! end -end \ No newline at end of file +end From 0fc9a0e3c81a3781b2afe35ad9ed763049dc8acf Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Oct 2009 00:33:36 -0700 Subject: [PATCH 057/118] Subcommand UI for project creation and initialization. --- COMMAND_LINE.markdown | 68 ++++++++++++++++++++++ lib/compass/commands/base.rb | 6 +- lib/compass/commands/create_project.rb | 68 +++++++++++++++++++++- lib/compass/commands/installer_command.rb | 4 +- lib/compass/exec.rb | 10 ++-- lib/compass/exec/command_option_parser.rb | 16 +++++ lib/compass/exec/global_options_parser.rb | 37 ++++++++++++ lib/compass/exec/project_options_parser.rb | 42 +++++++++++++ lib/compass/exec/sub_command_ui.rb | 42 +++++++++++++ lib/compass/exec/switch_ui.rb | 67 +++------------------ 10 files changed, 286 insertions(+), 74 deletions(-) create mode 100644 COMMAND_LINE.markdown create mode 100644 lib/compass/exec/command_option_parser.rb create mode 100644 lib/compass/exec/global_options_parser.rb create mode 100644 lib/compass/exec/project_options_parser.rb diff --git a/COMMAND_LINE.markdown b/COMMAND_LINE.markdown new file mode 100644 index 00000000..591a093f --- /dev/null +++ b/COMMAND_LINE.markdown @@ -0,0 +1,68 @@ +Compass Command Line Documentation +================================== + +Extensions Commands +------------------- + + # install a global extension. probably requires sudo. + compass extension install extension_name + + # install an extension into a project + compass extension unpack extension_name [path/to/project] + + # uninstall a local or global extension. global extensions will require sudo. + compass extension uninstall extension_name [path/to/project] + + # list the extensions in the project + compass extensions list + + # list the extensions available for install + compass extensions available + +Project Commands +---------------- + + # Create a new compass project + compass create path/to/project [--using blueprint] [--sass-dir=sass ...] [--project-type=rails] + + # Initialize an existing project to work with compass + compass init rails path/to/project [--using blueprint] + + # Install a pattern from an extension into a project + compass install blueprint/buttons [path/to/project] + + # Compile the project's sass files into css + compass compile [path/to/project] + + # Watch the project for changes and compile whenever it does + compass watch [path/to/project] + + # Emit a configuration file at the location specified. + compass config [path/to/config] [--sass-dir=sass --css-dir=css ...] + + # Validate the generated CSS. + compass validate [path/to/project] + +misc commands +------------- + + # Generate a background image that can be used to verify grid alignment + compass grid-background W+GxH [path/to/image.png] + + # Emit the version of compass + compass version + + # Get help on compass + compass help + + # Get help on an extension + compass help extension_name + + # Get help about an extension pattern + compass help extension_name/pattern_name + + # Get help about a particular sub command + compass help command_name + + + diff --git a/lib/compass/commands/base.rb b/lib/compass/commands/base.rb index 072ce7f5..91a0850f 100644 --- a/lib/compass/commands/base.rb +++ b/lib/compass/commands/base.rb @@ -1,10 +1,8 @@ module Compass module Commands class Base - def self.inherited(command_class) - if command_class.respond_to? :name - Compass::Commands[command_class.name] = command_class - end + def self.register(command_name) + Compass::Commands[command_name] = self end include Actions diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index 45cf2706..bf764f52 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -3,10 +3,72 @@ require 'compass/commands/stamp_pattern' module Compass module Commands + module CreateProjectOptionsParser + def set_options(opts) + + opts.banner = %q{ + Usage: compass create path/to/project [options] + + Description: + Create a new compass project at the path specified. + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + + opts.on("--using FRAMEWORK", "Framework to use when creating the project.") do |framework| + framework = framework.split('/', 2) + self.options[:framework] = framework[0] + self.options[:pattern] = framework[1] + end + + super + end + end + class CreateProject < StampPattern - def initialize(working_path, options) - super(working_path, options.merge(:pattern => "project", :pattern_name => nil)) + register :create + register :init + + class << self + def parse!(arguments) + parser = parse_options!(arguments) + parse_arguments!(parser, arguments) + set_default_arguments(parser) + parser.options + end + + def parse_init!(arguments) + parser = parse_options!(arguments) + if arguments.size > 0 + parser.options[:project_type] = arguments.shift.to_sym + end + parse_arguments!(parser, arguments) + set_default_arguments(parser) + parser.options + end + + def parse_options!(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(CreateProjectOptionsParser) + parser.parse! + parser + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size == 0 + raise Compass::Error, "Please specify a path to the project." + else + raise Compass::Error, "Too many arguments were specified." + end + end + + def set_default_arguments(parser) + parser.options[:framework] ||= :compass + parser.options[:pattern] ||= "project" + end end def is_project_creation? @@ -15,4 +77,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 35bc0af3..6069f593 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -27,8 +27,8 @@ module Compass end def installer_args - [template_directory(options[:pattern]), project_directory, options] + [template_directory(options[:pattern] || "project"), project_directory, options] end end end -end \ No newline at end of file +end diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 105175ed..ee489695 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -8,8 +8,8 @@ require 'compass/commands' module Compass::Exec end -require 'compass/exec/helpers' -require 'compass/exec/switch_ui' -require 'compass/exec/sub_command_ui' - - +%w(helpers switch_ui sub_command_ui + global_options_parser project_options_parser + command_option_parser).each do |lib| + require "compass/exec/#{lib}" +end diff --git a/lib/compass/exec/command_option_parser.rb b/lib/compass/exec/command_option_parser.rb new file mode 100644 index 00000000..2bd599cc --- /dev/null +++ b/lib/compass/exec/command_option_parser.rb @@ -0,0 +1,16 @@ +module Compass::Exec + class CommandOptionParser + attr_accessor :options, :arguments + def initialize(arguments) + self.arguments = arguments + self.options = {} + end + def parse! + opts = OptionParser.new(&method(:set_options)) + opts.parse!(arguments) + end + def set_options(opts) + + end + end +end diff --git a/lib/compass/exec/global_options_parser.rb b/lib/compass/exec/global_options_parser.rb new file mode 100644 index 00000000..955ee8e0 --- /dev/null +++ b/lib/compass/exec/global_options_parser.rb @@ -0,0 +1,37 @@ +module Compass::Exec::GlobalOptionsParser + def set_options(opts) + super + set_global_options(opts) + end + def set_global_options(opts) + opts.on('-r LIBRARY', '--require LIBRARY', + "Require the given ruby LIBRARY before running commands.", + " This is used to access compass plugins without having a", + " project configuration file.") do |library| + ::Compass.configuration.require library + end + + opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do + self.options[:quiet] = true + end + + opts.on('--trace', :NONE, 'Show a full stacktrace on error') do + self.options[:trace] = true + end + + opts.on('--force', :NONE, 'Allows some failing commands to succeed instead.') do + self.options[:force] = true + end + + opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do + self.options[:dry_run] = true + end + + opts.on_tail("-?", "-h", "--help", "Show this message") do + puts opts + exit + end + + end + +end diff --git a/lib/compass/exec/project_options_parser.rb b/lib/compass/exec/project_options_parser.rb new file mode 100644 index 00000000..a7c201b6 --- /dev/null +++ b/lib/compass/exec/project_options_parser.rb @@ -0,0 +1,42 @@ +module Compass::Exec::ProjectOptionsParser + def set_options(opts) + super + set_project_options(opts) + end + def set_project_options(opts) + opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| + self.options[:configuration_file] = configuration_file + end + + opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| + self.options[:sass_dir] = sass_dir + end + + opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| + self.options[:css_dir] = css_dir + end + + opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| + self.options[:images_dir] = images_dir + end + + opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| + self.options[:javascripts_dir] = javascripts_dir + end + + opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', + ' One of: development, production (default)') do |env| + self.options[:environment] = env + end + + opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', + ' One of: nested, expanded, compact, compressed') do |style| + self.options[:output_style] = style + end + + opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do + self.options[:relative_assets] = true + end + end + +end diff --git a/lib/compass/exec/sub_command_ui.rb b/lib/compass/exec/sub_command_ui.rb index e69de29b..867514ab 100644 --- a/lib/compass/exec/sub_command_ui.rb +++ b/lib/compass/exec/sub_command_ui.rb @@ -0,0 +1,42 @@ +require 'compass/exec/global_options_parser' +require 'compass/exec/project_options_parser' + +module Compass::Exec + class SubCommandUI + + attr_accessor :args + + def initialize(args) + self.args = args + end + + def run! + begin + perform! + rescue Exception => e + raise e if e.is_a? SystemExit + if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) + $stderr.puts e.message + else + ::Compass::Exec::Helpers.report_error(e, @options) + end + return 1 + end + return 0 + end + + protected + + def perform! + command = args.shift + command_class = Compass::Commands[command] + options = if command_class.respond_to?("parse_#{command}!") + command_class.send("parse_#{command}!", args) + else + command_class.parse!(args) + end + command_class.new(Dir.getwd, options).execute + end + + end +end diff --git a/lib/compass/exec/switch_ui.rb b/lib/compass/exec/switch_ui.rb index fe2f2b5e..384092cd 100644 --- a/lib/compass/exec/switch_ui.rb +++ b/lib/compass/exec/switch_ui.rb @@ -1,6 +1,10 @@ +require 'compass/exec/global_options_parser' +require 'compass/exec/project_options_parser' + module Compass::Exec class SwitchUI - + include GlobalOptionsParser + include ProjectOptionsParser attr_accessor :args, :options, :opts def initialize(args) @@ -127,64 +131,12 @@ END opts.separator '' opts.separator 'Configuration Options:' - opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| - self.options[:configuration_file] = configuration_file - end - - opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| - self.options[:sass_dir] = sass_dir - end - - opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| - self.options[:css_dir] = css_dir - end - - opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| - self.options[:images_dir] = images_dir - end - - opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| - self.options[:javascripts_dir] = javascripts_dir - end - - opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', - ' One of: development, production (default)') do |env| - self.options[:environment] = env - end - - opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', - ' One of: nested, expanded, compact, compressed') do |style| - self.options[:output_style] = style - end - - opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do - self.options[:relative_assets] = true - end + set_project_options(opts) opts.separator '' opts.separator 'General Options:' - opts.on('-r LIBRARY', '--require LIBRARY', "Require the given ruby LIBRARY before running commands.", - " This is used to access compass plugins without having a", - " project configuration file.") do |library| - ::Compass.configuration.require library - end - - opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do - self.options[:quiet] = true - end - - opts.on('--dry-run', :NONE, 'Dry Run. Tells you what it plans to do.') do - self.options[:dry_run] = true - end - - opts.on('--trace', :NONE, 'Show a full stacktrace on error') do - self.options[:trace] = true - end - - opts.on('--force', :NONE, 'Force. Allows some failing commands to succeed instead.') do - self.options[:force] = true - end + set_global_options(opts) opts.on('--imports', :NONE, 'Emit an imports suitable for passing to the sass command-line.', ' Example: sass `compass --imports`', @@ -198,11 +150,6 @@ END exit end - opts.on_tail("-?", "-h", "--help", "Show this message") do - puts opts - exit - end - opts.on_tail("-v", "--version", "Print version") do self.options[:command] = :print_version end From dedff936b824eebcbc45cd844a3afcb1b868e193 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Oct 2009 13:45:46 -0700 Subject: [PATCH 058/118] Better output for -h, --help and on option parse error. --- lib/compass/commands/create_project.rb | 49 +++++++++++++++++------ lib/compass/exec/command_option_parser.rb | 9 ++++- lib/compass/exec/sub_command_ui.rb | 11 +++-- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index bf764f52..2c2dba6f 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -6,12 +6,28 @@ module Compass module CreateProjectOptionsParser def set_options(opts) - opts.banner = %q{ - Usage: compass create path/to/project [options] + if $command == "create" + opts.banner = %Q{ + Usage: compass create path/to/project [options] - Description: - Create a new compass project at the path specified. - }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + Description: + Create a new compass project at the path specified. + + Options: + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + else + opts.banner = %Q{ + Usage: compass init project_type path/to/project [options] + + Description: + Initialize an existing project at the path specified. + + Supported Project Types: + * rails + + Options: + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n").strip + end opts.on("--using FRAMEWORK", "Framework to use when creating the project.") do |framework| framework = framework.split('/', 2) @@ -29,15 +45,28 @@ module Compass register :init class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(CreateProjectOptionsParser) + end + + def usage + option_parser([]).to_s + end + def parse!(arguments) - parser = parse_options!(arguments) + parser = option_parser(arguments) + parse_options!(parser, arguments) parse_arguments!(parser, arguments) set_default_arguments(parser) parser.options end def parse_init!(arguments) - parser = parse_options!(arguments) + parser = option_parser(arguments) + parse_options!(parser, arguments) if arguments.size > 0 parser.options[:project_type] = arguments.shift.to_sym end @@ -46,11 +75,7 @@ module Compass parser.options end - def parse_options!(arguments) - parser = Compass::Exec::CommandOptionParser.new(arguments) - parser.extend(Compass::Exec::GlobalOptionsParser) - parser.extend(Compass::Exec::ProjectOptionsParser) - parser.extend(CreateProjectOptionsParser) + def parse_options!(parser, arguments) parser.parse! parser end diff --git a/lib/compass/exec/command_option_parser.rb b/lib/compass/exec/command_option_parser.rb index 2bd599cc..3e1a7b43 100644 --- a/lib/compass/exec/command_option_parser.rb +++ b/lib/compass/exec/command_option_parser.rb @@ -1,16 +1,21 @@ module Compass::Exec class CommandOptionParser - attr_accessor :options, :arguments + attr_accessor :options, :arguments, :opts def initialize(arguments) self.arguments = arguments self.options = {} end def parse! - opts = OptionParser.new(&method(:set_options)) opts.parse!(arguments) end + def opts + OptionParser.new(&method(:set_options)) + end def set_options(opts) end + def to_s + opts.to_s + end end end diff --git a/lib/compass/exec/sub_command_ui.rb b/lib/compass/exec/sub_command_ui.rb index 867514ab..e7b33260 100644 --- a/lib/compass/exec/sub_command_ui.rb +++ b/lib/compass/exec/sub_command_ui.rb @@ -28,14 +28,17 @@ module Compass::Exec protected def perform! - command = args.shift - command_class = Compass::Commands[command] - options = if command_class.respond_to?("parse_#{command}!") - command_class.send("parse_#{command}!", args) + $command = args.shift + command_class = Compass::Commands[$command] + options = if command_class.respond_to?("parse_#{$command}!") + command_class.send("parse_#{$command}!", args) else command_class.parse!(args) end command_class.new(Dir.getwd, options).execute + rescue OptionParser::ParseError => e + puts "Error: #{e.message}" + puts command_class.usage end end From 515cdb316e907997bf5735d669235cf9b2181a35 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Oct 2009 15:58:05 -0700 Subject: [PATCH 059/118] Help command as a univeral way to access help information. With help for other commands so far. --- lib/compass/commands.rb | 2 +- lib/compass/commands/create_project.rb | 8 ++++ lib/compass/commands/help.rb | 62 ++++++++++++++++++++++++++ lib/compass/commands/registry.rb | 3 ++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 lib/compass/commands/help.rb diff --git a/lib/compass/commands.rb b/lib/compass/commands.rb index 227b405b..fdeceadf 100644 --- a/lib/compass/commands.rb +++ b/lib/compass/commands.rb @@ -3,7 +3,7 @@ end require 'compass/commands/registry' -%w(base generate_grid_background list_frameworks project_base +%w(base generate_grid_background help list_frameworks project_base update_project watch_project create_project installer_command print_version stamp_pattern validate_project write_configuration).each do |lib| require "compass/commands/#{lib}" diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index 2c2dba6f..57cd8a47 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -56,6 +56,14 @@ module Compass option_parser([]).to_s end + def description(command) + if command.to_sym == :create + "Create a new compass project" + else + "Initialize an existing project" + end + end + def parse!(arguments) parser = option_parser(arguments) parse_options!(parser, arguments) diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb new file mode 100644 index 00000000..ed5798cd --- /dev/null +++ b/lib/compass/commands/help.rb @@ -0,0 +1,62 @@ +module Compass + module Commands + module HelpOptionsParser + def set_options(opts) + banner = %Q{Usage: compass help [command] + +Description: + The Compass Stylesheet Authoring Framework helps you + build and maintain your stylesheets and makes it easy + for you to use stylesheet libraries provided by others. + +To get help on a particular command please specify the command. + +Available commands: + +} + Compass::Commands.all.sort_by{|c| c.to_s}.each do |command| + banner << " * #{command}" + if Compass::Commands[command].respond_to? :description + banner << " - #{Compass::Commands[command].description(command)}" + end + banner << "\n" + end + opts.banner = banner + + super + end + end + class Help < Base + register :help + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(HelpOptionsParser) + end + def usage + option_parser([]).to_s + end + def description(command) + "Get help on a compass command or extension" + end + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parser.options[:help_command] = arguments.shift || 'help' + parser.options + end + end + + def execute + if Compass::Commands.command_exists? options[:help_command] + $command = options[:help_command] + puts Compass::Commands[options[:help_command]].usage + $command = "help" + else + raise OptionParser::ParseError, "No such command: #{options[:help_command]}" + end + end + end + end +end diff --git a/lib/compass/commands/registry.rb b/lib/compass/commands/registry.rb index 53e3db37..d073bcb6 100644 --- a/lib/compass/commands/registry.rb +++ b/lib/compass/commands/registry.rb @@ -12,6 +12,9 @@ module Compass::Commands @commands ||= Hash.new @commands.has_key?(name.to_sym) end + def all + @commands.keys + end alias_method :[], :get alias_method :[]=, :register end From b8d380d68c519124d532be85bd093db6e366e60e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Oct 2009 22:17:56 -0700 Subject: [PATCH 060/118] Version subcommand. --- lib/compass/commands.rb | 3 +- lib/compass/commands/print_version.rb | 76 +++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 5 deletions(-) diff --git a/lib/compass/commands.rb b/lib/compass/commands.rb index fdeceadf..be65f1b9 100644 --- a/lib/compass/commands.rb +++ b/lib/compass/commands.rb @@ -5,6 +5,7 @@ require 'compass/commands/registry' %w(base generate_grid_background help list_frameworks project_base update_project watch_project create_project installer_command - print_version stamp_pattern validate_project write_configuration).each do |lib| + print_version stamp_pattern validate_project + write_configuration).each do |lib| require "compass/commands/#{lib}" end diff --git a/lib/compass/commands/print_version.rb b/lib/compass/commands/print_version.rb index 1217f2c3..9ca5381d 100644 --- a/lib/compass/commands/print_version.rb +++ b/lib/compass/commands/print_version.rb @@ -1,14 +1,82 @@ module Compass module Commands - class PrintVersion + module VersionOptionsParser + def set_options(opts) + opts.banner = %Q{Usage: compass version [options] + +Options: +} + opts.on_tail("-?", "-h", "--help", "Print out this message.") do + puts opts + exit + end + opts.on("-q", "--quiet", "Just print the version string.") do + self.options[:quiet] = true + end + opts.on("--major", "Print the major version number") do + self.options[:major] = true + self.options[:custom] = true + end + opts.on("--minor", "Print up to the minor version number") do + self.options[:major] = true + self.options[:minor] = true + self.options[:custom] = true + end + opts.on("--patch", "Print up to the patch version number") do + self.options[:major] = true + self.options[:minor] = true + self.options[:patch] = true + self.options[:custom] = true + end + opts.on("--revision", "Include the source control revision") do + self.options[:revision] = true + self.options[:custom] = true + end + end + end + + class PrintVersion < Base + register :version + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(VersionOptionsParser) + end + def usage + option_parser([]).to_s + end + def description(command) + "Print out version information" + end + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parser.options + end + end + attr_accessor :options + def initialize(working_path, options) self.options = options end def execute - if options[:quiet] - # The quiet option may make scripting easier + if options[:custom] + version = "" + version << "#{Compass.version[:major]}" if options[:major] + version << ".#{Compass.version[:minor]}" if options[:minor] + version << ".#{Compass.version[:teeny]}" if options[:patch] + if options[:revision] + if version.size > 0 + version << " [#{Compass.version[:rev][0..6]}]" + else + version << Compass.version[:rev] + end + end + puts version + elsif options[:quiet] puts ::Compass.version[:string] else lines = [] @@ -20,4 +88,4 @@ module Compass end end end -end \ No newline at end of file +end From f16b12e56bacd2be5df8037c5f9f598c9731720d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Oct 2009 22:18:19 -0700 Subject: [PATCH 061/118] This looks a little better. --- lib/compass/commands/help.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb index ed5798cd..8d516757 100644 --- a/lib/compass/commands/help.rb +++ b/lib/compass/commands/help.rb @@ -17,7 +17,7 @@ Available commands: Compass::Commands.all.sort_by{|c| c.to_s}.each do |command| banner << " * #{command}" if Compass::Commands[command].respond_to? :description - banner << " - #{Compass::Commands[command].description(command)}" + banner << "\t- #{Compass::Commands[command].description(command)}" end banner << "\n" end From 12dcccad5dc65e9c78279bd52564347c229d8e32 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Oct 2009 22:22:07 -0700 Subject: [PATCH 062/118] Install subcommand. --- lib/compass/commands/stamp_pattern.rb | 55 ++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/lib/compass/commands/stamp_pattern.rb b/lib/compass/commands/stamp_pattern.rb index e091c153..97199a3c 100644 --- a/lib/compass/commands/stamp_pattern.rb +++ b/lib/compass/commands/stamp_pattern.rb @@ -4,8 +4,61 @@ require 'compass/commands/update_project' module Compass module Commands + module StampPatternOptionsParser + def set_options(opts) + opts.banner = %Q{Usage: compass install extension/pattern [path/to/project] [options] + +Description: + Install an extension's pattern into your compass project + +Example: + compass install blueprint/buttons + +Options: +} + super + end + end + class StampPattern < ProjectBase + register :install + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(StampPatternOptionsParser) + end + def usage + option_parser([]).to_s + end + def description(command) + "Install an extension's pattern into your compass project" + end + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + def parse_arguments!(parser, arguments) + if arguments.size == 0 + raise OptionParser::ParseError, "Please specify a pattern." + end + pattern = arguments.shift.split('/', 2) + parser.options[:framework] = pattern[0] + parser.options[:pattern] = pattern[1] + if arguments.size > 0 + parser.options[:project_name] = arguments.shift + end + if arguments.size > 0 + raise OptionParser::ParseError, "Unexpected trailing arguments: #{arguments.join(" ")}" + end + end + + end include InstallerCommand def initialize(working_path, options) @@ -30,4 +83,4 @@ module Compass end end -end \ No newline at end of file +end From 8b5868ca004af47a0f3ee953d5b7afab5c964d5b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 5 Oct 2009 00:56:49 -0700 Subject: [PATCH 063/118] Grid image subcommand. --- COMMAND_LINE.markdown | 2 +- .../commands/generate_grid_background.rb | 62 ++++++++++++++++++- lib/compass/grid_builder.rb | 17 ++--- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/COMMAND_LINE.markdown b/COMMAND_LINE.markdown index 591a093f..540ee905 100644 --- a/COMMAND_LINE.markdown +++ b/COMMAND_LINE.markdown @@ -47,7 +47,7 @@ misc commands ------------- # Generate a background image that can be used to verify grid alignment - compass grid-background W+GxH [path/to/image.png] + compass grid-img W+GxH [path/to/grid.png] # Emit the version of compass compass version diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index 646c8d0a..06c2bc58 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -4,8 +4,65 @@ require 'compass/grid_builder' module Compass module Commands + module GridBackgroundOptionsParser + def set_options(opts) + banner = %Q{Usage: compass grid-img W+GxH [path/to/grid.png] + +Description: + Generates a background image that can be used to check grid alignment. + + Height is optional and defaults to 20px + + By default, the image generated will be named "grid.png" + and be found in the images directory. + + This command requires that you have both ImageMagick and RMagick installed. + +Examples: + + compass grid-img 40+10 # 40px column, 10px gutter, 20px height + compass grid-img 40+20x28 # 40px column, 20px gutter, 28px height + compass grid-img 60+20x28 images/wide_grid.png + +Options: +} + opts.banner = banner + + super + end + end class GenerateGridBackground < ProjectBase + include Actions + + register :"grid-img" + + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(GridBackgroundOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Generates a grid background image." + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + if arguments.size == 0 + raise OptionParser::ParseError, "Please specify the grid dimensions." + end + parser.options[:grid_dimensions] = arguments.shift + parser.options[:grid_filename] = arguments.shift + parser.options + end + end def initialize(working_path, options) super assert_project_directory_exists! @@ -22,7 +79,8 @@ module Compass column_width = $1.to_i gutter_width = $2.to_i height = $3.to_i if $3 - unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :height => height, :output_path => projectize(project_images_subdirectory), :working_path => self.working_path)).generate! + filename = options[:grid_filename] || projectize("#{project_images_subdirectory}/grid.png") + unless GridBuilder.new(options.merge(:column_width => column_width, :gutter_width => gutter_width, :height => height, :filename => filename, :working_path => self.working_path)).generate! puts "ERROR: Some library dependencies appear to be missing." puts "Have you installed rmagick? If not, please run:" puts "sudo gem install rmagick" @@ -30,4 +88,4 @@ module Compass end end end -end \ No newline at end of file +end diff --git a/lib/compass/grid_builder.rb b/lib/compass/grid_builder.rb index 8112b1bc..2b5c5d34 100644 --- a/lib/compass/grid_builder.rb +++ b/lib/compass/grid_builder.rb @@ -16,21 +16,21 @@ module Compass rescue Exception => e end - attr_reader :column_width, :gutter_width, :output_path, :able_to_generate, :options + attr_reader :column_width, :gutter_width, :filename, :able_to_generate, :options # ==== Options # * options # * :column_width -- Width (in pixels) of current grid column # * :gutter_width -- Width (in pixels) of current grid gutter # * :height -- Height (in pixels) of a row - # * :output_path -- Output path of grid.png file + # * :filename -- Output path of grid.png file def initialize(options={}) @able_to_generate = Magick::Long_version rescue false return unless @able_to_generate @column_width = options[:column_width] @gutter_width = options[:gutter_width] @height = options[:height] || 20 - @output_path = options[:output_path] + @filename = options[:filename] @options = options end @@ -56,7 +56,6 @@ module Compass end end - filename = File.join(self.output_path, "grid.png") if File.exists?(filename) if options[:force] overwrite = true @@ -65,9 +64,13 @@ module Compass raise Compass::FilesystemConflict.new(msg) end end - directory self.output_path + directory File.dirname(filename) logger.record((overwrite ? :overwrite : :create), basename(filename)) - rvg.draw.write(filename) + unless options[:dry_run] + rvg.draw.write(filename) + else + true + end end end -end \ No newline at end of file +end From 4c4cc0e55f92b4099dc9c92fbe92680728253bab Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 16 Oct 2009 00:56:16 -0700 Subject: [PATCH 064/118] Handle a call to the command line with no arguments. --- lib/compass/commands/registry.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compass/commands/registry.rb b/lib/compass/commands/registry.rb index d073bcb6..ac3654d9 100644 --- a/lib/compass/commands/registry.rb +++ b/lib/compass/commands/registry.rb @@ -10,7 +10,7 @@ module Compass::Commands end def command_exists?(name) @commands ||= Hash.new - @commands.has_key?(name.to_sym) + name && @commands.has_key?(name.to_sym) end def all @commands.keys From f6b138062f92a9b5922fab427cdafa83e266d745 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 16 Oct 2009 00:57:34 -0700 Subject: [PATCH 065/118] Setup Cucumber tests and wrote the first scenario for the command line. --- features/command_line.feature | 21 ++++++++ .../step_definitions/command_line_steps.rb | 49 +++++++++++++++++++ test/command_line_helper.rb | 3 +- test/test_helper.rb | 8 +-- 4 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 features/command_line.feature create mode 100644 features/step_definitions/command_line_steps.rb diff --git a/features/command_line.feature b/features/command_line.feature new file mode 100644 index 00000000..d02de470 --- /dev/null +++ b/features/command_line.feature @@ -0,0 +1,21 @@ +Feature: Command Line + In order to manage my stylesheets + As a user on the command line + I want to create a new project + + Scenario: Install a project without a framework + When I enter the command: compass create my_project + Then a directory my_project/ is created + And a configuration file my_project/config.rb is created + And a sass file my_project/src/screen.sass is created + And a sass file my_project/src/print.sass is created + And a sass file my_project/src/ie.sass is created + And a sass file my_project/src/screen.sass is compiled + And a sass file my_project/src/print.sass is compiled + And a sass file my_project/src/ie.sass is compiled + And a css file my_project/stylesheets/screen.css is created + And a css file my_project/stylesheets/print.css is created + And a css file my_project/stylesheets/ie.css is created + And I am told how to link to /stylesheets/screen.css for media "screen, projection" + And I am told how to link to /stylesheets/print.css for media "print" + And I am told how to conditionally link IE to /stylesheets/ie.css for media "screen, projection" diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb new file mode 100644 index 00000000..96086c48 --- /dev/null +++ b/features/step_definitions/command_line_steps.rb @@ -0,0 +1,49 @@ +require 'spec/expectations' +$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../test'))) + +require 'test_helper' + +require 'compass/exec' + +include Compass::CommandLineHelper +include Compass::IoHelper + +Before do + @cleanup_directories = [] +end + +After do + @cleanup_directories.each do |dir| + FileUtils.rm_rf dir + end +end + +When /I enter the command: compass create ([^\s]+) ?(.+)?/ do |dir, args| + @cleanup_directories << dir + compass 'create', dir, *(args || '').split +end + +# When /I enter the command: compass ([^\s]+) ?(.+)?/ do |command, args| +# compass command, *args.split +# end + + +Then /a directory ([^ ]+) is created/ do |directory| + File.directory?(directory).should == true +end + +Then /a \w+ file ([^ ]+) is created/ do |filename| + File.exists?(filename).should == true +end + +Then /a \w+ file ([^ ]+) is compiled/ do |filename| + @last_result.should =~ /compile #{Regexp.escape(filename)}/ +end + +Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media| + @last_result.should =~ %r{} +end + +Then /I am told how to conditionally link ([^ ]+) to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media| + @last_result.should =~ %r{}mi +end diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index 2ecb0871..89d5b986 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -91,6 +91,7 @@ module Compass::CommandLineHelper end def execute(*arguments) - Compass::Exec::SwitchUI.new(arguments).run! + command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(arguments) + command_line_class.new(arguments).run! end end diff --git a/test/test_helper.rb b/test/test_helper.rb index d1c32c4a..0c3cd661 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,8 @@ need_gems = false lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) $:.unshift(lib_dir) unless $:.include?(lib_dir) +test_dir = File.dirname(__FILE__) +$:.unshift(test_dir) unless $:.include?(test_dir) # allows testing with edge Haml by creating a test/haml symlink linked_haml = File.dirname(__FILE__) + '/haml' @@ -20,6 +22,6 @@ require 'compass' require 'test/unit' -require File.join(File.dirname(__FILE__), 'test_case_helper') -require File.join(File.dirname(__FILE__), 'io_helper') -require File.join(File.dirname(__FILE__), 'command_line_helper') +require 'test_case_helper' +require 'io_helper' +require 'command_line_helper' From 8b02a65ab43521234e4847c8351e3ca8cd03681b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 16 Oct 2009 17:35:43 -0700 Subject: [PATCH 066/118] Fix bugs in the dry-run mode of project creation. --- lib/compass/actions.rb | 2 +- lib/compass/commands/update_project.rb | 10 +++++++--- lib/compass/exec/sub_command_ui.rb | 6 +++--- lib/compass/installers/base.rb | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/compass/actions.rb b/lib/compass/actions.rb index 0c7c2cae..2d2875d0 100644 --- a/lib/compass/actions.rb +++ b/lib/compass/actions.rb @@ -48,7 +48,7 @@ module Compass logger.record :create, basename(file_name) end if skip_write - FileUtils.touch file_name + FileUtils.touch file_name unless options[:dry_run] else mode = "w" mode << "b" if binary diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index 709dd2aa..f1f89a01 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -7,12 +7,12 @@ module Compass def initialize(working_path, options) super - assert_project_directory_exists! + assert_project_directory_exists! unless dry_run? end def perform compiler = new_compiler_instance - if compiler.sass_files.empty? + if compiler.sass_files.empty? && !dry_run? message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n" message << "Run \"compass -h\" to get help." raise Compass::Error, message @@ -21,6 +21,10 @@ module Compass end end + def dry_run? + options[:dry_run] + end + def new_compiler_instance(additional_options = {}) Compass::Compiler.new(working_path, projectize(Compass.configuration.sass_dir), @@ -31,4 +35,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/exec/sub_command_ui.rb b/lib/compass/exec/sub_command_ui.rb index e7b33260..45ff9c84 100644 --- a/lib/compass/exec/sub_command_ui.rb +++ b/lib/compass/exec/sub_command_ui.rb @@ -18,7 +18,7 @@ module Compass::Exec if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) $stderr.puts e.message else - ::Compass::Exec::Helpers.report_error(e, @options) + ::Compass::Exec::Helpers.report_error(e, @options || {}) end return 1 end @@ -30,12 +30,12 @@ module Compass::Exec def perform! $command = args.shift command_class = Compass::Commands[$command] - options = if command_class.respond_to?("parse_#{$command}!") + @options = if command_class.respond_to?("parse_#{$command}!") command_class.send("parse_#{$command}!", args) else command_class.parse!(args) end - command_class.new(Dir.getwd, options).execute + command_class.new(Dir.getwd, @options).execute rescue OptionParser::ParseError => e puts "Error: #{e.message}" puts command_class.usage diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index c47d609c..2261fdd5 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -54,7 +54,7 @@ module Compass def run(options = {}) prepare install - finalize unless options[:skip_finalization] + finalize(options) unless options[:skip_finalization] end # The default prepare method -- it is a no-op. From 190c96872bc87be746db0921a9db18b7fb389b4a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 16 Oct 2009 17:36:29 -0700 Subject: [PATCH 067/118] more project creation scenarios. --- features/command_line.feature | 42 ++++++++++++++++++- .../step_definitions/command_line_steps.rb | 14 ++++--- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index d02de470..bed6a532 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -18,4 +18,44 @@ Feature: Command Line And a css file my_project/stylesheets/ie.css is created And I am told how to link to /stylesheets/screen.css for media "screen, projection" And I am told how to link to /stylesheets/print.css for media "print" - And I am told how to conditionally link IE to /stylesheets/ie.css for media "screen, projection" + And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" + + Scenario: Install a project with blueprint + When I enter the command: compass create bp_project --using blueprint + Then a directory bp_project/ is created + And a configuration file bp_project/config.rb is created + And a sass file bp_project/src/screen.sass is created + And a sass file bp_project/src/print.sass is created + And a sass file bp_project/src/ie.sass is created + And a sass file bp_project/src/screen.sass is compiled + And a sass file bp_project/src/print.sass is compiled + And a sass file bp_project/src/ie.sass is compiled + And a css file bp_project/stylesheets/screen.css is created + And a css file bp_project/stylesheets/print.css is created + And a css file bp_project/stylesheets/ie.css is created + And an image file bp_project/images/grid.png is created + And I am told how to link to /stylesheets/screen.css for media "screen, projection" + And I am told how to link to /stylesheets/print.css for media "print" + And I am told how to conditionally link "lt IE 8" to /stylesheets/ie.css for media "screen, projection" + + Scenario: Install a project with specific directories + When I enter the command: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs + Then a directory custom_project/ is created + And a directory custom_project/sass/ is created + And a directory custom_project/css/ is created + And a directory custom_project/assets/imgs/ is created + And a sass file custom_project/sass/screen.sass is created + And a css file custom_project/css/screen.css is created + And an image file custom_project/assets/imgs/grid.png is created + + Scenario: Perform a dry run of creating a project + When I enter the command: compass create my_project --dry-run + Then a directory my_project/ is not created + But a configuration file my_project/config.rb is reported created + And a sass file my_project/src/screen.sass is reported created + And a sass file my_project/src/print.sass is reported created + And a sass file my_project/src/ie.sass is reported created + And I am told how to link to /stylesheets/screen.css for media "screen, projection" + And I am told how to link to /stylesheets/print.css for media "print" + And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" + diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 96086c48..36f941a4 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -28,15 +28,19 @@ end # end -Then /a directory ([^ ]+) is created/ do |directory| - File.directory?(directory).should == true +Then /a directory ([^ ]+) is (not )?created/ do |directory, negated| + File.directory?(directory).should == !negated end -Then /a \w+ file ([^ ]+) is created/ do |filename| +Then /an? \w+ file ([^ ]+) is created/ do |filename| File.exists?(filename).should == true end -Then /a \w+ file ([^ ]+) is compiled/ do |filename| +Then /an? \w+ file ([^ ]+) is reported created/ do |filename| + @last_result.should =~ /create #{Regexp.escape(filename)}/ +end + +Then /a \w+ file ([^ ]+) is (?:reported )?compiled/ do |filename| @last_result.should =~ /compile #{Regexp.escape(filename)}/ end @@ -44,6 +48,6 @@ Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, medi @last_result.should =~ %r{} end -Then /I am told how to conditionally link ([^ ]+) to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media| +Then /I am told how to conditionally link "([^"]+)" to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media| @last_result.should =~ %r{}mi end From 964304caa41b9fcf630da0249408115e4abbc19c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 21 Oct 2009 17:59:51 -0700 Subject: [PATCH 068/118] This fixes a bug in ruby 1.8.7. --- lib/compass/exec/command_option_parser.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/compass/exec/command_option_parser.rb b/lib/compass/exec/command_option_parser.rb index 3e1a7b43..0475a8a5 100644 --- a/lib/compass/exec/command_option_parser.rb +++ b/lib/compass/exec/command_option_parser.rb @@ -9,7 +9,9 @@ module Compass::Exec opts.parse!(arguments) end def opts - OptionParser.new(&method(:set_options)) + OptionParser.new do |opts| + self.set_options(opts) + end end def set_options(opts) From 563c4cf43e37be1f713f6533aa93fd216c1e9425 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 21 Oct 2009 18:01:26 -0700 Subject: [PATCH 069/118] Slightly shorter is slightly better. --- features/command_line.feature | 8 ++++---- features/step_definitions/command_line_steps.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index bed6a532..e121fcb2 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -4,7 +4,7 @@ Feature: Command Line I want to create a new project Scenario: Install a project without a framework - When I enter the command: compass create my_project + When I run: compass create my_project Then a directory my_project/ is created And a configuration file my_project/config.rb is created And a sass file my_project/src/screen.sass is created @@ -21,7 +21,7 @@ Feature: Command Line And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" Scenario: Install a project with blueprint - When I enter the command: compass create bp_project --using blueprint + When I run: compass create bp_project --using blueprint Then a directory bp_project/ is created And a configuration file bp_project/config.rb is created And a sass file bp_project/src/screen.sass is created @@ -39,7 +39,7 @@ Feature: Command Line And I am told how to conditionally link "lt IE 8" to /stylesheets/ie.css for media "screen, projection" Scenario: Install a project with specific directories - When I enter the command: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs + When I run: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs Then a directory custom_project/ is created And a directory custom_project/sass/ is created And a directory custom_project/css/ is created @@ -49,7 +49,7 @@ Feature: Command Line And an image file custom_project/assets/imgs/grid.png is created Scenario: Perform a dry run of creating a project - When I enter the command: compass create my_project --dry-run + When I run: compass create my_project --dry-run Then a directory my_project/ is not created But a configuration file my_project/config.rb is reported created And a sass file my_project/src/screen.sass is reported created diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 36f941a4..2d784a10 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -18,12 +18,12 @@ After do end end -When /I enter the command: compass create ([^\s]+) ?(.+)?/ do |dir, args| +When /I run: compass create ([^\s]+) ?(.+)?/ do |dir, args| @cleanup_directories << dir compass 'create', dir, *(args || '').split end -# When /I enter the command: compass ([^\s]+) ?(.+)?/ do |command, args| +# When /I run: compass ([^\s]+) ?(.+)?/ do |command, args| # compass command, *args.split # end From 853e97f2e4c147d8042bb8be7f7ad8f857bcc626 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 22 Oct 2009 09:46:46 -0700 Subject: [PATCH 070/118] [Command Line] Ability to create a bare project with no stylesheets provided. --- features/command_line.feature | 14 +++++ .../step_definitions/command_line_steps.rb | 22 +++++++ .../app_integration/rails/installer.rb | 4 +- .../app_integration/stand_alone/installer.rb | 4 +- lib/compass/commands/create_project.rb | 7 +++ lib/compass/commands/installer_command.rb | 8 ++- lib/compass/exec.rb | 1 + lib/compass/installers.rb | 2 +- lib/compass/installers/bare_installer.rb | 13 ++++ lib/compass/installers/base.rb | 56 ++---------------- lib/compass/installers/manifest_installer.rb | 59 +++++++++++++++++++ test/command_line_helper.rb | 6 +- 12 files changed, 139 insertions(+), 57 deletions(-) create mode 100644 lib/compass/installers/bare_installer.rb create mode 100644 lib/compass/installers/manifest_installer.rb diff --git a/features/command_line.feature b/features/command_line.feature index e121fcb2..9a978c27 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -59,3 +59,17 @@ Feature: Command Line And I am told how to link to /stylesheets/print.css for media "print" And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" + Scenario: Creating a bare project + When I run: compass create bare_project --bare + Then a directory bare_project/ is created + And a configuration file bare_project/config.rb is created + And a directory custom_project/src/ is created + And a directory custom_project/stylesheets/ is not created + And I am congratulated + And I am told where to place stylesheets + And how to compile them + + Scenario: Creating a bare project with a framework + When I run: compass create bare_project --using blueprint --bare + Then an error message is printed out: A bare project cannot be created when a framework is specified. + And the command exits with a non-zero error code diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 2d784a10..765be60e 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -51,3 +51,25 @@ end Then /I am told how to conditionally link "([^"]+)" to ([^ ]+) for media "([^"]+)"/ do |condition, stylesheet, media| @last_result.should =~ %r{}mi end + +Then /^an error message is printed out: (.+)$/ do |error_message| + @last_error.should =~ Regexp.new(Regexp.escape(error_message)) +end + +Then /^the command exits with a non\-zero error code$/ do + @last_exit_code.should_not == 0 +end + + +Then /^I am congratulated$/ do + pending +end + +Then /^I am told where to place stylesheets$/ do + pending +end + +Then /^how to compile them$/ do + pending +end + diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index 3023c33f..863ad3ff 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -2,11 +2,13 @@ module Compass module Installers class Base end + class ManifestInstaller < Base + end end module AppIntegration module Rails - class Installer < Compass::Installers::Base + class Installer < Compass::Installers::ManifestInstaller def default_configuration Compass::Configuration::Data.new.extend(ConfigurationDefaults) diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index 4480cc46..cebcb51c 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -2,11 +2,13 @@ module Compass module Installers class Base end + class ManifestInstaller < Base + end end module AppIntegration module StandAlone - class Installer < Compass::Installers::Base + class Installer < Compass::Installers::ManifestInstaller def init directory targetize("") diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index 57cd8a47..b1f14133 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -15,6 +15,10 @@ module Compass Options: }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + + opts.on_tail("--bare", "Don't generate any Sass or CSS files.") do + self.options[:bare] = true + end else opts.banner = %Q{ Usage: compass init project_type path/to/project [options] @@ -68,6 +72,9 @@ module Compass parser = option_parser(arguments) parse_options!(parser, arguments) parse_arguments!(parser, arguments) + if parser.options[:framework] && parser.options[:bare] + raise Compass::Error, "A bare project cannot be created when a framework is specified." + end set_default_arguments(parser) parser.options end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 6069f593..982294a3 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -16,8 +16,12 @@ module Compass end def installer - project_type = options[:project_type] || Compass.configuration.project_type - installer_class = "Compass::AppIntegration::#{camelize(project_type)}::Installer" + installer_class = if options[:bare] + "Compass::Installers::BareInstaller" + else + project_type = options[:project_type] || Compass.configuration.project_type + "Compass::AppIntegration::#{camelize(project_type)}::Installer" + end @installer = eval("#{installer_class}.new *installer_args") end diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index ee489695..2547d376 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -3,6 +3,7 @@ require 'optparse' require 'compass/logger' require 'compass/errors' require 'compass/actions' +require 'compass/installers' require 'compass/commands' module Compass::Exec diff --git a/lib/compass/installers.rb b/lib/compass/installers.rb index 84598af7..70b87cc8 100644 --- a/lib/compass/installers.rb +++ b/lib/compass/installers.rb @@ -1,3 +1,3 @@ -%w(manifest template_context base).each do |f| +%w(manifest template_context base manifest_installer bare_installer).each do |f| require "compass/installers/#{f}" end diff --git a/lib/compass/installers/bare_installer.rb b/lib/compass/installers/bare_installer.rb new file mode 100644 index 00000000..6c04eff1 --- /dev/null +++ b/lib/compass/installers/bare_installer.rb @@ -0,0 +1,13 @@ +module Compass + module Installers + + class BareInstaller < Base + def prepare + + end + def install + # directory + end + end + end +end diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index 2261fdd5..fd72b3f1 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -7,21 +7,15 @@ module Compass attr_accessor :template_path, :target_path, :working_path attr_accessor :options - attr_accessor :manifest def initialize(template_path, target_path, options = {}) @template_path = template_path @target_path = target_path @working_path = Dir.getwd @options = options - @manifest = Manifest.new(manifest_file, options) if template_path self.logger = options[:logger] end - def manifest_file - @manifest_file ||= File.join(template_path, "manifest.rb") - end - [:css_dir, :sass_dir, :images_dir, :javascripts_dir, :http_stylesheets_path].each do |dir| define_method dir do Compass.configuration.send(dir) @@ -31,23 +25,6 @@ module Compass end end - # Initializes the project to work with compass - def init - dirs = manifest.map do |entry| - loc = send("install_location_for_#{entry.type}", entry.to, entry.options) - File.dirname(loc) - end - - if manifest.has_stylesheet? - dirs << sass_dir - dirs << css_dir - end - - dirs.uniq.sort.each do |dir| - directory targetize(dir) - end - end - # Runs the installer. # Every installer must conform to the installation strategy of prepare, install, and then finalize. # A default implementation is provided for each step. @@ -62,20 +39,9 @@ module Compass def prepare end - def configure_option_with_default(opt) - value = options[opt] - value ||= begin - default_method = "default_#{opt}".to_sym - send(default_method) if respond_to?(default_method) - end - send("#{opt}=", value) - end - - # The default install method. Calls install_ methods in the order specified by the manifest. + # The install method override this to install def install - manifest.each do |entry| - send("install_#{entry.type}", entry.from, entry.to, entry.options) - end + raise "Not Yet Implemented" end # The default finalize method -- it is a no-op. @@ -165,22 +131,12 @@ module Compass strip_trailing_separator File.join(template_path, separate(path)) end + # Emits an HTML fragment that can be used to link to the compiled css files def stylesheet_links - html = "\n" - manifest.each_stylesheet do |stylesheet| - # Skip partials. - next if File.basename(stylesheet.from)[0..0] == "_" - media = if stylesheet.options[:media] - %Q{ media="#{stylesheet.options[:media]}"} - end - ss_line = %Q{ } - if stylesheet.options[:condition] - ss_line = " " - end - html << ss_line + "\n" - end - html << "" + "" end end end end +require 'compass/installers/bare_installer' +require 'compass/installers/manifest_installer' diff --git a/lib/compass/installers/manifest_installer.rb b/lib/compass/installers/manifest_installer.rb new file mode 100644 index 00000000..d48ff5ad --- /dev/null +++ b/lib/compass/installers/manifest_installer.rb @@ -0,0 +1,59 @@ +module Compass + module Installers + + class ManifestInstaller < Base + + attr_accessor :manifest + + def initialize(template_path, target_path, options = {}) + super + @manifest = Manifest.new(manifest_file, options) if template_path + end + + def manifest_file + @manifest_file ||= File.join(template_path, "manifest.rb") + end + + # Initializes the project to work with compass + def init + dirs = manifest.map do |entry| + loc = send("install_location_for_#{entry.type}", entry.to, entry.options) + File.dirname(loc) + end + + if manifest.has_stylesheet? + dirs << sass_dir + dirs << css_dir + end + + dirs.uniq.sort.each do |dir| + directory targetize(dir) + end + end + + # The default install method. Calls install_ methods in the order specified by the manifest. + def install + manifest.each do |entry| + send("install_#{entry.type}", entry.from, entry.to, entry.options) + end + end + + def stylesheet_links + html = "\n" + manifest.each_stylesheet do |stylesheet| + # Skip partials. + next if File.basename(stylesheet.from)[0..0] == "_" + media = if stylesheet.options[:media] + %Q{ media="#{stylesheet.options[:media]}"} + end + ss_line = %Q{ } + if stylesheet.options[:condition] + ss_line = " " + end + html << ss_line + "\n" + end + html << "" + end + end + end +end diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index 89d5b986..9db130ed 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -35,8 +35,10 @@ module Compass::CommandLineHelper end end else - @last_result = capture_output do - execute *arguments + @last_error = capture_warning do + @last_result = capture_output do + @last_exit_code = execute *arguments + end end end rescue Timeout::Error From f9c5644dcc689c905e4fae0f20350a5a36f0d930 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 24 Oct 2009 15:21:08 -0700 Subject: [PATCH 071/118] Ability to create a bare project by passing the --bare option to the create command. --- features/command_line.feature | 8 +-- .../step_definitions/command_line_steps.rb | 10 ++-- .../app_integration/stand_alone/installer.rb | 33 ++++++++---- lib/compass/installers/bare_installer.rb | 53 ++++++++++++++++++- lib/compass/installers/base.rb | 2 +- 5 files changed, 84 insertions(+), 22 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 9a978c27..8e9736cb 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -63,11 +63,11 @@ Feature: Command Line When I run: compass create bare_project --bare Then a directory bare_project/ is created And a configuration file bare_project/config.rb is created - And a directory custom_project/src/ is created - And a directory custom_project/stylesheets/ is not created + And a directory bare_project/src/ is created + And a directory bare_project/stylesheets/ is not created And I am congratulated - And I am told where to place stylesheets - And how to compile them + And I am told that I can place stylesheets in the src subdirectory + And I am told how to compile my sass stylesheets Scenario: Creating a bare project with a framework When I run: compass create bare_project --using blueprint --bare diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 765be60e..143c39f9 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -62,14 +62,14 @@ end Then /^I am congratulated$/ do - pending + @last_result.should =~ /Congratulations!/ end -Then /^I am told where to place stylesheets$/ do - pending +Then /^I am told that I can place stylesheets in the ([^\s]+) subdirectory$/ do |subdir| + @last_result.should =~ /You may now add sass stylesheets to the #{subdir} subdirectory of your project./ end -Then /^how to compile them$/ do - pending +Then /^I am told how to compile my sass stylesheets$/ do + @last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/ end diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index cebcb51c..5c6177de 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -47,16 +47,29 @@ module Compass if options[:create] puts <<-NEXTSTEPS - Congratulations! Your compass project has been created. - You must recompile your sass stylesheets when they change. - This can be done in one of the following ways: - 1. From within your project directory run: - compass - 2. From any directory run: - compass -u path/to/project - 3. To monitor your project for changes and automatically recompile: - compass --watch [path/to/project] - NEXTSTEPS +********************************************************************* +Congratulations! Your compass project has been created. + +You may now add and edit sass stylesheets in the #{Compass.configuration.sass_dir} subdirectory of your project. + +Sass files beginning with an underscore are called partials and won't be +compiled to CSS, but they can be imported into other sass stylesheets. + +You can configure your project by editing the config.rb configuration file. + +You must compile your sass stylesheets into CSS when they change. +This can be done in one of the following ways: + 1. To compile on demand: + compass compile [path/to/project] + 2. To monitor your project for changes and automatically recompile: + compass watch [path/to/project] + +More Resources: + * Wiki: http://wiki.github.com/chriseppstein/compass + * Sass: http://sass-lang.com + * Community: http://groups.google.com/group/compass-users/ + +NEXTSTEPS end if manifest.has_stylesheet? puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" diff --git a/lib/compass/installers/bare_installer.rb b/lib/compass/installers/bare_installer.rb index 6c04eff1..049f7206 100644 --- a/lib/compass/installers/bare_installer.rb +++ b/lib/compass/installers/bare_installer.rb @@ -2,12 +2,61 @@ module Compass module Installers class BareInstaller < Base - def prepare + def default_configuration + Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults) + end + def completed_configuration + nil end + + def init + directory targetize("") + directory targetize(Compass.configuration.sass_dir) + end + + def prepare + end + def install - # directory + config_file ||= targetize('config.rb') + write_file config_file, config_contents end + + def config_contents + project_path, Compass.configuration.project_path = Compass.configuration.project_path, nil + Compass.configuration.serialize + ensure + Compass.configuration.project_path = project_path + end + + def finalize(options = {}) + puts <<-NEXTSTEPS + +********************************************************************* +Congratulations! Your compass project has been created. + +You may now add sass stylesheets to the #{Compass.configuration.sass_dir} subdirectory of your project. + +Sass files beginning with an underscore are called partials and won't be +compiled to CSS, but they can be imported into other sass stylesheets. + +You can configure your project by editing the config.rb configuration file. + +You must compile your sass stylesheets into CSS when they change. +This can be done in one of the following ways: + 1. To compile on demand: + compass compile [path/to/project] + 2. To monitor your project for changes and automatically recompile: + compass watch [path/to/project] + +More Resources: + * Wiki: http://wiki.github.com/chriseppstein/compass + * Sass: http://sass-lang.com + * Community: http://groups.google.com/group/compass-users/ +NEXTSTEPS + end + end end end diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index fd72b3f1..9fd27f2c 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -46,7 +46,7 @@ module Compass # The default finalize method -- it is a no-op. # This could print out a message or something. - def finalize + def finalize(options = {}) end def compilation_required? From c8df3f3c42ca892020177b70c38002afc1ccea85 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 24 Oct 2009 15:21:49 -0700 Subject: [PATCH 072/118] New subcommand: compile --- features/command_line.feature | 60 +++++++++++++++++-- .../step_definitions/command_line_steps.rb | 45 ++++++++++++-- lib/compass/commands/update_project.rb | 50 +++++++++++++++- 3 files changed, 142 insertions(+), 13 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 8e9736cb..6b121b7b 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -4,7 +4,7 @@ Feature: Command Line I want to create a new project Scenario: Install a project without a framework - When I run: compass create my_project + When I create a project using: compass create my_project Then a directory my_project/ is created And a configuration file my_project/config.rb is created And a sass file my_project/src/screen.sass is created @@ -21,7 +21,7 @@ Feature: Command Line And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" Scenario: Install a project with blueprint - When I run: compass create bp_project --using blueprint + When I create a project using: compass create bp_project --using blueprint Then a directory bp_project/ is created And a configuration file bp_project/config.rb is created And a sass file bp_project/src/screen.sass is created @@ -39,7 +39,7 @@ Feature: Command Line And I am told how to conditionally link "lt IE 8" to /stylesheets/ie.css for media "screen, projection" Scenario: Install a project with specific directories - When I run: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs + When I create a project using: compass create custom_project --using blueprint --sass-dir sass --css-dir css --images-dir assets/imgs Then a directory custom_project/ is created And a directory custom_project/sass/ is created And a directory custom_project/css/ is created @@ -49,7 +49,7 @@ Feature: Command Line And an image file custom_project/assets/imgs/grid.png is created Scenario: Perform a dry run of creating a project - When I run: compass create my_project --dry-run + When I create a project using: compass create my_project --dry-run Then a directory my_project/ is not created But a configuration file my_project/config.rb is reported created And a sass file my_project/src/screen.sass is reported created @@ -60,7 +60,7 @@ Feature: Command Line And I am told how to conditionally link "IE" to /stylesheets/ie.css for media "screen, projection" Scenario: Creating a bare project - When I run: compass create bare_project --bare + When I create a project using: compass create bare_project --bare Then a directory bare_project/ is created And a configuration file bare_project/config.rb is created And a directory bare_project/src/ is created @@ -70,6 +70,54 @@ Feature: Command Line And I am told how to compile my sass stylesheets Scenario: Creating a bare project with a framework - When I run: compass create bare_project --using blueprint --bare + When I create a project using: compass create bare_project --using blueprint --bare Then an error message is printed out: A bare project cannot be created when a framework is specified. And the command exits with a non-zero error code + + Scenario: Compiling an existing project. + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + Then a directory tmp/ is created + 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 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 + And a css file tmp/utilities.css is created + + Scenario: Compiling an existing project with a specified project + Given I am using the existing project in test/fixtures/stylesheets/compass + And I am in the parent directory + When I run: compass compile tmp_compass + Then a directory tmp_compass/tmp/ is created + 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 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 + And a css file tmp_compass/tmp/utilities.css is created + + Scenario: Recompiling 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 + 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 + + Scenario: Recompiling a project with no material changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I wait 1 second + And I touch sass/layout.sass + And I run: compass compile + Then a sass file sass/layout.sass is reported compiled + 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 diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 143c39f9..4bba5f5c 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -10,25 +10,48 @@ include Compass::IoHelper Before do @cleanup_directories = [] + @original_working_directory = Dir.pwd end After do + Dir.chdir @original_working_directory @cleanup_directories.each do |dir| FileUtils.rm_rf dir end end -When /I run: compass create ([^\s]+) ?(.+)?/ do |dir, args| +# Given Preconditions +Given %r{^I am using the existing project in ([^\s]+)$} do |project| + tmp_project = "tmp_#{File.basename(project)}" + @cleanup_directories << tmp_project + FileUtils.cp_r project, tmp_project + Dir.chdir tmp_project +end + +Given %r{^I am in the parent directory$} do + Dir.chdir ".." +end + +# When Actions are performed +When /^I create a project using: compass create ([^\s]+) ?(.+)?$/ do |dir, args| @cleanup_directories << dir compass 'create', dir, *(args || '').split end -# When /I run: compass ([^\s]+) ?(.+)?/ do |command, args| -# compass command, *args.split -# end +When /^I run: compass ([^\s]+) ?(.+)?$/ do |command, args| + compass command, *(args || '').split +end - -Then /a directory ([^ ]+) is (not )?created/ do |directory, negated| +When /^I touch ([^\s]+)$/ do |filename| + FileUtils.touch filename +end + +When /^I wait ([\d.]+) seconds?$/ do |count| + sleep count.to_f +end + +# Then postconditions +Then /^a directory ([^ ]+) is (not )?created$/ do |directory, negated| File.directory?(directory).should == !negated end @@ -44,6 +67,14 @@ Then /a \w+ file ([^ ]+) is (?:reported )?compiled/ do |filename| @last_result.should =~ /compile #{Regexp.escape(filename)}/ end +Then /a \w+ file ([^ ]+) is reported unchanged/ do |filename| + @last_result.should =~ /unchanged #{Regexp.escape(filename)}/ +end + +Then /a \w+ file ([^ ]+) is reported identical/ do |filename| + @last_result.should =~ /identical #{Regexp.escape(filename)}/ +end + Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media| @last_result.should =~ %r{} end @@ -73,3 +104,5 @@ Then /^I am told how to compile my sass stylesheets$/ do @last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/ end +end + diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index f1f89a01..0f49ff33 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -3,8 +3,25 @@ require 'compass/compiler' module Compass module Commands + module CompileProjectOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass compile [path/to/project] [options] + + Description: + compile project at the path specified or the current director if not specified. + + Options: + }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n") + + super + end + end + class UpdateProject < ProjectBase - + + register :compile + def initialize(working_path, options) super assert_project_directory_exists! unless dry_run? @@ -33,6 +50,37 @@ module Compass :force => options[:force]).merge(additional_options)) end + class << self + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(CompileProjectOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Compile Sass stylesheets to CSS" + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size > 1 + raise Compass::Error, "Too many arguments were specified." + end + end + end end end end From 61264714bd67816f3a431fbb2386f4eedfec2623 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 24 Oct 2009 17:46:59 -0700 Subject: [PATCH 073/118] Scenarios for the help subcommand. --- features/command_line.feature | 11 +++++++++++ features/step_definitions/command_line_steps.rb | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/features/command_line.feature b/features/command_line.feature index 6b121b7b..2e36d081 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -110,6 +110,17 @@ Feature: Command Line And a sass file sass/reset.sass is reported unchanged And a sass file sass/utilities.sass is reported unchanged + Scenario: Basic help + When I run: compass help + Then I should be shown a list of available commands + And the list of commands should describe the compile command + And the list of commands should describe the create command + And the list of commands should describe the grid-img command + And the list of commands should describe the help command + And the list of commands should describe the init command + And the list of commands should describe the install command + And the list of commands should describe the version command + Scenario: Recompiling a project with no material changes Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass compile diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 4bba5f5c..0c5d86f6 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -104,5 +104,11 @@ Then /^I am told how to compile my sass stylesheets$/ do @last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/ end +Then /^I should be shown a list of available commands$/ do + @last_result.should =~ /^Available commands:$/ +end + +Then /^the list of commands should describe the ([^ ]+) command$/ do |command| + @last_result.should =~ /^\s+\* #{command}\s+- [A-Z].+$/ end From 58cc6c0aab7218930bf6ff0638caa2a2c613f56f Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 24 Oct 2009 17:53:02 -0700 Subject: [PATCH 074/118] Scenario for recompiling after changes. --- features/command_line.feature | 12 ++++++++++++ features/step_definitions/command_line_steps.rb | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/features/command_line.feature b/features/command_line.feature index 2e36d081..931f8978 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -132,3 +132,15 @@ Feature: Command Line 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 + + Scenario: Recompiling a project with changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I wait 1 second + And I add some sass to sass/layout.sass + And I run: compass compile + Then a sass file sass/layout.sass is reported compiled + 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 diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 0c5d86f6..65e522ec 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -50,6 +50,13 @@ When /^I wait ([\d.]+) seconds?$/ do |count| sleep count.to_f end +When /^I add some sass to ([^\s]+)$/ do |filename| + open(filename, "w+") do |file| + file.puts ".added .some .arbitrary" + file.puts " sass: code" + end +end + # Then postconditions Then /^a directory ([^ ]+) is (not )?created$/ do |directory, negated| File.directory?(directory).should == !negated @@ -75,6 +82,10 @@ Then /a \w+ file ([^ ]+) is reported identical/ do |filename| @last_result.should =~ /identical #{Regexp.escape(filename)}/ end +Then /a \w+ file ([^ ]+) is reported overwritten/ do |filename| + @last_result.should =~ /overwrite #{Regexp.escape(filename)}/ +end + Then /I am told how to link to ([^ ]+) for media "([^"]+)"/ do |stylesheet, media| @last_result.should =~ %r{} end From 3e99fedab0347730f9ce88c1a42f17ec3986020e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 00:45:34 -0700 Subject: [PATCH 075/118] Added a watch subcommand. Watching a project can now by done with: compass watch --- features/command_line.feature | 10 ++++++ features/env.rb | 35 +++++++++++++++++++ .../step_definitions/command_line_steps.rb | 29 +++++++++++++++ lib/compass/commands/watch_project.rb | 4 ++- 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 features/env.rb diff --git a/features/command_line.feature b/features/command_line.feature index 931f8978..4c55ef91 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -144,3 +144,13 @@ Feature: Command Line 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 + + Scenario: Watching a project for changes + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass compile + And I run in a separate process: compass watch + And I wait 1 second + And I touch sass/layout.sass + And I wait 2 seconds + And I shutdown the other process + And a css file tmp/layout.css is reported identical diff --git a/features/env.rb b/features/env.rb new file mode 100644 index 00000000..70f553de --- /dev/null +++ b/features/env.rb @@ -0,0 +1,35 @@ +require 'cucumber/ast/step_invocation' + +module Cucumber + module Ast + class StepInvocation #:nodoc: + def invoke(step_mother, options) + find_step_match!(step_mother) + unless @skip_invoke || options[:dry_run] || @exception || @step_collection.exception + @skip_invoke = true + begin + @step_match.invoke(@multiline_arg) + step_mother.after_step + status!(:passed) + rescue Pending => e + failed(options, e, false) + status!(:pending) + rescue Undefined => e + failed(options, e, false) + status!(:undefined) + rescue Cucumber::Ast::Table::Different => e + @different_table = e.table + failed(options, e, false) + status!(:failed) + rescue SystemExit => e + raise + rescue Exception => e + failed(options, e, false) + status!(:failed) + end + end + end + end + end +end + diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 65e522ec..c319e510 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -42,6 +42,35 @@ When /^I run: compass ([^\s]+) ?(.+)?$/ do |command, args| compass command, *(args || '').split end +When /^I run in a separate process: compass ([^\s]+) ?(.+)?$/ do |command, args| + unless @other_process = fork + @last_result = '' + @last_error = '' + Signal.trap("HUP") do + open('/tmp/last_result.compass_test.txt', 'w') do |file| + file.puts $stdout.string + end + open('/tmp/last_error.compass_test.txt', 'w') do |file| + file.puts @stderr.string + end + exit # This doesn't exit + end + # this command will run forever + # we kill it with a HUP signal from the parent process. + args = (args || '').split + args << { :wait => 5 } + compass command, *args + exit + end +end + +When /^I shutdown the other process$/ do + Process.kill("HUP", @other_process) + Process.wait + @last_result = File.read('/tmp/last_result.compass_test.txt') + @last_error = File.read('/tmp/last_error.compass_test.txt') +end + When /^I touch ([^\s]+)$/ do |filename| FileUtils.touch filename end diff --git a/lib/compass/commands/watch_project.rb b/lib/compass/commands/watch_project.rb index 9841b3a9..0e5e90cd 100644 --- a/lib/compass/commands/watch_project.rb +++ b/lib/compass/commands/watch_project.rb @@ -7,6 +7,8 @@ module Compass module Commands class WatchProject < UpdateProject + register :watch + attr_accessor :last_update_time, :last_sass_files def perform @@ -66,4 +68,4 @@ module Compass end end -end \ No newline at end of file +end From bf043c572cafeeea4614bf6bd734787defe52f82 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 10:30:13 -0700 Subject: [PATCH 076/118] Grid image command tests --- features/command_line.feature | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/features/command_line.feature b/features/command_line.feature index 4c55ef91..5e35fb84 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -153,4 +153,21 @@ Feature: Command Line And I touch sass/layout.sass And I wait 2 seconds And I shutdown the other process - And a css file tmp/layout.css is reported identical + Then a css file tmp/layout.css is reported identical + + Scenario: Generating a grid image so that I can debug my grid alignments + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass grid-img 30+10x24 + Then a png file images/grid.png is created + + Scenario: Generating a grid image to a specified path with custom dimensions + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass grid-img 50+10x24 assets/wide_grid.png + Then a directory assets is created + Then a png file assets/wide_grid.png is created + + Scenario: Generating a grid image with invalid dimensions + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass grid-img 50x24 assets/wide_grid.png + Then a directory assets is not created + And a png file assets/wide_grid.png is not created From adce6a4873a12ae0986bd35a3a3943524419e43b Mon Sep 17 00:00:00 2001 From: Beau Smith Date: Sun, 25 Oct 2009 13:04:36 -0700 Subject: [PATCH 077/118] applying border to image element rather than anchor element --- .../compass/stylesheets/compass/utilities/general/_reset.sass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass index c52fc808..4ade16ee 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass @@ -33,7 +33,7 @@ q, blockquote +reset-quotation - img a + a img +reset-image-anchor-border @@ -57,7 +57,7 @@ q, blockquote +reset-quotation - img a + a img +reset-image-anchor-border //Mixins partials From 0e244f21c56cd711a7c5a3e80a125ce77d28b017 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 20:13:28 -0700 Subject: [PATCH 078/118] Oh look, there's the ruby call I was looking for (exit!) --- features/env.rb | 35 ---------------- .../step_definitions/command_line_steps.rb | 4 +- test/rails_helper.rb | 40 +++++++++++++++++++ 3 files changed, 42 insertions(+), 37 deletions(-) delete mode 100644 features/env.rb create mode 100644 test/rails_helper.rb diff --git a/features/env.rb b/features/env.rb deleted file mode 100644 index 70f553de..00000000 --- a/features/env.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'cucumber/ast/step_invocation' - -module Cucumber - module Ast - class StepInvocation #:nodoc: - def invoke(step_mother, options) - find_step_match!(step_mother) - unless @skip_invoke || options[:dry_run] || @exception || @step_collection.exception - @skip_invoke = true - begin - @step_match.invoke(@multiline_arg) - step_mother.after_step - status!(:passed) - rescue Pending => e - failed(options, e, false) - status!(:pending) - rescue Undefined => e - failed(options, e, false) - status!(:undefined) - rescue Cucumber::Ast::Table::Different => e - @different_table = e.table - failed(options, e, false) - status!(:failed) - rescue SystemExit => e - raise - rescue Exception => e - failed(options, e, false) - status!(:failed) - end - end - end - end - end -end - diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index c319e510..71101160 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -53,14 +53,14 @@ When /^I run in a separate process: compass ([^\s]+) ?(.+)?$/ do |command, args| open('/tmp/last_error.compass_test.txt', 'w') do |file| file.puts @stderr.string end - exit # This doesn't exit + exit! end # this command will run forever # we kill it with a HUP signal from the parent process. args = (args || '').split args << { :wait => 5 } compass command, *args - exit + exit! end end diff --git a/test/rails_helper.rb b/test/rails_helper.rb new file mode 100644 index 00000000..789365b9 --- /dev/null +++ b/test/rails_helper.rb @@ -0,0 +1,40 @@ +module Compass + module RailsHelper + def generate_rails_app_directories(name) + Dir.mkdir name + Dir.mkdir File.join(name, "config") + Dir.mkdir File.join(name, "config", "initializers") + end + + # Generate a rails application without polluting our current set of requires + # with the rails libraries. This will allow testing against multiple versions of rails + # by manipulating the load path. + def generate_rails_app(name) + if pid = fork + Process.wait(pid) + if $?.exitstatus == 2 + raise LoadError, "Couldn't load rails" + elsif $?.exitstatus != 0 + raise "Failed to generate rails application." + end + else + begin + require 'rails/version' + require 'rails_generator' + require 'rails_generator/scripts/generate' + Rails::Generator::Base.use_application_sources! + capture_output do + Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout + Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') + end + rescue LoadError + Kernel.exit(2) + rescue => e + $stderr.puts e + Kernel.exit!(1) + end + Kernel.exit!(0) + end + end + end +end From c0a39160801124f5fa30baf9da14a7c7a57fcabc Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 20:14:09 -0700 Subject: [PATCH 079/118] Use rcov to generate a coverage report for tests. --- .gitignore | 1 + Rakefile | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/.gitignore b/.gitignore index b6cd7a3b..d85e13a5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ test/fixtures/stylesheets/*/saved test/fixtures/stylesheets/empty test/fixtures/stylesheets/*/sass/.sass-cache pkg/* +coverage* diff --git a/Rakefile b/Rakefile index ee6c3cb0..09ca56b0 100644 --- a/Rakefile +++ b/Rakefile @@ -14,6 +14,7 @@ require 'rubygems' require 'rake' $:.unshift File.join(File.dirname(__FILE__), 'lib') require 'compass' +require 'rcov/rcovtask' # ----- Default: Testing ------ @@ -129,3 +130,34 @@ namespace :git do sh "git", "clean", "-fdx" end end + +require 'cucumber/rake/task' + +namespace :rcov do + Cucumber::Rake::Task.new(:cucumber) do |t| + t.rcov = true + t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data} + t.rcov_opts << %[-o "coverage"] + end + + Rcov::RcovTask.new(:units) do |rcov| + rcov.libs << 'lib' + rcov.libs << 'haml/lib' if ENV["RUN_CODE_RUN"] + test_files = FileList['test/**/*_test.rb'] + test_files.exclude('test/rails/*', 'test/haml/*') + rcov.pattern = test_files + rcov.output_dir = 'coverage' + rcov.verbose = true + rcov.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data} + rcov.rcov_opts << %[-o "coverage" --sort coverage] + end + + + desc "Run both specs and features to generate aggregated coverage" + task :all do |t| + rm "coverage.data" if File.exist?("coverage.data") + Rake::Task["rcov:units"].invoke + Rake::Task["rcov:cucumber"].invoke + end +end + From 217c522a92529a6212954444ad4a0f9073eea741 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 20:15:31 -0700 Subject: [PATCH 080/118] test scenario for the rails project initialization. --- features/command_line.feature | 11 +++++ .../step_definitions/command_line_steps.rb | 16 ++++++- lib/compass/commands/create_project.rb | 2 +- test/rails_integration_test.rb | 42 +------------------ test/test_helper.rb | 1 + 5 files changed, 29 insertions(+), 43 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 5e35fb84..bc0cae6a 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -74,6 +74,17 @@ Feature: Command Line Then an error message is printed out: A bare project cannot be created when a framework is specified. And the command exits with a non-zero error code + Scenario: Initializing a rails project + Given I'm in a newly created rails project: my_rails_project + When I initialize a project using: compass init rails --sass-dir app/stylesheets --css-dir public/stylesheets/compiled + Then a config file config/compass.config is reported created + Then a config file config/compass.config is created + And a ruby file config/compass.config is created + And a sass file config/initializers/compass.rb is created + And a sass file app/stylesheets/screen.sass is created + And a sass file app/stylesheets/print.sass is created + And a sass file app/stylesheets/ie.sass is created + Scenario: Compiling an existing project. Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass compile diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 71101160..a665bd84 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -7,8 +7,10 @@ require 'compass/exec' include Compass::CommandLineHelper include Compass::IoHelper +include Compass::RailsHelper Before do + Compass.reset_configuration! @cleanup_directories = [] @original_working_directory = Dir.pwd end @@ -32,12 +34,22 @@ Given %r{^I am in the parent directory$} do Dir.chdir ".." end +Given /^I'm in a newly created rails project: (.+)$/ do |project_name| + @cleanup_directories << project_name + generate_rails_app project_name + Dir.chdir project_name +end + # When Actions are performed When /^I create a project using: compass create ([^\s]+) ?(.+)?$/ do |dir, args| @cleanup_directories << dir compass 'create', dir, *(args || '').split end +When /^I initialize a project using: compass init ?(.+)?$/ do |args| + compass 'init', *(args || '').split +end + When /^I run: compass ([^\s]+) ?(.+)?$/ do |command, args| compass command, *(args || '').split end @@ -91,8 +103,8 @@ Then /^a directory ([^ ]+) is (not )?created$/ do |directory, negated| File.directory?(directory).should == !negated end -Then /an? \w+ file ([^ ]+) is created/ do |filename| - File.exists?(filename).should == true +Then /an? \w+ file ([^ ]+) is (not )?created/ do |filename, negated| + File.exists?(filename).should == !negated end Then /an? \w+ file ([^ ]+) is reported created/ do |filename| diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index b1f14133..ca0f0330 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -99,7 +99,7 @@ module Compass if arguments.size == 1 parser.options[:project_name] = arguments.shift elsif arguments.size == 0 - raise Compass::Error, "Please specify a path to the project." + # default to the current directory. else raise Compass::Error, "Too many arguments were specified." end diff --git a/test/rails_integration_test.rb b/test/rails_integration_test.rb index f57c8a97..d9273504 100644 --- a/test/rails_integration_test.rb +++ b/test/rails_integration_test.rb @@ -8,6 +8,7 @@ class RailsIntegrationTest < Test::Unit::TestCase include Compass::TestCaseHelper include Compass::CommandLineHelper include Compass::IoHelper + include Compass::RailsHelper def setup Compass.reset_configuration! @@ -42,43 +43,4 @@ class RailsIntegrationTest < Test::Unit::TestCase rescue LoadError puts "Skipping rails test. Couldn't Load rails" end - - - def generate_rails_app_directories(name) - Dir.mkdir name - Dir.mkdir File.join(name, "config") - Dir.mkdir File.join(name, "config", "initializers") - end - - # Generate a rails application without polluting our current set of requires - # with the rails libraries. This will allow testing against multiple versions of rails - # by manipulating the load path. - def generate_rails_app(name) - if pid = fork - Process.wait(pid) - if $?.exitstatus == 2 - raise LoadError, "Couldn't load rails" - elsif $?.exitstatus != 0 - raise "Failed to generate rails application." - end - else - begin - require 'rails/version' - require 'rails_generator' - require 'rails_generator/scripts/generate' - Rails::Generator::Base.use_application_sources! - capture_output do - Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout - Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') - end - rescue LoadError - Kernel.exit(2) - rescue => e - $stderr.puts e - Kernel.exit!(1) - end - Kernel.exit!(0) - end - end - -end \ No newline at end of file +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 0c3cd661..e9e6ea28 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -24,4 +24,5 @@ require 'test/unit' require 'test_case_helper' require 'io_helper' +require 'rails_helper' require 'command_line_helper' From 3a763d1e9144d10be6caf118f686785b569105e4 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 20:18:47 -0700 Subject: [PATCH 081/118] Fix test failure after fixing the incorrect 'img a' selector --- test/fixtures/stylesheets/compass/css/reset.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/stylesheets/compass/css/reset.css b/test/fixtures/stylesheets/compass/css/reset.css index 6b067e61..2df6b411 100644 --- a/test/fixtures/stylesheets/compass/css/reset.css +++ b/test/fixtures/stylesheets/compass/css/reset.css @@ -43,7 +43,7 @@ q, blockquote { q:before, q:after, blockquote:before, blockquote:after { content: ""; } -img a { +a img { border: none; } .unregistered-only, .registered-only { From 04362083d47b16656fb9b39d5e18c3b734d5810d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 22:17:27 -0700 Subject: [PATCH 082/118] Moved some docs into a folder. --- COMMAND_LINE.markdown => docs/COMMAND_LINE.markdown | 0 EXTENSIONS.markdown => docs/EXTENSIONS.markdown | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename COMMAND_LINE.markdown => docs/COMMAND_LINE.markdown (100%) rename EXTENSIONS.markdown => docs/EXTENSIONS.markdown (100%) diff --git a/COMMAND_LINE.markdown b/docs/COMMAND_LINE.markdown similarity index 100% rename from COMMAND_LINE.markdown rename to docs/COMMAND_LINE.markdown diff --git a/EXTENSIONS.markdown b/docs/EXTENSIONS.markdown similarity index 100% rename from EXTENSIONS.markdown rename to docs/EXTENSIONS.markdown From a847004811ec25138c02fd8c2866d308852744d3 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 25 Oct 2009 22:18:46 -0700 Subject: [PATCH 083/118] Test scenario for installing patterns into projects. --- features/command_line.feature | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/features/command_line.feature b/features/command_line.feature index bc0cae6a..f2bb9d92 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -121,6 +121,15 @@ Feature: Command Line And a sass file sass/reset.sass is reported unchanged And a sass file sass/utilities.sass is reported unchanged + Scenario: Installing a pattern into a project + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass install blueprint/buttons + Then a sass file sass/buttons.sass is created + And an image file images/buttons/cross.png is created + And an image file images/buttons/key.png is created + And an image file images/buttons/tick.png is created + And a css file tmp/buttons.css is created + Scenario: Basic help When I run: compass help Then I should be shown a list of available commands From 149978b4c9db76a145d7f69b04aefe069320080a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 26 Oct 2009 09:24:38 -0700 Subject: [PATCH 084/118] A helper function for capturing the output of a pipe. --- features/command_line.feature | 24 +++++++++++++++++++ .../step_definitions/command_line_steps.rb | 17 +++++++++++++ test/io_helper.rb | 19 ++++++++++++++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/features/command_line.feature b/features/command_line.feature index f2bb9d92..03f4da42 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -191,3 +191,27 @@ Feature: Command Line When I run: compass grid-img 50x24 assets/wide_grid.png Then a directory assets is not created And a png file assets/wide_grid.png is not created + + Scenario: Generate a compass configuration file + When I run: compass config config/compass.rb --sass-dir sass --css-dir assets/css + Then a configuration file config/compass.rb is created + And the following configuration properties are set in config/compass.rb: + | property | value | + | sass_dir | sass | + | css_dir | assets/css | + + Scenario: Validate the generated CSS + Given I am using the existing project in test/fixtures/stylesheets/compass + When I run: compass validate + Then my css is validated + And I am informed that it is not, because IE6 hacks suck. + + Scenario: Get stats for my project + 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 | lines | mixins | selectors | properties | + | src/screen.sass | 22 | 1 | 134 | 1,320 | + | src/print.sass | 22 | 1 | 134 | 1,320 | + | src/ie.sass | 22 | 1 | 134 | 1,320 | + diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index a665bd84..9307c88c 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -164,3 +164,20 @@ Then /^the list of commands should describe the ([^ ]+) command$/ do |command| @last_result.should =~ /^\s+\* #{command}\s+- [A-Z].+$/ end +Then /^the following configuration properties are set in config\/compass\.rb:$/ do |table| + # table is a Cucumber::Ast::Table + pending +end + +Then /^my css is validated$/ do + pending +end + +Then /^I am informed that it is not, because IE6 hacks suck\.$/ do + pending +end + +Then /^I am told statistics for each file:$/ do |table| + # table is a Cucumber::Ast::Table + pending +end diff --git a/test/io_helper.rb b/test/io_helper.rb index 499dec93..ee88380d 100644 --- a/test/io_helper.rb +++ b/test/io_helper.rb @@ -15,5 +15,22 @@ module Compass ensure $stderr = real_stderr end + + def capture_pipe(io, options = {}) + options[:wait] = 0.25 + options[:timeout] = 1.0 + output = "" + eof_at = nil + while !eof_at || (Time.now - eof_at < options[:wait]) + if io.eof? + eof_at ||= Time.now + sleep 0.1 + else + eof_at = nil + timeout(options[:timeout]) { output << io.readpartial(1024) } + end + end + output + end end -end \ No newline at end of file +end From dd750391be66b19781790cdfc25d02bb56c1e0e0 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 26 Oct 2009 09:25:52 -0700 Subject: [PATCH 085/118] Subcommand for CSS validation. --- features/command_line.feature | 2 +- .../step_definitions/command_line_steps.rb | 6 +- lib/compass/commands/validate_project.rb | 58 ++++++++++++++++++- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 03f4da42..782fdd86 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -204,7 +204,7 @@ Feature: Command Line Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass validate Then my css is validated - And I am informed that it is not, because IE6 hacks suck. + And I am informed that my css is valid. Scenario: Get stats for my project Given I am using the existing project in test/fixtures/stylesheets/compass diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 9307c88c..cf92c8c1 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -170,11 +170,11 @@ Then /^the following configuration properties are set in config\/compass\.rb:$/ end Then /^my css is validated$/ do - pending + @last_result.should =~ /Compass CSS Validator/ end -Then /^I am informed that it is not, because IE6 hacks suck\.$/ do - pending +Then /^I am informed that my css is valid.$/ do + @last_result.should =~ /Your CSS files are valid\./ end Then /^I am told statistics for each file:$/ do |table| diff --git a/lib/compass/commands/validate_project.rb b/lib/compass/commands/validate_project.rb index cd19ce60..bd326560 100644 --- a/lib/compass/commands/validate_project.rb +++ b/lib/compass/commands/validate_project.rb @@ -3,8 +3,26 @@ require 'compass/commands/update_project' module Compass module Commands + module ValidationOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass validate [path/to/project] [options] + + Description: + Compile project at the path specified or the current + directory if not specified and then validate the + generated CSS. + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end class ValidateProject < ProjectBase - + + register :validate + def initialize(working_path, options) super assert_project_directory_exists! @@ -16,6 +34,42 @@ module Compass Validator.new(project_css_subdirectory).validate() end + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(ValidationOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Validate your generated css." + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + + end + end end -end \ No newline at end of file +end From 0d45a3b4aa63473c1589d29d32b0c0695ec8988a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Mon, 26 Oct 2009 18:52:27 -0700 Subject: [PATCH 086/118] Subcommand for writing a configuration file. --- .../step_definitions/command_line_steps.rb | 9 ++- lib/compass/commands/write_configuration.rb | 62 ++++++++++++++++++- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index cf92c8c1..c830a883 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -164,9 +164,12 @@ Then /^the list of commands should describe the ([^ ]+) command$/ do |command| @last_result.should =~ /^\s+\* #{command}\s+- [A-Z].+$/ end -Then /^the following configuration properties are set in config\/compass\.rb:$/ do |table| - # table is a Cucumber::Ast::Table - pending +Then /^the following configuration properties are set in ([^ ]+):$/ do |config_file, table| + + config = Compass::Configuration::Data.new_from_file(config_file) + table.hashes.each do |hash| + config.send(hash['property']).should == hash['value'] + end end Then /^my css is validated$/ do diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index 2aaefb69..1eb865aa 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -2,8 +2,29 @@ require 'compass/commands/project_base' module Compass module Commands + module ConfigurationOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass config [path/to/config_file.rb] [options] + + Description: + Generate a configuration file for the options specified. + Compass will recognize configuration files in the + following locations relative to the project root: + * #{Compass::Configuration::Helpers::KNOWN_CONFIG_LOCATIONS.join(" + * ")} + Any other location, and you'll need to specify it when working with the command line tool using the -c option. + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end class WriteConfiguration < ProjectBase - + + register :config + include InstallerCommand def initialize(working_path, options) @@ -16,6 +37,7 @@ module Compass end def perform + directory projectize(File.dirname(options[:configuration_file])) installer.write_configuration_files(options[:configuration_file]) end @@ -27,6 +49,42 @@ module Compass false end + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(ConfigurationOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Generate a configuration file for the provided command line options." + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:configuration_file] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + + end + end end -end \ No newline at end of file +end From d1e1c1756d8d773b72c30f6bb01cf7eb98b73a02 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 29 Oct 2009 01:05:41 -0700 Subject: [PATCH 087/118] New compass subcommand: stats. Emits details about your stylesheets. --- lib/compass/commands.rb | 2 +- lib/compass/commands/project_stats.rb | 141 ++++++++++++++++++ lib/compass/compiler.rb | 7 +- lib/compass/configuration/helpers.rb | 9 ++ lib/compass/sass_extensions/monkey_patches.rb | 4 +- .../monkey_patches/traversal.rb | 23 +++ lib/compass/stats.rb | 78 ++++++++++ 7 files changed, 258 insertions(+), 6 deletions(-) create mode 100644 lib/compass/commands/project_stats.rb create mode 100644 lib/compass/sass_extensions/monkey_patches/traversal.rb create mode 100644 lib/compass/stats.rb diff --git a/lib/compass/commands.rb b/lib/compass/commands.rb index be65f1b9..7389a508 100644 --- a/lib/compass/commands.rb +++ b/lib/compass/commands.rb @@ -5,7 +5,7 @@ require 'compass/commands/registry' %w(base generate_grid_background help list_frameworks project_base update_project watch_project create_project installer_command - print_version stamp_pattern validate_project + print_version project_stats stamp_pattern validate_project write_configuration).each do |lib| require "compass/commands/#{lib}" end diff --git a/lib/compass/commands/project_stats.rb b/lib/compass/commands/project_stats.rb new file mode 100644 index 00000000..2cabb0d7 --- /dev/null +++ b/lib/compass/commands/project_stats.rb @@ -0,0 +1,141 @@ +require 'compass/commands/project_base' +require 'compass/commands/update_project' + +module Compass + module Commands + module StatsOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass stats [path/to/project] [options] + + Description: + Compile project at the path specified (or the current + directory if not specified) and then compute statistics + for the sass and css files in the project. + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end + class ProjectStats < UpdateProject + + register :stats + + def initialize(working_path, options) + super + assert_project_directory_exists! + end + + def perform + super + require 'compass/stats' + compiler = new_compiler_instance + sass_files = sorted_sass_files(compiler) + rows = [[ :-, :-, :-, :-, :- ], + [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used' ], + [ :-, :-, :-, :-, :- ]] + maximums = [ 8, 5, 10, 14, 11 ] + alignments = [ :left, :right, :right, :right, :right ] + delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] + totals = [ "Total (#{sass_files.size} files):", 0, 0, 0, 0 ] + + sass_files.each do |sass_file| + css_file = compiler.corresponding_css_file(sass_file) unless sass_file[0..0] == '_' + row = filename_columns(sass_file) + row += sass_columns(sass_file) + row.each_with_index do |c, i| + maximums[i] = [maximums[i].to_i, c.size].max + totals[i] = totals[i] + c.to_i if i > 0 + end + rows << row + end + rows << [:-, :-, :-, :-, :-] + rows << totals.map{|t| t.to_s} + rows << [:-, :-, :-, :-, :-] + rows.each do |row| + row.each_with_index do |col, i| + print pad(col, maximums[i], :align => alignments[i], :left => delimiters[i].first, :right => delimiters[i].last) + end + print "\n" + end + end + + def pad(c, max, options = {}) + options[:align] ||= :left + if c == :- + filler = '-' + c = '' + else + filler = ' ' + end + spaces = max - c.size + filled = filler * [spaces,0].max + "#{options[:left]}#{filled if options[:align] == :right}#{c}#{filled if options[:align] == :left}#{options[:right]}" + end + + def sorted_sass_files(compiler) + sass_files = compiler.sass_files(:exclude_partials => false) + sass_files.map! do |s| + filename = Compass.deprojectize(s, File.join(Compass.configuration.project_path, Compass.configuration.sass_dir)) + [s, File.dirname(filename), File.basename(filename)] + end + sass_files = sass_files.sort_by do |s,d,f| + File.join(d, f[0] == ?_ ? f[1..-1] : f) + end + sass_files.map!{|s,d,f| s} + end + + def filename_columns(sass_file) + filename = Compass.deprojectize(sass_file, working_path) + [filename] + end + + def sass_columns(sass_file) + sf = Compass::Stats::SassFile.new(sass_file) + sf.analyze! + %w(rule_count prop_count mixin_def_count mixin_count).map do |t| + sf.send(t).to_s + end + end + + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(StatsOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Report statistics about your stylesheets" + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parse_arguments!(parser, arguments) + parser.options + end + + def parse_arguments!(parser, arguments) + if arguments.size == 1 + parser.options[:project_name] = arguments.shift + elsif arguments.size == 0 + # default to the current directory. + else + raise Compass::Error, "Too many arguments were specified." + end + end + + end + + end + end +end diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index c48b2b63..a38fba76 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -13,8 +13,9 @@ module Compass self.options[:cache_location] ||= File.join(from, ".sass-cache") end - def sass_files - @sass_files || Dir.glob(separate("#{from}/**/[^_]*.sass")) + def sass_files(options = {}) + exclude_partials = options.fetch(:exclude_partials, true) + @sass_files || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.sass")) end def stylesheet_name(sass_file) @@ -51,4 +52,4 @@ module Compass end end end -end \ No newline at end of file +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index f779a973..18bd60ac 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -66,6 +66,15 @@ module Compass File.join(project_path, *path.split('/')) end + def deprojectize(path, project_path = nil) + project_path ||= configuration.project_path + if path[0..(project_path.size - 1)] == project_path + path[(project_path.size + 1)..-1] + else + path + end + end + # TODO: Deprecate the src/config.rb location. KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] diff --git a/lib/compass/sass_extensions/monkey_patches.rb b/lib/compass/sass_extensions/monkey_patches.rb index 04cc8a72..c612ea21 100644 --- a/lib/compass/sass_extensions/monkey_patches.rb +++ b/lib/compass/sass_extensions/monkey_patches.rb @@ -1,3 +1,3 @@ -%w(stylesheet_updating).each do |patch| +%w(stylesheet_updating traversal).each do |patch| require "compass/sass_extensions/monkey_patches/#{patch}" -end \ No newline at end of file +end diff --git a/lib/compass/sass_extensions/monkey_patches/traversal.rb b/lib/compass/sass_extensions/monkey_patches/traversal.rb new file mode 100644 index 00000000..4b40e2ec --- /dev/null +++ b/lib/compass/sass_extensions/monkey_patches/traversal.rb @@ -0,0 +1,23 @@ +module Sass + module Tree + class Node + unless method_defined?(:visit_depth_first) + def visit_depth_first(visitor) + visitor.visit(self) + visitor.down(self) if children.any? and visitor.respond_to?(:down) + if is_a?(ImportNode) && visitor.import?(self) + root = Sass::Files.tree_for(import, @options) + imported_children = root.children + end + + (imported_children || children).each do |child| + break if visitor.respond_to?(:stop?) && visitor.stop? + child.visit_depth_first(visitor) + end + visitor.up(self) if children.any? + end + end + end + end +end + diff --git a/lib/compass/stats.rb b/lib/compass/stats.rb new file mode 100644 index 00000000..18a93790 --- /dev/null +++ b/lib/compass/stats.rb @@ -0,0 +1,78 @@ +module Compass + module Stats + class StatsVisitor + attr_accessor :rule_count, :prop_count, :mixin_def_count, :mixin_count + def initialize + self.rule_count = 0 + self.prop_count = 0 + self.mixin_def_count = 0 + self.mixin_count = 0 + end + def visit(node) + self.prop_count += 1 if node.is_a?(Sass::Tree::PropNode) && !node.children.any? + if node.is_a?(Sass::Tree::RuleNode) + self.rule_count += node.rules.map{|r| r.split(/,/)}.flatten.compact.size + end + self.mixin_def_count += 1 if node.is_a?(Sass::Tree::MixinDefNode) + self.mixin_count += 1 if node.is_a?(Sass::Tree::MixinNode) + end + def up(node) + end + def down(node) + end + def import?(node) + return false + full_filename = node.send(:import) + full_filename != Compass.deprojectize(full_filename) + end + end + class CssFile + attr_accessor :path + def initialize(path) + self.path = path + end + def contents + @contents ||= File.read(path) + end + def lines + contents.inject(0){|m,c| m + 1 } + end + end + class SassFile + attr_accessor :path + attr_reader :visitor + def initialize(path) + self.path = path + end + def contents + @contents ||= File.read(path) + end + def tree + @tree = Sass::Engine.new(contents, Compass.configuration.to_sass_engine_options).to_tree + end + def visit_tree! + @visitor = StatsVisitor.new + tree.visit_depth_first(@visitor) + @visitor + end + def analyze! + visit_tree! + end + def lines + contents.inject(0){|m,c| m + 1 } + end + def rule_count + visitor.rule_count + end + def prop_count + visitor.prop_count + end + def mixin_def_count + visitor.mixin_def_count + end + def mixin_count + visitor.mixin_count + end + end + end +end From 7d04f480b9fc71e70fae5bdaafdbf22907d0aa20 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 29 Oct 2009 09:57:05 -0700 Subject: [PATCH 088/118] Make the stats scenario pass now that it's real. --- features/command_line.feature | 9 +++++---- features/step_definitions/command_line_steps.rb | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 782fdd86..b77b0912 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -210,8 +210,9 @@ 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 | lines | mixins | selectors | properties | - | src/screen.sass | 22 | 1 | 134 | 1,320 | - | src/print.sass | 22 | 1 | 134 | 1,320 | - | src/ie.sass | 22 | 1 | 134 | 1,320 | + | Filename | Rules | Properties | Mixins Defs | Mixins Used | + | sass/layout.sass | 0 | 0 | 0 | 1 | + | sass/print.sass | 0 | 0 | 0 | 2 | + | sass/reset.sass | 4 | 1 | 0 | 2 | + | sass/utilities.sass | 2 | 0 | 0 | 2 | diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index c830a883..3879d44b 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -182,5 +182,10 @@ end Then /^I am told statistics for each file:$/ do |table| # table is a Cucumber::Ast::Table - pending + table.raw.each do |row| + re = Regexp.new row.join(' *\| *') + @last_result.should =~ re + end end + + From 2675f8ed9ab73175ea132490216dc67ef0f7665b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 29 Oct 2009 11:35:20 -0700 Subject: [PATCH 089/118] CSS Stats for projects so that the complexities can be compared. --- features/command_line.feature | 11 ++++---- lib/compass/commands/project_stats.rb | 37 ++++++++++++++++++++------- lib/compass/stats.rb | 16 +++++++++++- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index b77b0912..6aa615c7 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -210,9 +210,10 @@ 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 | - | sass/layout.sass | 0 | 0 | 0 | 1 | - | sass/print.sass | 0 | 0 | 0 | 2 | - | sass/reset.sass | 4 | 1 | 0 | 2 | - | sass/utilities.sass | 2 | 0 | 0 | 2 | + | Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Rules | CSS Properties | + | sass/layout.sass | 0 | 0 | 0 | 1 | 5 | 9 | + | sass/print.sass | 0 | 0 | 0 | 2 | 61 | 61 | + | sass/reset.sass | 4 | 1 | 0 | 2 | 191 | 665 | + | sass/utilities.sass | 2 | 0 | 0 | 2 | 5 | 11 | + | Total.* | 6 | 1 | 0 | 7 | 262 | 746 | diff --git a/lib/compass/commands/project_stats.rb b/lib/compass/commands/project_stats.rb index 2cabb0d7..05d20acf 100644 --- a/lib/compass/commands/project_stats.rb +++ b/lib/compass/commands/project_stats.rb @@ -33,33 +33,37 @@ module Compass require 'compass/stats' compiler = new_compiler_instance sass_files = sorted_sass_files(compiler) - rows = [[ :-, :-, :-, :-, :- ], - [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used' ], - [ :-, :-, :-, :-, :- ]] - maximums = [ 8, 5, 10, 14, 11 ] - alignments = [ :left, :right, :right, :right, :right ] - delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] - totals = [ "Total (#{sass_files.size} files):", 0, 0, 0, 0 ] + rows = [[ :-, :-, :-, :-, :-, :-, :- ], + [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'CSS Rules', 'CSS Properties' ], + [ :-, :-, :-, :-, :-, :-, :- ]] + maximums = [ 8, 5, 10, 14, 11, 9, 14 ] + alignments = [ :left, :right, :right, :right, :right, :right, :right ] + delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] + totals = [ "Total (#{sass_files.size} files):", 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] == '_' row = filename_columns(sass_file) row += sass_columns(sass_file) + row += css_columns(css_file) row.each_with_index do |c, i| maximums[i] = [maximums[i].to_i, c.size].max totals[i] = totals[i] + c.to_i if i > 0 end rows << row end - rows << [:-, :-, :-, :-, :-] + rows << [:-] * 7 rows << totals.map{|t| t.to_s} - rows << [:-, :-, :-, :-, :-] + rows << [:-] * 7 rows.each do |row| row.each_with_index do |col, i| print pad(col, maximums[i], :align => alignments[i], :left => delimiters[i].first, :right => delimiters[i].last) end print "\n" end + if @missing_css_parser + puts "\nInstall css_parser to enable stats on your css files:\n\n\tgem install css_parser" + end end def pad(c, max, options = {}) @@ -100,6 +104,21 @@ module Compass end end + def css_columns(css_file) + if File.exists?(css_file) + cf = Compass::Stats::CssFile.new(css_file) + cf.analyze! + %w(selector_count prop_count).map do |t| + cf.send(t).to_s + end + else + return [ '--', '--' ] + end + rescue LoadError + @missing_css_parser = true + return [ 'DISABLED', 'DISABLED' ] + end + class << self def option_parser(arguments) diff --git a/lib/compass/stats.rb b/lib/compass/stats.rb index 18a93790..30f59093 100644 --- a/lib/compass/stats.rb +++ b/lib/compass/stats.rb @@ -27,9 +27,15 @@ module Compass end end class CssFile - attr_accessor :path + attr_accessor :path, :css + attr_accessor :selector_count, :prop_count def initialize(path) + require 'css_parser' self.path = path + self.css = CssParser::Parser.new + self.css.add_block!(contents) + self.selector_count = 0 + self.prop_count = 0 end def contents @contents ||= File.read(path) @@ -37,6 +43,14 @@ module Compass def lines contents.inject(0){|m,c| m + 1 } end + def analyze! + css.each_selector do |selector, declarations, specificity| + sels = selector.split(/,/).size + props = declarations.split(/;/).size + self.selector_count += sels + self.prop_count += props + end + end end class SassFile attr_accessor :path From b0637be654b7df7cc901edfe3e70413204120260 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 30 Oct 2009 08:13:25 -0700 Subject: [PATCH 090/118] Fix some test errors that occur when gems are missing. --- features/step_definitions/command_line_steps.rb | 14 +++++++++++--- lib/compass/errors.rb | 5 ++++- lib/compass/validator.rb | 5 ++--- test/command_line_helper.rb | 2 ++ test/rails_helper.rb | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 3879d44b..4d8c86ae 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -36,8 +36,12 @@ end Given /^I'm in a newly created rails project: (.+)$/ do |project_name| @cleanup_directories << project_name - generate_rails_app project_name - Dir.chdir project_name + begin + generate_rails_app project_name + Dir.chdir project_name + rescue LoadError + pending "Missing Ruby-on-rails gems: sudo gem install rails" + end end # When Actions are performed @@ -173,7 +177,11 @@ Then /^the following configuration properties are set in ([^ ]+):$/ do |config_f end Then /^my css is validated$/ do - @last_result.should =~ /Compass CSS Validator/ + if @last_error =~ /The Compass CSS Validator could not be loaded/ + pending "Missing Dependency: sudo gem install chriseppstein-compass-validator" + else + @last_result.should =~ /Compass CSS Validator/ + end end Then /^I am informed that my css is valid.$/ do diff --git a/lib/compass/errors.rb b/lib/compass/errors.rb index d0dccfcd..96695e34 100644 --- a/lib/compass/errors.rb +++ b/lib/compass/errors.rb @@ -4,4 +4,7 @@ module Compass class FilesystemConflict < Error end -end \ No newline at end of file + + class MissingDependency < Error + end +end diff --git a/lib/compass/validator.rb b/lib/compass/validator.rb index 8ddefafa..606f3420 100644 --- a/lib/compass/validator.rb +++ b/lib/compass/validator.rb @@ -2,9 +2,8 @@ begin require 'rubygems' require 'compass-validator' rescue LoadError - puts %Q{The Compass CSS Validator could not be loaded. Please install it: + raise Compass::MissingDependency, %Q{The Compass CSS Validator could not be loaded. Please install it: sudo gem install chriseppstein-compass-validator --source http://gems.github.com/ } - exit(1) -end \ No newline at end of file +end diff --git a/test/command_line_helper.rb b/test/command_line_helper.rb index 9db130ed..3fc48bd6 100644 --- a/test/command_line_helper.rb +++ b/test/command_line_helper.rb @@ -1,3 +1,5 @@ +require 'timeout' + module Compass::CommandLineHelper def compass(*arguments) options = arguments.last.is_a?(Hash) ? arguments.pop : {} diff --git a/test/rails_helper.rb b/test/rails_helper.rb index 789365b9..d8b47a17 100644 --- a/test/rails_helper.rb +++ b/test/rails_helper.rb @@ -28,7 +28,7 @@ module Compass Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') end rescue LoadError - Kernel.exit(2) + Kernel.exit!(2) rescue => e $stderr.puts e Kernel.exit!(1) From ca19ea6414b0e5c41787a9fb5714e66e41bffd8b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 30 Oct 2009 08:21:34 -0700 Subject: [PATCH 091/118] Version bump to 0.9.1 --- VERSION.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/VERSION.yml b/VERSION.yml index f7330b54..5f948000 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,5 @@ --- -:patch: 0 -:major: 0 :minor: 9 +:build: +:patch: 1 +:major: 0 From c93b51346ad9cda00eee628540841e3e11ab7ab1 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 30 Oct 2009 08:24:10 -0700 Subject: [PATCH 092/118] gemspec for edge release. --- Rakefile | 1 + compass.gemspec | 657 ++++++++++++++++++++++++++---------------------- 2 files changed, 358 insertions(+), 300 deletions(-) diff --git a/Rakefile b/Rakefile index 09ca56b0..e8879dc9 100644 --- a/Rakefile +++ b/Rakefile @@ -66,6 +66,7 @@ begin gemspec.files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*") gemspec.test_files = Dir.glob("test/**/*.*") gemspec.test_files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*") + gemspec.test_files += Dir.glob("features/**/*.*") end rescue LoadError puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" diff --git a/compass.gemspec b/compass.gemspec index cf5c510a..345163f1 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -1,326 +1,382 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- + Gem::Specification.new do |s| s.name = %q{compass} - s.version = "0.8.12" + s.version = "0.9.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Chris Eppstein"] - s.date = %q{2009-08-22} + s.date = %q{2009-10-30} s.default_executable = %q{compass} s.description = %q{Compass is a Sass-based Stylesheet Framework that streamlines the creation and maintainance of CSS.} s.email = %q{chris@eppsteins.net} s.executables = ["compass"] s.extra_rdoc_files = [ "LICENSE.markdown", - "README.markdown" + "README.markdown" ] s.files = [ "CHANGELOG.markdown", - "LICENSE.markdown", - "README.markdown", - "REVISION", - "Rakefile", - "VERSION.yml", - "bin/compass", - "deps.rip", - "examples/README.markdown", - "examples/blueprint_default/config.rb", - "examples/blueprint_default/images/grid.png", - "examples/blueprint_default/index.html.haml", - "examples/blueprint_default/parts/elements.html.haml", - "examples/blueprint_default/parts/forms.html.haml", - "examples/blueprint_default/parts/grid.html.haml", - "examples/blueprint_default/parts/test-small.jpg", - "examples/blueprint_default/parts/test.jpg", - "examples/blueprint_default/parts/valid.png", - "examples/blueprint_default/src/ie.sass", - "examples/blueprint_default/src/images/grid.png", - "examples/blueprint_default/src/print.sass", - "examples/blueprint_default/src/screen.sass", - "examples/blueprint_plugins/config.rb", - "examples/blueprint_plugins/images/buttons/cross.png", - "examples/blueprint_plugins/images/buttons/key.png", - "examples/blueprint_plugins/images/buttons/tick.png", - "examples/blueprint_plugins/images/grid.png", - "examples/blueprint_plugins/images/link_icons/doc.png", - "examples/blueprint_plugins/images/link_icons/email.png", - "examples/blueprint_plugins/images/link_icons/external.png", - "examples/blueprint_plugins/images/link_icons/feed.png", - "examples/blueprint_plugins/images/link_icons/im.png", - "examples/blueprint_plugins/images/link_icons/pdf.png", - "examples/blueprint_plugins/images/link_icons/visited.png", - "examples/blueprint_plugins/images/link_icons/xls.png", - "examples/blueprint_plugins/images/test-small.jpg", - "examples/blueprint_plugins/images/test.jpg", - "examples/blueprint_plugins/images/valid.png", - "examples/blueprint_plugins/index.html.haml", - "examples/blueprint_plugins/plugins/buttons.html.haml", - "examples/blueprint_plugins/plugins/fancy_type.html.haml", - "examples/blueprint_plugins/plugins/link_icons.html.haml", - "examples/blueprint_plugins/plugins/rtl.html.haml", - "examples/blueprint_plugins/src/buttons.sass", - "examples/blueprint_plugins/src/ie.sass", - "examples/blueprint_plugins/src/images/grid.png", - "examples/blueprint_plugins/src/link_icons.sass", - "examples/blueprint_plugins/src/print.sass", - "examples/blueprint_plugins/src/rtl_screen.sass", - "examples/blueprint_plugins/src/screen.sass", - "examples/blueprint_scoped/images/grid.png", - "examples/blueprint_scoped/src/ie.sass", - "examples/blueprint_scoped/src/print.sass", - "examples/blueprint_scoped/src/screen.sass", - "examples/blueprint_scoped_form/images/grid.png", - "examples/blueprint_scoped_form/src/ie.sass", - "examples/blueprint_scoped_form/src/print.sass", - "examples/blueprint_scoped_form/src/screen.sass", - "examples/blueprint_semantic/config.rb", - "examples/blueprint_semantic/images/grid.png", - "examples/blueprint_semantic/index.html.haml", - "examples/blueprint_semantic/parts/fancy_type.html.haml", - "examples/blueprint_semantic/parts/liquid.html.haml", - "examples/blueprint_semantic/parts/test-small.jpg", - "examples/blueprint_semantic/parts/test.jpg", - "examples/blueprint_semantic/parts/valid.png", - "examples/blueprint_semantic/src/ie.sass", - "examples/blueprint_semantic/src/images/grid.png", - "examples/blueprint_semantic/src/liquid.sass", - "examples/blueprint_semantic/src/print.sass", - "examples/blueprint_semantic/src/screen.sass", - "examples/compass/compass.html.haml", - "examples/compass/config.rb", - "examples/compass/images/blue_arrow.gif", - "examples/compass/src/compass.sass", - "examples/compass/src/images/blue_arrow.gif", - "examples/compass/src/sticky_footer.sass", - "examples/compass/src/utilities.sass", - "examples/compass/sticky_footer.html.haml", - "examples/compass/utilities.html.haml", - "examples/logo/logo.html.haml", - "examples/logo/src/ie.sass", - "examples/logo/src/print.sass", - "examples/logo/src/screen.sass", - "examples/yui/divisions.html.haml", - "examples/yui/index.html.haml", - "examples/yui/src/screen.sass", - "examples/yui/sub_divisions.html.haml", - "examples/yui/templates.html.haml", - "examples/yui/test.jpg", - "examples/yui/typography.html.haml", - "frameworks/blueprint.rb", - "frameworks/blueprint/stylesheets/_blueprint.sass", - "frameworks/blueprint/stylesheets/blueprint/_ie.sass", - "frameworks/blueprint/stylesheets/blueprint/_print.sass", - "frameworks/blueprint/stylesheets/blueprint/_reset.sass", - "frameworks/blueprint/stylesheets/blueprint/_screen.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_form.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass", - "frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass", - "frameworks/blueprint/templates/buttons/buttons.sass", - "frameworks/blueprint/templates/buttons/buttons/cross.png", - "frameworks/blueprint/templates/buttons/buttons/key.png", - "frameworks/blueprint/templates/buttons/buttons/tick.png", - "frameworks/blueprint/templates/buttons/manifest.rb", - "frameworks/blueprint/templates/link_icons/link_icons.sass", - "frameworks/blueprint/templates/link_icons/link_icons/doc.png", - "frameworks/blueprint/templates/link_icons/link_icons/email.png", - "frameworks/blueprint/templates/link_icons/link_icons/external.png", - "frameworks/blueprint/templates/link_icons/link_icons/feed.png", - "frameworks/blueprint/templates/link_icons/link_icons/im.png", - "frameworks/blueprint/templates/link_icons/link_icons/pdf.png", - "frameworks/blueprint/templates/link_icons/link_icons/visited.png", - "frameworks/blueprint/templates/link_icons/link_icons/xls.png", - "frameworks/blueprint/templates/link_icons/manifest.rb", - "frameworks/blueprint/templates/project/grid.png", - "frameworks/blueprint/templates/project/ie.sass", - "frameworks/blueprint/templates/project/manifest.rb", - "frameworks/blueprint/templates/project/partials/_base.sass", - "frameworks/blueprint/templates/project/print.sass", - "frameworks/blueprint/templates/project/screen.sass", - "frameworks/compass.rb", - "frameworks/compass/stylesheets/_compass.sass", - "frameworks/compass/stylesheets/compass/_layout.sass", - "frameworks/compass/stylesheets/compass/_misc.sass", - "frameworks/compass/stylesheets/compass/_reset.sass", - "frameworks/compass/stylesheets/compass/_utilities.sass", - "frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass", - "frameworks/compass/stylesheets/compass/utilities/_general.sass", - "frameworks/compass/stylesheets/compass/utilities/_links.sass", - "frameworks/compass/stylesheets/compass/utilities/_lists.sass", - "frameworks/compass/stylesheets/compass/utilities/_print.sass", - "frameworks/compass/stylesheets/compass/utilities/_sprites.sass", - "frameworks/compass/stylesheets/compass/utilities/_tables.sass", - "frameworks/compass/stylesheets/compass/utilities/_text.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_float.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_reset.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass", - "frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass", - "frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass", - "frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass", - "frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass", - "frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass", - "frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass", - "frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass", - "frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass", - "frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass", - "frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass", - "frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass", - "frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass", - "frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass", - "frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass", - "frameworks/compass/templates/ellipsis/ellipsis.sass", - "frameworks/compass/templates/ellipsis/manifest.rb", - "frameworks/compass/templates/ellipsis/xml/ellipsis.xml", - "frameworks/compass/templates/project/ie.sass", - "frameworks/compass/templates/project/manifest.rb", - "frameworks/compass/templates/project/print.sass", - "frameworks/compass/templates/project/screen.sass", - "frameworks/yui.rb", - "frameworks/yui/stylesheets/_yui.sass", - "frameworks/yui/stylesheets/yui/modules/_base.sass", - "frameworks/yui/stylesheets/yui/modules/_fonts.sass", - "frameworks/yui/stylesheets/yui/modules/_grids.sass", - "frameworks/yui/stylesheets/yui/modules/_reset.sass", - "frameworks/yui/templates/project/manifest.rb", - "frameworks/yui/templates/project/screen.sass", - "lib/compass.rb", - "lib/compass/actions.rb", - "lib/compass/app_integration.rb", - "lib/compass/app_integration/merb.rb", - "lib/compass/app_integration/rails.rb", - "lib/compass/app_integration/rails/action_controller.rb", - "lib/compass/app_integration/rails/sass_plugin.rb", - "lib/compass/app_integration/rails/templates/compass-install-rails.rb", - "lib/compass/app_integration/rails/urls.rb", - "lib/compass/commands/base.rb", - "lib/compass/commands/create_project.rb", - "lib/compass/commands/generate_grid_background.rb", - "lib/compass/commands/installer_command.rb", - "lib/compass/commands/list_frameworks.rb", - "lib/compass/commands/print_version.rb", - "lib/compass/commands/project_base.rb", - "lib/compass/commands/stamp_pattern.rb", - "lib/compass/commands/update_project.rb", - "lib/compass/commands/validate_project.rb", - "lib/compass/commands/watch_project.rb", - "lib/compass/commands/write_configuration.rb", - "lib/compass/compiler.rb", - "lib/compass/configuration.rb", - "lib/compass/core_ext.rb", - "lib/compass/dependencies.rb", - "lib/compass/errors.rb", - "lib/compass/exec.rb", - "lib/compass/frameworks.rb", - "lib/compass/grid_builder.rb", - "lib/compass/installers.rb", - "lib/compass/installers/base.rb", - "lib/compass/installers/manifest.rb", - "lib/compass/installers/rails.rb", - "lib/compass/installers/stand_alone.rb", - "lib/compass/logger.rb", - "lib/compass/sass_extensions.rb", - "lib/compass/sass_extensions/functions.rb", - "lib/compass/sass_extensions/functions/display.rb", - "lib/compass/sass_extensions/functions/enumerate.rb", - "lib/compass/sass_extensions/functions/inline_image.rb", - "lib/compass/sass_extensions/functions/selectors.rb", - "lib/compass/sass_extensions/functions/urls.rb", - "lib/compass/sass_extensions/monkey_patches.rb", - "lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb", - "lib/compass/test_case.rb", - "lib/compass/validator.rb", - "lib/compass/version.rb", - "test/command_line_helper.rb", - "test/command_line_test.rb", - "test/compass_test.rb", - "test/configuration_test.rb", - "test/fixtures/stylesheets/blueprint/config.rb", - "test/fixtures/stylesheets/blueprint/css/typography.css", - "test/fixtures/stylesheets/blueprint/images/grid.png", - "test/fixtures/stylesheets/blueprint/sass/ie.sass", - "test/fixtures/stylesheets/blueprint/sass/print.sass", - "test/fixtures/stylesheets/blueprint/sass/screen.sass", - "test/fixtures/stylesheets/blueprint/sass/typography.sass", - "test/fixtures/stylesheets/compass/config.rb", - "test/fixtures/stylesheets/compass/css/layout.css", - "test/fixtures/stylesheets/compass/css/print.css", - "test/fixtures/stylesheets/compass/css/reset.css", - "test/fixtures/stylesheets/compass/css/utilities.css", - "test/fixtures/stylesheets/compass/sass/layout.sass", - "test/fixtures/stylesheets/compass/sass/print.sass", - "test/fixtures/stylesheets/compass/sass/reset.sass", - "test/fixtures/stylesheets/compass/sass/utilities.sass", - "test/fixtures/stylesheets/image_urls/config.rb", - "test/fixtures/stylesheets/image_urls/css/screen.css", - "test/fixtures/stylesheets/image_urls/images/grid.png", - "test/fixtures/stylesheets/image_urls/sass/screen.sass", - "test/fixtures/stylesheets/yui/config.rb", - "test/fixtures/stylesheets/yui/css/mixins.css", - "test/fixtures/stylesheets/yui/sass/base.sass", - "test/fixtures/stylesheets/yui/sass/fonts.sass", - "test/fixtures/stylesheets/yui/sass/grids.sass", - "test/fixtures/stylesheets/yui/sass/mixins.sass", - "test/rails_integration_test.rb", - "test/sass_extensions_test.rb", - "test/test_case_helper.rb", - "test/test_helper.rb", - "test/test_rails_helper.rb" + "LICENSE.markdown", + "README.markdown", + "REVISION", + "Rakefile", + "VERSION.yml", + "bin/compass", + "deps.rip", + "examples/README.markdown", + "examples/blueprint_default/config.rb", + "examples/blueprint_default/images/grid.png", + "examples/blueprint_default/index.html.haml", + "examples/blueprint_default/parts/elements.html.haml", + "examples/blueprint_default/parts/forms.html.haml", + "examples/blueprint_default/parts/grid.html.haml", + "examples/blueprint_default/parts/test-small.jpg", + "examples/blueprint_default/parts/test.jpg", + "examples/blueprint_default/parts/valid.png", + "examples/blueprint_default/src/ie.sass", + "examples/blueprint_default/src/images/grid.png", + "examples/blueprint_default/src/print.sass", + "examples/blueprint_default/src/screen.sass", + "examples/blueprint_plugins/config.rb", + "examples/blueprint_plugins/images/buttons/cross.png", + "examples/blueprint_plugins/images/buttons/key.png", + "examples/blueprint_plugins/images/buttons/tick.png", + "examples/blueprint_plugins/images/grid.png", + "examples/blueprint_plugins/images/link_icons/doc.png", + "examples/blueprint_plugins/images/link_icons/email.png", + "examples/blueprint_plugins/images/link_icons/external.png", + "examples/blueprint_plugins/images/link_icons/feed.png", + "examples/blueprint_plugins/images/link_icons/im.png", + "examples/blueprint_plugins/images/link_icons/pdf.png", + "examples/blueprint_plugins/images/link_icons/visited.png", + "examples/blueprint_plugins/images/link_icons/xls.png", + "examples/blueprint_plugins/images/test-small.jpg", + "examples/blueprint_plugins/images/test.jpg", + "examples/blueprint_plugins/images/valid.png", + "examples/blueprint_plugins/index.html.haml", + "examples/blueprint_plugins/plugins/buttons.html.haml", + "examples/blueprint_plugins/plugins/fancy_type.html.haml", + "examples/blueprint_plugins/plugins/link_icons.html.haml", + "examples/blueprint_plugins/plugins/rtl.html.haml", + "examples/blueprint_plugins/src/buttons.sass", + "examples/blueprint_plugins/src/ie.sass", + "examples/blueprint_plugins/src/images/grid.png", + "examples/blueprint_plugins/src/link_icons.sass", + "examples/blueprint_plugins/src/print.sass", + "examples/blueprint_plugins/src/rtl_screen.sass", + "examples/blueprint_plugins/src/screen.sass", + "examples/blueprint_scoped/images/grid.png", + "examples/blueprint_scoped/src/ie.sass", + "examples/blueprint_scoped/src/print.sass", + "examples/blueprint_scoped/src/screen.sass", + "examples/blueprint_scoped_form/images/grid.png", + "examples/blueprint_scoped_form/src/ie.sass", + "examples/blueprint_scoped_form/src/print.sass", + "examples/blueprint_scoped_form/src/screen.sass", + "examples/blueprint_semantic/config.rb", + "examples/blueprint_semantic/images/grid.png", + "examples/blueprint_semantic/index.html.haml", + "examples/blueprint_semantic/parts/fancy_type.html.haml", + "examples/blueprint_semantic/parts/liquid.html.haml", + "examples/blueprint_semantic/parts/test-small.jpg", + "examples/blueprint_semantic/parts/test.jpg", + "examples/blueprint_semantic/parts/valid.png", + "examples/blueprint_semantic/src/ie.sass", + "examples/blueprint_semantic/src/images/grid.png", + "examples/blueprint_semantic/src/liquid.sass", + "examples/blueprint_semantic/src/print.sass", + "examples/blueprint_semantic/src/screen.sass", + "examples/compass/compass.html.haml", + "examples/compass/config.rb", + "examples/compass/images/blue_arrow.gif", + "examples/compass/src/compass.sass", + "examples/compass/src/images/blue_arrow.gif", + "examples/compass/src/sticky_footer.sass", + "examples/compass/src/utilities.sass", + "examples/compass/sticky_footer.html.haml", + "examples/compass/utilities.html.haml", + "examples/downloader.rb", + "examples/logo/logo.html.haml", + "examples/logo/src/ie.sass", + "examples/logo/src/print.sass", + "examples/logo/src/screen.sass", + "examples/ninesixty/bootstrap.rb", + "examples/ninesixty/config.rb", + "examples/ninesixty/extensions/ninesixty/README.mkdn", + "examples/ninesixty/extensions/ninesixty/compass-960-plugin.gemspec", + "examples/ninesixty/extensions/ninesixty/lib/ninesixty.rb", + "examples/ninesixty/extensions/ninesixty/lib/ninesixty/compass_plugin.rb", + "examples/ninesixty/extensions/ninesixty/sass/960/_grid.sass", + "examples/ninesixty/extensions/ninesixty/sass/960/_text.sass", + "examples/ninesixty/extensions/ninesixty/templates/project/grid.sass", + "examples/ninesixty/extensions/ninesixty/templates/project/manifest.rb", + "examples/ninesixty/extensions/ninesixty/templates/project/text.sass", + "examples/ninesixty/src/grid.sass", + "examples/ninesixty/src/text.sass", + "examples/yui/bootstrap.rb", + "examples/yui/divisions.html.haml", + "examples/yui/extensions/yui/stylesheets/_yui.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_base.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_fonts.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_grids.sass", + "examples/yui/extensions/yui/stylesheets/yui/modules/_reset.sass", + "examples/yui/extensions/yui/templates/project/manifest.rb", + "examples/yui/extensions/yui/templates/project/screen.sass", + "examples/yui/index.html.haml", + "examples/yui/src/screen.sass", + "examples/yui/sub_divisions.html.haml", + "examples/yui/templates.html.haml", + "examples/yui/test.jpg", + "examples/yui/typography.html.haml", + "lib/compass.rb", + "lib/compass/actions.rb", + "lib/compass/app_integration.rb", + "lib/compass/app_integration/merb.rb", + "lib/compass/app_integration/merb/runtime.rb", + "lib/compass/app_integration/rails.rb", + "lib/compass/app_integration/rails/action_controller.rb", + "lib/compass/app_integration/rails/configuration_defaults.rb", + "lib/compass/app_integration/rails/installer.rb", + "lib/compass/app_integration/rails/runtime.rb", + "lib/compass/app_integration/rails/sass_plugin.rb", + "lib/compass/app_integration/rails/templates/compass-install-rails.rb", + "lib/compass/app_integration/rails/urls.rb", + "lib/compass/app_integration/stand_alone.rb", + "lib/compass/app_integration/stand_alone/configuration_defaults.rb", + "lib/compass/app_integration/stand_alone/installer.rb", + "lib/compass/commands.rb", + "lib/compass/commands/base.rb", + "lib/compass/commands/create_project.rb", + "lib/compass/commands/generate_grid_background.rb", + "lib/compass/commands/help.rb", + "lib/compass/commands/installer_command.rb", + "lib/compass/commands/list_frameworks.rb", + "lib/compass/commands/print_version.rb", + "lib/compass/commands/project_base.rb", + "lib/compass/commands/project_stats.rb", + "lib/compass/commands/registry.rb", + "lib/compass/commands/stamp_pattern.rb", + "lib/compass/commands/update_project.rb", + "lib/compass/commands/validate_project.rb", + "lib/compass/commands/watch_project.rb", + "lib/compass/commands/write_configuration.rb", + "lib/compass/compiler.rb", + "lib/compass/configuration.rb", + "lib/compass/configuration/adapters.rb", + "lib/compass/configuration/comments.rb", + "lib/compass/configuration/data.rb", + "lib/compass/configuration/defaults.rb", + "lib/compass/configuration/helpers.rb", + "lib/compass/configuration/inheritance.rb", + "lib/compass/configuration/serialization.rb", + "lib/compass/core_ext.rb", + "lib/compass/dependencies.rb", + "lib/compass/errors.rb", + "lib/compass/exec.rb", + "lib/compass/exec/command_option_parser.rb", + "lib/compass/exec/global_options_parser.rb", + "lib/compass/exec/helpers.rb", + "lib/compass/exec/project_options_parser.rb", + "lib/compass/exec/sub_command_ui.rb", + "lib/compass/exec/switch_ui.rb", + "lib/compass/frameworks.rb", + "lib/compass/frameworks/blueprint/stylesheets/_blueprint.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_ie.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_print.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_reset.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/_screen.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass", + "lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass", + "lib/compass/frameworks/blueprint/templates/buttons/buttons.sass", + "lib/compass/frameworks/blueprint/templates/buttons/buttons/cross.png", + "lib/compass/frameworks/blueprint/templates/buttons/buttons/key.png", + "lib/compass/frameworks/blueprint/templates/buttons/buttons/tick.png", + "lib/compass/frameworks/blueprint/templates/buttons/manifest.rb", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons.sass", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png", + "lib/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png", + "lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb", + "lib/compass/frameworks/blueprint/templates/project/grid.png", + "lib/compass/frameworks/blueprint/templates/project/ie.sass", + "lib/compass/frameworks/blueprint/templates/project/manifest.rb", + "lib/compass/frameworks/blueprint/templates/project/partials/_base.sass", + "lib/compass/frameworks/blueprint/templates/project/print.sass", + "lib/compass/frameworks/blueprint/templates/project/screen.sass", + "lib/compass/frameworks/blueprint/templates/project/welcome.html.haml", + "lib/compass/frameworks/compass/stylesheets/_compass.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_layout.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_misc.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_reset.sass", + "lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass", + "lib/compass/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_general.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_links.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_lists.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_print.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_tables.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/_text.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass", + "lib/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass", + "lib/compass/frameworks/compass/templates/ellipsis/ellipsis.sass", + "lib/compass/frameworks/compass/templates/ellipsis/manifest.rb", + "lib/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml", + "lib/compass/frameworks/compass/templates/extension/manifest.rb", + "lib/compass/frameworks/compass/templates/extension/stylesheets/main.sass", + "lib/compass/frameworks/compass/templates/extension/templates/project/manifest.rb", + "lib/compass/frameworks/compass/templates/extension/templates/project/screen.sass", + "lib/compass/frameworks/compass/templates/project/ie.sass", + "lib/compass/frameworks/compass/templates/project/manifest.rb", + "lib/compass/frameworks/compass/templates/project/print.sass", + "lib/compass/frameworks/compass/templates/project/screen.sass", + "lib/compass/grid_builder.rb", + "lib/compass/installers.rb", + "lib/compass/installers/bare_installer.rb", + "lib/compass/installers/base.rb", + "lib/compass/installers/manifest.rb", + "lib/compass/installers/manifest_installer.rb", + "lib/compass/installers/template_context.rb", + "lib/compass/logger.rb", + "lib/compass/sass_extensions.rb", + "lib/compass/sass_extensions/functions.rb", + "lib/compass/sass_extensions/functions/display.rb", + "lib/compass/sass_extensions/functions/enumerate.rb", + "lib/compass/sass_extensions/functions/inline_image.rb", + "lib/compass/sass_extensions/functions/selectors.rb", + "lib/compass/sass_extensions/functions/urls.rb", + "lib/compass/sass_extensions/monkey_patches.rb", + "lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb", + "lib/compass/sass_extensions/monkey_patches/traversal.rb", + "lib/compass/stats.rb", + "lib/compass/test_case.rb", + "lib/compass/validator.rb", + "lib/compass/version.rb", + "lib/vendor/fssm.rb", + "lib/vendor/fssm/backends/fsevents.rb", + "lib/vendor/fssm/backends/polling.rb", + "lib/vendor/fssm/ext.rb", + "lib/vendor/fssm/monitor.rb", + "lib/vendor/fssm/path.rb", + "lib/vendor/fssm/state.rb", + "lib/vendor/fssm/support.rb", + "test/command_line_helper.rb", + "test/command_line_test.rb", + "test/compass_test.rb", + "test/configuration_test.rb", + "test/fixtures/stylesheets/blueprint/config.rb", + "test/fixtures/stylesheets/blueprint/css/typography.css", + "test/fixtures/stylesheets/blueprint/images/grid.png", + "test/fixtures/stylesheets/blueprint/sass/ie.sass", + "test/fixtures/stylesheets/blueprint/sass/print.sass", + "test/fixtures/stylesheets/blueprint/sass/screen.sass", + "test/fixtures/stylesheets/blueprint/sass/typography.sass", + "test/fixtures/stylesheets/compass/config.rb", + "test/fixtures/stylesheets/compass/css/layout.css", + "test/fixtures/stylesheets/compass/css/print.css", + "test/fixtures/stylesheets/compass/css/reset.css", + "test/fixtures/stylesheets/compass/css/utilities.css", + "test/fixtures/stylesheets/compass/sass/layout.sass", + "test/fixtures/stylesheets/compass/sass/print.sass", + "test/fixtures/stylesheets/compass/sass/reset.sass", + "test/fixtures/stylesheets/compass/sass/utilities.sass", + "test/fixtures/stylesheets/image_urls/config.rb", + "test/fixtures/stylesheets/image_urls/css/screen.css", + "test/fixtures/stylesheets/image_urls/images/grid.png", + "test/fixtures/stylesheets/image_urls/sass/screen.sass", + "test/io_helper.rb", + "test/rails_helper.rb", + "test/rails_integration_test.rb", + "test/sass_extensions_test.rb", + "test/test_case_helper.rb", + "test/test_helper.rb", + "test/test_rails_helper.rb" ] s.homepage = %q{http://compass-style.org} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubyforge_project = %q{compass} - s.rubygems_version = %q{1.3.3} + s.rubygems_version = %q{1.3.5} s.summary = %q{A Real Stylesheet Framework} s.test_files = [ "test/command_line_helper.rb", - "test/command_line_test.rb", - "test/compass_test.rb", - "test/configuration_test.rb", - "test/fixtures/stylesheets/blueprint/config.rb", - "test/fixtures/stylesheets/blueprint/css/typography.css", - "test/fixtures/stylesheets/blueprint/images/grid.png", - "test/fixtures/stylesheets/blueprint/sass/ie.sass", - "test/fixtures/stylesheets/blueprint/sass/print.sass", - "test/fixtures/stylesheets/blueprint/sass/screen.sass", - "test/fixtures/stylesheets/blueprint/sass/typography.sass", - "test/fixtures/stylesheets/compass/config.rb", - "test/fixtures/stylesheets/compass/css/layout.css", - "test/fixtures/stylesheets/compass/css/print.css", - "test/fixtures/stylesheets/compass/css/reset.css", - "test/fixtures/stylesheets/compass/css/utilities.css", - "test/fixtures/stylesheets/compass/sass/layout.sass", - "test/fixtures/stylesheets/compass/sass/print.sass", - "test/fixtures/stylesheets/compass/sass/reset.sass", - "test/fixtures/stylesheets/compass/sass/utilities.sass", - "test/fixtures/stylesheets/image_urls/config.rb", - "test/fixtures/stylesheets/image_urls/css/screen.css", - "test/fixtures/stylesheets/image_urls/images/grid.png", - "test/fixtures/stylesheets/image_urls/sass/screen.sass", - "test/fixtures/stylesheets/yui/config.rb", - "test/fixtures/stylesheets/yui/css/mixins.css", - "test/fixtures/stylesheets/yui/sass/base.sass", - "test/fixtures/stylesheets/yui/sass/fonts.sass", - "test/fixtures/stylesheets/yui/sass/grids.sass", - "test/fixtures/stylesheets/yui/sass/mixins.sass", - "test/rails_integration_test.rb", - "test/sass_extensions_test.rb", - "test/test_case_helper.rb", - "test/test_helper.rb", - "test/test_rails_helper.rb" + "test/command_line_test.rb", + "test/compass_test.rb", + "test/configuration_test.rb", + "test/fixtures/stylesheets/blueprint/config.rb", + "test/fixtures/stylesheets/blueprint/css/typography.css", + "test/fixtures/stylesheets/blueprint/images/grid.png", + "test/fixtures/stylesheets/blueprint/sass/ie.sass", + "test/fixtures/stylesheets/blueprint/sass/print.sass", + "test/fixtures/stylesheets/blueprint/sass/screen.sass", + "test/fixtures/stylesheets/blueprint/sass/typography.sass", + "test/fixtures/stylesheets/compass/config.rb", + "test/fixtures/stylesheets/compass/css/layout.css", + "test/fixtures/stylesheets/compass/css/print.css", + "test/fixtures/stylesheets/compass/css/reset.css", + "test/fixtures/stylesheets/compass/css/utilities.css", + "test/fixtures/stylesheets/compass/sass/layout.sass", + "test/fixtures/stylesheets/compass/sass/print.sass", + "test/fixtures/stylesheets/compass/sass/reset.sass", + "test/fixtures/stylesheets/compass/sass/utilities.sass", + "test/fixtures/stylesheets/image_urls/config.rb", + "test/fixtures/stylesheets/image_urls/css/screen.css", + "test/fixtures/stylesheets/image_urls/images/grid.png", + "test/fixtures/stylesheets/image_urls/sass/screen.sass", + "test/io_helper.rb", + "test/rails_helper.rb", + "test/rails_integration_test.rb", + "test/sass_extensions_test.rb", + "test/test_case_helper.rb", + "test/test_helper.rb", + "test/test_rails_helper.rb", + "features/command_line.feature", + "features/step_definitions/command_line_steps.rb" ] if s.respond_to? :specification_version then @@ -336,3 +392,4 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 2.2.0"]) end end + From 8c9a7378b707f80ae0695d1c378ef6ff0c92e98e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 30 Oct 2009 08:25:53 -0700 Subject: [PATCH 093/118] Version bump to 0.9.2 gem changes for release. --- Rakefile | 2 +- VERSION.yml | 2 +- compass.gemspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index e8879dc9..f18b1f3b 100644 --- a/Rakefile +++ b/Rakefile @@ -40,7 +40,7 @@ begin require 'jeweler' Jeweler::Tasks.new do |gemspec| gemspec.rubyforge_project = "compass" - gemspec.name = "compass" + gemspec.name = "compass-edge" gemspec.summary = "A Real Stylesheet Framework" gemspec.email = "chris@eppsteins.net" gemspec.homepage = "http://compass-style.org" diff --git a/VERSION.yml b/VERSION.yml index 5f948000..a7a19a74 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- :minor: 9 :build: -:patch: 1 +:patch: 2 :major: 0 diff --git a/compass.gemspec b/compass.gemspec index 345163f1..9f85381a 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -4,7 +4,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| - s.name = %q{compass} + s.name = %q{compass-edge} s.version = "0.9.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= From d1a6490f2c4aff4d89a107d22fb8d364cd1ead1a Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 30 Oct 2009 09:27:59 -0700 Subject: [PATCH 094/118] Make the validator work even when you're not in the project directory. --- lib/compass/commands/validate_project.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/compass/commands/validate_project.rb b/lib/compass/commands/validate_project.rb index bd326560..2f024d36 100644 --- a/lib/compass/commands/validate_project.rb +++ b/lib/compass/commands/validate_project.rb @@ -31,7 +31,9 @@ module Compass def perform require 'compass/validator' UpdateProject.new(working_path, options).perform - Validator.new(project_css_subdirectory).validate() + Dir.chdir Compass.configuration.project_path do + Validator.new(project_css_subdirectory).validate() + end end class << self From c40982c5335b7321bb3881b500ca96317f4d41d3 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 09:59:48 -0800 Subject: [PATCH 095/118] Debug configuration with compass config --debug --- lib/compass/commands/write_configuration.rb | 19 +++++++++++++++++-- lib/compass/configuration/inheritance.rb | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index 1eb865aa..f4fbbd25 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -17,6 +17,9 @@ module Compass Options: }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + opts.on("--debug [PROPERTY]", "Debug your configuration by printing out details.") do |prop| + self.options[:debug] = prop.nil? ? true : prop.to_sym + end super end @@ -37,8 +40,20 @@ module Compass end def perform - directory projectize(File.dirname(options[:configuration_file])) - installer.write_configuration_files(options[:configuration_file]) + if options[:debug] + Compass.configuration.debug.each do |prop, values| + if options[:debug].is_a?(Symbol) + next unless prop == options[:debug] + end + puts "***** #{prop} = #{values.first[:resolved].inspect} *****" + [:default, :value, :raw, :resolved].each do |kind| + puts "#{kind}: " + values.inject([]){|m, v| m << v[kind]}.map{|v| v.nil? ? '-' : v.inspect}.join(", ") + end + end + else + directory projectize(File.dirname(options[:configuration_file])) + installer.write_configuration_files(options[:configuration_file]) + end end def installer_args diff --git a/lib/compass/configuration/inheritance.rb b/lib/compass/configuration/inheritance.rb index fd030172..255749c2 100644 --- a/lib/compass/configuration/inheritance.rb +++ b/lib/compass/configuration/inheritance.rb @@ -156,7 +156,7 @@ module Compass :raw => (instance.send("raw_#{prop}") rescue nil), :value => (instance.send("#{prop}_without_default") rescue nil), :default => (instance.send("default_#{prop}") rescue nil), - :resoved => instance.send(prop) + :resolved => instance.send(prop) } end normalized_attrs[prop] = values From 9ae53ac72e6398c203ef8f3fb3d0f07a25f30841 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 10:01:29 -0800 Subject: [PATCH 096/118] Move compass/utilities/css3 module to compass/css3 --- .../blueprint/stylesheets/blueprint/modules/_buttons.sass | 2 +- lib/compass/frameworks/compass/stylesheets/_compass.sass | 3 ++- .../compass/stylesheets/compass/{utilities => }/_css3.sass | 0 .../frameworks/compass/stylesheets/compass/_utilities.sass | 1 - .../compass/{utilities => }/css3/_border_radius.sass | 0 .../stylesheets/compass/{utilities => }/css3/_box_shadow.sass | 0 .../stylesheets/compass/{utilities => }/css3/_box_sizing.sass | 0 .../stylesheets/compass/{utilities => }/css3/_columns.sass | 0 .../compass/{utilities => }/css3/_inline_block.sass | 0 .../stylesheets/compass/{utilities => }/css3/_opacity.sass | 0 10 files changed, 3 insertions(+), 3 deletions(-) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/_css3.sass (100%) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/css3/_border_radius.sass (100%) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/css3/_box_shadow.sass (100%) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/css3/_box_sizing.sass (100%) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/css3/_columns.sass (100%) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/css3/_inline_block.sass (100%) rename lib/compass/frameworks/compass/stylesheets/compass/{utilities => }/css3/_opacity.sass (100%) diff --git a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass index b2b5e3e1..11932cfd 100644 --- a/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +++ b/lib/compass/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass @@ -1,4 +1,4 @@ -@import compass/utilities/css3/inline_block.sass +@import compass/css3/inline_block.sass @import compass/utilities/general/float.sass // Button Font diff --git a/lib/compass/frameworks/compass/stylesheets/_compass.sass b/lib/compass/frameworks/compass/stylesheets/_compass.sass index 79a50ab1..bbb7de73 100644 --- a/lib/compass/frameworks/compass/stylesheets/_compass.sass +++ b/lib/compass/frameworks/compass/stylesheets/_compass.sass @@ -1 +1,2 @@ -@import compass/utilities.sass \ No newline at end of file +@import compass/utilities.sass +@import compass/css3.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass b/lib/compass/frameworks/compass/stylesheets/compass/_css3.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/_css3.sass rename to lib/compass/frameworks/compass/stylesheets/compass/_css3.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass b/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass index ba76cf7b..767001d5 100644 --- a/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass +++ b/lib/compass/frameworks/compass/stylesheets/compass/_utilities.sass @@ -1,4 +1,3 @@ -@import utilities/css3.sass @import utilities/general.sass @import utilities/links.sass @import utilities/lists.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_border_radius.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_border_radius.sass rename to lib/compass/frameworks/compass/stylesheets/compass/css3/_border_radius.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_shadow.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_shadow.sass rename to lib/compass/frameworks/compass/stylesheets/compass/css3/_box_shadow.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_box_sizing.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_box_sizing.sass rename to lib/compass/frameworks/compass/stylesheets/compass/css3/_box_sizing.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_columns.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_columns.sass rename to lib/compass/frameworks/compass/stylesheets/compass/css3/_columns.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_inline_block.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_inline_block.sass rename to lib/compass/frameworks/compass/stylesheets/compass/css3/_inline_block.sass diff --git a/lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass b/lib/compass/frameworks/compass/stylesheets/compass/css3/_opacity.sass similarity index 100% rename from lib/compass/frameworks/compass/stylesheets/compass/utilities/css3/_opacity.sass rename to lib/compass/frameworks/compass/stylesheets/compass/css3/_opacity.sass From 8bcdd7360d4d29b902626e0f8130b272a8473ff3 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 15:26:58 -0800 Subject: [PATCH 097/118] Each framework pattern can have help now. --- lib/compass/commands/help.rb | 11 +++++++++++ lib/compass/frameworks.rb | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb index 8d516757..6cc417e6 100644 --- a/lib/compass/commands/help.rb +++ b/lib/compass/commands/help.rb @@ -21,6 +21,15 @@ Available commands: end banner << "\n" end + + banner << "\nAvailable Frameworks & Patterns:\n\n" + Compass::Frameworks::ALL.each do |framework| + banner << " * #{framework.name}\n" + framework.template_directories.each do |pattern| + banner << " - #{framework.name}/#{pattern}\n" + end + end + opts.banner = banner super @@ -53,6 +62,8 @@ Available commands: $command = options[:help_command] puts Compass::Commands[options[:help_command]].usage $command = "help" + elsif Compass::Frameworks.template_exists? options[:help_command] + puts Compass::Frameworks.template_usage(options[:help_command]) else raise OptionParser::ParseError, "No such command: #{options[:help_command]}" end diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index 9d6b2d7c..e9c8ac2b 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -15,6 +15,9 @@ module Compass @templates_directory = options[:templates_directory] || File.join(path, 'templates') @stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets') end + def template_directories + Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)} + end end def register(name, *arguments) @@ -47,6 +50,29 @@ module Compass end end + def template_exists?(template) + framework_name, template = template.split(%r{/}, 2) + template ||= "project" + if framework = self[framework_name] + return File.directory?(File.join(framework.templates_directory, template)) + end + false + end + + def template_usage(template) + framework_name, template = template.split(%r{/}, 2) + framework = self[framework_name] + template ||= "project" + usage_file = File.join(framework.templates_directory, template, "USAGE.markdown") + if File.exists?(usage_file) + File.read(usage_file) + else + <<-END.gsub(/^ {8}/, '') + No Usage! + END + end + end + end end From 353a225ac570f62c3b3c8ee35afb3db120f7e9c8 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 16:49:44 -0800 Subject: [PATCH 098/118] Allow help, welcome message, and description of an extension to be specified in the manifest file. --- .../app_integration/stand_alone/installer.rb | 1 + lib/compass/commands/help.rb | 6 ++++- lib/compass/frameworks.rb | 9 +++++++ lib/compass/installers/manifest.rb | 26 ++++++++++++++++++- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index 5c6177de..25d5ea44 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -71,6 +71,7 @@ More Resources: NEXTSTEPS end + puts manifest.welcome_message if manifest.welcome_message if manifest.has_stylesheet? puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" puts stylesheet_links diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb index 6cc417e6..dccc313e 100644 --- a/lib/compass/commands/help.rb +++ b/lib/compass/commands/help.rb @@ -26,7 +26,11 @@ Available commands: Compass::Frameworks::ALL.each do |framework| banner << " * #{framework.name}\n" framework.template_directories.each do |pattern| - banner << " - #{framework.name}/#{pattern}\n" + banner << " - #{framework.name}/#{pattern}" + if description = framework.manifest(pattern).description + banner << "\t- #{description}" + end + banner << "\n" end end diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index e9c8ac2b..d11ff8fb 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -18,6 +18,13 @@ module Compass def template_directories Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)} end + def manifest_file(pattern) + File.join(templates_directory, pattern.to_s, "manifest.rb") + end + def manifest(pattern, options = {}) + options[:pattern_name] ||= pattern + Compass::Installers::Manifest.new(manifest_file(pattern), options) + end end def register(name, *arguments) @@ -66,6 +73,8 @@ module Compass usage_file = File.join(framework.templates_directory, template, "USAGE.markdown") if File.exists?(usage_file) File.read(usage_file) + elsif help = framework.manifest(template).help + help else <<-END.gsub(/^ {8}/, '') No Usage! diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index 0f1978f5..b90831ff 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -40,6 +40,30 @@ module Compass type :file type :html + def help(value = nil) + if value + @help = value + else + @help + end + end + + def welcome_message(value = nil) + if value + @welcome_message = value + else + @welcome_message + end + end + + def description(value = nil) + if value + @description = value + else + @description + end + end + # Enumerates over the manifest files def each @entries.each {|e| yield e} @@ -76,4 +100,4 @@ module Compass end end -end \ No newline at end of file +end From d4f67a315cf7cebc277e4bb23b65705acea96ff8 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 17:09:44 -0800 Subject: [PATCH 099/118] Allow the welcome message to replace the default one instead of just augment it. --- lib/compass/app_integration/stand_alone/installer.rb | 4 ++-- lib/compass/installers/manifest.rb | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index 25d5ea44..d13d6162 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -44,7 +44,7 @@ module Compass end def finalize(options = {}) - if options[:create] + if options[:create] && !manifest.welcome_message_options[:replace] puts <<-NEXTSTEPS ********************************************************************* @@ -72,7 +72,7 @@ More Resources: NEXTSTEPS end puts manifest.welcome_message if manifest.welcome_message - if manifest.has_stylesheet? + if manifest.has_stylesheet? && !manifest.welcome_message_options[:replace] puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" puts stylesheet_links end diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index b90831ff..aa3d9660 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -48,9 +48,12 @@ module Compass end end - def welcome_message(value = nil) + attr_reader :welcome_message_options + + def welcome_message(value = nil, options = {}) if value @welcome_message = value + @welcome_message_options = options else @welcome_message end From 1981e5f2ca24a33fa338b7a6eff4689d617aeadf Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 17:40:50 -0800 Subject: [PATCH 100/118] Help for each template that ships with compass. --- .../blueprint/templates/buttons/manifest.rb | 12 +++++++ .../templates/link_icons/manifest.rb | 13 ++++++++ .../blueprint/templates/project/manifest.rb | 24 ++++++++++++++ .../compass/templates/ellipsis/manifest.rb | 27 +++++++++++++++- .../compass/templates/extension/manifest.rb | 18 +++++++++-- .../compass/templates/project/USAGE.markdown | 32 +++++++++++++++++++ .../compass/templates/project/manifest.rb | 1 + 7 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 lib/compass/frameworks/compass/templates/project/USAGE.markdown diff --git a/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb b/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb index b097845b..e9821ca2 100644 --- a/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb +++ b/lib/compass/frameworks/blueprint/templates/buttons/manifest.rb @@ -1,5 +1,17 @@ +description "Button Plugin" stylesheet 'buttons.sass', :media => 'screen, projection' image 'buttons/cross.png' image 'buttons/key.png' image 'buttons/tick.png' + +help %Q{ +To install the button plugin: + compass init --using blueprint/buttons + +The buttons.sass file is just a recommendation to show you how to use the button mixins. +} + +welcome_message %Q{ +The buttons.sass file is just a recommendation to show you how to use the button mixins. +} diff --git a/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb b/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb index 5b8b4f9f..9d0dc09a 100644 --- a/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb +++ b/lib/compass/frameworks/blueprint/templates/link_icons/manifest.rb @@ -1,3 +1,5 @@ +description "Icons for common types of links" + stylesheet "link_icons.sass", :media => 'screen, projection' image 'link_icons/doc.png' @@ -8,3 +10,14 @@ image 'link_icons/im.png' image 'link_icons/pdf.png' image 'link_icons/visited.png' image 'link_icons/xls.png' + +help %Q{ +To install the link_icons plugin: + compass init --using blueprint/link_icons + +The link_icons.sass file is just a recommendation to show you how to use the link mixins. +} + +welcome_message %Q{ +The link_icons.sass file is just a recommendation to show you how to use the link mixins. +} diff --git a/lib/compass/frameworks/blueprint/templates/project/manifest.rb b/lib/compass/frameworks/blueprint/templates/project/manifest.rb index fa700632..e637d521 100644 --- a/lib/compass/frameworks/blueprint/templates/project/manifest.rb +++ b/lib/compass/frameworks/blueprint/templates/project/manifest.rb @@ -1,3 +1,5 @@ +description "The blueprint framework." + stylesheet 'screen.sass', :media => 'screen, projection' stylesheet 'partials/_base.sass' stylesheet 'print.sass', :media => 'print' @@ -6,3 +8,25 @@ stylesheet 'ie.sass', :media => 'screen, projection', :condition => "lt IE 8 image 'grid.png' html 'welcome.html.haml', :erb => true + +help %Q{ +Please see the blueprint website for documentation on how blueprint works: + + http://blueprintcss.org/ + +Docs on the compass port of blueprint can be found on the wiki: + + http://wiki.github.com/chriseppstein/compass/blueprint-documentation +} + +welcome_message %Q{ +Please see the blueprint website for documentation on how blueprint works: + + http://blueprintcss.org/ + +Docs on the compass port of blueprint can be found on the wiki: + + http://wiki.github.com/chriseppstein/compass/blueprint-documentation + +To get started, edit the screen.sass file and read the comments and code there. +} diff --git a/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb b/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb index de28fcec..5de7d673 100644 --- a/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb +++ b/lib/compass/frameworks/compass/templates/ellipsis/manifest.rb @@ -1,2 +1,27 @@ +description "Plugin for cross-browser ellipsis truncated text." + file 'xml/ellipsis.xml', :like => :css -stylesheet 'ellipsis.sass' \ No newline at end of file +stylesheet 'ellipsis.sass' + +help %Q{ +First, install the plugin to get the xml file that makes this work in firfox: + + compass init --using blueprint/link_icons + +Then mix +ellipsis into your selectors to enable ellipsis +there when text gets too long. + +The ellipsis.sass file is just an example for how to use this plugin, +feel free to delete it. + +For more information see: + http://mattsnider.com/css/css-string-truncation-with-ellipsis/ +} + +welcome_message %Q{ +The ellipsis.sass file is just an example for how to use this plugin, +feel free to delete it. + +For more information see: + http://mattsnider.com/css/css-string-truncation-with-ellipsis/ +} \ No newline at end of file diff --git a/lib/compass/frameworks/compass/templates/extension/manifest.rb b/lib/compass/frameworks/compass/templates/extension/manifest.rb index cdfea4d3..0f92706a 100644 --- a/lib/compass/frameworks/compass/templates/extension/manifest.rb +++ b/lib/compass/frameworks/compass/templates/extension/manifest.rb @@ -1,6 +1,20 @@ -file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:pattern_name])}.sass" +description "Generate a compass extension." + +file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:pattern_name]||options[:project_name]||'main')}.sass" file 'templates/project/manifest.rb' file 'templates/project/screen.sass' +help %Q{ + To generate a compass extension: + compass create my_extension --using compass/extension +} + +welcome_message %Q{ +For a full tutorial on how to build your own extension see: + +http://github.com/chriseppstein/compass/blob/edge/docs/EXTENSIONS.markdown + +}, :replace => true + no_configuration_file! -skip_compilation! \ No newline at end of file +skip_compilation! diff --git a/lib/compass/frameworks/compass/templates/project/USAGE.markdown b/lib/compass/frameworks/compass/templates/project/USAGE.markdown new file mode 100644 index 00000000..21b5fb61 --- /dev/null +++ b/lib/compass/frameworks/compass/templates/project/USAGE.markdown @@ -0,0 +1,32 @@ +When no framework is specified, a new compass project is set up with three stylesheets: + +* screen.sass +* print.sass +* ie.sass + +It is expected that you will link your html to these like so: + + + + + + + +You don't have to use these three stylesheets, they are just a recommendation. +You can rename them, make new stylesheets, and delete them. Compass will +happily compile whatever sass files you place into your project. + +Any folders you create in your source directory with sass files in them will be folders +that get created with css files in them when compiled. + +Sass files beginning with an underscore are called partials, they are not directly +compiled to their own css file. You can use these partials by importing them +into other stylesheets. This is useful for keeping your stylesheets small and manageable +and single-focused. It is common to create a file called _base.sass at the top level +of your stylesheets and to import this to set up project-wide constants and mixins. + diff --git a/lib/compass/frameworks/compass/templates/project/manifest.rb b/lib/compass/frameworks/compass/templates/project/manifest.rb index 03604fe2..fade058b 100644 --- a/lib/compass/frameworks/compass/templates/project/manifest.rb +++ b/lib/compass/frameworks/compass/templates/project/manifest.rb @@ -1,3 +1,4 @@ +description "The default project layout." stylesheet 'screen.sass', :media => 'screen, projection' stylesheet 'print.sass', :media => 'print' stylesheet 'ie.sass', :media => 'screen, projection', :condition => "IE" \ No newline at end of file From f9caa133f578a76be646b6d58c0d53994d7efa42 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 21:01:59 -0800 Subject: [PATCH 101/118] Stuff that needs to be done before the next release. --- TODO.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TODO.md b/TODO.md index 82cc0ff1..b78a68ca 100644 --- a/TODO.md +++ b/TODO.md @@ -1,2 +1,9 @@ +MUST: * vendored plugins should override default plugins. +* rails support for vendored extensions +* A proper welcome page for blueprint projects (or delete it) + +NICE: +* some extension commands +* Better help for commands and patterns From 7117f05412baf84bad916bcb6c89e9b5a5a63a71 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 21:02:25 -0800 Subject: [PATCH 102/118] Starting work on the changelog for 0.10 --- CHANGELOG.markdown | 123 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 890c7b78..266386e3 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,6 +1,129 @@ COMPASS CHANGELOG ================= +0.10.0 (UNRELEASED) +------------ + +Command-Line: + +* The compass command-line tool has been re-written to allow be easier to + use and be more flexible. The old command line is still supported at + this time. "compass help" will get you started on using the new + command line syntax. +* Allow specification of a height for the grid image +* For the truly hardcore compass users, you may now create a + compass project using "compass create my_project --bare" + and you'll have a completely bare project created for you with no + sass files provided for you. +* Get stats on your compass project with "compass stats". You'll + need to install the "css_parser" ruby gem to get stats on your + css files. + +Configuration: + +* The entire configuration infrastructure has been re-written to make it + easier to support the various sources of configuration data (project type, + config file, command line, and hard coded defaults) +* Whether to generate relative links to assets is now controlled by a + separate boolean configuration flag called `relative_assets` in the + configuration file and `--relative-assets` on the command line. + Setting `http_images_path` to `:relative` is deprecated. +* You may now configure the http locations for your project by simply setting + `http_path` for the top level path of the project. You + may also set `http_images_dir`, `http_stylesheets_dir`, and + `http_javascripts_dir` relative to the `http_path` instead of + setting the absolute `http_XXX_path` counterparts. + +Compass Core: + +* A new helper function `stylesheet_url(path)` can now be used to refer + to assets that are relative to the css directory. +* Compass sprite mixins are now more flexible and feature rich. +* Fixed the append_selector function to allow comma-delimited selectors + for both arguments instead of just the first +* There is no longer any outline on unstyled links in the :active and :focused states. +* IE6 bug fixes for sticky-footer +* New CSS3 Compatibility Mixins. You can import them all with `@import compass/css3` + * `+opacity(amount)` where amount should be between 0 and 1, where 0 is transparent and 1 is opaque. + * `+opaque` and `+transparent` mixins for convenience. Built on top of the opacity mixin. + * `+border-radius(amount)` as well as the following convenience mixins: + * `+border-top-left-radius(amount)` + * `+border-top-right-radius(amount)` + * `+border-top-right-radius(amount)`, + * `+border-bottom-left-radius(amount)` + * `+border-bottom-right-radius(amount)` + * `+border-top-radius(amount)` + * `+border-right-radius(amount)` + * `+border-left-radius(amount)` + * `+border-bottom-radius(amount)` + * `+box-shadow(!horiz_offset, !vert_offset, !blur, !color)` + * `+box-sizing(!sizing_mode)` + * Column support via the following mixins: + * `+column-count` + * `+column-gap` + * `+column-width` + * `+column-rule-width` + * `+column-rule-style` + * `+column-rule-color` + * `+column-rule` + * The import for `+inline-block` has moved from compass/utilities/general/inline_block + to compass/css3/inline_block + * The import for `+opacity` has moved from compass/utilities/general/opacity + to compass/css3/opacity + * Note: If you are using the `+opacity` or `+inline-block` mixins, + you may need to update your imports. + +Blueprint: + +* Make the primary blueprint mixins easier to use by allowing them to be nested when passing true as the first argument. + The old approach of passing a selector as the first argument is now deprecated in favor of a simple flag to indicate nesting or not. + +YUI: + +* YUI was upgraded to 2.7.0 +* Yahoo has deprecated the YUI CSS framework, as such YUI has been extracted to a plugin. + If you use it, please install it with: `sudo gem install compass-yui` + +Extensions: + +* Extensions can now be installed locally by unpacking them into a project's + "extensions" directory. +* Extensions can deliver html to projects if they like. The html can be in + haml and will be transformed to html. +* All files can be processed using ERB before being copied into the user's + project. +* Compass extensions can now add support for other application frameworks. + These extensions can help compass understand the project structure of that + framework as well as provide runtime integration for ruby-based apps. + Contact me if you plan to do this -- the first couple times may be a little + rough. +* Compass extensions can now add new command line commands. Contact me if you + plan to do this -- the first couple times may be a little rough. +* Extensions can now provide help documentation just after a project is + created and on demand when the user uses the command line help system. + This can be done via the manifest file or by adding a USAGE.markdown file + at the top level of the framework template. + +Miscellaneous: + +* The compass configuration object is no longer a singleton, this makes it + possible for other ruby software to manage multiple compass projects at a + time. +* Compass no longer requires rubygems in order to work, this is a ruby + best-practice. +* All sass provided by compass now uses css-style property syntax. +* The command line tool is now tested using the cucumber testing framework. + +Many thanks to the following Contributors: + + * Brandon Mathis - CSS3 (+opacity, +border-radius) and sprites + * Eric Meyer - CSS3 (+box-shadow, +columns, +box-sizing) + * Jacques Crocker - Merb Compatibility fixes + * Gabriel Mansour - Fixes to +unstyled-link + * John Debs - IE6 Fixes for +sticky-footer + * Brian Johnson - Upgraded to YUI 2.7.0 + * Beau Smith - fixing my dyslexia. + 0.8.12 (August 22, 2009) ------------------------ From 9a51c8a9a21f497cd7880bb8975a91b45d14fde7 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 21:02:40 -0800 Subject: [PATCH 103/118] Version bump to 0.9.3 --- VERSION.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.yml b/VERSION.yml index a7a19a74..c9cc4359 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- -:minor: 9 -:build: -:patch: 2 :major: 0 +:minor: 9 +:patch: 3 +:build: From 57aae945119a453c8f5f5d54921734fb6a22b65b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 1 Nov 2009 21:08:45 -0800 Subject: [PATCH 104/118] Fix a bug when the welcome message was not provided by an extension template. --- lib/compass/installers/manifest.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index aa3d9660..eb664a7d 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -59,6 +59,10 @@ module Compass end end + def welcome_message_options + @welcome_message_options || {} + end + def description(value = nil) if value @description = value From ba33c5a5a6edbffb7ad82b22fc9988ce3640da5c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 14 Nov 2009 09:37:36 -0800 Subject: [PATCH 105/118] Add config/compass.rb as a known config location. Default to config/compass.rb as the configuration file for rails projects. --- features/command_line.feature | 5 ++--- lib/compass/app_integration/rails/installer.rb | 4 +++- lib/compass/configuration/helpers.rb | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 6aa615c7..800c2253 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -77,9 +77,8 @@ Feature: Command Line Scenario: Initializing a rails project Given I'm in a newly created rails project: my_rails_project When I initialize a project using: compass init rails --sass-dir app/stylesheets --css-dir public/stylesheets/compiled - Then a config file config/compass.config is reported created - Then a config file config/compass.config is created - And a ruby file config/compass.config is created + Then a config file config/compass.rb is reported created + Then a config file config/compass.rb is created And a sass file config/initializers/compass.rb is created And a sass file app/stylesheets/screen.sass is created And a sass file app/stylesheets/print.sass is created diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index 863ad3ff..ece81ea2 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -22,8 +22,10 @@ module Compass end def write_configuration_files(config_file = nil) - config_file ||= targetize('config/compass.config') + config_file ||= targetize('config/compass.rb') + directory File.dirname(config_file) write_file config_file, config_contents + directory File.dirname(targetize('config/initializers/compass.rb')) write_file targetize('config/initializers/compass.rb'), initializer_contents end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index 18bd60ac..edcfb40c 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -76,7 +76,7 @@ module Compass end # TODO: Deprecate the src/config.rb location. - KNOWN_CONFIG_LOCATIONS = [".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] + KNOWN_CONFIG_LOCATIONS = ['config/compass.rb', ".compass/config.rb", "config/compass.config", "config.rb", "src/config.rb"] # Finds the configuration file, if it exists in a known location. def detect_configuration_file(project_path = nil) From 22cdcf2cb53411a51d4bec7b3019ac0fd763b468 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 14 Nov 2009 09:42:37 -0800 Subject: [PATCH 106/118] Separate the project type default configuration from the installer. --- lib/compass/app_integration.rb | 21 ++++++++++++++ lib/compass/app_integration/rails.rb | 18 ++++++++++++ lib/compass/app_integration/stand_alone.rb | 21 +++++++++++++- lib/compass/commands/installer_command.rb | 23 +++++++-------- lib/compass/commands/write_configuration.rb | 2 +- lib/compass/configuration/defaults.rb | 3 +- lib/compass/configuration/helpers.rb | 31 +++++++++++++++++---- lib/compass/exec/project_options_parser.rb | 4 +++ 8 files changed, 102 insertions(+), 21 deletions(-) diff --git a/lib/compass/app_integration.rb b/lib/compass/app_integration.rb index 8d7ec37b..bede6075 100644 --- a/lib/compass/app_integration.rb +++ b/lib/compass/app_integration.rb @@ -1,3 +1,24 @@ %w(stand_alone rails merb).each do |lib| require "compass/app_integration/#{lib}" end + +module Compass + module AppIntegration + module Helpers + def lookup(project_type) + eval "Compass::AppIntegration::#{camelize(project_type)}" + rescue NameError + raise Compass::Error, "No application integration exists for #{project_type}" + end + + protected + + # Stolen from ActiveSupport + def camelize(s) + s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + end + + end + extend Helpers + end +end diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index 28bef715..745efca5 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -5,4 +5,22 @@ end require 'compass/app_integration/rails/runtime' if defined?(ActionController::Base) +module Compass + module AppIntegration + module Rails + + extend self + + def installer(*args) + Installer.new(*args) + end + + def configuration + Compass::Configuration::Data.new. + extend(ConfigurationDefaults) + end + + end + end +end diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb index 4e5d0722..c3a6c9fe 100644 --- a/lib/compass/app_integration/stand_alone.rb +++ b/lib/compass/app_integration/stand_alone.rb @@ -1,3 +1,22 @@ %w(configuration_defaults installer).each do |lib| require "compass/app_integration/stand_alone/#{lib}" -end \ No newline at end of file +end + +module Compass + module AppIntegration + module StandAlone + + extend self + + def installer(*args) + Installer.new(*args) + end + + def configuration + Compass::Configuration::Data.new. + extend(ConfigurationDefaults) + end + + end + end +end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 982294a3..62dc87d2 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -6,8 +6,8 @@ module Compass include Compass::Installers def configure! - Compass.add_configuration(installer.default_configuration) - Compass.add_project_configuration + Compass.add_configuration(options[:project_type] || :stand_alone) + Compass.add_project_configuration unless respond_to?(:is_project_creation?) && is_project_creation? Compass.add_configuration(options) Compass.add_configuration(installer.completed_configuration) if File.exists?(Compass.configuration.extensions_path) @@ -15,19 +15,16 @@ module Compass end end - def installer - installer_class = if options[:bare] - "Compass::Installers::BareInstaller" - else - project_type = options[:project_type] || Compass.configuration.project_type - "Compass::AppIntegration::#{camelize(project_type)}::Installer" - end - @installer = eval("#{installer_class}.new *installer_args") + def app + @app ||= Compass::AppIntegration.lookup(Compass.configuration.project_type) end - # Stolen from ActiveSupport - def camelize(s) - s.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + def installer + @installer ||= if options[:bare] + Compass::Installers::BareInstaller.new(*installer_args) + else + app.installer(*installer_args) + end end def installer_args diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index f4fbbd25..c4e847dd 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -51,7 +51,7 @@ module Compass end end else - directory projectize(File.dirname(options[:configuration_file])) + directory File.dirname(options[:configuration_file]) installer.write_configuration_files(options[:configuration_file]) end end diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index 83da5c2e..8dcad8b5 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -85,6 +85,7 @@ module Compass def http_join(*segments) segments.map do |segment| + next unless segment segment = http_pathify(segment) segment[-1..-1] == "/" ? segment[0..-2] : segment end.join("/") @@ -104,4 +105,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index edcfb40c..ec454d80 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -16,7 +16,16 @@ module Compass def add_configuration(config, filename = nil) return if config.nil? - data = if config.is_a?(Compass::Configuration::Data) + + data = configuration_for(config, filename) + + data.inherit_from!(configuration) + data.on_top! + @configuration = data + end + + def configuration_for(config, filename = nil) + if config.is_a?(Compass::Configuration::Data) config elsif config.respond_to?(:read) Compass::Configuration::Data.new_from_string(config.read, filename) @@ -24,12 +33,11 @@ module Compass Compass::Configuration::Data.new(config) elsif config.is_a?(String) Compass::Configuration::Data.new_from_file(config) + elsif config.is_a?(Symbol) + Compass::AppIntegration.lookup(config).configuration else raise "I don't know what to do with: #{config.inspect}" end - data.inherit_from!(configuration) - data.on_top! - @configuration = data end # Support for testing. @@ -57,7 +65,20 @@ module Compass # Read the configuration file for this project def add_project_configuration(configuration_file_path = nil) configuration_file_path ||= detect_configuration_file - Compass.add_configuration(configuration_file_path) if configuration_file_path + if configuration_file_path + + data = configuration_for(configuration_file_path) + + if data.raw_project_type + add_configuration(data.raw_project_type.to_sym) + else + add_configuration(:stand_alone) + end + + add_configuration(data) + else + add_configuration(configuration.project_type || :stand_alone) + end end # Returns a full path to the relative path to the project directory diff --git a/lib/compass/exec/project_options_parser.rb b/lib/compass/exec/project_options_parser.rb index a7c201b6..6ef5471a 100644 --- a/lib/compass/exec/project_options_parser.rb +++ b/lib/compass/exec/project_options_parser.rb @@ -8,6 +8,10 @@ module Compass::Exec::ProjectOptionsParser self.options[:configuration_file] = configuration_file end + opts.on('--app APP', 'Tell compass what kind of application it is integrating with. E.g. rails') do |project_type| + self.options[:project_type] = project_type.to_sym + end + opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| self.options[:sass_dir] = sass_dir end From 46ccb5b6e1344ad1aa3b78ecf5b7e19d576d42eb Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 14 Nov 2009 10:11:19 -0800 Subject: [PATCH 107/118] [Command Line] Access the Sass Repl (sass -i) with the compass environment loaded. --- lib/compass/commands.rb | 2 +- lib/compass/commands/interactive.rb | 61 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 lib/compass/commands/interactive.rb diff --git a/lib/compass/commands.rb b/lib/compass/commands.rb index 7389a508..ce22e296 100644 --- a/lib/compass/commands.rb +++ b/lib/compass/commands.rb @@ -6,6 +6,6 @@ require 'compass/commands/registry' %w(base generate_grid_background help list_frameworks project_base update_project watch_project create_project installer_command print_version project_stats stamp_pattern validate_project - write_configuration).each do |lib| + write_configuration interactive).each do |lib| require "compass/commands/#{lib}" end diff --git a/lib/compass/commands/interactive.rb b/lib/compass/commands/interactive.rb new file mode 100644 index 00000000..c0a0d46f --- /dev/null +++ b/lib/compass/commands/interactive.rb @@ -0,0 +1,61 @@ + +require 'compass/commands/project_base' +require 'compass/commands/update_project' + +module Compass + module Commands + module InteractiveOptionsParser + def set_options(opts) + opts.banner = %Q{ + Usage: compass interactive [path/to/project] [options] + + Description: + Interactively evaluate SassScript + + Options: + }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") + + super + end + end + class Interactive < ProjectBase + + register :interactive + + def initialize(working_path, options) + super + end + + def perform + require 'sass/repl' + Sass::Repl.new.run + end + + class << self + + def option_parser(arguments) + parser = Compass::Exec::CommandOptionParser.new(arguments) + parser.extend(Compass::Exec::GlobalOptionsParser) + parser.extend(Compass::Exec::ProjectOptionsParser) + parser.extend(InteractiveOptionsParser) + end + + def usage + option_parser([]).to_s + end + + def description(command) + "Interactively evaluate SassScript" + end + + def parse!(arguments) + parser = option_parser(arguments) + parser.parse! + parser.options + end + + end + + end + end +end From a281dc1d5f0b1353eef16c1b131563ca6ec511a6 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 15 Nov 2009 12:28:03 -0800 Subject: [PATCH 108/118] [Command Line] Primary commands get special status in the initial help output. --- features/command_line.feature | 23 +++++++++------ .../step_definitions/command_line_steps.rb | 24 ++++++++++++++-- lib/compass/commands/create_project.rb | 2 ++ lib/compass/commands/help.rb | 28 +++++++++++++------ lib/compass/commands/project_stats.rb | 2 ++ lib/compass/commands/update_project.rb | 2 ++ 6 files changed, 63 insertions(+), 18 deletions(-) diff --git a/features/command_line.feature b/features/command_line.feature index 800c2253..f6e6ae9e 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -129,16 +129,23 @@ Feature: Command Line And an image file images/buttons/tick.png is created And a css file tmp/buttons.css is created + @now Scenario: Basic help When I run: compass help - Then I should be shown a list of available commands - And the list of commands should describe the compile command - And the list of commands should describe the create command - And the list of commands should describe the grid-img command - And the list of commands should describe the help command - And the list of commands should describe the init command - And the list of commands should describe the install command - And the list of commands should describe the version command + Then I should see the following "primary" commands: + | compile | + | create | + | init | + | watch | + And I should see the following "other" commands: + | config | + | grid-img | + | help | + | install | + | interactive | + | stats | + | validate | + | version | Scenario: Recompiling a project with no material changes Given I am using the existing project in test/fixtures/stylesheets/compass diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 4d8c86ae..4f8e8854 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -160,8 +160,21 @@ Then /^I am told how to compile my sass stylesheets$/ do @last_result.should =~ /You must compile your sass stylesheets into CSS when they change.\nThis can be done in one of the following ways:/ end -Then /^I should be shown a list of available commands$/ do - @last_result.should =~ /^Available commands:$/ +Then /^I should be shown a list of "([^"]+)" commands$/ do |kind| + @last_result.should =~ /^#{kind.capitalize} Commands:$/ + @last_command_list = [] + found = false + indent = nil + @last_result.split("\n").each do |line| + if line =~ /^#{kind.capitalize} Commands:$/ + found = true + elsif found && line =~ /^\s+/ + @last_command_list << line + elsif found && line =~ /^$|^\w/ + break + end + end + end Then /^the list of commands should describe the ([^ ]+) command$/ do |command| @@ -196,4 +209,11 @@ Then /^I am told statistics for each file:$/ do |table| end end +Then /^I should see the following "([^"]+)" commands:$/ do |kind, table| + + Then %Q{I should be shown a list of "#{kind}" commands} + + commands = @last_command_list.map{|c| c =~ /^\s+\* ([^ ]+)\s+- [A-Z].+$/; [$1]} + table.diff!(commands) +end diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index ca0f0330..fa3d2dbe 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -68,6 +68,8 @@ module Compass end end + def primary; true; end + def parse!(arguments) parser = option_parser(arguments) parse_options!(parser, arguments) diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb index dccc313e..2f5067e2 100644 --- a/lib/compass/commands/help.rb +++ b/lib/compass/commands/help.rb @@ -11,16 +11,16 @@ Description: To get help on a particular command please specify the command. -Available commands: - } - Compass::Commands.all.sort_by{|c| c.to_s}.each do |command| - banner << " * #{command}" - if Compass::Commands[command].respond_to? :description - banner << "\t- #{Compass::Commands[command].description(command)}" - end - banner << "\n" + + primary_commands = Compass::Commands.all.select do |c| + cmd = Compass::Commands[c] + cmd.respond_to?(:primary) && cmd.primary end + other_commands = Compass::Commands.all - primary_commands + + banner << command_list("Primary Commands:", primary_commands) + banner << command_list("Other Commands:", other_commands) banner << "\nAvailable Frameworks & Patterns:\n\n" Compass::Frameworks::ALL.each do |framework| @@ -38,6 +38,18 @@ Available commands: super end + + def command_list(header, commands) + list = "#{header}\n" + commands.sort_by{|c| c.to_s}.each do |command| + list << " * #{command}" + if Compass::Commands[command].respond_to? :description + list << "\t- #{Compass::Commands[command].description(command)}" + end + list << "\n" + end + list + end end class Help < Base register :help diff --git a/lib/compass/commands/project_stats.rb b/lib/compass/commands/project_stats.rb index 05d20acf..81f958c9 100644 --- a/lib/compass/commands/project_stats.rb +++ b/lib/compass/commands/project_stats.rb @@ -136,6 +136,8 @@ module Compass "Report statistics about your stylesheets" end + def primary; false; end + def parse!(arguments) parser = option_parser(arguments) parser.parse! diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index 0f49ff33..9ab8814b 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -62,6 +62,8 @@ module Compass option_parser([]).to_s end + def primary; true; end + def description(command) "Compile Sass stylesheets to CSS" end From bd422403bd0fb4e9bee101d92d4583521fbc6d58 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 17 Nov 2009 08:58:12 -0800 Subject: [PATCH 109/118] Name all configuration sources for debugging purposes. --- lib/compass/app_integration/rails.rb | 2 +- lib/compass/app_integration/rails/installer.rb | 4 ---- lib/compass/app_integration/stand_alone.rb | 2 +- lib/compass/app_integration/stand_alone/installer.rb | 4 ---- lib/compass/commands/generate_grid_background.rb | 2 +- lib/compass/commands/installer_command.rb | 4 ++-- lib/compass/commands/write_configuration.rb | 8 ++++++++ lib/compass/configuration/data.rb | 7 +++++-- lib/compass/configuration/helpers.rb | 9 ++++++--- lib/compass/configuration/serialization.rb | 4 ++-- lib/compass/installers/bare_installer.rb | 4 ---- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index 745efca5..668fbd42 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -16,7 +16,7 @@ module Compass end def configuration - Compass::Configuration::Data.new. + Compass::Configuration::Data.new('rails'). extend(ConfigurationDefaults) end diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index ece81ea2..4b06a2a7 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -10,10 +10,6 @@ module Compass module Rails class Installer < Compass::Installers::ManifestInstaller - def default_configuration - Compass::Configuration::Data.new.extend(ConfigurationDefaults) - end - def completed_configuration config = {} config[:sass_dir] = prompt_sass_dir unless sass_dir_without_default diff --git a/lib/compass/app_integration/stand_alone.rb b/lib/compass/app_integration/stand_alone.rb index c3a6c9fe..2a00d195 100644 --- a/lib/compass/app_integration/stand_alone.rb +++ b/lib/compass/app_integration/stand_alone.rb @@ -13,7 +13,7 @@ module Compass end def configuration - Compass::Configuration::Data.new. + Compass::Configuration::Data.new('stand_alone'). extend(ConfigurationDefaults) end diff --git a/lib/compass/app_integration/stand_alone/installer.rb b/lib/compass/app_integration/stand_alone/installer.rb index d13d6162..84dc19dc 100644 --- a/lib/compass/app_integration/stand_alone/installer.rb +++ b/lib/compass/app_integration/stand_alone/installer.rb @@ -35,10 +35,6 @@ module Compass write_configuration_files unless config_files_exist? || !@manifest.generate_config? end - def default_configuration - Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults) - end - def completed_configuration nil end diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index 06c2bc58..2bd16d9a 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -66,7 +66,7 @@ Options: def initialize(working_path, options) super assert_project_directory_exists! - Compass.add_configuration(options) + Compass.add_configuration(options, 'command_line') end def perform diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 62dc87d2..138296f8 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -8,8 +8,8 @@ module Compass def configure! Compass.add_configuration(options[:project_type] || :stand_alone) Compass.add_project_configuration unless respond_to?(:is_project_creation?) && is_project_creation? - Compass.add_configuration(options) - Compass.add_configuration(installer.completed_configuration) + Compass.add_configuration(options, 'command_line') + Compass.add_configuration(installer.completed_configuration, 'installer') if File.exists?(Compass.configuration.extensions_path) Compass::Frameworks.discover(Compass.configuration.extensions_path) end diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index c4e847dd..acf60301 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -41,6 +41,14 @@ module Compass def perform if options[:debug] + puts "Configuration sources:" + c = Compass.configuration + while c + print c.name + c = c.inherited_data + print ", " if c + end + print "\n" Compass.configuration.debug.each do |prop, values| if options[:debug].is_a?(Symbol) next unless prop == options[:debug] diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb index 755ccfd1..42936045 100644 --- a/lib/compass/configuration/data.rb +++ b/lib/compass/configuration/data.rb @@ -18,6 +18,7 @@ module Compass class Data attr_accessor :required_libraries + attr_reader :name include Compass::Configuration::Inheritance include Compass::Configuration::Serialization @@ -25,7 +26,9 @@ module Compass inherited_accessor *ATTRIBUTES - def initialize(attr_hash = nil) + def initialize(name, attr_hash = nil) + raise "I need a name!" unless name + @name = name self.required_libraries = [] set_all(attr_hash) if attr_hash self.top_level = self @@ -100,4 +103,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index ec454d80..b2e0e396 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -11,14 +11,17 @@ module Compass end def default_configuration - Data.new.extend(Defaults).extend(Comments) + Data.new('defaults').extend(Defaults).extend(Comments) end def add_configuration(config, filename = nil) return if config.nil? + data = configuration_for(config, filename) + # puts "New configuration: #{data.name}" + # puts caller.join("\n") data.inherit_from!(configuration) data.on_top! @configuration = data @@ -30,7 +33,7 @@ module Compass elsif config.respond_to?(:read) Compass::Configuration::Data.new_from_string(config.read, filename) elsif config.is_a?(Hash) - Compass::Configuration::Data.new(config) + Compass::Configuration::Data.new(filename, config) elsif config.is_a?(String) Compass::Configuration::Data.new_from_file(config) elsif config.is_a?(Symbol) @@ -67,7 +70,7 @@ module Compass configuration_file_path ||= detect_configuration_file if configuration_file_path - data = configuration_for(configuration_file_path) + data = configuration_for(configuration_file_path) if data.raw_project_type add_configuration(data.raw_project_type.to_sym) diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index 4d8af6c0..829e3bb6 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -9,13 +9,13 @@ module Compass module ClassMethods def new_from_file(config_file) - data = Data.new + data = Data.new(config_file) data.parse(config_file) data end def new_from_string(contents, filename) - data = Data.new + data = Data.new(filename) data.parse_string(contents, filename) data end diff --git a/lib/compass/installers/bare_installer.rb b/lib/compass/installers/bare_installer.rb index 049f7206..96b017d3 100644 --- a/lib/compass/installers/bare_installer.rb +++ b/lib/compass/installers/bare_installer.rb @@ -2,10 +2,6 @@ module Compass module Installers class BareInstaller < Base - def default_configuration - Compass::Configuration::Data.new.extend(Compass::AppIntegration::StandAlone::ConfigurationDefaults) - end - def completed_configuration nil end From 00958c1b24c0bf975777849ac62c533db7ce2cd7 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 17 Nov 2009 13:47:29 -0800 Subject: [PATCH 110/118] Don't leave directories around after testing. --- features/command_line.feature | 1 + features/step_definitions/command_line_steps.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/features/command_line.feature b/features/command_line.feature index f6e6ae9e..03424ddd 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -199,6 +199,7 @@ Feature: Command Line And a png file assets/wide_grid.png is not created Scenario: Generate a compass configuration file + Given I should clean up the directory: config When I run: compass config config/compass.rb --sass-dir sass --css-dir assets/css Then a configuration file config/compass.rb is created And the following configuration properties are set in config/compass.rb: diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 4f8e8854..c0c19f00 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -44,6 +44,10 @@ Given /^I'm in a newly created rails project: (.+)$/ do |project_name| end end +Given /^I should clean up the directory: (\w+)$/ do |directory| + @cleanup_directories << directory +end + # When Actions are performed When /^I create a project using: compass create ([^\s]+) ?(.+)?$/ do |dir, args| @cleanup_directories << dir From 0da214a987294b0cf4686ae1f4fea7c071cdad48 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 18 Nov 2009 23:43:33 -0800 Subject: [PATCH 111/118] Fix some issues regarding how the project type configuration gets applied. --- .../app_integration/rails/configuration_defaults.rb | 4 ++++ .../stand_alone/configuration_defaults.rb | 6 +++++- lib/compass/commands/installer_command.rb | 9 ++++++--- lib/compass/commands/project_base.rb | 4 ++-- lib/compass/configuration/helpers.rb | 10 +++++++--- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb index be44f13d..21fade64 100644 --- a/lib/compass/app_integration/rails/configuration_defaults.rb +++ b/lib/compass/app_integration/rails/configuration_defaults.rb @@ -3,6 +3,10 @@ module Compass module Rails module ConfigurationDefaults + def default_project_type + :rails + end + def default_images_dir File.join("public", "images") end diff --git a/lib/compass/app_integration/stand_alone/configuration_defaults.rb b/lib/compass/app_integration/stand_alone/configuration_defaults.rb index a9ed92dc..5eb364fa 100644 --- a/lib/compass/app_integration/stand_alone/configuration_defaults.rb +++ b/lib/compass/app_integration/stand_alone/configuration_defaults.rb @@ -2,6 +2,10 @@ module Compass module AppIntegration module StandAlone module ConfigurationDefaults + def default_project_type + :stand_alone + end + def sass_dir_without_default "src" end @@ -21,4 +25,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 138296f8..b7245ec2 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -6,13 +6,16 @@ module Compass include Compass::Installers def configure! - Compass.add_configuration(options[:project_type] || :stand_alone) - Compass.add_project_configuration unless respond_to?(:is_project_creation?) && is_project_creation? + if respond_to?(:is_project_creation?) && is_project_creation? + Compass.add_configuration(options.delete(:project_type) || :stand_alone) + else + Compass.add_project_configuration(:project_type => options.delete(:project_type)) + end Compass.add_configuration(options, 'command_line') - Compass.add_configuration(installer.completed_configuration, 'installer') if File.exists?(Compass.configuration.extensions_path) Compass::Frameworks.discover(Compass.configuration.extensions_path) end + Compass.add_configuration(installer.completed_configuration, 'installer') end def app diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 3567682e..5d5c3312 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -11,7 +11,7 @@ module Compass def initialize(working_path, options = {}) super(working_path, options) self.project_name = determine_project_name(working_path, options) - Compass.configuration.project_path = determine_project_directory(working_path, options) + Compass.add_configuration({:project_path => determine_project_directory(working_path, options)}, "implied") configure! end @@ -89,4 +89,4 @@ module Compass end end -end \ No newline at end of file +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index b2e0e396..d1d983bb 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -66,21 +66,25 @@ module Compass end # Read the configuration file for this project - def add_project_configuration(configuration_file_path = nil) - configuration_file_path ||= detect_configuration_file + def add_project_configuration(*args) + options = args.last.is_a?(Hash) ? args.pop : {} + configuration_file_path = args.shift || detect_configuration_file + raise ArgumentError, "Too many arguments" if args.any? if configuration_file_path data = configuration_for(configuration_file_path) if data.raw_project_type add_configuration(data.raw_project_type.to_sym) + elsif options[:project_type] + add_configuration(options[:project_type]) else add_configuration(:stand_alone) end add_configuration(data) else - add_configuration(configuration.project_type || :stand_alone) + add_configuration(options[:project_type] || configuration.project_type || :stand_alone) end end From 51315469d891f2a69f3c4c4a7b96815b851b59dc Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 18 Nov 2009 23:44:30 -0800 Subject: [PATCH 112/118] [Rails] Allow compass extensions to be stored in the vendor/plugins/compass/extensions directory. --- features/extensions.feature | 20 +++++++++++++++++++ features/step_definitions/extension_steps.rb | 13 ++++++++++++ .../rails/configuration_defaults.rb | 4 ++++ 3 files changed, 37 insertions(+) create mode 100644 features/extensions.feature create mode 100644 features/step_definitions/extension_steps.rb diff --git a/features/extensions.feature b/features/extensions.feature new file mode 100644 index 00000000..34c8c1e8 --- /dev/null +++ b/features/extensions.feature @@ -0,0 +1,20 @@ +Feature: Extensions + In order to have an open source ecosystem for stylesheets + As a compass user + I can install extensions that others have created + And I can create and publish my own extensions + + Scenario: Extensions directory for stand_alone projects + Given I am using the existing project in test/fixtures/stylesheets/compass + And the "extensions" directory exists + And and I have a fake extension at extensions/testing + When I run: compass --list-frameworks + Then the list of frameworks includes "testing" + + Scenario: Extensions directory for rails projects + Given I'm in a newly created rails project: my_rails_project + And the "my_rails_project/vendor/plugins/compass/extensions" directory exists + And and I have a fake extension at my_rails_project/vendor/plugins/compass/extensions/testing + When I run: compass --list-frameworks + Then the list of frameworks includes "testing" + diff --git a/features/step_definitions/extension_steps.rb b/features/step_definitions/extension_steps.rb new file mode 100644 index 00000000..f6216c1e --- /dev/null +++ b/features/step_definitions/extension_steps.rb @@ -0,0 +1,13 @@ +Given /^the "([^\"]*)" directory exists$/ do |directory| + FileUtils.mkdir_p directory +end + +Given /^and I have a fake extension at (.*)$/ do |directory| + FileUtils.mkdir_p File.join(directory, 'stylesheets') + FileUtils.mkdir_p File.join(directory, 'templates/project') +end + +Then /^the list of frameworks includes "([^\"]*)"$/ do |framework| + @last_result.split("\n").map{|f| f.strip}.should include(framework) +end + diff --git a/lib/compass/app_integration/rails/configuration_defaults.rb b/lib/compass/app_integration/rails/configuration_defaults.rb index 21fade64..93fe449a 100644 --- a/lib/compass/app_integration/rails/configuration_defaults.rb +++ b/lib/compass/app_integration/rails/configuration_defaults.rb @@ -27,6 +27,10 @@ module Compass "/stylesheets" end + def default_extensions_dir + "vendor/plugins/compass/extensions" + end + end end end From 651bcc997721862ed5f7929737dd55f17a6dfc65 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 19 Nov 2009 00:41:15 -0800 Subject: [PATCH 113/118] Allow vendored frameworks to override built-in frameworks to enable testing and development. --- lib/compass/frameworks.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index d11ff8fb..d856bcfe 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -28,7 +28,11 @@ module Compass end def register(name, *arguments) - ALL << Framework.new(name, *arguments) + if idx = ALL.index{|f| f.name.to_s == name.to_s} + ALL[idx] = Framework.new(name, *arguments) + else + ALL << Framework.new(name, *arguments) + end end def [](name) From 0c2a8a4e21cfcce5d48b7c30e3d0eccb4ddcd6d5 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 19 Nov 2009 01:03:57 -0800 Subject: [PATCH 114/118] If a template provides a haml file, it can have compass-enabled sass filters within it. --- .../blueprint/templates/project/welcome.html.haml | 7 ++++++- lib/compass/installers/base.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml b/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml index 460eac03..032fb3f3 100644 --- a/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml +++ b/lib/compass/frameworks/blueprint/templates/project/welcome.html.haml @@ -7,7 +7,12 @@ %link(href="<%= http_stylesheets_path %>/print.css" media="print" rel="stylesheet" type="text/css") /[if lt IE 8] %link(href="<%= http_stylesheets_path %>/ie.css" media="screen, projection" rel="stylesheet" type="text/css") + %style(type="text/css") + :sass + @import blueprint.sass + .foo + +column(8) %body#welcome.bp #container %h1 Welcome to Compass! - %p This is <%= "ERB" %> \ No newline at end of file + %p This is <%= "ERB" %> diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index 9fd27f2c..e27dc2d0 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -112,6 +112,7 @@ module Compass ctx = TemplateContext.ctx(:to => to, :options => options) contents = process_erb(contents, ctx) end + Compass.configure_sass_plugin! html = Haml::Engine.new(contents, :filename => templatize(from)).render write_file(targetize(to), html, options) else From 63ddf8f09d045bdf6d4f24f243082024e49c9a4e Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 19 Nov 2009 01:30:41 -0800 Subject: [PATCH 115/118] Update the TODO. --- TODO.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/TODO.md b/TODO.md index b78a68ca..14c37fdc 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,4 @@ MUST: -* vendored plugins should override default plugins. -* rails support for vendored extensions * A proper welcome page for blueprint projects (or delete it) NICE: From 9e93da16cc51c107f614965b6bdf7075e9bbf889 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 19 Nov 2009 01:38:34 -0800 Subject: [PATCH 116/118] Version bump to 0.9.4 --- VERSION.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.yml b/VERSION.yml index c9cc4359..736489ad 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- :major: 0 :minor: 9 -:patch: 3 +:patch: 4 :build: From bad615ef09ffe4cdb18aece31b82d57b0f2e2130 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 19 Nov 2009 02:19:38 -0800 Subject: [PATCH 117/118] Fix a bug in FSSM for ruby 1.9. Closes GH-48. --- lib/vendor/fssm/state.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vendor/fssm/state.rb b/lib/vendor/fssm/state.rb index fe514c3f..9850bfa5 100644 --- a/lib/vendor/fssm/state.rb +++ b/lib/vendor/fssm/state.rb @@ -37,7 +37,7 @@ class FSSM::State end def add_glob(snap, glob) - Pathname.glob(@path.to_pathname.join(glob)).each do |fn| + Pathname.glob(@path.to_pathname.join(glob).to_s).each do |fn| next unless fn.file? snap["#{fn}"] = fn.mtime end From bdd1e2de330e554557cf440f98c436d2d3ac3401 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 19 Nov 2009 02:26:35 -0800 Subject: [PATCH 118/118] Make the tests pass in ruby 1.9 --- Rakefile | 1 + test/command_line_test.rb | 4 ++-- test/compass_test.rb | 4 ++-- test/configuration_test.rb | 4 ++-- test/rails_integration_test.rb | 2 +- test/sass_extensions_test.rb | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Rakefile b/Rakefile index f18b1f3b..29b64f49 100644 --- a/Rakefile +++ b/Rakefile @@ -25,6 +25,7 @@ require 'fileutils' Rake::TestTask.new :run_tests do |t| t.libs << 'lib' + t.libs << 'test' t.libs << 'haml/lib' if ENV["RUN_CODE_RUN"] test_files = FileList['test/**/*_test.rb'] test_files.exclude('test/rails/*', 'test/haml/*') diff --git a/test/command_line_test.rb b/test/command_line_test.rb index b23ad2b0..d99f7378 100644 --- a/test/command_line_test.rb +++ b/test/command_line_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' require 'fileutils' require 'compass' require 'compass/exec' @@ -64,4 +64,4 @@ class CommandLineTest < Test::Unit::TestCase end end -end \ No newline at end of file +end diff --git a/test/compass_test.rb b/test/compass_test.rb index 1ed50411..eb155b15 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' require 'fileutils' require 'compass' @@ -129,4 +129,4 @@ private File.join(project_path(project_name), "saved") end -end \ No newline at end of file +end diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 1ba96327..08c872fa 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' require 'compass' require 'stringio' @@ -120,4 +120,4 @@ EXPECTED assert_equal expected_serialization, Compass.configuration.serialize end -end \ No newline at end of file +end diff --git a/test/rails_integration_test.rb b/test/rails_integration_test.rb index d9273504..a46fd2f1 100644 --- a/test/rails_integration_test.rb +++ b/test/rails_integration_test.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__),'test_helper') +require 'test_helper' require 'fileutils' require 'compass' require 'compass/exec' diff --git a/test/sass_extensions_test.rb b/test/sass_extensions_test.rb index 98136c9a..797e235c 100644 --- a/test/sass_extensions_test.rb +++ b/test/sass_extensions_test.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__)+'/test_helper' +require 'test_helper' class SassExtensionsTest < Test::Unit::TestCase def test_simple @@ -28,4 +28,4 @@ protected options = arguments.last.is_a?(Hash) ? arguments.pop : Hash.new evaluation_content(options).nest(*arguments.map{|a| Sass::Script::String.new(a)}).to_s end -end \ No newline at end of file +end