Sha256: 4083fd01c1f6bb2367fd5906b0e41667a05d8b5eaf00637f4e81847b5713fcc5

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

require 'thor'

module NexusCli
  module Tasks
    def self.included(base)
      base.send :include, ::Thor::Actions
      base.class_eval do

        desc "pull_artifact artifact", "Pulls an artifact from Nexus and places it on your machine."
        method_option :destination, :default => nil # defaults to the current working directory
        def pull_artifact(artifact)
          begin
            path_to_artifact = Remote.pull_artifact(artifact, options[:destination])
            say "Artifact has been retrived and can be found at path: #{path_to_artifact}", :green
          rescue NexusCliError => e
            say e.message, :red
            exit e.status_code
          end
        end

        desc "push_artifact artifact file", "Pushes an artifact from your machine onto the Nexus."
        method_options :insecure => false
        def push_artifact(artifact, file)
          begin
            Remote.push_artifact(artifact, file, options[:insecure])
            say "Artifact #{artifact} has been successfully pushed to Nexus.", :green
          rescue NexusCliError => e
            say e.message, :red
            exit e.status_code
          end
        end

        desc "get_artifact_info artifact", "Gets and returns the XML information about a particular artifact."
        def get_artifact_info(artifact)
          begin
            say Remote.get_artifact_info(artifact), :green
          rescue NexusCliError => e
            say e.message, :red
            exit e.status_code
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nexus_cli-0.0.5 lib/nexus_cli/tasks.rb