Class: Pod::Sandbox::PodspecFinder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ PodspecFinder

Returns a new instance of PodspecFinder.



6
7
8
# File 'lib/cocoapods/sandbox/podspec_finder.rb', line 6

def initialize(root)
  @root = root
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



4
5
6
# File 'lib/cocoapods/sandbox/podspec_finder.rb', line 4

def root
  @root
end

Instance Method Details

#podspecsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cocoapods/sandbox/podspec_finder.rb', line 10

def podspecs
  return @specs_by_name if @specs_by_name
  @specs_by_name = {}
  spec_files = Pathname.glob(root + '{,*,*/*}.podspec{,.json}')
  spec_files.sort_by { |p| -p.to_path.split(File::SEPARATOR).size }.each do |file|
    begin
      spec = Specification.from_file(file)
      spec.validate_cocoapods_version
      @specs_by_name[spec.name] = spec
    rescue => e
      UI.warn "Unable to load a podspec from `#{file.basename}`, skipping:\n\n#{e}"
    end
  end
  @specs_by_name
end