Class: Pod::Extension::SourceDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-extension/development/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain, parent) ⇒ SourceDefinition

Returns a new instance of SourceDefinition.



11
12
13
14
15
16
17
18
19
# File 'lib/cocoapods-extension/development/definition.rb', line 11

def initialize(domain, parent)
    @domain = domain
    @parent = parent
    @children = []
    @map = Hash::new
    if parent.is_a?(Pod::Extension::SourceDefinition)
        parent.children << self
    end
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



8
9
10
# File 'lib/cocoapods-extension/development/definition.rb', line 8

def children
  @children
end

#domainObject (readonly)

Returns the value of attribute domain.



6
7
8
# File 'lib/cocoapods-extension/development/definition.rb', line 6

def domain
  @domain
end

#mapObject (readonly)

Returns the value of attribute map.



9
10
11
# File 'lib/cocoapods-extension/development/definition.rb', line 9

def map
  @map
end

#parentObject (readonly)

Returns the value of attribute parent.



7
8
9
# File 'lib/cocoapods-extension/development/definition.rb', line 7

def parent
  @parent
end

Instance Method Details

#source_listObject



21
22
23
24
25
26
27
# File 'lib/cocoapods-extension/development/definition.rb', line 21

def source_list
    list = Hash::new(@map)
    for source in children do
        list = list.merge(source.map)
    end
    list
end

#store_pod(name = nil, *requirements) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cocoapods-extension/development/definition.rb', line 29

def store_pod(name = nil, *requirements)
    options = requirements.last || Hash.new
    git = options[:git] || "#{name}.git"
    group = options[:group] || name

    if domain.start_with? "git@"
        store_pod_git(name, group, git)
    elsif domain.size > 0
        store_pod_http(name, group, git)
    end
end

#store_pod_git(name, group, git) ⇒ Object



41
42
43
44
# File 'lib/cocoapods-extension/development/definition.rb', line 41

def store_pod_git(name, group, git)
    source = "#{domain}:#{group}/#{git}"
    map[name] = source
end

#store_pod_http(name, group, git) ⇒ Object



46
47
48
49
50
51
# File 'lib/cocoapods-extension/development/definition.rb', line 46

def store_pod_http(name, group, git)
    source = Pathname(domain)
    source += group
    source += git
    map[name] = source.to_s
end