Use the Compass.configuration singleton for updates.
This commit is contained in:
parent
a7406659b6
commit
98a2f0538b
@ -7,12 +7,12 @@ require File.join(File.dirname(__FILE__), 'base')
|
|||||||
module Compass
|
module Compass
|
||||||
module Commands
|
module Commands
|
||||||
class ProjectBase < Base
|
class ProjectBase < Base
|
||||||
attr_accessor :project_directory, :project_name, :options, :project_src_subdirectory, :project_css_subdirectory
|
attr_accessor :project_directory, :project_name, :options
|
||||||
|
|
||||||
def initialize(working_directory, options = {})
|
def initialize(working_directory, options = {})
|
||||||
super(working_directory, options)
|
super(working_directory, options)
|
||||||
self.project_name = determine_project_name(working_directory, options)
|
self.project_name = determine_project_name(working_directory, options)
|
||||||
self.project_directory = determine_project_directory(working_directory, options)
|
Compass.configuration.project_path = determine_project_directory(working_directory, options)
|
||||||
assert_project_directory_exists!
|
assert_project_directory_exists!
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -37,13 +37,23 @@ module Compass
|
|||||||
def projectize(path)
|
def projectize(path)
|
||||||
File.join(project_directory, separate(path))
|
File.join(project_directory, separate(path))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def project_directory
|
||||||
|
Compass.configuration.project_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def project_css_subdirectory
|
||||||
|
Compass.configuration.css_dir
|
||||||
|
end
|
||||||
|
def project_src_subdirectory
|
||||||
|
Compass.configuration.sass_dir
|
||||||
|
end
|
||||||
# Read the configuration file for this project
|
# Read the configuration file for this project
|
||||||
def read_project_configuration
|
def read_project_configuration
|
||||||
config_file = projectize('src/config.rb')
|
if File.exists?(projectize('config.rb'))
|
||||||
if File.exists?(config_file)
|
Compass.configuration.parse(projectize('config.rb'))
|
||||||
contents = open(config_file) {|f| f.read}
|
elsif File.exists?(projectize('src/config.rb'))
|
||||||
eval(contents, nil, config_file)
|
Compass.configuration.parse(projectize('src/config.rb'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ module Compass
|
|||||||
|
|
||||||
# The subdirectory where the sass source is kept.
|
# The subdirectory where the sass source is kept.
|
||||||
def project_src_subdirectory
|
def project_src_subdirectory
|
||||||
@project_src_subdirectory ||= options[:src_dir] || "src"
|
Compass.configuration.sass_dir ||= options[:src_dir] || "src"
|
||||||
end
|
end
|
||||||
|
|
||||||
# The subdirectory where the css output is kept.
|
# The subdirectory where the css output is kept.
|
||||||
def project_css_subdirectory
|
def project_css_subdirectory
|
||||||
@project_css_subdirectory ||= options[:css_dir] || "stylesheets"
|
Compass.configuration.css_dir ||= options[:css_dir] || "stylesheets"
|
||||||
end
|
end
|
||||||
|
|
||||||
# The directory where the project source files are located.
|
# The directory where the project source files are located.
|
||||||
|
@ -13,6 +13,12 @@ module Compass
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset!
|
||||||
|
[:project_path, :css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |attr|
|
||||||
|
send("#{attr}=", nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def instance_binding
|
def instance_binding
|
||||||
binding
|
binding
|
||||||
end
|
end
|
||||||
|
@ -6,6 +6,11 @@ require 'timeout'
|
|||||||
|
|
||||||
class CommandLineTest < Test::Unit::TestCase
|
class CommandLineTest < Test::Unit::TestCase
|
||||||
include Compass::TestCaseHelper
|
include Compass::TestCaseHelper
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
Compass.configuration.reset!
|
||||||
|
end
|
||||||
|
|
||||||
def test_basic_install
|
def test_basic_install
|
||||||
within_tmp_directory do
|
within_tmp_directory do
|
||||||
compass "basic"
|
compass "basic"
|
||||||
|
Loading…
Reference in New Issue
Block a user