Sha256: 90baa3b2804a70b73f02fa94a06ba0f8d23d638483f5c9e1c95a46f54627dad6

Contents?: true

Size: 1005 Bytes

Versions: 3

Compression:

Stored size: 1005 Bytes

Contents

module Compass::Exec
  module Helpers
    extend self
    def select_appropriate_command_line_ui(arguments)
      if Compass::Commands.command_exists? arguments.first
        SubCommandUI
      else
        unless arguments.include?("-h") || arguments.include?("--help")
          Compass::Logger.new.red do
            Haml::Util.haml_warn "WARNING: This interface is deprecated. Please use the new subcommand interface.\nSee `compass help` for more information.\n"
          end
        end
        SwitchUI
      end
    end
    def report_error(e, options)
      $stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}"
      if options[:trace]
        e.backtrace[1..-1].each { |t| $stderr.puts "  #{t}" }
      else
        $stderr.puts "Run with --trace to see the full backtrace"
      end
    end

    def get_file(exception)
      exception.backtrace[0].split(/:/, 2)[0]
    end

    def get_line(exception)
      exception.backtrace[0].scan(/:(\d+)/)[0]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
compass-0.11.alpha.0 lib/compass/exec/helpers.rb
compass-0.10.6 lib/compass/exec/helpers.rb
compass-0.10.6.pre.1 lib/compass/exec/helpers.rb