Class: NexusAPI::Script

Inherits:
Thor
  • Object
show all
Includes:
CLIUtils
Defined in:
lib/nexus_api/cli_commands/script.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

#apiObject

Returns the value of attribute api.



3
4
5
# File 'lib/nexus_api/cli_commands/script.rb', line 3

def api
  @api
end

Instance Method Details

#deleteObject



9
10
11
12
# File 'lib/nexus_api/cli_commands/script.rb', line 9

def delete
  setup
  @api.delete_script(name: options[:name])
end

#executeObject



17
18
19
20
# File 'lib/nexus_api/cli_commands/script.rb', line 17

def execute
  setup
  @api.run_script(name: options[:name])
end

#listObject



24
25
26
# File 'lib/nexus_api/cli_commands/script.rb', line 24

def list
  print_set(action: :list_scripts, filter: 'name')
end

#uploadObject



30
31
32
33
34
35
36
# File 'lib/nexus_api/cli_commands/script.rb', line 30

def upload
  setup
  options[:repository] = 'scripts'
  if_file_exists? do
    @api.upload_script(filename: options[:filename])
  end
end