class Shiplane::ChefErrorParser
Constants
- CHEF_ERRORS
- ERROR_LINE_REGEXP
Attributes
error[RW]
Public Class Methods
new(error)
click to toggle source
# File lib/capistrano/chef_error_parser.rb, line 11 def initialize(error) @error = error end
parse(error)
click to toggle source
# File lib/capistrano/chef_error_parser.rb, line 31 def self.parse(error) new(error).parse end
Public Instance Methods
first_line()
click to toggle source
# File lib/capistrano/chef_error_parser.rb, line 19 def first_line @first_line ||= lines.index(lines.reverse_each.find{|line| line =~ ERROR_LINE_REGEXP }) || 0 end
last_line()
click to toggle source
# File lib/capistrano/chef_error_parser.rb, line 23 def last_line @last_line ||= lines.index{|line| CHEF_ERRORS.any?{ |error| line =~ error } } || -1 end
lines()
click to toggle source
# File lib/capistrano/chef_error_parser.rb, line 15 def lines @lines ||= error.message.split("\n") end
parse()
click to toggle source
# File lib/capistrano/chef_error_parser.rb, line 27 def parse lines[first_line..last_line] end