Class: XCCache::SPM::Package::Dependency
Constant Summary
Constants inherited
from BaseObject
BaseObject::ATTRS
Instance Attribute Summary
#raw
Instance Method Summary
collapse
Methods inherited from BaseObject
#cast_to, #fetch, #full_name, #inspect, #name, #pkg_desc_of, #pkg_name, #pkg_slug, #src_dir, #to_s
#config
#load, #save
#[], #[]=, #initialize, #load, #merge!, #reload, #save
Instance Method Details
#display_name ⇒ Object
7
8
9
|
# File 'lib/xccache/spm/desc/dep.rb', line 7
def display_name
slug
end
|
#hash ⇒ Object
15
16
17
|
# File 'lib/xccache/spm/desc/dep.rb', line 15
def hash
@hash ||= local? ? raw["fileSystem"].first : raw["sourceControl"].first
end
|
#local? ⇒ Boolean
11
12
13
|
# File 'lib/xccache/spm/desc/dep.rb', line 11
def local?
raw.key?("fileSystem")
end
|
#path ⇒ Object
30
31
32
|
# File 'lib/xccache/spm/desc/dep.rb', line 30
def path
@path ||= Pathname(hash["path"]).expand_path if local?
end
|
#pkg_desc ⇒ Object
34
35
36
|
# File 'lib/xccache/spm/desc/dep.rb', line 34
def pkg_desc
@pkg_desc ||= pkg_desc_of(slug)
end
|
#slug ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/xccache/spm/desc/dep.rb', line 19
def slug
@slug ||=
if hash.key?("path")
File.basename(hash["path"])
elsif (location = hash["location"]) && location.key?("remote")
File.basename(location["remote"].flat_map(&:values)[0], ".*")
else
hash["identity"]
end
end
|