lib/cocoapods-core/standard_error.rb
# The message of the exception reports the content of podspec for the
# line that generated the original exception.
#
# @example Output
#
#   Invalid podspec at `RestKit.podspec` - undefined method
#   `exclude_header_search_paths=' for #<Pod::Specification for
#   `RestKit/Network (0.9.3)`>
#
#       from spec-repos/master/RestKit/0.9.3/RestKit.podspec:36
#       -------------------------------------------
#           # because it would break: #import <CoreData/CoreData.h>
#    >      ns.exclude_header_search_paths = 'Code/RestKit.h'
#         end
#       -------------------------------------------
#
# @return [String] the message of the exception.
#
The message of the exception reports the content of podspec for the
line that generated the original exception.
The message of the exception reports the content of podspec for the line that generated the original exception .
def message
      @message ||= begin
        trace_line, description = parse_line_number_from_description
        m = "\n[!] #{description}.\n"
        m = m.red if m.respond_to?(:red)
        backtrace = underlying_exception.backtrace
        return m unless backtrace && dsl_path && contents
        trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) } || trace_line
        return m unless trace_line
        line_numer = trace_line.split(':')[1].to_i - 1
        return m unless line_numer
        lines      = contents.lines
        indent     = ' #  '
        indicator  = indent.tr('#', '>')
        first_line = (line_numer.zero?)
        last_line  = (line_numer == (lines.count - 1))
        m << "\n"
        m << "#{indent}from #{trace_line.gsub(/:in.*$/, '')}\n"
        m << "#{indent}-------------------------------------------\n"
        m << "#{indent}#{lines[line_numer - 1]}" unless first_line
        m << "#{indicator}#{lines[line_numer]}"
        m << "#{indent}#{lines[line_numer + 1]}" unless last_line
        m << "\n" unless m.end_with?("\n")
        m << "#{indent}-------------------------------------------\n"
      end
    end
def message @message ||= begin trace_line , description = parse_line_number_from_description m = "\n[!] #{description}.\n" m = m . red if m . respond_to? ( :red ) backtrace = underlying_exception . backtrace return m unless backtrace && dsl_path && contents trace_line = backtrace . find { | l | l . include? ( dsl_path . to_s ) } || trace_line return m unless trace_line line_numer = trace_line . split ( ':' ) [ 1 ] . to_i - 1 return m unless line_numer lines = contents . lines indent = ' #  ' indicator = indent . tr ( '#' , '>' ) first_line = ( line_numer . zero? ) last_line = ( line_numer == ( lines . count - 1 ) ) m << "\n" m << "#{indent}from #{trace_line.gsub(/:in.*$/, '')}\n" m << "#{indent}-------------------------------------------\n" m << "#{indent}#{lines[line_numer - 1]}" unless first_line m << "#{indicator}#{lines[line_numer]}" m << "#{indent}#{lines[line_numer + 1]}" unless last_line m << "\n" unless m . end_with? ( "\n" ) m << "#{indent}-------------------------------------------\n" end end
The message of the exception reports the content of podspec for the
line that generated the original exception.
The message of the exception reports the content of podspec for the line that generated the original exception .
the message of the exception.
the message of the exception .
String
example
Output Invalid podspec at `RestKit.podspec` - undefined method `exclude_header_search_paths=' for # from spec-repos/master/RestKit/0.9.3/RestKit.podspec:36 # because it would break: #import  > ns.exclude_header_search_paths = 'Code/RestKit.h' end
Output Invalid podspec at ` RestKit . podspec ` - undefined method ` exclude_header_search_paths = ' for # from spec - repos / master / RestKit / 0 . 9 . 3 / RestKit . podspec : 36 # because it would break : #import > ns . exclude_header_search_paths = ' Code / RestKit . h ' end