class Haml::Exec::HamlSass
:nodoc:
specific to Haml and Sass.
A class encapsulating the executable functionality
def initialize(args)
specific to Haml and Sass.
A class encapsulating the executable functionality
def initialize(args) super @options[:for_engine] = {} end
def process_result
def process_result super require File.dirname(__FILE__) + "/../#{@name.downcase}" end
def set_opts(opts)
def set_opts(opts) opts.banner = <<END #{@name.downcase} [options] [INPUT] [OUTPUT] ption: the #{@name} engine to parse the specified template outputs the result to the specified file. s: opts.on('--rails RAILS_DIR', "Install Haml and Sass from the Gem to a Rails project") do |dir| original_dir = dir dir = File.join(dir, 'vendor', 'plugins') unless File.exists?(dir) puts "Directory #{dir} doesn't exist" exit end dir = File.join(dir, 'haml') if File.exists?(dir) print "Directory #{dir} already exists, overwrite [y/N]? " exit if gets !~ /y/i FileUtils.rm_rf(dir) end begin Dir.mkdir(dir) rescue SystemCallError puts "Cannot create #{dir}" exit end File.open(File.join(dir, 'init.rb'), 'w') do |file| file.puts "require 'rubygems'" file << File.read(File.dirname(__FILE__) + "/../../init.rb") end puts "Haml plugin added to #{original_dir}" exit end opts.on('-c', '--check', "Just check syntax, don't evaluate.") do require 'stringio' @options[:check_syntax] = true @options[:output] = StringIO.new end super end