Class: Dependabot::Swift::FileParser

Inherits:
FileParsers::Base
  • Object
show all
Defined in:
lib/dependabot/swift/file_parser.rb,
lib/dependabot/swift/file_parser/manifest_parser.rb,
lib/dependabot/swift/file_parser/dependency_parser.rb

Defined Under Namespace

Classes: DependencyParser, ManifestParser

Instance Method Summary collapse

Instance Method Details

#ecosystemObject



42
43
44
45
46
47
48
49
50
# File 'lib/dependabot/swift/file_parser.rb', line 42

def ecosystem
  @ecosystem ||= T.let(begin
    Ecosystem.new(
      name: ECOSYSTEM,
      language: language,
      package_manager: package_manager
    )
  end, T.nilable(Dependabot::Ecosystem))
end

#parseObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dependabot/swift/file_parser.rb', line 17

def parse
  dependency_set = DependencySet.new

  dependency_parser.parse.map do |dep|
    if dep.top_level?
      source = dep.requirements.first[:source]

      requirements = ManifestParser.new(package_manifest_file, source: source).requirements

      dependency_set << Dependency.new(
        name: dep.name,
        version: dep.version,
        package_manager: dep.package_manager,
        requirements: requirements,
        metadata: dep.
      )
    else
      dependency_set << dep
    end
  end

  dependency_set.dependencies
end