10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rubyc/colorize_stack.rb', line 10
def colorize_line(line)
red = "\e[31m"
clear = "\e[0m"
green = "\e[32m"
blue = "\e[34m"
magenta = "\e[35m"
clear = "\e[0m"
url_regex = /(.*?)([.\w\/]*.rb):(\d+)(.*)/
if line =~ url_regex
prefix, file_name, line_number, suffix = $1, $2, $3, $4
if File.exist? file_name
full_path = File.expand_path(file_name)
app_trace = full_path.match(Dir.pwd) && full_path !~ /vendor/
new_line = "#{prefix}#{blue}txmt://open?url=file://#{File.dirname(full_path)}/#{clear}#{red if app_trace }#{File.basename(full_path)}#{clear if app_trace}&line=#{line_number}#{suffix}\n"
else
new_line = line
end
else
new_line = line
end
end
|