class Fastlane::Actions::UploadToNexus3Action
Public Class Methods
artifact_url()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 158 def artifact_url [ @nexus_base_url, "repository", @repository, group_path, @artifact_id, @version ].join("/") end
available_options()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 38 def self.available_options # Define all options your action supports. # Below a few examples [ FastlaneCore::ConfigItem.new(key: :file, env_name: "file", # The name of the repository description: "File to upload", # a short description of this parameter verify_block: proc do |value| UI.user_error!("Please provide file") unless value and !value.empty? end), FastlaneCore::ConfigItem.new(key: :repository, env_name: "repository", # The name of the repository description: "Target repository", # a short description of this parameter verify_block: proc do |value| UI.user_error!("Please provide repository") unless value and !value.empty? end), FastlaneCore::ConfigItem.new(key: :nexus_base_url, env_name: "nexus_base_url", # The name of the environment variable description: "The URL base address to nexus. Example https://localhost:8080", # a short description of this parameter verify_block: proc do |value| UI.user_error!("Please provide nexus_base_url") unless value and !value.empty? # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :artifact_id, env_name: "artifact_id", # The name of the environment variable description: "The artifact_id to use", # a short description of this parameter verify_block: proc do |value| UI.user_error!("Please provide artifact_id") unless value and !value.empty? # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :group_id, env_name: "group_id", description: "The group_id to use", verify_block: proc do |value| UI.user_error!("Please provide group_id") unless value and !value.empty? # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :type, env_name: "type", description: "The artefact types", is_string: false, default_value: ""), FastlaneCore::ConfigItem.new(key: :version, env_name: "version", description: "The version of the artifact", verify_block: proc do |value| UI.user_error!("Please provide version") unless value and !value.empty? # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :classifier, env_name: "classifier", description: "The classifier of the artifact", default_value: "", optional: true), FastlaneCore::ConfigItem.new(key: :nexus_user, env_name: "nexus_user", description: "The username in nexus", verify_block: proc do |value| UI.user_error!("Please provide group_id") unless value and !value.empty? # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :nexus_password, env_name: "nexus_password", description: "The password in nexus", verify_block: proc do |value| UI.user_error!("Please provide group_id") unless value and !value.empty? # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value) end) ] end
classifier()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 169 def classifier "-#{@classifier}" unless @classifier.empty? end
classifier_tag()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 173 def classifier_tag " <classifier>#{@classifier}</classifier>" unless @classifier.empty? end
credentials()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 187 def credentials "#{@nexus_user}:$FASTLANE_NEXUS_PASSWORD" end
description()
click to toggle source
@!group Documentation
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 28 def self.description "Uploads an artifact to Nexus 3" end
details()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 32 def self.details # Optional: # this is your chance to provide a more detailed description of this action "You can use this action to do cool things..." end
file_url()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 177 def file_url file_name = "#{@artifact_id}-#{@version}#{classifier}.#{@type}" [artifact_url, file_name].join("/") end
group_path()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 154 def group_path @group_id.gsub(".", "/") end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 127 def self.is_supported?(platform) platform == :android end
output()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 110 def self.output # Define the shared values you are going to provide # Example [ ['UPLOAD_TO_NEXUS_3_CUSTOM_VALUE', 'A description of what this value contains'] ] end
pom_url()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 182 def pom_url pom_name = "#{@artifact_id}-#{@version}#{classifier}.pom" [artifact_url, pom_name].join("/") end
return_value()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 118 def self.return_value # If you method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 4 def self.run(params) @group_id = params[:group_id] @artifact_id = params[:artifact_id] @version = params[:version] @classifier = params[:classifier] @nexus_base_url = params[:nexus_base_url] @nexus_user = params[:nexus_user] @repository = params[:repository] @type = params[:type] ENV['FASTLANE_NEXUS_PASSWORD'] = params[:nexus_password] actions = [ "curl --fail -u \"#{credentials}\" --upload-file #{temp_pom_file} #{pom_url} #{verbose}", "curl --fail -u \"#{credentials}\" --upload-file #{params[:file]} #{file_url} #{verbose}" ].map(&:rstrip).join(' && ') sh(actions) end
temp_pom_file()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 136 def temp_pom_file pom = [ "<project>", " <modelVersion>4.0.0</modelVersion>", " <groupId>#{@group_id}</groupId>", " <artifactId>#{@artifact_id}</artifactId>", " <version>#{@version}</version>", classifier_tag, "</project>" ].compact.join("\n") pom_file = Tempfile.new("pom.xml") pom_file.write(pom) pom_file.flush return pom_file.path end
verbose()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/upload_to_nexus_3_action.rb, line 132 def verbose "-v" if FastlaneCore::Globals.verbose? end