Class: NexusAPI::List
- Inherits:
-
Thor
- Object
- Thor
- NexusAPI::List
show all
- Includes:
- CLIUtils
- Defined in:
- lib/nexus_api/cli_commands/list.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from CLIUtils
#if_file_exists?, #print_element, #print_paginating_set, #print_set, #repository_set?, #set, #setup
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
3
4
5
|
# File 'lib/nexus_api/cli_commands/list.rb', line 3
def api
@api
end
|
Instance Method Details
#asset ⇒ Object
10
11
12
|
# File 'lib/nexus_api/cli_commands/list.rb', line 10
def asset
print_element(action: :list_asset, params: {id: options[:id]}, filter: 'path')
end
|
#asset_size ⇒ Object
16
17
18
19
|
# File 'lib/nexus_api/cli_commands/list.rb', line 16
def asset_size
setup
puts @api.get_asset_size(asset_url: options[:url])
end
|
#assets ⇒ Object
23
24
25
26
|
# File 'lib/nexus_api/cli_commands/list.rb', line 23
def assets
return false unless repository_set?
print_paginating_set(action: :list_assets, params: {repository: options[:repository]}, filter: 'path')
end
|
#component ⇒ Object
30
31
32
|
# File 'lib/nexus_api/cli_commands/list.rb', line 30
def component
print_element(action: :list_component, params: {id: options[:id]}, filter: 'name')
end
|
#components ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/nexus_api/cli_commands/list.rb', line 37
def components
return false unless repository_set?
proc = Proc.new do |components|
components.map do |component|
version = component['version'].nil? ? 'version is nil' : component['version']
line = "#{component['name']} (#{version})\n"
if options[:assets]
component['assets'].each do |asset|
line += " #{asset['path']}\n"
end
end
line
end
end
print_paginating_set(action: :list_components, params: {repository: options[:repository]}, filter: 'name', proc: proc)
end
|
#privileges ⇒ Object
55
56
57
|
# File 'lib/nexus_api/cli_commands/list.rb', line 55
def privileges
print_set(action: :list_privileges, filter: 'name')
end
|
#repositories ⇒ Object
60
61
62
|
# File 'lib/nexus_api/cli_commands/list.rb', line 60
def repositories
print_set(action: :list_repositories, filter: 'name')
end
|
#roles ⇒ Object
65
66
67
|
# File 'lib/nexus_api/cli_commands/list.rb', line 65
def roles
print_set(action: :list_roles, filter: 'name')
end
|
#status ⇒ Object
70
71
72
73
74
|
# File 'lib/nexus_api/cli_commands/list.rb', line 70
def status
setup
puts "Nexus can respond to read requests: #{@api.status}"
puts "Nexus can respond to write requests: #{@api.status_writable}"
end
|
#users ⇒ Object
77
78
79
|
# File 'lib/nexus_api/cli_commands/list.rb', line 77
def users
print_set(action: :list_users, filter: 'emailAddress')
end
|