nexus_cli_nx 4.1.2 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/Guardfile +1 -1
- data/README.md +2 -1
- data/Thorfile +3 -3
- data/VERSION +1 -1
- data/lib/nexus_cli.rb +0 -1
- data/lib/nexus_cli/configuration.rb +12 -7
- data/nexus_cli_nx.gemspec +0 -1
- data/spec/spec_helper.rb +4 -13
- data/spec/unit/nexus_cli/configuration_spec.rb +3 -14
- data/spec/unit/nexus_cli/mixins/pro/custom_metadata_actions_spec.rb +2 -2
- data/spec/unit/nexus_cli/oss_remote_spec.rb +13 -12
- data/spec/unit/nexus_cli/pro_remote_spec.rb +2 -2
- data/spec/unit/nexus_cli/remote_factory_spec.rb +5 -5
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852ce8270ce7c4c686f146f5a7658f5b6eb67ed7d9fdcc91d0104901f0c6ed8b
|
4
|
+
data.tar.gz: 7885abdb6f97d60158c9ca0bbfaffb3ee0aa19f67e66859e0124507801d691d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d23059cc585e85a4fa40926c2605e0d34f4632d57e1749d8c6b47c26831ce3cb4c8fe18c36b37146588a56e50c5744193542f0496b0f23eaf0432d9ddb4c011d
|
7
|
+
data.tar.gz: 4ec14c935f6398d7e85348c67da27dd77b3b56c07f2257565c70f6891fb54d5c6d628e999032fb2fdafc349f2389d9796a69cc8f6ed1d54c9ea56504f1ca827f
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Guardfile
CHANGED
@@ -12,7 +12,7 @@ guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
|
|
12
12
|
watch(%r{ext/.+\.c})
|
13
13
|
end
|
14
14
|
|
15
|
-
guard 'rspec', cli: "--color --
|
15
|
+
guard 'rspec', cli: "--color --format Fuubar", all_on_start: false, all_after_pass: false do
|
16
16
|
watch(%r{^spec/unit/.+_spec\.rb$})
|
17
17
|
|
18
18
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Nexus CLI No-eXtlib
|
2
|
+
[![Build Status](https://travis-ci.org/mbakhoff/nexus_cli_nx.png)](https://travis-ci.org/mbakhoff/nexus_cli_nx)
|
2
3
|
|
3
4
|
A CLI wrapper around Sonatype Nexus REST calls.
|
4
5
|
|
@@ -11,7 +12,7 @@ The original author is Kyle Allan of RiotGames.
|
|
11
12
|
|
12
13
|
# Installation
|
13
14
|
|
14
|
-
1. Install the Gem - `gem install
|
15
|
+
1. Install the Gem - `gem install nexus_cli_nx`
|
15
16
|
2. Create a file in your user's home directory named `.nexus_cli`
|
16
17
|
3. Give the file the following information:
|
17
18
|
|
data/Thorfile
CHANGED
@@ -11,17 +11,17 @@ class Default < Thor
|
|
11
11
|
include Thor::RakeCompat
|
12
12
|
Bundler::GemHelper.install_tasks
|
13
13
|
|
14
|
-
desc "build", "Build
|
14
|
+
desc "build", "Build nexus_cli_nx-#{NexusCli.version}.gem into the pkg directory"
|
15
15
|
def build
|
16
16
|
Rake::Task["build"].execute
|
17
17
|
end
|
18
18
|
|
19
|
-
desc "install", "Build and install
|
19
|
+
desc "install", "Build and install nexus_cli_nx-#{NexusCli.version}.gem into system gems"
|
20
20
|
def install
|
21
21
|
Rake::Task["install"].execute
|
22
22
|
end
|
23
23
|
|
24
|
-
desc "release", "Create tag v#{NexusCli.version} and build and push
|
24
|
+
desc "release", "Create tag v#{NexusCli.version} and build and push nexus_cli_nx-#{NexusCli.version}.gem to Rubygems"
|
25
25
|
def release
|
26
26
|
Rake::Task["release"].execute
|
27
27
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.1.
|
1
|
+
4.1.3
|
data/lib/nexus_cli.rb
CHANGED
@@ -19,9 +19,8 @@ module NexusCli
|
|
19
19
|
# @return [NexusCli::Configuration]
|
20
20
|
def from_overrides(overrides)
|
21
21
|
raise MissingSettingsFileException unless overrides
|
22
|
-
overrides = overrides.with_indifferent_access
|
23
22
|
|
24
|
-
configuration =
|
23
|
+
configuration = load_config || Hash.new
|
25
24
|
configuration.merge!(overrides)
|
26
25
|
new(configuration)
|
27
26
|
end
|
@@ -33,7 +32,6 @@ module NexusCli
|
|
33
32
|
def from_file
|
34
33
|
config = load_config
|
35
34
|
raise MissingSettingsFileException unless config
|
36
|
-
config = config.with_indifferent_access
|
37
35
|
new(config)
|
38
36
|
end
|
39
37
|
|
@@ -84,10 +82,10 @@ module NexusCli
|
|
84
82
|
attr_accessor :password
|
85
83
|
|
86
84
|
def initialize(options)
|
87
|
-
@url = options[:url]
|
88
|
-
@repository = options[:repository]
|
89
|
-
@username = options[:username]
|
90
|
-
@password = options[:password]
|
85
|
+
@url = options[:url] || options['url']
|
86
|
+
@repository = options[:repository] || options['repository']
|
87
|
+
@username = options[:username] || options['username']
|
88
|
+
@password = options[:password] || options['password']
|
91
89
|
|
92
90
|
if @repository.is_a?(String)
|
93
91
|
@repository = @repository.gsub(' ', '_')
|
@@ -97,5 +95,12 @@ module NexusCli
|
|
97
95
|
def [](attr)
|
98
96
|
self.instance_variable_get('@' + attr.to_s)
|
99
97
|
end
|
98
|
+
|
99
|
+
def []=(attr, value)
|
100
|
+
self.instance_variable_set('@' + attr.to_s, value)
|
101
|
+
if @repository.is_a?(String)
|
102
|
+
@repository = @repository.gsub(' ', '_')
|
103
|
+
end
|
104
|
+
end
|
100
105
|
end
|
101
106
|
end
|
data/nexus_cli_nx.gemspec
CHANGED
@@ -22,7 +22,6 @@ 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 'activesupport', '~> 3.2.0'
|
26
25
|
|
27
26
|
s.add_development_dependency 'rspec'
|
28
27
|
s.add_development_dependency 'aruba', "= 0.5.0"
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'spork'
|
1
|
+
require 'nexus_cli'
|
2
|
+
require 'webmock/rspec'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
APP_ROOT = File.expand_path('../../', __FILE__)
|
9
|
-
ENV["NEXUS_CONFIG"] = File.join(APP_ROOT, "spec", "fixtures", "nexus.config")
|
10
|
-
end
|
11
|
-
|
12
|
-
Spork.each_run do
|
13
|
-
require 'nexus_cli'
|
14
|
-
end
|
4
|
+
APP_ROOT = File.expand_path('../../', __FILE__)
|
5
|
+
ENV["NEXUS_CONFIG"] = File.join(APP_ROOT, "spec", "fixtures", "nexus.config")
|
15
6
|
|
16
7
|
def app_root_path
|
17
8
|
Pathname.new(File.expand_path('../..', __FILE__))
|
@@ -53,7 +53,7 @@ describe NexusCli::Configuration do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
before do
|
56
|
-
YAML.
|
56
|
+
allow(YAML).to receive(:load_file).and_return(partial_config_file)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "uses non-overridden parts from the file" do
|
@@ -66,10 +66,6 @@ describe NexusCli::Configuration do
|
|
66
66
|
subject { from_file }
|
67
67
|
let(:from_file) { configuration.from_file }
|
68
68
|
|
69
|
-
before do
|
70
|
-
YAML.stub(:load_file).and_return(valid_config)
|
71
|
-
end
|
72
|
-
|
73
69
|
context "when the NEXUS_CONFIG environment variable exists" do
|
74
70
|
let(:nexus_config_path) { "/home/var/nexus_cli" }
|
75
71
|
|
@@ -78,7 +74,7 @@ describe NexusCli::Configuration do
|
|
78
74
|
end
|
79
75
|
|
80
76
|
it "loads the config file from NEXUS_CONFIG" do
|
81
|
-
YAML.
|
77
|
+
expect(YAML).to receive(:load_file).with(nexus_config_path).and_return(valid_config)
|
82
78
|
from_file
|
83
79
|
end
|
84
80
|
end
|
@@ -91,7 +87,7 @@ describe NexusCli::Configuration do
|
|
91
87
|
end
|
92
88
|
|
93
89
|
it "loads the config file from DEFAULT_FILE" do
|
94
|
-
YAML.
|
90
|
+
expect(YAML).to receive(:load_file).with(nexus_config_path).and_return(valid_config)
|
95
91
|
from_file
|
96
92
|
end
|
97
93
|
end
|
@@ -136,13 +132,6 @@ describe NexusCli::Configuration do
|
|
136
132
|
it "returns the repository" do
|
137
133
|
expect(repository_config.repository).to eq("releases")
|
138
134
|
end
|
139
|
-
|
140
|
-
context "when repository has illegal values" do
|
141
|
-
let(:repository) { "ILLEGAL VALUE" }
|
142
|
-
it "makes it legal" do
|
143
|
-
expect(repository_config.repository).to eq("illegal_value")
|
144
|
-
end
|
145
|
-
end
|
146
135
|
end
|
147
136
|
|
148
137
|
describe "#username" do
|
@@ -14,8 +14,8 @@ describe NexusCli::CustomMetadataActions do
|
|
14
14
|
let(:get_artifact_array) { custom_metadata_actions.send(:get_artifact_array, document) }
|
15
15
|
|
16
16
|
it "returns an array of strings" do
|
17
|
-
get_artifact_array.
|
18
|
-
get_artifact_array.each { |element| element.
|
17
|
+
expect(get_artifact_array).to be_a(Array)
|
18
|
+
get_artifact_array.each { |element| expect(element).to be_a(String) }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
remote
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
def remote
|
4
|
+
NexusCli::OSSRemote.new(
|
5
|
+
'url' => 'http://localhost:8081/nexus',
|
6
|
+
'repository' => 'releases',
|
7
|
+
'username' => 'admin',
|
8
|
+
'password' => 'admin123'
|
9
|
+
)
|
10
|
+
end
|
10
11
|
|
11
12
|
fake_xml = <<EOS
|
12
|
-
|
13
|
+
<search-results>
|
13
14
|
<totalCount>1</totalCount>
|
14
15
|
<from>-1</from>
|
15
16
|
<count>-1</count>
|
@@ -41,17 +42,17 @@ describe NexusCli do
|
|
41
42
|
end
|
42
43
|
|
43
44
|
it "gives you errors when you attempt to pull an artifact and it cannot be found" do
|
44
|
-
HTTPClient.
|
45
|
+
expect_any_instance_of(HTTPClient).to receive(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
45
46
|
expect {remote.pull_artifact "com.something:something:tgz:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
|
46
47
|
end
|
47
48
|
|
48
49
|
it "gives you errors when you attempt to get an artifact's info and it cannot be found" do
|
49
|
-
HTTPClient.
|
50
|
+
expect_any_instance_of(HTTPClient).to receive(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
50
51
|
expect {remote.get_artifact_info "com.something:something:tgz:1.0.0"}.to raise_error(NexusCli::ArtifactNotFoundException)
|
51
52
|
end
|
52
53
|
|
53
54
|
it "gives you errors when you attempt to pull an artifact with classifier and it cannot be found" do
|
54
|
-
HTTPClient.
|
55
|
+
expect_any_instance_of(HTTPClient).to receive(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
55
56
|
expect {remote.pull_artifact "com.something:something:tgz:x64:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
|
56
57
|
end
|
57
58
|
|
@@ -77,7 +78,7 @@ describe NexusCli do
|
|
77
78
|
end
|
78
79
|
|
79
80
|
it "gives you errors when you attempt to get an artifact's download url and it cannot be found" do
|
80
|
-
HTTPClient.
|
81
|
+
expect_any_instance_of(HTTPClient).to receive(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
81
82
|
expect {remote.get_artifact_download_url "com.something:something:tgz:1.0.0"}.to raise_error(NexusCli::ArtifactNotFoundException)
|
82
83
|
end
|
83
84
|
end
|
@@ -15,7 +15,7 @@ describe NexusCli::ProRemote do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "gives you errors when you attempt to get an artifact's custom info and it cannot be found" do
|
18
|
-
HTTPClient.
|
18
|
+
expect_any_instance_of(HTTPClient).to receive(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
19
19
|
expect {remote.get_artifact_custom_info("com.something:something:tgz:1.0.0")}.to raise_error(NexusCli::ArtifactNotFoundException)
|
20
20
|
end
|
21
21
|
|
@@ -28,7 +28,7 @@ describe NexusCli::ProRemote do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "gives you errors when you attempt to clear an artifact's custom info and it cannot be found" do
|
31
|
-
HTTPClient.
|
31
|
+
expect_any_instance_of(HTTPClient).to receive(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
32
32
|
expect {remote.clear_artifact_custom_info("com.something:something:tgz:1.0.0")}.to raise_error(NexusCli::ArtifactNotFoundException)
|
33
33
|
end
|
34
34
|
|
@@ -9,9 +9,9 @@ describe NexusCli::RemoteFactory do
|
|
9
9
|
let(:create) { remote_factory.create(overrides) }
|
10
10
|
|
11
11
|
before do
|
12
|
-
NexusCli::Connection.
|
13
|
-
remote_factory.
|
14
|
-
NexusCli::OSSRemote.
|
12
|
+
expect(NexusCli::Connection).to receive(:new)
|
13
|
+
allow(remote_factory).to receive(:running_nexus_pro?).and_return(false)
|
14
|
+
expect(NexusCli::OSSRemote).to receive(:new)
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when overrides are passed in" do
|
@@ -25,7 +25,7 @@ describe NexusCli::RemoteFactory do
|
|
25
25
|
}
|
26
26
|
|
27
27
|
it "loads configuration from the overrides" do
|
28
|
-
NexusCli::Configuration.
|
28
|
+
expect(NexusCli::Configuration).to receive(:from_overrides).with(overrides)
|
29
29
|
create
|
30
30
|
end
|
31
31
|
end
|
@@ -34,7 +34,7 @@ describe NexusCli::RemoteFactory do
|
|
34
34
|
let(:overrides) { nil }
|
35
35
|
|
36
36
|
it "loads configuration from the config file" do
|
37
|
-
NexusCli::Configuration.
|
37
|
+
expect(NexusCli::Configuration).to receive(:from_file)
|
38
38
|
create
|
39
39
|
end
|
40
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus_cli_nx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Märt Bakhoff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-05-
|
12
|
+
date: 2018-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -81,20 +81,6 @@ dependencies:
|
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: activesupport
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - "~>"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 3.2.0
|
91
|
-
type: :runtime
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: 3.2.0
|
98
84
|
- !ruby/object:Gem::Dependency
|
99
85
|
name: rspec
|
100
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
227
|
version: '0'
|
242
228
|
requirements: []
|
243
229
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.7.
|
230
|
+
rubygems_version: 2.7.7
|
245
231
|
signing_key:
|
246
232
|
specification_version: 4
|
247
233
|
summary: A command-line wrapper for making REST calls to Sonatype Nexus. Fork of nexus_cli
|