Class: Pod::CacheProxySource

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-cache-proxy/native/cache_proxy_source.rb,
lib/cocoapods-cache-proxy/helper/cache_proxy_source_helper.rb

Defined Under Namespace

Classes: CacheProxySourceHelper

Instance Method Summary collapse

Constructor Details

#initialize(name, baseURL, user, password) ⇒ CacheProxySource

Returns a new instance of CacheProxySource.

Parameters:



13
14
15
16
17
18
# File 'lib/cocoapods-cache-proxy/native/cache_proxy_source.rb', line 13

def initialize(name, baseURL, user, password)
    @name = name
    @baseURL = baseURL
    @user = user
    @password = password
end

Instance Method Details

#baseURLObject



26
27
28
# File 'lib/cocoapods-cache-proxy/native/cache_proxy_source.rb', line 26

def baseURL
    @baseURL
end

#build_proxy_source(pod, git, tag, submodules = false) ⇒ String

Returns full download url.

Parameters:

  • pod name

  • repo address

  • repo tag

  • (defaults to: false)

    need update submodules

Returns:

  • full download url



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cocoapods-cache-proxy/native/cache_proxy_source.rb', line 43

def build_proxy_source(pod, git, tag, submodules = false)
    auth_cnf = CPSH.get_cache_proxy_auth_conf_host(git)
    if auth_cnf.nil?
        uri = URI.parse("#{@baseURL}/#{pod}?git=#{git}&tag=#{tag}&submodules=#{submodules}&cache_proxy=1")
        uri.user = @user
        uri.password = @password
        uri.to_s
    else
        uri = URI.parse(git)
        uri.user = "oauth2"
        uri.password = auth_cnf.token
        url = uri.to_s
        uri = URI.parse("#{@baseURL}/#{pod}?git=#{url}&tag=#{tag}&submodules=#{submodules}&cache_proxy=1")
        uri.user = @user
        uri.password = @password
        uri.to_s
    end
end

#nameString

Returns:



22
23
24
# File 'lib/cocoapods-cache-proxy/native/cache_proxy_source.rb', line 22

def name
    @name
end

#passwordObject



34
35
36
# File 'lib/cocoapods-cache-proxy/native/cache_proxy_source.rb', line 34

def password
    @password
end

#userObject



30
31
32
# File 'lib/cocoapods-cache-proxy/native/cache_proxy_source.rb', line 30

def user
    @user
end