Class: BlobViewer::GoMod
Constant Summary
collapse
- MODULE_REGEX =
%r{
\A (?# beginning of file)
module\s+ (?# module directive)
(?<name>.*?) (?# module name)
\s*(?://.*)? (?# comment)
(?:\n|\z) (?# newline or end of file)
}x
Constants inherited
from Base
Base::PARTIAL_PATH_PREFIX
Instance Attribute Summary
Attributes inherited from Base
#blob
Instance Method Summary
collapse
Methods included from ServerSide
#prepare!, #render_error
Methods included from Auxiliary
#visible_to?
#can?
Methods inherited from Base
auxiliary?, binary?, #binary_detected_after_load?, can_render?, #collapsed?, #initialize, load_async?, loading_partial_path, partial_path, #prepare!, #render_error, rich?, simple?, text?, #too_large?
Instance Method Details
#manager_name ⇒ Object
18
19
20
|
# File 'app/models/blob_viewer/go_mod.rb', line 18
def manager_name
'Go Modules'
end
|
#manager_url ⇒ Object
22
23
24
|
# File 'app/models/blob_viewer/go_mod.rb', line 22
def manager_url
'https://golang.org/ref/mod'
end
|
#package_name ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'app/models/blob_viewer/go_mod.rb', line 30
def package_name
strong_memoize(:package_name) do
next if blob.name != 'go.mod'
next unless match = MODULE_REGEX.match(blob.data)
match[:name]
end
end
|
#package_type ⇒ Object
26
27
28
|
# File 'app/models/blob_viewer/go_mod.rb', line 26
def package_type
'go'
end
|
#package_url ⇒ Object
39
40
41
|
# File 'app/models/blob_viewer/go_mod.rb', line 39
def package_url
Gitlab::Golang.package_url(package_name)
end
|