Module: Compass::Exec::Helpers

Extended by:
Helpers
Included in:
Helpers
Defined in:
lib/compass/exec/helpers.rb

Instance Method Summary collapse

Instance Method Details

#get_file(exception) ⇒ Object



20
21
22
# File 'lib/compass/exec/helpers.rb', line 20

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

#get_line(exception) ⇒ Object



24
25
26
# File 'lib/compass/exec/helpers.rb', line 24

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

#report_error(e, options) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/compass/exec/helpers.rb', line 11

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

#select_appropriate_command_line_ui(arguments) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/compass/exec/helpers.rb', line 4

def select_appropriate_command_line_ui(arguments)
  if Compass::Commands.command_exists? arguments.first
    SubCommandUI
  else
    SwitchUI
  end
end