class Pod::Specification
Public Class Methods
from_file(path, subspec_name = nil)
click to toggle source
# File lib/cocoapods-cn-dwd/command/dwd.rb, line 52 def from_file(path, subspec_name = nil) path = Pathname.new(path) unless path.exist? raise Informative, "No podspec exists at path `#{path}`." end string = File.open(path, 'r:utf-8', &:read) # Work around for Rubinius incomplete encoding in 1.9 mode if string.respond_to?(:encoding) && string.encoding.name != 'UTF-8' string.encode!('UTF-8') end if path.extname == '.json' then pod_object = JSON.parse(string) if (pod_object['source'] && pod_object['source']['git']) pod_object['source']['git'] = process_source_http_url(pod_object['source']['git'], pod_object['version']) string = pod_object.to_json end end return from_string(string, path, subspec_name) end
Also aliased as: old_from_file
process_source_http_url(url, version)
click to toggle source
# File lib/cocoapods-cn-dwd/command/dwd.rb, line 75 def process_source_http_url(url, version) if url != nil then if url.include? 'git@mirror' then path = url.split(':')[1] returnURL = "https://github.com/#{path}" puts("git地址转换:") puts(" url = #{url}") puts(" returnURL = #{returnURL}") return returnURL end if url.include?("git@gitlab.alibaba-inc.com") then returnURL = url.split('@')[1].gsub(":", "/") if !returnURL.include?('http:') then returnURL = 'http://' + returnURL; end return returnURL end end return url end