lib/compass-sass.rb in capucine-0.0.8 vs lib/compass-sass.rb in capucine-0.0.9
- old
+ new
@@ -2,77 +2,76 @@
class CompassSass
def self.update_plugins gems
return if not gems
gems.each do |plugin|
- begin
+ begin
require "#{plugin}"
rescue LoadError
system("gem install #{plugin} --no-ri --no-rdoc")
end
end
end
-
def self.update_config
settings = Capucine.settings
template_file = File.join settings.gem_content_dir, 'templates', 'compass_config.erb'
output_file = File.join settings.working_dir, '.compass.rb'
-
+
settings.config['compass_plugins_list'] = []
plugins_gems = []
plugins = settings.config['compass_plugins']
if plugins.size > 0
plugins.each do |key, value|
settings.config['compass_plugins_list'].push key
-
+
if value and value.length > 0
plugins_gems.push value
else
plugins_gems.push key
end
-
+
end
end
config_ = settings.config
result = Capucine::Tools.render_template template_file, config_
-
+
f = File.open(output_file, 'w')
f.write(result)
f.close
-
+
self.update_plugins plugins_gems
end
-
+
# def self.load_my_functions
# rb_files = Dir.glob "#{Capucine.settings.working_dir}/#{Capucine.settings.config['compass_compass_files_dir']}/**/**.rb"
- #
+ #
# rb_files.each do |file|
# require "#{file}"
# end
- #
+ #
# end
def self.import_css
s = Capucine.settings
import_dir = File.join s.working_dir, s.config['sass_import_css_dir']
output_dir= File.join s.working_dir, s.config['sass_import_output_dir']
Dir.mkdir(import_dir) if not File.directory?(import_dir)
Dir.mkdir(output_dir) if not File.directory?(output_dir)
-
+
formats = s.config['sass_import_formats'].split
from_format = formats[0]
to_format = formats[2]
-
+
command = "sass-convert -R --from #{from_format} --to #{to_format} #{import_dir} #{output_dir}"
system(command)
Capucine::Tools.archive_file import_dir
-
+
end
def self.run_once
self.update_config
# self.load_my_functions
@@ -105,7 +104,7 @@
require 'compass/exec'
Compass::Exec::SubCommandUI.new(compass_args).run!
end
end
-
+
end