[Command Line] Make it easier to load non-gem frameworks from the
command line and project configuration files.
This commit is contained in:
parent
a5e39eb709
commit
dd0f3a816b
@ -25,7 +25,7 @@ module Compass
|
||||
extend Compass::Configuration::Paths
|
||||
|
||||
inherited_accessor *ATTRIBUTES
|
||||
inherited_accessor :required_libraries #XXX we should make this array add up cumulatively.
|
||||
inherited_accessor :required_libraries, :loaded_frameworks, :framework_path #XXX we should make these arrays add up cumulatively.
|
||||
|
||||
strip_trailing_separator *ATTRIBUTES.select{|a| a.to_s =~ /dir|path/}
|
||||
|
||||
@ -95,6 +95,16 @@ module Compass
|
||||
super
|
||||
end
|
||||
|
||||
def load(framework_dir)
|
||||
(self.loaded_frameworks ||= []) << framework_dir
|
||||
Compass::Frameworks.register_directory framework_dir
|
||||
end
|
||||
|
||||
def discover(frameworks_dir)
|
||||
(self.framework_path ||= []) << frameworks_dir
|
||||
Compass::Frameworks.discover frameworks_dir
|
||||
end
|
||||
|
||||
def relative_assets?
|
||||
# the http_images_path is deprecated, but here for backwards compatibility.
|
||||
relative_assets || http_images_path == :relative
|
||||
|
@ -56,6 +56,12 @@ module Compass
|
||||
(required_libraries || []).each do |lib|
|
||||
contents << %Q{require '#{lib}'\n}
|
||||
end
|
||||
(loaded_frameworks || []).each do |lib|
|
||||
contents << %Q{load '#{lib}'\n}
|
||||
end
|
||||
(framework_path || []).each do |lib|
|
||||
contents << %Q{discover '#{lib}'\n}
|
||||
end
|
||||
contents << "# Require any additional compass plugins here.\n"
|
||||
contents << "\n" if (required_libraries || []).any?
|
||||
ATTRIBUTES.each do |prop|
|
||||
|
@ -7,10 +7,25 @@ module Compass::Exec::GlobalOptionsParser
|
||||
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|
|
||||
" project configuration file."
|
||||
) do |library|
|
||||
::Compass.configuration.require library
|
||||
end
|
||||
|
||||
opts.on('-l FRAMEWORK_DIR', '--load FRAMEWORK_DIR',
|
||||
"Load the framework or extensions found in the FRAMEWORK directory."
|
||||
) do |framework_dir|
|
||||
require 'pathname'
|
||||
::Compass.configuration.load Pathname.new(framework_dir).realpath
|
||||
end
|
||||
|
||||
opts.on('-L FRAMEWORKS_DIR', '--load-all FRAMEWORKS_DIR',
|
||||
"Load all the frameworks or extensions found in the FRAMEWORKS_DIR directory."
|
||||
) do |frameworks_dir|
|
||||
require 'pathname'
|
||||
::Compass.configuration.discover Pathname.new(frameworks_dir).realpath
|
||||
end
|
||||
|
||||
opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do
|
||||
self.options[:quiet] = true
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user