nexus_cli 4.0.0.beta1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  script: "bundle exec thor spec:unit"
2
2
  language: ruby
3
3
  rvm:
4
- - 1.9.2
5
4
  - 1.9.3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
- # 4.0.0.beta1
1
+ # 4.0.0
2
2
 
3
+ * Major Change - GAV ordering that used to be G:A:V:E has changed to G:A:E:C:V
4
+ * Support for an anonymous connection to the Nexus server
3
5
  * Added support for Maven classifiers
4
- * In general, references to an 'artifact' have been renamed to 'coordinates'
6
+ * In general, references to an 'artifact' (GAV identifier) have been renamed to 'coordinates'
data/README.md CHANGED
@@ -20,27 +20,93 @@ username: "username"
20
20
  password: "password"
21
21
  ```
22
22
 
23
+ You can also omit the username and password to create an anonymous session with the Nexus server. Keep in mind that an anonymous session may have different permissions than an authenticated one, depending on your Nexus server configuration.
24
+
23
25
  # Usage
24
26
 
25
- There are two calls that can be made. push\_artifact and pull\_artifact. Both calls will push or pull artifacts from Nexus using the Maven Co-ordinates syntax: `groupId:artifactId:version` or `groupId:artifactId:extension:version` or `groupId:artifactId:extension:classifier:version`
27
+ There are a few calls that can be made. The most important are push\_artifact and pull\_artifact. Both calls will push or pull artifacts from Nexus using the Maven Co-ordinates syntax: `groupId:artifactId:version` (default extension is jar) or `groupId:artifactId:extension:version` or `groupId:artifactId:extension:classifier:version`
28
+
29
+ One can also search for artifacts and get back raw xml containing matches.
30
+
31
+ ## Listing of Available Commands
32
+
33
+ ```
34
+ nexus-cli add_to_group_repository group_id repository_to_add_id # Adds a repository with the given id into the group repository.
35
+ nexus-cli add_trusted_key --certificate=CERTIFICATE --description=DESCRIPTION # Adds a new trusted key to the Smart Proxy configuration.
36
+ nexus-cli change_password user_id # Changes the given user's passwords to a new one.
37
+ nexus-cli clear_artifact_custom_info coordinates # Clears the artifact custom metadata.
38
+ nexus-cli create_group_repository name # Creates a new repository group with the given name.
39
+ nexus-cli create_repository name # Creates a new Repository with the provided name.
40
+ nexus-cli create_user # Creates a new user
41
+ nexus-cli delete_group_repository group_id # Deletes a group repository based on the given id.
42
+ nexus-cli delete_repository name # Deletes a Repository with the provided name.
43
+ nexus-cli delete_trusted_key key_id # Deletes a trusted key using the given key_id.
44
+ nexus-cli delete_user user_id # Deletes the user with the given id.
45
+ nexus-cli disable_artifact_publish repository_id # Sets a repository to disable the publishing of updates about its artifacts.
46
+ nexus-cli disable_artifact_subscribe repository_id # Sets a repository to stop subscribing to updates about artifacts.
47
+ nexus-cli disable_smart_proxy # Disables Smart Proxy on the server.
48
+ nexus-cli enable_artifact_publish repository_id # Sets a repository to enable the publishing of updates about its artifacts.
49
+ nexus-cli enable_artifact_subscribe repository_id # Sets a repository to subscribe to updates about artifacts.
50
+ nexus-cli enable_smart_proxy # Enables Smart Proxy on the server.
51
+ nexus-cli get_artifact_custom_info coordinates # Gets and returns the custom metadata in XML format about a particular artifact.
52
+ nexus-cli get_artifact_info coordinates # Gets and returns the metadata in XML format about a particular artifact.
53
+ nexus-cli get_global_settings # Prints out your Nexus' current setttings and saves them to a file.
54
+ nexus-cli get_group_repository group_id # Gets information about the given group repository.
55
+ nexus-cli get_license_info # Returns the license information of the server.
56
+ nexus-cli get_logging_info # Gets the log4j Settings of the Nexus server.
57
+ nexus-cli get_nexus_configuration # Prints out configuration from the .nexus_cli file that helps inform where artifacts will be uploaded.
58
+ nexus-cli get_nexus_status # Prints out information about the Nexus instance.
59
+ nexus-cli get_pub_sub repository_id # Returns the publish/subscribe status of the given repository.
60
+ nexus-cli get_repository_info name # Finds and returns information about the provided Repository.
61
+ nexus-cli get_smart_proxy_settings # Returns the Smart Proxy settings of the server.
62
+ nexus-cli get_trusted_keys # Returns the trusted keys of the server.
63
+ nexus-cli get_users # Returns XML representing the users in Nexus.
64
+ nexus-cli help [COMMAND] # Describe available commands or one specific command
65
+ nexus-cli install_license license_file # Installs a license file into the server.
66
+ nexus-cli pull_artifact coordinates # Pulls an artifact from Nexus and places it on your machine.
67
+ nexus-cli push_artifact coordinates file # Pushes an artifact from your machine onto the Nexus.
68
+ nexus-cli remove_from_group_repository group_id repository_to_remove_id # Remove a repository with the given id from the group repository.
69
+ nexus-cli reset_global_settings # Resets your Nexus global_settings to their out-of-the-box defaults.
70
+ nexus-cli search_artifacts_custom param1 param2 ... # Searches for artifacts using artifact metadata and returns the result as a list with items in XML format.
71
+ nexus-cli search_for_artifacts # Searches for all the versions of a particular artifact and prints it to the screen.
72
+ nexus-cli set_logger_level level # Updates the log4j logging level to a new value.
73
+ nexus-cli transfer_artifact coordinates from_repository to_repository # Transfers a given artifact from one repository to another.
74
+ nexus-cli update_artifact_custom_info coordinates param1 param2 ... # Updates the artifact custom metadata with the given key-value pairs.
75
+ nexus-cli update_user user_id # Updates a user's details. Leave fields blank for them to remain their current values.
76
+ nexus-cli upload_global_settings # Uploads a global_settings.json file to your Nexus to update its settings.
77
+ ```
78
+
79
+ Each command can be prefaced with `help` to get more information about the command. For example - `nexus-cli help get_users`
80
+
81
+ There are also two global config options, `--overrides` which overrides the configruation in `~/.nexus_cli` and `--ssl-verify false` which turns off SSL verification.
26
82
 
27
83
  ## Pull Artifact Example
28
84
 
29
85
  ```
30
- nexus-cli pull_artifact com.mycompany.artifacts:myartifact:tgz:1.0.0
86
+ nexus-cli pull_artifact com.mycompany.artifacts:myartifact:1.0.0:tgz
31
87
  ```
32
88
 
33
89
  ## Push Artifact Example
34
90
 
35
91
  ```
36
- nexus-cli push_artifact com.mycompany.artifacts:myartifact:tgz:1.0.0 ~/path/to/file/to/push/myartifact.tgz
92
+ nexus-cli push_artifact com.mycompany.artifacts:myartifact:1.0.0:tgz ~/path/to/file/to/push/myartifact.tgz
93
+ ```
94
+
95
+ ## Search Example
96
+
97
+ ```
98
+ nexus-cli search_for_artifacts com.mycompany.artifacts:myartifact
99
+
100
+ or more generic if you wish:
101
+
102
+ nexus-cli search_for_artifacts com.mycompany.artifacts
37
103
  ```
38
104
 
39
105
  # License and Author
40
106
 
41
107
  Author:: Kyle Allan (<kallan@riotgames.com>)
42
108
 
43
- Copyright:: 2012 Riot Games Inc.
109
+ Copyright:: 2013 Riot Games Inc.
44
110
 
45
111
  Licensed under the Apache License, Version 2.0 (the "License");
46
112
  you may not use this file except in compliance with the License.
data/Thorfile CHANGED
@@ -7,7 +7,7 @@ require 'bundler/setup'
7
7
  require 'thor/rake_compat'
8
8
  require 'nexus_cli'
9
9
 
10
- class Default < Thor
10
+ class Default < Thor
11
11
  include Thor::RakeCompat
12
12
  Bundler::GemHelper.install_tasks
13
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.0.beta1
1
+ 4.0.0
@@ -50,8 +50,7 @@ Feature: Use the Nexus CLI
50
50
  When I call the nexus "search_for_artifacts com.test:mytest" command
51
51
  Then the output should contain:
52
52
  """
53
- Found Versions:
54
- 1.0.0: `nexus-cli pull com.test:mytest:tgz:1.0.0`
53
+ <search-results>
55
54
  """
56
55
  And the exit status should be 0
57
56
 
@@ -18,29 +18,29 @@ When /^I call the nexus "(.*?)" command as the "(.*?)" user with password "(.*?)
18
18
  step "I run `nexus-cli #{command} --overrides=#{overrides}`"
19
19
  end
20
20
 
21
- When /^I push an artifact with the GAV of "(.*)"$/ do |gav|
22
- groupId, artifact_id, version, extension = gav.split(":")
21
+ When /^I push an artifact with the GAV of "(.*)"$/ do |coordinates|
22
+ groupId, artifact_id, extension, version = coordinates.split(":")
23
23
  file = File.new(File.join(temp_dir, "#{artifact_id}-#{version}.#{extension}"), 'w')
24
24
  file.puts "some data"
25
25
  file.close
26
- step "I run `nexus-cli push #{gav} #{file.path} --overrides=#{get_overrides_string}`"
26
+ step "I run `nexus-cli push #{coordinates} #{file.path} --overrides=#{get_overrides_string}`"
27
27
  end
28
28
 
29
- When /^I pull an artifact with the GAV of "(.*?)" to a temp directory$/ do |gav|
30
- step "I run `nexus-cli pull #{gav} --destination #{temp_dir} --overrides=#{get_overrides_string}`"
29
+ When /^I pull an artifact with the GAV of "(.*?)" to a temp directory$/ do |coordinates|
30
+ step "I run `nexus-cli pull #{coordinates} --destination #{temp_dir} --overrides=#{get_overrides_string}`"
31
31
  end
32
32
 
33
33
  Then /^I should have a copy of the "(.*?)" artifact in a temp directory$/ do |fileName|
34
34
  File.exists?(File.join(temp_dir, fileName)).should == true
35
35
  end
36
36
 
37
- When /^I delete an artifact with the GAV of "(.*)"$/ do |gav|
38
- nexus_remote.delete_artifact(gav)
37
+ When /^I delete an artifact with the GAV of "(.*)"$/ do |coordinates|
38
+ nexus_remote.delete_artifact(coordinates)
39
39
  end
40
40
 
41
- When /^I delete an artifact with the GAV of "(.*?)" from the "(.*?)" repository$/ do |gav, repository|
41
+ When /^I delete an artifact with the GAV of "(.*?)" from the "(.*?)" repository$/ do |coordinates, repository|
42
42
  nexus_remote.configuration["repository"] = repository
43
- nexus_remote.delete_artifact(gav)
43
+ nexus_remote.delete_artifact(coordinates)
44
44
  end
45
45
 
46
46
  When /^I edit the "(.*?)" files "(.*?)" field to true$/ do |file, field|
@@ -1,11 +1,7 @@
1
1
  module NexusCli
2
2
  class Artifact
3
- attr_reader :group_id
4
- attr_reader :artifact_id
5
- attr_reader :extension
6
- attr_reader :classifier
7
- attr_reader :version
8
- attr_reader :file_name
3
+ attr_reader :group_id, :artifact_id, :extension, :classifier
4
+ attr_accessor :version
9
5
 
10
6
  # Constructs an artifact object from Maven co-ordinates
11
7
  # See http://maven.apache.org/pom.html#Maven_coordinatess
@@ -16,11 +12,13 @@ module NexusCli
16
12
  # @return [Array<String>] an Array with four elements
17
13
  def initialize(coordinates)
18
14
  @group_id, @artifact_id, @extension, @classifier, @version = parse_coordinates(coordinates)
15
+ end
19
16
 
20
- if @classifier.nil?
21
- @file_name = "#{@artifact_id}-#{@version}.#{@extension}"
17
+ def file_name
18
+ if classifier.nil?
19
+ "#{artifact_id}-#{version}.#{extension}"
22
20
  else
23
- @file_name = "#{@artifact_id}-#{@version}-#{@classifier}.#{@extension}"
21
+ "#{artifact_id}-#{version}-#{classifier}.#{extension}"
24
22
  end
25
23
  end
26
24
 
@@ -3,7 +3,7 @@ require 'chozo'
3
3
 
4
4
  module NexusCli
5
5
  class Configuration
6
- DEFAULT_FILE = "~/.nexus_cli".freeze
6
+ DEFAULT_FILE = (ENV['HOME'] ? "~/.nexus_cli" : "/root/.nexus_cli").freeze
7
7
 
8
8
  class << self
9
9
  # The filepath to the nexus cli configuration file
@@ -14,7 +14,7 @@ module NexusCli
14
14
  end
15
15
 
16
16
  # Creates a new instance of the Configuration object based on some overrides
17
- #
17
+ #
18
18
  # @param [Hash] overrides
19
19
  #
20
20
  # @return [NexusCli::Configuration]
@@ -40,7 +40,7 @@ module NexusCli
40
40
  # is an error with it
41
41
  #
42
42
  # @param config [NexusCli::Configuration]
43
- #
43
+ #
44
44
  # @raise [NexusCli::InvalidSettingsException]
45
45
  def validate!(config)
46
46
  unless config.valid?
@@ -49,6 +49,10 @@ module NexusCli
49
49
  end
50
50
  end
51
51
 
52
+ def validate!
53
+ self.class.validate!(self)
54
+ end
55
+
52
56
  include Chozo::VariaModel
53
57
 
54
58
  attribute :url,
@@ -63,12 +67,10 @@ module NexusCli
63
67
  }
64
68
 
65
69
  attribute :username,
66
- type: String,
67
- required: true
70
+ type: String
68
71
 
69
72
  attribute :password,
70
- type: String,
71
- required: true
73
+ type: String
72
74
 
73
75
  def initialize(options)
74
76
  mass_assign(options)
@@ -4,8 +4,8 @@ require 'tempfile'
4
4
  module NexusCli
5
5
  # @author Kyle Allan <kallan@riotgames.com>
6
6
  module ArtifactActions
7
-
8
- # Retrieves a file from the Nexus server using the given [String]
7
+
8
+ # Retrieves a file from the Nexus server using the given [String]
9
9
  # coordinates. Optionally provide a destination [String].
10
10
  #
11
11
  # @param [String] coordinates
@@ -14,7 +14,10 @@ module NexusCli
14
14
  # @return [Hash] Some information about the artifact that was pulled.
15
15
  def pull_artifact(coordinates, destination=nil)
16
16
  artifact = Artifact.new(coordinates)
17
- version = REXML::Document.new(get_artifact_info(coordinates)).elements["//version"].text if artifact.version.casecmp("latest")
17
+
18
+ if artifact.version.casecmp("latest")
19
+ artifact.version = REXML::Document.new(get_artifact_info(coordinates)).elements["//version"].text
20
+ end
18
21
 
19
22
  file_name = artifact.file_name
20
23
  destination = File.join(File.expand_path(destination || "."), file_name)
@@ -37,17 +40,17 @@ module NexusCli
37
40
  {
38
41
  :file_name => file_name,
39
42
  :file_path => File.expand_path(destination),
40
- :version => version,
43
+ :version => artifact.version,
41
44
  :size => File.size(File.expand_path(destination))
42
45
  }
43
46
  end
44
47
 
45
48
  # Pushes the given [file] to the Nexus server
46
49
  # under the given [artifact] identifier.
47
- #
50
+ #
48
51
  # @param coordinates [String] the Maven identifier
49
52
  # @param file [type] the path to the file
50
- #
53
+ #
51
54
  # @return [Boolean] returns true when successful
52
55
  def push_artifact(coordinates, file)
53
56
  artifact = Artifact.new(coordinates)
@@ -90,9 +93,9 @@ module NexusCli
90
93
 
91
94
  # Retrieves information about the given [artifact] and returns
92
95
  # it in as a [String] of XML.
93
- #
96
+ #
94
97
  # @param coordinates [String] the Maven identifier
95
- #
98
+ #
96
99
  # @return [String] A string of XML data about the desired artifact
97
100
  def get_artifact_info(coordinates)
98
101
  artifact = Artifact.new(coordinates)
@@ -116,9 +119,9 @@ module NexusCli
116
119
  #
117
120
  # @param coordinates [String] the Maven identifier
118
121
  # @example com.artifact:my-artifact
119
- #
122
+ #
120
123
  # @return [Array<String>] a formatted Array of results
121
- # @example
124
+ # @example
122
125
  # 1.0.0 `nexus-cli pull com.artifact:my-artifact:tgz:1.0.0`
123
126
  # 2.0.0 `nexus-cli pull com.artifact:my-artifact:tgz:2.0.0`
124
127
  # 3.0.0 `nexus-cli pull com.artifact:my-artifact:tgz:3.0.0`
@@ -127,8 +130,7 @@ module NexusCli
127
130
  response = nexus.get(nexus_url("service/local/data_index"), :query => {:g => group_id, :a => artifact_id})
128
131
  case response.status
129
132
  when 200
130
- doc = REXML::Document.new(response.content)
131
- return format_search_results(doc, group_id, artifact_id)
133
+ return response.content
132
134
  else
133
135
  raise UnexpectedStatusCodeException.new(response.status)
134
136
  end
@@ -142,14 +144,14 @@ module NexusCli
142
144
 
143
145
  # Formats the given XML into an [Array<String>] so it
144
146
  # can be displayed nicely.
145
- #
147
+ #
146
148
  # @param doc [REXML::Document] the xml search results
147
149
  # @param group_id [String] the group id
148
150
  # @param artifact_id [String] the artifact id
149
- #
151
+ #
150
152
  # @return [type] [description]
151
153
  def format_search_results(doc, group_id, artifact_id)
152
-
154
+
153
155
  versions = []
154
156
  REXML::XPath.each(doc, "//version") { |matched_version| versions << matched_version.text }
155
157
  if versions.length > 0
@@ -159,18 +161,18 @@ module NexusCli
159
161
  temp_version = version + ":"
160
162
  array << "#{temp_version.ljust(indent_size)} `nexus-cli pull #{group_id}:#{artifact_id}:#{version}:tgz`"
161
163
  end
162
- else
164
+ else
163
165
  formated_results = ['No Versions Found.']
164
- end
166
+ end
165
167
  end
166
168
 
167
169
  # Transfers an artifact from one repository
168
170
  # to another. Sometimes called a `promotion`
169
- #
171
+ #
170
172
  # @param coordinates [String] a Maven identifier
171
173
  # @param from_repository [String] the name of the from repository
172
174
  # @param to_repository [String] the name of the to repository
173
- #
175
+ #
174
176
  # @return [Boolean] returns true when successful
175
177
  def do_transfer_artifact(coordinates, from_repository, to_repository)
176
178
  Dir.mktmpdir do |temp_dir|
@@ -50,7 +50,7 @@ module NexusCli
50
50
 
51
51
  desc "search_for_artifacts", "Searches for all the versions of a particular artifact and prints it to the screen."
52
52
  def search_for_artifacts(coordinates)
53
- nexus_remote.search_for_artifacts(coordinates).each{|output| say output, :green}
53
+ say nexus_remote.search_for_artifacts(coordinates), :green
54
54
  end
55
55
 
56
56
  desc "get_artifact_custom_info coordinates", "Gets and returns the custom metadata in XML format about a particular artifact."
@@ -105,7 +105,7 @@ module NexusCli
105
105
  say "Your current Nexus global settings have been written to the file: ~/.nexus/global_settings.json", :blue
106
106
  end
107
107
 
108
- method_option :json,
108
+ method_option :json,
109
109
  :type => :string,
110
110
  :default => nil,
111
111
  :desc => "A String of the JSON you wish to upload."
@@ -190,10 +190,10 @@ module NexusCli
190
190
  :require => false,
191
191
  :desc => "An array of roles."
192
192
  desc "create_user", "Creates a new user"
193
- def create_user
193
+ def create_user
194
194
  params = ask_user(options)
195
195
 
196
- if nexus_remote.create_user(params)
196
+ if nexus_remote.create_user(params)
197
197
  say "A user with the ID of #{params[:userId]} has been created.", :blue
198
198
  end
199
199
  end
@@ -326,7 +326,7 @@ module NexusCli
326
326
  desc "disable_smart_proxy", "Disables Smart Proxy on the server."
327
327
  def disable_smart_proxy
328
328
  raise NotNexusProException unless nexus_remote.kind_of? ProRemote
329
- say nexus_remote.disable_smart_proxy
329
+ say nexus_remote.disable_smart_proxy
330
330
  end
331
331
 
332
332
  desc "get_smart_proxy_settings", "Returns the Smart Proxy settings of the server."
@@ -453,9 +453,9 @@ module NexusCli
453
453
  password = params[:password]
454
454
  roles = params[:roles]
455
455
  status = enabled
456
-
456
+
457
457
  if username.nil? && ask_username
458
- username = ask "Please enter the username:"
458
+ username = ask "Please enter the username:"
459
459
  end
460
460
  if first_name.nil?
461
461
  first_name = ask "Please enter the first name:"
@@ -472,7 +472,7 @@ module NexusCli
472
472
  if password.nil? && ask_password
473
473
  password = ask_password("Please enter a password:")
474
474
  end
475
- if roles.size == 0
475
+ if roles.size == 0
476
476
  roles = ask "Please enter the roles:"
477
477
  end
478
478
  params = {:userId => username}
@@ -486,7 +486,7 @@ module NexusCli
486
486
  end
487
487
 
488
488
  def ask_password(message)
489
- HighLine.new.ask(message) do |q|
489
+ HighLine.new.ask(message) do |q|
490
490
  q.echo = false
491
491
  end
492
492
  end
data/nexus_cli.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency 'activesupport', '>= 3.2.0'
27
27
 
28
28
  s.add_development_dependency 'rspec'
29
- s.add_development_dependency 'aruba'
29
+ s.add_development_dependency 'aruba', "= 0.5.0"
30
30
  s.add_development_dependency 'cucumber'
31
31
  s.add_development_dependency 'rake'
32
32
  s.add_development_dependency 'webmock'
@@ -7,4 +7,4 @@
7
7
  <info>test 2</info>
8
8
  </artifact>
9
9
  </data>
10
- </search-results>
10
+ </search-results>
data/spec/spec_helper.rb CHANGED
@@ -19,4 +19,4 @@ end
19
19
 
20
20
  def fixtures_path
21
21
  app_root_path.join('spec/fixtures')
22
- end
22
+ end
@@ -25,6 +25,19 @@ describe NexusCli::Configuration do
25
25
  it "returns a new Configuration object" do
26
26
  expect(from_overrides).to be_a(NexusCli::Configuration)
27
27
  end
28
+
29
+ context "without username and password" do
30
+ let(:valid_config) do
31
+ {
32
+ "url" => "http://somewebsite.com",
33
+ "repository" => "foo"
34
+ }
35
+ end
36
+
37
+ it "should not raise an exception" do
38
+ expect { from_overrides.validate! }.not_to raise_error
39
+ end
40
+ end
28
41
  end
29
42
 
30
43
  describe "::from_file" do
@@ -17,5 +17,5 @@ describe NexusCli::CustomMetadataActions do
17
17
  get_artifact_array.should be_a(Array)
18
18
  get_artifact_array.each { |element| element.should be_a(String) }
19
19
  end
20
- end
20
+ end
21
21
  end
@@ -7,6 +7,30 @@ remote = NexusCli::OSSRemote.new(
7
7
  'password' => 'admin123'
8
8
  )
9
9
 
10
+
11
+ fake_xml = <<EOS
12
+ <search-results>
13
+ <totalCount>1</totalCount>
14
+ <from>-1</from>
15
+ <count>-1</count>
16
+ <tooManyResults>false</tooManyResults>
17
+ <data>
18
+ <artifact>
19
+ <resourceURI>https://someuri.com/com/something/thing.tgz</resourceURI>
20
+ <groupId>com.something</groupId>
21
+ <artifactId>thing-stuff</artifactId>
22
+ <version>0.4.0</version>
23
+ <packaging>tgz</packaging>
24
+ <extension>tgz</extension>
25
+ <repoId>company_artifact</repoId>
26
+ <contextId>Company Replicated Artifacts</contextId>
27
+ <pomLink>https://somedomain.com/nexus/service/local/artifact/maven/redirect?r=company_artifact&amp;g=com.something&amp;a=thing-stuff&amp;v=0.4.0&amp;e=pom</pomLink>
28
+ <artifactLink>https://somedomain/nexus/service/local/artifact/maven/redirect?r=ompany_artifact&amp;g=com.something&amp;a=thing-stuff&amp;v=0.4.0&amp;e=tgz</artifactLink>
29
+ </artifact>
30
+ </data>
31
+ </search-results>
32
+ EOS
33
+
10
34
  describe NexusCli do
11
35
  it "gives you errors when you attempt to pull an artifact don't give a valid artifact name" do
12
36
  expect {remote.pull_artifact "com.something:something", nil}.to raise_error(NexusCli::ArtifactMalformedException)
@@ -15,7 +39,7 @@ describe NexusCli do
15
39
  it "gives you errors when you attempt to get an artifact's info and don't give a valid artifact name" do
16
40
  expect {remote.get_artifact_info "com.something:something"}.to raise_error(NexusCli::ArtifactMalformedException)
17
41
  end
18
-
42
+
19
43
  it "gives you errors when you attempt to pull an artifact and it cannot be found" do
20
44
  HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
21
45
  expect {remote.pull_artifact "com.something:something:tgz:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
@@ -46,4 +70,9 @@ describe NexusCli do
46
70
  it "gives you an error when you try to set the logging level to something weird" do
47
71
  expect {remote.set_logger_level("weird")}.to raise_error(NexusCli::InvalidLoggingLevelException)
48
72
  end
73
+
74
+ it "will return raw xml from the search command" do
75
+ stub_request(:get, "http://admin:admin123@localhost:8081/nexus/service/local/data_index?a=something&g=com.something").to_return(:status => 200, :body => fake_xml, :headers => {})
76
+ remote.search_for_artifacts("com.something:something").should eq fake_xml
77
+ end
49
78
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta1
5
- prerelease: 6
4
+ version: 4.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kyle Allan
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-25 00:00:00.000000000 Z
12
+ date: 2013-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -160,17 +160,17 @@ dependencies:
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
- - - ! '>='
163
+ - - '='
164
164
  - !ruby/object:Gem::Version
165
- version: '0'
165
+ version: 0.5.0
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
171
- - - ! '>='
171
+ - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: 0.5.0
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: cucumber
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -288,13 +288,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
288
  version: '0'
289
289
  segments:
290
290
  - 0
291
- hash: 4253291549693801280
291
+ hash: 64115953308248345
292
292
  required_rubygems_version: !ruby/object:Gem::Requirement
293
293
  none: false
294
294
  requirements:
295
- - - ! '>'
295
+ - - ! '>='
296
296
  - !ruby/object:Gem::Version
297
- version: 1.3.1
297
+ version: '0'
298
+ segments:
299
+ - 0
300
+ hash: 64115953308248345
298
301
  requirements: []
299
302
  rubyforge_project:
300
303
  rubygems_version: 1.8.23