Class: NexusAPI::Upload

Inherits:
Thor
  • Object
show all
Includes:
CLIUtils
Defined in:
lib/nexus_api/cli_commands/upload.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/upload.rb', line 3

def api
  @api
end

Instance Method Details

#dockerObject



10
11
12
13
14
15
16
17
18
# File 'lib/nexus_api/cli_commands/upload.rb', line 10

def docker
  setup
  if_file_exists?(file: options[:image].to_s + ':' + options[:docker_tag].to_s, repository: ENV['DOCKER_PUSH_HOSTNAME']) do
    @api.upload_docker_component(
      image: options[:image],
      tag: options[:docker_tag]
    )
  end
end

#mavenObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nexus_api/cli_commands/upload.rb', line 27

def maven
  return false unless repository_set?
  set(repository: :maven_repository)
  if_file_exists? do
    @api.upload_maven_component(
      filename: options[:filename],
      group_id: options[:group_id],
      artifact_id: options[:artifact_id],
      version: options[:version],
      repository: options[:repository],
      tag: options[:tag],
    )
  end
end

#npmObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/nexus_api/cli_commands/upload.rb', line 46

def npm
  return false unless repository_set?
  set(repository: :npm_repository)
  if_file_exists? do
    @api.upload_npm_component(
      filename: options[:filename],
      repository: options[:repository],
      tag: options[:tag],
    )
  end
end

#pypiObject



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/nexus_api/cli_commands/upload.rb', line 62

def pypi
  return false unless repository_set?
  set(repository: :pypi_repository)
  if_file_exists? do
    @api.upload_pypi_component(
      filename: options[:filename],
      repository: options[:repository],
      tag: options[:tag],
    )
  end
end

#rawObject



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/nexus_api/cli_commands/upload.rb', line 79

def raw
  return false unless repository_set?
  set(repository: :raw_repository)
  if_file_exists? do
    @api.upload_raw_component(
      filename: options[:filename],
      directory: options[:directory],
      repository: options[:repository],
      tag: options[:tag],
    )
  end
end

#rubygemsObject



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/nexus_api/cli_commands/upload.rb', line 96

def rubygems
  return false unless repository_set?
  set(repository: :rubygems_repository)
  if_file_exists? do
    @api.upload_rubygems_component(
      filename: options[:filename],
      repository: options[:repository],
      tag: options[:tag],
    )
  end
end

#yumObject



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/nexus_api/cli_commands/upload.rb', line 113

def yum
  return false unless repository_set?
  set(repository: :yum_repository)
  if_file_exists? do
    @api.upload_yum_component(
      filename: options[:filename],
      directory: options[:directory],
      repository: options[:repository],
      tag: options[:tag],
    )
  end
end