Class: Pod::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/source.rb

Defined Under Namespace

Classes: Aggregate

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Source) initialize(repo)

A new instance of Source



53
54
55
# File 'lib/cocoapods/source.rb', line 53

def initialize(repo)
  @repo = repo
end

Instance Attribute Details

- (Object) repo (readonly)

Returns the value of attribute repo



51
52
53
# File 'lib/cocoapods/source.rb', line 51

def repo
  @repo
end

Class Method Details

+ (Object) all



35
36
37
# File 'lib/cocoapods/source.rb', line 35

def self.all
  Aggregate.new.all
end

+ (Object) all_sets



39
40
41
# File 'lib/cocoapods/source.rb', line 39

def self.all_sets
  Aggregate.new.all_sets
end

+ (Object) search(dependency)



43
44
45
# File 'lib/cocoapods/source.rb', line 43

def self.search(dependency)
  Aggregate.new.search(dependency)
end

+ (Object) search_by_name(name, full_text_search)



47
48
49
# File 'lib/cocoapods/source.rb', line 47

def self.search_by_name(name, full_text_search)
  Aggregate.new.search_by_name(name, full_text_search)
end

Instance Method Details

- (Object) pod_sets



57
58
59
60
61
62
63
# File 'lib/cocoapods/source.rb', line 57

def pod_sets
  @repo.children.map do |child|
    if child.directory? && child.basename.to_s != '.git'
      Specification::Set.new(child)
    end
  end.compact
end

- (Object) search(dependency)



65
66
67
68
69
70
71
72
73
# File 'lib/cocoapods/source.rb', line 65

def search(dependency)
  pod_sets.find do |set|
    # First match the (top level) name, which does not yet load the spec from disk
    set.name == dependency.top_level_spec_name &&
      # Now either check if it's a dependency on the top level spec, or if it's not
      # check if the requested subspec exists in the top level spec.
      set.specification.subspec_by_name(dependency.name)
  end
end

- (Object) search_by_name(query, full_text_search)



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/cocoapods/source.rb', line 75

def search_by_name(query, full_text_search)
  pod_sets.map do |set|
    text = if full_text_search
      s = set.specification
      "#{s.name} #{s.authors} #{s.summary} #{s.description}"
    else
      set.name
    end
    set if text.downcase.include?(query.downcase)
  end.compact
end