Class: NexusCli::ProRemote

Inherits:
BaseRemote show all
Includes:
ArtifactActions, CustomMetadataActions, GlobalSettingsActions, LoggingActions, RepositoryActions, SmartProxyActions, UserActions
Defined in:
lib/nexus_cli/remote/pro_remote.rb

Instance Attribute Summary

Attributes inherited from BaseRemote

#configuration, #connection

Instance Method Summary collapse

Methods included from UserActions

#change_password, #create_user, #delete_user, #get_user, #get_users, #update_user

Methods included from SmartProxyActions

#add_trusted_key, #delete_trusted_key, #disable_artifact_publish, #disable_artifact_subscribe, #disable_smart_proxy, #enable_artifact_publish, #enable_artifact_subscribe, #enable_smart_proxy, #get_pub_sub, #get_smart_proxy_key, #get_smart_proxy_settings, #get_trusted_keys

Methods included from RepositoryActions

#add_to_group_repository, #create_group_repository, #create_repository, #delete_group_repository, #delete_repository, #get_group_repository, #get_repository_info, #remove_from_group_repository, #repository_in_group?

Methods included from LoggingActions

#get_logging_info, #set_logger_level

Methods included from GlobalSettingsActions

#get_global_settings, #get_global_settings_json, #reset_global_settings, #upload_global_settings

Methods included from CustomMetadataActions

#clear_artifact_custom_info, #get_artifact_custom_info, #get_artifact_custom_info_raw, #search_artifacts_custom, #update_artifact_custom_info

Methods included from ArtifactActions

#delete_artifact, #get_artifact_download_url, #get_artifact_info, #pull_artifact, #push_artifact, #search_artifacts_lucene, #search_for_artifacts

Methods inherited from BaseRemote

#initialize

Constructor Details

This class inherits a constructor from NexusCli::BaseRemote

Instance Method Details

#get_license_infoObject



12
13
14
15
16
17
18
19
20
# File 'lib/nexus_cli/remote/pro_remote.rb', line 12

def get_license_info
  response = nexus.get(nexus_url("service/local/licensing"), :header => DEFAULT_ACCEPT_HEADER)
  case response.status
  when 200
    return response.content
  else
    raise UnexpectedStatusCodeException.new(response.status)
  end
end

#install_license(license_file) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nexus_cli/remote/pro_remote.rb', line 22

def install_license(license_file)
  file = File.read(File.expand_path(license_file))
  response = nexus.post(nexus_url("service/local/licensing/upload"), :body => file, :header => {"Content-Type" => "application/octet-stream"})
  case response.status
  when 201
    return true
  when 403
    raise LicenseInstallFailure
  else
    raise UnexpectedStatusCodeException.new(response.status)
  end
end

#install_license_bytes(bytes) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/nexus_cli/remote/pro_remote.rb', line 35

def install_license_bytes(bytes)
  response = nexus.post(nexus_url("service/local/licensing/upload"), :body => bytes, :header => {"Content-Type" => "application/octet-stream"})
  case response.status
  when 201
    return true
  when 403
    raise LicenseInstallFailure
  else
    raise UnexpectedStatusCodeException.new(response.status)
  end
end

#transfer_artifact(artifact, from_repository, to_repository) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/nexus_cli/remote/pro_remote.rb', line 47

def transfer_artifact(artifact, from_repository, to_repository)
  do_transfer_artifact(artifact, from_repository, to_repository)
  
  configuration["repository"] = sanitize_for_id(from_repository)
   = (artifact)

  configuration["repository"] = sanitize_for_id(to_repository)
   = (artifact)

  (artifact, , )
end