Class: Dependabot::FileParsers::Git::Submodules

Inherits:
Base
  • Object
show all
Defined in:
lib/dependabot/file_parsers/git/submodules.rb

Instance Attribute Summary

Attributes inherited from Base

#credentials, #dependency_files, #source

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dependabot::FileParsers::Base

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dependabot/file_parsers/git/submodules.rb', line 12

def parse
  SharedHelpers.in_a_temporary_directory do
    File.write(".gitmodules", gitmodules_file.content)

    ParseConfig.new(".gitmodules").params.map do |_, params|
      branch = params["branch"]

      Dependency.new(
        name: params["path"],
        version: submodule_sha(params["path"]),
        package_manager: "submodules",
        requirements: [{
          requirement: nil,
          file: ".gitmodules",
          source: {
            type: "git",
            url: absolute_url(params["url"]),
            branch: branch,
            ref: branch
          },
          groups: []
        }]
      )
    end
  end
end