nexus_cli 3.0.0 → 4.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,11 +3,11 @@ module NexusCli
3
3
  module CustomMetadataActions
4
4
 
5
5
  # Gets the custom metadata for an artifact
6
- # @param [String] artifact The GAVE string of the artifact
6
+ # @param [String] coordinates The GAVE string of the artifact
7
7
  # @result [String] The resulting custom metadata xml from the get operation
8
- def get_artifact_custom_info_raw(artifact)
9
- group_id, artifact_id, version, extension = parse_artifact_string(artifact)
10
- encoded_string = N3Metadata::create_base64_subject(group_id, artifact_id, version, extension)
8
+ def get_artifact_custom_info_raw(coordinates)
9
+ artifact = Artifact.new(coordinates)
10
+ encoded_string = N3Metadata::create_base64_subject(artifact)
11
11
  response = nexus.get(nexus_url("service/local/index/custom_metadata/#{configuration['repository']}/#{encoded_string}"))
12
12
  case response.status
13
13
  when 200
@@ -24,30 +24,30 @@ module NexusCli
24
24
  end
25
25
 
26
26
  # Gets the custom metadata for an artifact in a simplified XML format
27
- # @param [String] artifact The GAVE string of the artifact
27
+ # @param [String] coordinates The GAVE string of the artifact
28
28
  # @result [String] The resulting custom metadata xml from the get operation
29
- def get_artifact_custom_info(artifact)
30
- N3Metadata::convert_result_to_simple_xml(get_artifact_custom_info_raw(artifact))
29
+ def get_artifact_custom_info(coordinates)
30
+ N3Metadata::convert_result_to_simple_xml(get_artifact_custom_info_raw(coordinates))
31
31
  end
32
32
 
33
33
  # Updates custom metadata for an artifact
34
- # @param [String] artifact The GAVE string of the artifact
34
+ # @param [String] coordinates The GAVE string of the artifact
35
35
  # @param [Array] *params The array of key:value strings
36
36
  # @result [Integer] The resulting exit code of the operation
37
- def update_artifact_custom_info(artifact, *params)
37
+ def update_artifact_custom_info(coordinates, *params)
38
38
  target_n3 = parse_custom_metadata_update_params(*params)
39
- nexus_n3 = get_custom_metadata_hash(artifact)
39
+ nexus_n3 = get_custom_metadata_hash(coordinates)
40
40
 
41
- do_update_custom_metadata(artifact, nexus_n3, target_n3)
41
+ do_update_custom_metadata(coordinates, nexus_n3, target_n3)
42
42
  end
43
43
 
44
44
  # Clears all custom metadata from an artifact
45
45
  # @param [String] The GAVE string of the artifact
46
46
  # @result [Integer] The resulting exit code of the operation
47
- def clear_artifact_custom_info(artifact)
48
- get_artifact_custom_info(artifact) # Check that artifact has custom metadata
49
- group_id, artifact_id, version, extension = parse_artifact_string(artifact)
50
- encoded_string = N3Metadata::create_base64_subject(group_id, artifact_id, version, extension)
47
+ def clear_artifact_custom_info(coordinates)
48
+ get_artifact_custom_info(coordinates) # Check that artifact has custom metadata
49
+ artifact = Artifact.new(coordinates)
50
+ encoded_string = N3Metadata::create_base64_subject(artifact)
51
51
  response = nexus.post(nexus_url("service/local/index/custom_metadata/#{configuration['repository']}/#{encoded_string}"), :body => create_custom_metadata_clear_json, :header => DEFAULT_CONTENT_TYPE_HEADER)
52
52
  case response.status
53
53
  when 201
@@ -84,17 +84,17 @@ module NexusCli
84
84
 
85
85
  private
86
86
 
87
- def get_custom_metadata_hash(artifact)
87
+ def get_custom_metadata_hash(coordinates)
88
88
  begin
89
- N3Metadata::convert_result_to_hash(get_artifact_custom_info_raw(artifact))
89
+ N3Metadata::convert_result_to_hash(get_artifact_custom_info_raw(coordinates))
90
90
  rescue N3NotFoundException
91
91
  Hash.new
92
92
  end
93
93
  end
94
94
 
95
- def do_update_custom_metadata(artifact, source_metadata, target_metadata)
96
- group_id, artifact_id, version, extension = parse_artifact_string(artifact)
97
- encoded_string = N3Metadata::create_base64_subject(group_id, artifact_id, version, extension)
95
+ def do_update_custom_metadata(coordinates, source_metadata, target_metadata)
96
+ artifact = Artifact.new(coordinates)
97
+ encoded_string = N3Metadata::create_base64_subject(artifact)
98
98
  response = nexus.post(nexus_url("service/local/index/custom_metadata/#{configuration['repository']}/#{encoded_string}"), :body => create_custom_metadata_update_json(source_metadata, target_metadata), :header => DEFAULT_CONTENT_TYPE_HEADER)
99
99
  case response.code
100
100
  when 201
@@ -166,10 +166,11 @@ module NexusCli
166
166
  #
167
167
  # @param [REXML::Document] document The object to be divided by <artifact> elements
168
168
  #
169
- # @result [Array] The result array of artifact elements
169
+ # @result [Array<String>] The result array of artifact elements
170
170
  def get_artifact_array(document)
171
171
  artifacts = []
172
172
  REXML::XPath.each(document, "//artifact") { |matched_artifact| artifacts << matched_artifact.text }
173
+ artifacts
173
174
  end
174
175
  end
175
- end
176
+ end
@@ -21,8 +21,8 @@ module NexusCli
21
21
  end
22
22
 
23
23
  # Creates a custom metadata subject for HTTP requests.
24
- def create_base64_subject(group_id, artifact_id, version, extension)
25
- return Base64.urlsafe_encode64("urn:maven/artifact##{group_id}:#{artifact_id}:#{version}::#{extension}")
24
+ def create_base64_subject(artifact)
25
+ return Base64.urlsafe_encode64("urn:maven/artifact##{artifact.group_id}:#{artifact.artifact_id}:#{artifact.version}::#{artifact.extension}")
26
26
  end
27
27
 
28
28
  # Parses the regular custom metadata xml into a simpler format containing only the custom metadata.
@@ -7,8 +7,15 @@ module NexusCli
7
7
  attr_reader :configuration
8
8
  attr_reader :connection
9
9
 
10
+ # Creates a new Nexus Remote that can connect to and communicate with
11
+ # the Nexus server.
12
+ #
13
+ # @param [Hash] overrides
14
+ # @param [Boolean] ssl_verify
15
+ #
16
+ # @return [NexusCli::ProRemote, NexusCli::OSSRemote]
10
17
  def create(overrides, ssl_verify=true)
11
- @configuration = Configuration::parse(overrides)
18
+ @configuration = overrides ? Configuration.from_overrides(overrides) : Configuration.from_file
12
19
  @connection = Connection.new(configuration, ssl_verify)
13
20
  running_nexus_pro? ? ProRemote.new(overrides, ssl_verify) : OSSRemote.new(overrides, ssl_verify)
14
21
  end
@@ -19,7 +19,7 @@ module NexusCli
19
19
 
20
20
  class_option :overrides,
21
21
  :type => :hash,
22
- :default => {},
22
+ :default => nil,
23
23
  :desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
24
24
 
25
25
  class_option :ssl_verify,
@@ -31,46 +31,46 @@ module NexusCli
31
31
  :type => :string,
32
32
  :default => nil,
33
33
  :desc => "A different folder other than the current working directory."
34
- desc "pull_artifact artifact", "Pulls an artifact from Nexus and places it on your machine."
35
- def pull_artifact(artifact)
36
- pull_artifact_response = nexus_remote.pull_artifact(artifact, options[:destination])
37
- say "Artifact has been retrived and can be found at path: #{pull_artifact_response[:file_path]}", :green
34
+ desc "pull_artifact coordinates", "Pulls an artifact from Nexus and places it on your machine."
35
+ def pull_artifact(coordinates)
36
+ pull_artifact_response = nexus_remote.pull_artifact(coordinates, options[:destination])
37
+ say "Artifact has been retrieved and can be found at path: #{pull_artifact_response[:file_path]}", :green
38
38
  end
39
39
 
40
- desc "push_artifact artifact file", "Pushes an artifact from your machine onto the Nexus."
41
- def push_artifact(artifact, file)
42
- nexus_remote.push_artifact(artifact, file)
43
- say "Artifact #{artifact} has been successfully pushed to Nexus.", :green
40
+ desc "push_artifact coordinates file", "Pushes an artifact from your machine onto the Nexus."
41
+ def push_artifact(coordinates, file)
42
+ nexus_remote.push_artifact(coordinates, file)
43
+ say "Artifact #{coordinates} has been successfully pushed to Nexus.", :green
44
44
  end
45
45
 
46
- desc "get_artifact_info artifact", "Gets and returns the metadata in XML format about a particular artifact."
47
- def get_artifact_info(artifact)
48
- say nexus_remote.get_artifact_info(artifact), :green
46
+ desc "get_artifact_info coordinates", "Gets and returns the metadata in XML format about a particular artifact."
47
+ def get_artifact_info(coordinates)
48
+ say nexus_remote.get_artifact_info(coordinates), :green
49
49
  end
50
50
 
51
51
  desc "search_for_artifacts", "Searches for all the versions of a particular artifact and prints it to the screen."
52
- def search_for_artifacts(artifact)
53
- nexus_remote.search_for_artifacts(artifact).each{|output| say output, :green}
52
+ def search_for_artifacts(coordinates)
53
+ nexus_remote.search_for_artifacts(coordinates).each{|output| say output, :green}
54
54
  end
55
55
 
56
- desc "get_artifact_custom_info artifact", "Gets and returns the custom metadata in XML format about a particular artifact."
57
- def get_artifact_custom_info(artifact)
56
+ desc "get_artifact_custom_info coordinates", "Gets and returns the custom metadata in XML format about a particular artifact."
57
+ def get_artifact_custom_info(coordinates)
58
58
  raise NotNexusProException unless nexus_remote.kind_of? ProRemote
59
- say nexus_remote.get_artifact_custom_info(artifact), :green
59
+ say nexus_remote.get_artifact_custom_info(coordinates), :green
60
60
  end
61
61
 
62
- desc "update_artifact_custom_info artifact param1 param2 ...", "Updates the artifact custom metadata with the given key-value pairs."
63
- def update_artifact_custom_info(artifact, *params)
62
+ desc "update_artifact_custom_info coordinates param1 param2 ...", "Updates the artifact custom metadata with the given key-value pairs."
63
+ def update_artifact_custom_info(coordinates, *params)
64
64
  raise NotNexusProException unless nexus_remote.kind_of? ProRemote
65
- nexus_remote.update_artifact_custom_info(artifact, *params)
66
- say "Custom metadata for artifact #{artifact} has been successfully pushed to Nexus.", :green
65
+ nexus_remote.update_artifact_custom_info(coordinates, *params)
66
+ say "Custom metadata for artifact #{coordinates} has been successfully pushed to Nexus.", :green
67
67
  end
68
68
 
69
- desc "clear_artifact_custom_info artifact", "Clears the artifact custom metadata."
70
- def clear_artifact_custom_info(artifact)
69
+ desc "clear_artifact_custom_info coordinates", "Clears the artifact custom metadata."
70
+ def clear_artifact_custom_info(coordinates)
71
71
  raise NotNexusProException unless nexus_remote.kind_of? ProRemote
72
- nexus_remote.clear_artifact_custom_info(artifact)
73
- say "Custom metadata for artifact #{artifact} has been successfully cleared.", :green
72
+ nexus_remote.clear_artifact_custom_info(coordinates)
73
+ say "Custom metadata for artifact #{coordinates} has been successfully cleared.", :green
74
74
  end
75
75
 
76
76
  desc "search_artifacts_custom param1 param2 ... ", "Searches for artifacts using artifact metadata and returns the result as a list with items in XML format."
@@ -426,10 +426,10 @@ module NexusCli
426
426
  end
427
427
  end
428
428
 
429
- desc "transfer_artifact artifact from_repository to_repository", "Transfers a given artifact from one repository to another."
430
- def transfer_artifact(artifact, from_repository, to_repository)
431
- if nexus_remote.transfer_artifact(artifact, from_repository, to_repository)
432
- say "The artifact #{artifact} has been transferred from #{from_repository} to #{to_repository}.", :blue
429
+ desc "transfer_artifact coordinates from_repository to_repository", "Transfers a given artifact from one repository to another."
430
+ def transfer_artifact(coordinates, from_repository, to_repository)
431
+ if nexus_remote.transfer_artifact(coordinates, from_repository, to_repository)
432
+ say "The artifact #{coordinates} has been transferred from #{from_repository} to #{to_repository}.", :blue
433
433
  end
434
434
  end
435
435
 
data/lib/nexus_cli.rb CHANGED
@@ -3,6 +3,7 @@ require 'httpclient'
3
3
  require 'nexus_cli/errors'
4
4
  require 'rexml/document'
5
5
  require 'yaml'
6
+ require 'active_support/core_ext/hash'
6
7
 
7
8
  module NexusCli
8
9
  DEFAULT_ACCEPT_HEADER = {
@@ -13,6 +14,7 @@ module NexusCli
13
14
  "Content-Type" => "application/json"
14
15
  }.freeze
15
16
 
17
+ autoload :Artifact, 'nexus_cli/artifact'
16
18
  autoload :Tasks, 'nexus_cli/tasks'
17
19
  autoload :Cli, 'nexus_cli/cli'
18
20
  autoload :Connection, 'nexus_cli/connection'
@@ -39,4 +41,4 @@ module NexusCli
39
41
  @ui ||= Thor::Shell::Color.new
40
42
  end
41
43
  end
42
- end
44
+ end
data/nexus_cli.gemspec CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency 'json'
23
23
  s.add_dependency 'highline'
24
24
  s.add_dependency 'jsonpath'
25
+ s.add_runtime_dependency 'chozo', '>= 0.6.0'
26
+ s.add_runtime_dependency 'activesupport', '>= 3.2.0'
25
27
 
26
28
  s.add_development_dependency 'rspec'
27
29
  s.add_development_dependency 'aruba'
@@ -0,0 +1,10 @@
1
+ <search-results>
2
+ <data>
3
+ <artifact>
4
+ <info>test</info>
5
+ </artifact>
6
+ <artifact>
7
+ <info>test 2</info>
8
+ </artifact>
9
+ </data>
10
+ </search-results>
data/spec/spec_helper.rb CHANGED
@@ -12,3 +12,11 @@ end
12
12
  Spork.each_run do
13
13
  require 'nexus_cli'
14
14
  end
15
+
16
+ def app_root_path
17
+ Pathname.new(File.expand_path('../..', __FILE__))
18
+ end
19
+
20
+ def fixtures_path
21
+ app_root_path.join('spec/fixtures')
22
+ end
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+
3
+ describe NexusCli::Artifact do
4
+
5
+ describe "#new" do
6
+ it "gives you errors when you under specify" do
7
+ expect { described_class.new("group:artifact") }.to raise_error(NexusCli::ArtifactMalformedException)
8
+ end
9
+
10
+ it "gives you errors when you over specify" do
11
+ expect { described_class.new("group:artifact:extension:classifier:version:garbage") }.to raise_error(NexusCli::ArtifactMalformedException)
12
+ end
13
+
14
+ context "when extension and classifier are omitted" do
15
+ subject { new_artifact }
16
+ let(:new_artifact) { described_class.new("group:artifact:version") }
17
+
18
+ it "creates a new Artifact object" do
19
+ expect(new_artifact).to be_a(NexusCli::Artifact)
20
+ end
21
+
22
+ it "has the correct attributes" do
23
+ expect(new_artifact.group_id).to eq("group")
24
+ expect(new_artifact.artifact_id).to eq("artifact")
25
+ expect(new_artifact.extension).to eq("jar")
26
+ expect(new_artifact.classifier).to be_nil
27
+ expect(new_artifact.version).to eq("version")
28
+ expect(new_artifact.file_name).to eq("artifact-version.jar")
29
+ end
30
+ end
31
+
32
+ context "when just extension is specified" do
33
+ subject { new_artifact }
34
+ let(:new_artifact) { described_class.new("group:artifact:extension:version") }
35
+
36
+ it "creates a new Artifact object" do
37
+ expect(new_artifact).to be_a(NexusCli::Artifact)
38
+ end
39
+
40
+ it "has the correct attributes" do
41
+ expect(new_artifact.group_id).to eq("group")
42
+ expect(new_artifact.artifact_id).to eq("artifact")
43
+ expect(new_artifact.extension).to eq("extension")
44
+ expect(new_artifact.classifier).to be_nil
45
+ expect(new_artifact.version).to eq("version")
46
+ expect(new_artifact.file_name).to eq("artifact-version.extension")
47
+ end
48
+ end
49
+
50
+ context "when both extension and classifer are specified" do
51
+ subject { new_artifact }
52
+ let(:new_artifact) { described_class.new("group:artifact:extension:classifier:version") }
53
+
54
+ it "creates a new Artifact object" do
55
+ expect(new_artifact).to be_a(NexusCli::Artifact)
56
+ end
57
+
58
+ it "has the correct attributes" do
59
+ expect(new_artifact.group_id).to eq("group")
60
+ expect(new_artifact.artifact_id).to eq("artifact")
61
+ expect(new_artifact.extension).to eq("extension")
62
+ expect(new_artifact.classifier).to eq("classifier")
63
+ expect(new_artifact.version).to eq("version")
64
+ expect(new_artifact.file_name).to eq("artifact-version-classifier.extension")
65
+ end
66
+ end
67
+
68
+ context "when you specify latest as the version" do
69
+ subject { new_artifact }
70
+ let(:new_artifact) { described_class.new("group:artifact:latest") }
71
+
72
+ it "upper cases version" do
73
+ expect(new_artifact.group_id).to eq("group")
74
+ expect(new_artifact.artifact_id).to eq("artifact")
75
+ expect(new_artifact.extension).to eq("jar")
76
+ expect(new_artifact.classifier).to be_nil
77
+ expect(new_artifact.version).to eq("LATEST")
78
+ expect(new_artifact.file_name).to eq("artifact-LATEST.jar")
79
+ end
80
+ end
81
+ end
82
+ end
@@ -1,23 +1,124 @@
1
- require 'nexus_cli'
1
+ require 'spec_helper'
2
2
 
3
- describe NexusCli do
4
- it "gives you errors when configuration has a blank password" do
5
- overrides = {"url" => "http://somewebsite.com", "username" => "admin", "password" => ""}
6
- expect {NexusCli::Configuration.parse(overrides)}.to raise_error(NexusCli::InvalidSettingsException)
3
+ describe NexusCli::Configuration do
4
+ subject { configuration }
5
+ let(:configuration) { described_class }
6
+ let(:config_instance) { configuration.from_overrides(valid_config) }
7
+ let(:url) { "http://some-url.com" }
8
+ let(:repository) { "releases" }
9
+ let(:username) { "kallan" }
10
+ let(:password) { "password" }
11
+
12
+ let(:valid_config) do
13
+ {
14
+ "url" => "http://somewebsite.com",
15
+ "repository" => "foo",
16
+ "username" => "admin",
17
+ "password" => "password"
18
+ }
19
+ end
20
+
21
+ describe "::from_overrides" do
22
+ subject { from_overrides }
23
+ let(:from_overrides) { configuration.from_overrides(valid_config) }
24
+
25
+ it "returns a new Configuration object" do
26
+ expect(from_overrides).to be_a(NexusCli::Configuration)
27
+ end
28
+ end
29
+
30
+ describe "::from_file" do
31
+ subject { from_file }
32
+ let(:from_file) { configuration.from_file }
33
+
34
+ before do
35
+ YAML.stub(:load_file).and_return(valid_config)
36
+ end
37
+
38
+ context "when the NEXUS_CONFIG environment variable exists" do
39
+ let(:nexus_config_path) { "/home/var/nexus_cli" }
40
+
41
+ before do
42
+ ENV['NEXUS_CONFIG'] = nexus_config_path
43
+ end
44
+
45
+ it "loads the config file from NEXUS_CONFIG" do
46
+ YAML.should_receive(:load_file).with(nexus_config_path)
47
+ from_file
48
+ end
49
+ end
50
+
51
+ context "when the NEXUS_CONFIG environment variable does not exist" do
52
+ let(:nexus_config_path) { File.expand_path(NexusCli::Configuration::DEFAULT_FILE) }
53
+
54
+ before do
55
+ ENV['NEXUS_CONFIG'] = nil
56
+ end
57
+
58
+ it "loads the config file from DEFAULT_FILE" do
59
+ YAML.should_receive(:load_file).with(nexus_config_path)
60
+ from_file
61
+ end
62
+ end
63
+
64
+ it "returns a new Configuration object" do
65
+ expect(from_file).to be_a(NexusCli::Configuration)
66
+ end
67
+ end
68
+
69
+ describe "::validate!" do
70
+ subject { validate! }
71
+ let(:validate!) {described_class.validate!(invalid_config)}
72
+ let(:invalid_config) do
73
+ described_class.new(url: nil, repository: "something", username: "someone", password: "somepass")
74
+ end
75
+
76
+ context "when the object is invalide" do
77
+ it "raises an error" do
78
+ expect { validate! }.to raise_error(NexusCli::InvalidSettingsException)
79
+ end
80
+ end
81
+ end
82
+
83
+ describe "#new" do
84
+ subject { new_config }
85
+ let(:new_config) { described_class.new(url: url, repository: repository, username: username, password: password) }
86
+
87
+ it "creates a new Configuration object" do
88
+ expect(new_config).to be_a(NexusCli::Configuration)
89
+ end
90
+ end
91
+
92
+ describe "#url" do
93
+ it "returns the url" do
94
+ expect(config_instance.url).to eq("http://somewebsite.com")
95
+ end
7
96
  end
8
97
 
9
- it "gives you errors when configuration has a blank username" do
10
- overrides = {"url" => "http://somewebsite.com", "username" => "", "password" => "admin"}
11
- expect {NexusCli::Configuration.parse(overrides)}.to raise_error(NexusCli::InvalidSettingsException)
98
+ describe "#repository" do
99
+ let(:repository_config) { described_class.new(url: url, repository: repository, username: username, password: password) }
100
+
101
+ it "returns the repository" do
102
+ expect(config_instance.repository).to eq("foo")
103
+ end
104
+
105
+ context "when repository has illegal values" do
106
+ let(:repository) { "ILLEGAL VALUE" }
107
+ it "makes it legal" do
108
+ expect(repository_config.repository).to eq("illegal_value")
109
+ end
110
+ end
12
111
  end
13
112
 
14
- it "gives you errors when configuration has a blank url" do
15
- overrides = {"url" => "", "username" => "admin", "password" => "admin"}
16
- expect {NexusCli::Configuration.parse(overrides)}.to raise_error(NexusCli::InvalidSettingsException)
113
+ describe "#username" do
114
+ it "returns the username" do
115
+ expect(config_instance.username).to eq("admin")
116
+ end
17
117
  end
18
118
 
19
- it "gives you errors when configuration has a blank repository" do
20
- overrides = {"url" => "http://somewebsite.com", "repository" => ""}
21
- expect {NexusCli::Configuration.parse(overrides)}.to raise_error(NexusCli::InvalidSettingsException)
119
+ describe "#password" do
120
+ it "returns the password" do
121
+ expect(config_instance.password).to eq("password")
122
+ end
22
123
  end
23
- end
124
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe NexusCli::CustomMetadataActions do
4
+ let(:custom_metadata_actions) { injected_module.new }
5
+ let(:injected_module) do
6
+ Class.new {
7
+ include NexusCli::CustomMetadataActions
8
+ }
9
+ end
10
+ let(:document) { REXML::Document.new(File.read(fixtures_path.join('metadata_search.xml'))) }
11
+
12
+ describe "::get_artifact_array" do
13
+ subject { get_artifact_array }
14
+ let(:get_artifact_array) { custom_metadata_actions.send(:get_artifact_array, document) }
15
+
16
+ it "returns an array of strings" do
17
+ get_artifact_array.should be_a(Array)
18
+ get_artifact_array.each { |element| element.should be_a(String) }
19
+ end
20
+ end
21
+ end
@@ -9,21 +9,26 @@ remote = NexusCli::OSSRemote.new(
9
9
 
10
10
  describe NexusCli do
11
11
  it "gives you errors when you attempt to pull an artifact don't give a valid artifact name" do
12
- expect {remote.pull_artifact "com.something:something:1.0.0", nil}.to raise_error(NexusCli::ArtifactMalformedException)
12
+ expect {remote.pull_artifact "com.something:something", nil}.to raise_error(NexusCli::ArtifactMalformedException)
13
13
  end
14
14
 
15
15
  it "gives you errors when you attempt to get an artifact's info and don't give a valid artifact name" do
16
- expect {remote.get_artifact_info "com.something:something:1.0.0"}.to raise_error(NexusCli::ArtifactMalformedException)
16
+ expect {remote.get_artifact_info "com.something:something"}.to raise_error(NexusCli::ArtifactMalformedException)
17
17
  end
18
18
 
19
19
  it "gives you errors when you attempt to pull an artifact and it cannot be found" do
20
20
  HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
21
- expect {remote.pull_artifact "com.something:something:1.0.0:tgz", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
21
+ expect {remote.pull_artifact "com.something:something:tgz:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
22
22
  end
23
23
 
24
24
  it "gives you errors when you attempt to get an artifact's info and it cannot be found" do
25
25
  HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
26
- expect {remote.get_artifact_info "com.something:something:1.0.0:tgz"}.to raise_error(NexusCli::ArtifactNotFoundException)
26
+ expect {remote.get_artifact_info "com.something:something:tgz:1.0.0"}.to raise_error(NexusCli::ArtifactNotFoundException)
27
+ end
28
+
29
+ it "gives you errors when you attempt to pull an artifact with classifier and it cannot be found" do
30
+ HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
31
+ expect {remote.pull_artifact "com.something:something:tgz:x64:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
27
32
  end
28
33
 
29
34
  it "gives you an error when you try to update a user that doesnt exist" do