Class Sass::Exec::Base
In: lib/sass/exec/base.rb
Parent: Object

The abstract base class for Sass executables.

Methods

Constants

COLORS = {:red => 31, :green => 32, :yellow => 33}

Public Class methods

@param args [Array<String>] The command-line arguments

Public Instance methods

Parses the command-line arguments and runs the executable. This does not handle exceptions or exit the program.

@see parse!

Parses the command-line arguments and runs the executable. Calls `Kernel#exit` at the end, so it never returns.

@see parse

@return [String] A description of the executable

Protected Instance methods

Wraps the given string in terminal escapes causing it to have the given color. If terminal escapes aren‘t supported on this platform, just returns the string instead.

@param color [Symbol] The name of the color to use.

  Can be `:red`, `:green`, or `:yellow`.

@param str [String] The string to wrap in the given color. @return [String] The wrapped string.

Set an option for specifying `Encoding.default_external`.

@param opts [OptionParser]

Finds the line of the source template on which an exception was raised.

@param exception [Exception] The exception @return [String] The line number

Processes the options set by the command-line arguments. In particular, sets `@options[:input]` and `@options[:output]` to appropriate IO streams.

This is meant to be overridden by subclasses so they can run their respective programs.

Same as `Kernel.puts`, but doesn‘t print anything if the `—quiet` option is set.

@param args [Array] Passed on to `Kernel.puts`

Prints a status message about performing the given action, colored using the given color (via terminal escapes) if possible.

@param name [to_s] A short name for the action being performed.

  Shouldn't be longer than 11 characters.

@param color [Symbol] The name of the color to use for this action.

  Can be `:red`, `:green`, or `:yellow`.

Tells optparse how to parse the arguments available for all executables.

This is meant to be overridden by subclasses so they can add their own options.

@param opts [OptionParser]

[Validate]