nexus_cli 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/nexus_cli/errors.rb +7 -0
- data/lib/nexus_cli/nexus_oss_remote.rb +3 -1
- data/lib/nexus_cli/nexus_remote_factory.rb +10 -3
- data/lib/nexus_cli/tasks.rb +6 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.1
|
data/lib/nexus_cli/errors.rb
CHANGED
@@ -223,4 +223,11 @@ The output from the server was:
|
|
223
223
|
end
|
224
224
|
status_code(124)
|
225
225
|
end
|
226
|
+
|
227
|
+
class SSLException < NexusCliError
|
228
|
+
def message
|
229
|
+
"You are attempting to communicate securely with a server that has an untrusted certificate. Please ensure your certificate is correct or set ssl_verify to false."
|
230
|
+
end
|
231
|
+
status_code(125)
|
232
|
+
end
|
226
233
|
end
|
@@ -6,8 +6,9 @@ require 'jsonpath'
|
|
6
6
|
|
7
7
|
module NexusCli
|
8
8
|
class OSSRemote
|
9
|
-
def initialize(overrides)
|
9
|
+
def initialize(overrides, ssl_verify=true)
|
10
10
|
@configuration = Configuration::parse(overrides)
|
11
|
+
@ssl_verify = ssl_verify
|
11
12
|
end
|
12
13
|
|
13
14
|
def configuration
|
@@ -21,6 +22,7 @@ module NexusCli
|
|
21
22
|
# https://github.com/nahi/httpclient/issues/63
|
22
23
|
client.set_auth(nil, configuration['username'], configuration['password'])
|
23
24
|
client.www_auth.basic_auth.challenge(configuration['url'])
|
25
|
+
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_verify
|
24
26
|
return client
|
25
27
|
end
|
26
28
|
|
@@ -5,9 +5,10 @@ require 'yaml'
|
|
5
5
|
module NexusCli
|
6
6
|
class Factory
|
7
7
|
class << self
|
8
|
-
def create(overrides)
|
8
|
+
def create(overrides, ssl_verify)
|
9
9
|
@configuration = Configuration::parse(overrides)
|
10
|
-
|
10
|
+
@ssl_verify = ssl_verify
|
11
|
+
running_nexus_pro? ? ProRemote.new(overrides, ssl_verify) : OSSRemote.new(overrides, ssl_verify)
|
11
12
|
end
|
12
13
|
|
13
14
|
def configuration
|
@@ -19,6 +20,7 @@ module NexusCli
|
|
19
20
|
# https://github.com/nahi/httpclient/issues/63
|
20
21
|
client.set_auth(nil, configuration['username'], configuration['password'])
|
21
22
|
client.www_auth.basic_auth.challenge(configuration['url'])
|
23
|
+
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_verify
|
22
24
|
return client
|
23
25
|
end
|
24
26
|
|
@@ -27,7 +29,12 @@ module NexusCli
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def status
|
30
|
-
|
32
|
+
begin
|
33
|
+
response = nexus.get(nexus_url("service/local/status"))
|
34
|
+
rescue OpenSSL::SSL::SSLError => e
|
35
|
+
raise SSLException
|
36
|
+
end
|
37
|
+
|
31
38
|
case response.status
|
32
39
|
when 200
|
33
40
|
doc = Nokogiri::XML(response.content).xpath("/status/data")
|
data/lib/nexus_cli/tasks.rb
CHANGED
@@ -21,10 +21,15 @@ module NexusCli
|
|
21
21
|
:default => {},
|
22
22
|
:desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
|
23
23
|
|
24
|
+
class_option :ssl_verify,
|
25
|
+
:type => :boolean,
|
26
|
+
:default => true,
|
27
|
+
:desc => "Set to false to disable SSL Verification."
|
28
|
+
|
24
29
|
def initialize(*args)
|
25
30
|
super
|
26
31
|
begin
|
27
|
-
@nexus_remote = Factory.create(options[:overrides])
|
32
|
+
@nexus_remote = Factory.create(options[:overrides], options[:ssl_verify])
|
28
33
|
rescue NexusCliError => e
|
29
34
|
say e.message, :red
|
30
35
|
exit e.status_code
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -253,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
253
253
|
version: '0'
|
254
254
|
segments:
|
255
255
|
- 0
|
256
|
-
hash:
|
256
|
+
hash: 4549159005215379437
|
257
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
258
258
|
none: false
|
259
259
|
requirements:
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
segments:
|
264
264
|
- 0
|
265
|
-
hash:
|
265
|
+
hash: 4549159005215379437
|
266
266
|
requirements: []
|
267
267
|
rubyforge_project:
|
268
268
|
rubygems_version: 1.8.21
|