Module: Pod::X::BuilderDSL

Included in:
PodsBuilder, SourcesBuilder
Defined in:
lib/cocoapods-x/extension/installer/dsl.rb

Instance Method Summary collapse

Instance Method Details

#build(url) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/cocoapods-x/extension/installer/dsl.rb', line 68

def build url
    contents = File.exist?(url) ? File.open(url, 'r:utf-8', &:read) : nil
    # Work around for Rubinius incomplete encoding in 1.9 mode
    if !contents.nil? && contents.respond_to?(:encoding) && contents.encoding.name != 'UTF-8'
        contents.encode!('UTF-8')
    end
    if !contents.nil? && contents.tr!('“”‘’‛', %(""'''))
        # Changes have been made
        CoreUI.warn "Smart quotes were detected and ignored in your #{File.basename(url)}. " \
                    'To avoid issues in the future, you should not use ' \
                    'TextEdit for editing it. If you are not using TextEdit, ' \
                    'you should turn off smart quotes in your editor of choice.'
    end
    unless contents.nil?
        begin
            eval(contents, nil, url.to_s)
        rescue Exception => e
            message = "Invalid `#{File.basename(url)}` file: #{e.message}"
            raise DSLError.new(message, url, e, contents)
        end
    end
end