nexus_cli 3.0.0 → 4.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,33 +1,35 @@
1
1
  require 'nexus_cli'
2
2
 
3
- remote = NexusCli::ProRemote.new(
4
- 'url' => 'http://localhost:8081/nexus',
5
- 'repository' => 'releases',
6
- 'username' => 'admin',
7
- 'password' => 'admin123'
8
- )
9
-
10
- describe NexusCli do
3
+ describe NexusCli::ProRemote do
4
+ let(:remote) do
5
+ NexusCli::ProRemote.new(
6
+ 'url' => 'http://localhost:8081/nexus',
7
+ 'repository' => 'releases',
8
+ 'username' => 'admin',
9
+ 'password' => 'admin123'
10
+ )
11
+ end
12
+
11
13
  it "gives you errors when you attempt to get an artifact's custom info and don't give a valid artifact name" do
12
- expect {remote.get_artifact_custom_info("com.something:something:1.0.0")}.to raise_error(NexusCli::ArtifactMalformedException)
14
+ expect {remote.get_artifact_custom_info("com.something:something")}.to raise_error(NexusCli::ArtifactMalformedException)
13
15
  end
14
16
 
15
17
  it "gives you errors when you attempt to get an artifact's custom info and it cannot be found" do
16
18
  HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
17
- expect {remote.get_artifact_custom_info("com.something:something:1.0.0:tgz")}.to raise_error(NexusCli::ArtifactNotFoundException)
19
+ expect {remote.get_artifact_custom_info("com.something:something:tgz:1.0.0")}.to raise_error(NexusCli::ArtifactNotFoundException)
18
20
  end
19
21
 
20
22
  it "gives you errors when you attempt to update an artifact's custom info and don't give valid parameters" do
21
- expect {remote.update_artifact_custom_info("com.something:something:1.0.0:tgz", "_somebadkey:_somebadvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
23
+ expect {remote.update_artifact_custom_info("com.something:something:tgz:1.0.0", "_somebadkey:_somebadvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
22
24
  end
23
25
 
24
26
  it "gives you errors when you attempt to update an artifact's custom info and don't give valid parameters" do
25
- expect {remote.update_artifact_custom_info("com.something:something:1.0.0:tgz", "_somebadkey")}.to raise_error(NexusCli::N3ParameterMalformedException)
27
+ expect {remote.update_artifact_custom_info("com.something:something:tgz:1.0.0", "_somebadkey")}.to raise_error(NexusCli::N3ParameterMalformedException)
26
28
  end
27
29
 
28
30
  it "gives you errors when you attempt to clear an artifact's custom info and it cannot be found" do
29
31
  HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
30
- expect {remote.clear_artifact_custom_info("com.something:something:1.0.0:tgz")}.to raise_error(NexusCli::ArtifactNotFoundException)
32
+ expect {remote.clear_artifact_custom_info("com.something:something:tgz:1.0.0")}.to raise_error(NexusCli::ArtifactNotFoundException)
31
33
  end
32
34
 
33
35
  it "gives you errors when you attempt to search for artifacts using custom info and don't give valid key" do
@@ -48,61 +50,61 @@ describe NexusCli do
48
50
 
49
51
  describe "tests for custom metadata private helper methods" do
50
52
  it "gives you errors when you attempt to parse custom metadata with bad update keys" do
51
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "badkey_:goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
53
+ expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "badkey_:goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
52
54
  end
53
55
 
54
56
  it "gives you errors when you attempt to parse custom metadata with missing update keys" do
55
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, ":goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
57
+ expect {remote.send(:parse_custom_metadata_update_params, ":goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
56
58
  end
57
59
 
58
60
  it "gives you errors when you attempt to parse custom metadata with typo" do
59
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, "goodkeygoodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
61
+ expect {remote.send(:parse_custom_metadata_update_params, "goodkeygoodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
60
62
  end
61
63
 
62
64
  it "gives you errors when you attempt to parse custom metadata with bad update values" do
63
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "goodkey:badvalue\"'\\")}.to raise_error(NexusCli::N3ParameterMalformedException)
65
+ expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "goodkey:badvalue\"'\\")}.to raise_error(NexusCli::N3ParameterMalformedException)
64
66
  end
65
67
 
66
68
  it "gives you errors when you attempt to parse custom metadata with missing search type and value" do
67
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_search_params, "goodkey")}.to raise_error(NexusCli::SearchParameterMalformedException)
69
+ expect {remote.send(:parse_custom_metadata_search_params, "goodkey")}.to raise_error(NexusCli::SearchParameterMalformedException)
68
70
  end
69
71
 
70
72
  it "gives you errors when you attempt to parse custom metadata with bad search type" do
71
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_search_params, "goodkey:eq:goodvalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
73
+ expect {remote.send(:parse_custom_metadata_search_params, "goodkey:eq:goodvalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
72
74
  end
73
75
 
74
76
  it "gives you errors when you attempt to parse custom metadata with bad search value" do
75
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_search_params, "goodkey:equals:badvalue\"'\\")}.to raise_error(NexusCli::SearchParameterMalformedException)
77
+ expect {remote.send(:parse_custom_metadata_search_params, "goodkey:equals:badvalue\"'\\")}.to raise_error(NexusCli::SearchParameterMalformedException)
76
78
  end
77
79
  end
78
80
 
79
81
  describe "tests for custom metadata private helper methods" do
80
82
  it "gives you errors when you attempt to parse custom metadata with bad update keys" do
81
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "badkey_:goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
83
+ expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "badkey_:goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
82
84
  end
83
85
 
84
86
  it "gives you errors when you attempt to parse custom metadata with missing update keys" do
85
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, ":goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
87
+ expect {remote.send(:parse_custom_metadata_update_params, ":goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
86
88
  end
87
89
 
88
90
  it "gives you errors when you attempt to parse custom metadata with typo" do
89
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, "goodkeygoodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
91
+ expect {remote.send(:parse_custom_metadata_update_params, "goodkeygoodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
90
92
  end
91
93
 
92
94
  it "gives you errors when you attempt to parse custom metadata with bad update values" do
93
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "goodkey:badvalue\"'\\")}.to raise_error(NexusCli::N3ParameterMalformedException)
95
+ expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "goodkey:badvalue\"'\\")}.to raise_error(NexusCli::N3ParameterMalformedException)
94
96
  end
95
97
 
96
98
  it "gives you errors when you attempt to parse custom metadata with missing search type and value" do
97
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_search_params, "goodkey")}.to raise_error(NexusCli::SearchParameterMalformedException)
99
+ expect {remote.send(:parse_custom_metadata_search_params, "goodkey")}.to raise_error(NexusCli::SearchParameterMalformedException)
98
100
  end
99
101
 
100
102
  it "gives you errors when you attempt to parse custom metadata with bad search type" do
101
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_search_params, "goodkey:eq:goodvalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
103
+ expect {remote.send(:parse_custom_metadata_search_params, "goodkey:eq:goodvalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
102
104
  end
103
105
 
104
106
  it "gives you errors when you attempt to parse custom metadata with bad search value" do
105
- expect {NexusCli::ProRemote.new(nil).send(:parse_custom_metadata_search_params, "goodkey:equals:badvalue\"'\\")}.to raise_error(NexusCli::SearchParameterMalformedException)
107
+ expect {remote.send(:parse_custom_metadata_search_params, "goodkey:equals:badvalue\"'\\")}.to raise_error(NexusCli::SearchParameterMalformedException)
106
108
  end
107
109
  end
108
110
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe NexusCli::RemoteFactory do
4
+ subject { remote_factory }
5
+ let(:remote_factory) { described_class }
6
+
7
+ describe "::create" do
8
+ subject { create }
9
+ let(:create) { remote_factory.create(overrides) }
10
+
11
+ before do
12
+ NexusCli::Connection.stub(:new)
13
+ remote_factory.stub(:running_nexus_pro?).and_return(false)
14
+ NexusCli::OSSRemote.stub(:new)
15
+ end
16
+
17
+ context "when overrides are passed in" do
18
+ let(:overrides) {
19
+ {
20
+ "url" => "http://somewebsite.com",
21
+ "repository" => "foo",
22
+ "username" => "admin",
23
+ "password" => "password"
24
+ }
25
+ }
26
+
27
+ it "loads configuration from the overrides" do
28
+ NexusCli::Configuration.should_receive(:from_overrides).with(overrides)
29
+ create
30
+ end
31
+ end
32
+
33
+ context "when no overrides are passed in" do
34
+ let(:overrides) { nil }
35
+
36
+ it "loads configuration from the config file" do
37
+ NexusCli::Configuration.should_receive(:from_file)
38
+ create
39
+ end
40
+ end
41
+ end
42
+ 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: 3.0.0
5
- prerelease:
4
+ version: 4.0.0.beta1
5
+ prerelease: 6
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-02-19 00:00:00.000000000 Z
12
+ date: 2013-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -107,6 +107,38 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: chozo
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.6.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 0.6.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: activesupport
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: 3.2.0
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 3.2.0
110
142
  - !ruby/object:Gem::Dependency
111
143
  name: rspec
112
144
  requirement: !ruby/object:Gem::Requirement
@@ -197,6 +229,7 @@ extra_rdoc_files: []
197
229
  files:
198
230
  - .gitignore
199
231
  - .travis.yml
232
+ - CHANGELOG.md
200
233
  - Gemfile
201
234
  - Guardfile
202
235
  - LICENSE
@@ -212,6 +245,7 @@ files:
212
245
  - features/step_definitions/cli_steps.rb
213
246
  - features/support/env.rb
214
247
  - lib/nexus_cli.rb
248
+ - lib/nexus_cli/artifact.rb
215
249
  - lib/nexus_cli/base_remote.rb
216
250
  - lib/nexus_cli/cli.rb
217
251
  - lib/nexus_cli/configuration.rb
@@ -231,11 +265,15 @@ files:
231
265
  - lib/nexus_cli/tasks.rb
232
266
  - lib/nexus_cli/version.rb
233
267
  - nexus_cli.gemspec
268
+ - spec/fixtures/metadata_search.xml
234
269
  - spec/fixtures/nexus.config
235
270
  - spec/spec_helper.rb
271
+ - spec/unit/nexus_cli/artifact_spec.rb
236
272
  - spec/unit/nexus_cli/configuration_spec.rb
273
+ - spec/unit/nexus_cli/mixins/pro/custom_metadata_actions_spec.rb
237
274
  - spec/unit/nexus_cli/oss_remote_spec.rb
238
275
  - spec/unit/nexus_cli/pro_remote_spec.rb
276
+ - spec/unit/nexus_cli/remote_factory_spec.rb
239
277
  homepage: https://github.com/RiotGames/nexus_cli
240
278
  licenses: []
241
279
  post_install_message:
@@ -250,19 +288,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
288
  version: '0'
251
289
  segments:
252
290
  - 0
253
- hash: 1427229917539912472
291
+ hash: 4253291549693801280
254
292
  required_rubygems_version: !ruby/object:Gem::Requirement
255
293
  none: false
256
294
  requirements:
257
- - - ! '>='
295
+ - - ! '>'
258
296
  - !ruby/object:Gem::Version
259
- version: '0'
260
- segments:
261
- - 0
262
- hash: 1427229917539912472
297
+ version: 1.3.1
263
298
  requirements: []
264
299
  rubyforge_project:
265
- rubygems_version: 1.8.24
300
+ rubygems_version: 1.8.23
266
301
  signing_key:
267
302
  specification_version: 3
268
303
  summary: A command-line wrapper for making REST calls to Sonatype Nexus.
@@ -272,9 +307,13 @@ test_files:
272
307
  - features/pro/nexus_pro.feature
273
308
  - features/step_definitions/cli_steps.rb
274
309
  - features/support/env.rb
310
+ - spec/fixtures/metadata_search.xml
275
311
  - spec/fixtures/nexus.config
276
312
  - spec/spec_helper.rb
313
+ - spec/unit/nexus_cli/artifact_spec.rb
277
314
  - spec/unit/nexus_cli/configuration_spec.rb
315
+ - spec/unit/nexus_cli/mixins/pro/custom_metadata_actions_spec.rb
278
316
  - spec/unit/nexus_cli/oss_remote_spec.rb
279
317
  - spec/unit/nexus_cli/pro_remote_spec.rb
318
+ - spec/unit/nexus_cli/remote_factory_spec.rb
280
319
  has_rdoc: