Class: Licensed::Sources::GitSubmodule
- Inherits:
-
Source
- Object
- Source
- Licensed::Sources::GitSubmodule
show all
- Defined in:
- lib/licensed/sources/git_submodule.rb
Constant Summary
collapse
- REMOTE_URL_ARGUMENT =
"$(git remote get-url origin)".freeze
- GIT_SUBMODULES_ARGUMENTS =
[
"$displaypath", "$toplevel", "$sha1", "$(git config --get remote.origin.url)", ].freeze
Instance Attribute Summary
Attributes inherited from Source
#config
Instance Method Summary
collapse
Methods inherited from Source
#dependencies, full_type, #ignored?, inherited, #initialize, register_source, require_matched_dependency_version, #source_config, type, type_and_version
Instance Method Details
#enumerate_dependencies ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/licensed/sources/git_submodule.rb', line 19
def enumerate_dependencies
git_submodules_command.lines.map do |line|
displaypath, toplevel, version, homepage = line.strip.split
name = File.basename(displaypath)
submodule_path =
if toplevel == config.pwd.to_s
name
else
parent = File.basename(toplevel)
"#{submodule_paths[parent]}/#{name}"
end
submodule_paths[name] = submodule_path
Licensed::Dependency.new(
name: submodule_path,
version: version,
path: config.pwd.join(displaypath),
metadata: {
"type" => self.class.type,
"name" => name,
"homepage" => homepage
}
)
end
end
|
#git_submodules_command ⇒ Object
#gitmodules_path ⇒ Object
53
54
55
|
# File 'lib/licensed/sources/git_submodule.rb', line 53
def gitmodules_path
config.pwd.join(".gitmodules")
end
|
#submodule_paths ⇒ Object
45
46
47
|
# File 'lib/licensed/sources/git_submodule.rb', line 45
def submodule_paths
@submodule_paths ||= {}
end
|