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
      unless @message
        m = description.dup
        return m unless backtrace && dsl_path && File.exist?(dsl_path)
        trace_line = backtrace.find { |l| l =~ /#{dsl_path}/ }
        return m unless trace_line
        line_numer = trace_line.split(':')[1].to_i - 1
        return m unless line_numer
        lines      = File.readlines(dsl_path.to_s)
        indent     = " #  "
        indicator  = indent.dup.gsub("#", ">")
        first_line = ( line_numer.zero? )
        last_line  = ( line_numer == (lines.count - 1) )
        m << "\n #\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"
        m << " #"
        @message = m
      end
      @message
    end
def message unless @message m = description . dup return m unless backtrace && dsl_path && File . exist? ( dsl_path ) trace_line = backtrace . find { | l | l =~ / #{ dsl_path } / } return m unless trace_line line_numer = trace_line . split ( ':' ) [ 1 ] . to_i - 1 return m unless line_numer lines = File . readlines ( dsl_path . to_s ) indent = " #  " indicator = indent . dup . gsub ( "#" , ">" ) first_line = ( line_numer . zero? ) last_line = ( line_numer == ( lines . count - 1 ) ) m << "\n #\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" m << " #" @message = m end @message 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