Add the ability to print out compass configuration values
This commit is contained in:
parent
81e2836f37
commit
03e01c4eb2
@ -7,6 +7,11 @@ layout: article
|
||||
COMPASS CHANGELOG
|
||||
=================
|
||||
|
||||
0.10.7 (UNRELEASED)
|
||||
-------------------
|
||||
* compass config -p <property> -- will now print out the configuration value
|
||||
for that property for the current project
|
||||
|
||||
0.10.6 (10/11/2010)
|
||||
-------------------
|
||||
|
||||
|
@ -247,6 +247,24 @@ Feature: Command Line
|
||||
| sass_dir | sass |
|
||||
| css_dir | assets/css |
|
||||
|
||||
@now
|
||||
Scenario Outline: Print out a configuration value
|
||||
Given I am using the existing project in test/fixtures/stylesheets/compass
|
||||
When I run: compass config -p <property>
|
||||
Then I should see the following output: <value>
|
||||
And the command exits <exit>
|
||||
|
||||
Examples:
|
||||
| property | value | exit |
|
||||
| extensions_dir | extensions | normally |
|
||||
| extensions_path | $PROJECT_PATH/extensions | normally |
|
||||
| css_dir | tmp | normally |
|
||||
| css_path | $PROJECT_PATH/tmp | normally |
|
||||
| sass_dir | sass | normally |
|
||||
| sass_path | $PROJECT_PATH/sass | normally |
|
||||
| foobar | ERROR: configuration property 'foobar' does not exist | with a non-zero error code |
|
||||
|
||||
@validator @ignore
|
||||
Scenario: Validate the generated CSS
|
||||
Given I am using the existing project in test/fixtures/stylesheets/compass
|
||||
When I run: compass validate
|
||||
|
@ -154,6 +154,9 @@ Then /^the command exits with a non\-zero error code$/ do
|
||||
@last_exit_code.should_not == 0
|
||||
end
|
||||
|
||||
Then /^the command exits normally$/ do
|
||||
@last_exit_code.should_not =~ 0
|
||||
end
|
||||
|
||||
Then /^I am congratulated$/ do
|
||||
@last_result.should =~ /Congratulations!/
|
||||
@ -234,3 +237,7 @@ end
|
||||
Then /^I should see the following lines of output:$/ do |table|
|
||||
table.diff!([['blueprint'],['compass']])
|
||||
end
|
||||
|
||||
Then /^I should see the following output: (.*)$/ do |output|
|
||||
(@last_result + @last_error).strip.should == output.gsub(/\$PROJECT_PATH/,Dir.pwd).strip
|
||||
end
|
||||
|
@ -20,6 +20,9 @@ module Compass
|
||||
opts.on("--debug [PROPERTY]", "Debug your configuration by printing out details.") do |prop|
|
||||
self.options[:debug] = prop.nil? ? true : prop.to_sym
|
||||
end
|
||||
opts.on("-p PROPERTY", "--property PROPERTY", "Print out the value of a particular configuration property") do |prop|
|
||||
self.options[:display] = prop.to_sym
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
@ -40,7 +43,13 @@ module Compass
|
||||
end
|
||||
|
||||
def perform
|
||||
if options[:debug]
|
||||
if options[:display]
|
||||
if Compass.configuration.respond_to?(options[:display])
|
||||
puts Compass.configuration.send(options[:display])
|
||||
else
|
||||
raise Compass::Error, "ERROR: configuration property '#{options[:display]}' does not exist"
|
||||
end
|
||||
elsif options[:debug]
|
||||
puts "Configuration sources:"
|
||||
c = Compass.configuration
|
||||
while c
|
||||
|
Loading…
Reference in New Issue
Block a user