nexus 1.3.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/commands/abstract_command.rb +31 -7
- data/lib/commands/nexus.rb +5 -0
- data/lib/nexus/cipher.rb +5 -0
- data/lib/nexus/config.rb +5 -0
- data/lib/nexus/config_file.rb +8 -3
- data/lib/nexus/version.rb +6 -1
- data/lib/rubygems_plugin.rb +5 -0
- data/test/abstract_command_test.rb +5 -20
- data/test/cipher_test.rb +5 -0
- data/test/command_helper.rb +6 -1
- data/test/config_test.rb +7 -2
- data/test/configfile_test.rb +6 -1
- data/test/nexus_command_test.rb +11 -6
- metadata +18 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 210f5f076cb3baa04605d4761e4976f03901da8dbf4105e68b53067d31028772
|
4
|
+
data.tar.gz: 965602324a55a6f5a684cde56ac7aa66355acdde0ad43d5454371707b4a0547b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4771813a366dbb775ce709e2a51e01189aa7a1c3bf8bbf6cf5084c057e62c95e0d5d24007f8fc8edb5499602dd806a51446826b22c556cac36c0fd7c9076ba65
|
7
|
+
data.tar.gz: c73b63ddb527c01ace95b4e5a69d3da2922a35c76c9c8ca471a556f22ee1f4d85237eb41b43cf674d1b5912794926392d20e4b438ecba8f0d796bc651f1bccd1
|
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'rubygems/local_remote_options'
|
2
7
|
require 'net/http'
|
3
8
|
require 'base64'
|
@@ -19,6 +24,16 @@ class Gem::AbstractCommand < Gem::Command
|
|
19
24
|
options[ :nexus_clear ] = value
|
20
25
|
end
|
21
26
|
|
27
|
+
add_option( '--url URL',
|
28
|
+
'URL of the rubygems repository on a Nexus server' ) do |value, options|
|
29
|
+
options[ :nexus_url ] = value
|
30
|
+
end
|
31
|
+
|
32
|
+
add_option( '--credential USER:PASS',
|
33
|
+
'Enter your Nexus credentials in "Username:Password" format' ) do |value, options|
|
34
|
+
options[ :nexus_credential ] = value
|
35
|
+
end
|
36
|
+
|
22
37
|
add_option( '--nexus-config FILE',
|
23
38
|
"File location of nexus config to use.\n default #{Nexus::Config.default_file}" ) do |value, options|
|
24
39
|
options[ :nexus_config ] = File.expand_path( value )
|
@@ -38,9 +53,13 @@ class Gem::AbstractCommand < Gem::Command
|
|
38
53
|
end
|
39
54
|
|
40
55
|
def configure_url
|
41
|
-
|
42
|
-
|
43
|
-
|
56
|
+
url =
|
57
|
+
if options[ :nexus_url ]
|
58
|
+
options[ :nexus_url ]
|
59
|
+
else
|
60
|
+
say "Enter the URL of the rubygems repository on a Nexus server"
|
61
|
+
ask("URL: ")
|
62
|
+
end
|
44
63
|
|
45
64
|
if URI.parse( "#{url}" ).host != nil
|
46
65
|
config.url = url
|
@@ -70,12 +89,17 @@ class Gem::AbstractCommand < Gem::Command
|
|
70
89
|
end
|
71
90
|
|
72
91
|
def sign_in
|
73
|
-
|
74
|
-
|
75
|
-
|
92
|
+
token =
|
93
|
+
if options[ :nexus_credential ]
|
94
|
+
options[ :nexus_credential ]
|
95
|
+
else
|
96
|
+
say "Enter your Nexus credentials"
|
97
|
+
username = ask("Username: ")
|
98
|
+
password = ask_for_password("Password: ")
|
99
|
+
"#{username}:#{password}"
|
100
|
+
end
|
76
101
|
|
77
102
|
# mimic strict_encode64 which is not there on ruby1.8
|
78
|
-
token = "#{username}:#{password}"
|
79
103
|
auth = "Basic #{Base64.encode64(token).gsub(/\s+/, '')}"
|
80
104
|
@authorization = token == ':' ? nil : auth
|
81
105
|
|
data/lib/commands/nexus.rb
CHANGED
data/lib/nexus/cipher.rb
CHANGED
data/lib/nexus/config.rb
CHANGED
data/lib/nexus/config_file.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'rubygems/local_remote_options'
|
2
7
|
require 'net/http'
|
3
8
|
require 'base64'
|
@@ -14,7 +19,7 @@ module Nexus
|
|
14
19
|
if configfile.is_a?( String )
|
15
20
|
@file = configfile
|
16
21
|
|
17
|
-
if File.
|
22
|
+
if File.exist?( configfile )
|
18
23
|
@all = YAML.load( ::File.read( configfile ) )
|
19
24
|
else
|
20
25
|
store # make sure we can write it
|
@@ -99,8 +104,8 @@ module Nexus
|
|
99
104
|
|
100
105
|
def store
|
101
106
|
dirname = File.dirname( @file )
|
102
|
-
Dir.mkdir( dirname ) unless File.
|
103
|
-
new = !File.
|
107
|
+
Dir.mkdir( dirname ) unless File.exist?( dirname )
|
108
|
+
new = !File.exist?( @file )
|
104
109
|
|
105
110
|
File.open( @file, 'w') do |f|
|
106
111
|
f.write @all.to_yaml
|
data/lib/nexus/version.rb
CHANGED
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'command_helper'
|
2
7
|
|
3
8
|
class Gem::Commands::FakeCommand < Gem::AbstractCommand
|
@@ -128,26 +133,6 @@ class AbstractCommandTest < CommandTest
|
|
128
133
|
end
|
129
134
|
end
|
130
135
|
|
131
|
-
context 'separeted config per repo key' do
|
132
|
-
should 'store the config on per key' do
|
133
|
-
config_path = File.join( 'pkg', 'configrepo')
|
134
|
-
FileUtils.rm_f( config_path )
|
135
|
-
@command.options[ :nexus_config ] = config_path
|
136
|
-
@command.options[ :nexus_repo ] = :first
|
137
|
-
@command.config.url = :thing
|
138
|
-
@command.options[ :nexus_repo ] = :second
|
139
|
-
@command.send :instance_variable_set, '@config'.to_sym, nil
|
140
|
-
@command.config.url = :otherthing
|
141
|
-
@command.options[ :nexus_repo ] = nil
|
142
|
-
@command.send :instance_variable_set, '@config'.to_sym, nil
|
143
|
-
@command.config.url = :nothing
|
144
|
-
assert_equal( Gem.configuration.load_file(config_path),
|
145
|
-
{ :first => {:url => :thing},
|
146
|
-
:second => {:url => :otherthing},
|
147
|
-
:url => :nothing } )
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
136
|
context "clear username + password" do
|
152
137
|
|
153
138
|
should "clear stored authorization" do
|
data/test/cipher_test.rb
CHANGED
data/test/command_helper.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'minitest/autorun'
|
2
7
|
|
3
8
|
require 'shoulda'
|
@@ -37,7 +42,7 @@ class CommandTest < ActiveSupport::TestCase
|
|
37
42
|
end
|
38
43
|
|
39
44
|
def stub_config(config)
|
40
|
-
file = Gem::ConfigFile.new(
|
45
|
+
file = Gem::ConfigFile.new([])
|
41
46
|
config.each { |key, value| file[key] = value }
|
42
47
|
stub(Gem).configuration { config }
|
43
48
|
end
|
data/test/config_test.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'minitest/autorun'
|
2
7
|
require 'shoulda'
|
3
8
|
require 'fileutils'
|
@@ -87,7 +92,7 @@ class ConfigTest < ::MiniTest::Unit::TestCase
|
|
87
92
|
end
|
88
93
|
|
89
94
|
Nexus::Config.new( file ).new_secrets( sfile )
|
90
|
-
assert File.
|
95
|
+
assert File.exist?( sfile ), true
|
91
96
|
|
92
97
|
repos.each do |repo|
|
93
98
|
c = Nexus::Config.new( sfile, repo )
|
@@ -105,7 +110,7 @@ class ConfigTest < ::MiniTest::Unit::TestCase
|
|
105
110
|
end
|
106
111
|
|
107
112
|
Nexus::Config.new( file ).new_secrets( nil )
|
108
|
-
assert_equal File.
|
113
|
+
assert_equal File.exist?( sfile ), false
|
109
114
|
|
110
115
|
repos.each do |repo|
|
111
116
|
c = Nexus::Config.new( file, repo )
|
data/test/configfile_test.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'minitest/autorun'
|
2
7
|
require 'shoulda'
|
3
8
|
require 'fileutils'
|
@@ -9,7 +14,7 @@ class ConfigTest < ::MiniTest::Unit::TestCase
|
|
9
14
|
context 'file' do
|
10
15
|
|
11
16
|
should 'store key/values' do
|
12
|
-
file = File.join(
|
17
|
+
file = File.join('pkg', 'cfg' )
|
13
18
|
FileUtils.rm_f file
|
14
19
|
f = Nexus::ConfigFile.new( file )
|
15
20
|
f[ 'asd_key', nil ] = 'dsa_value'
|
data/test/nexus_command_test.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2019-present Sonatype, Inc. All rights reserved.
|
3
|
+
# "Sonatype" is a trademark of Sonatype, Inc.
|
4
|
+
#
|
5
|
+
|
1
6
|
require 'command_helper'
|
2
7
|
require 'fileutils'
|
3
8
|
|
@@ -152,8 +157,8 @@ class NexusCommandTest < CommandTest
|
|
152
157
|
@command.options[ :nexus_clear_all ] = true
|
153
158
|
mock(@command).ask( 'delete all current credentials ? (y/N)' ){ 'y' }
|
154
159
|
@command.execute
|
155
|
-
assert_equal( File.
|
156
|
-
assert_equal( File.
|
160
|
+
assert_equal( File.exist?( @with + ".config" ), true )
|
161
|
+
assert_equal( File.exist?( @with + ".secrets" ), false )
|
157
162
|
|
158
163
|
@command.options.delete( :nexus_clear_all )
|
159
164
|
mock(@command).sign_in
|
@@ -194,7 +199,7 @@ class NexusCommandTest < CommandTest
|
|
194
199
|
@command.options[ :nexus_config ] = @with + ".config"
|
195
200
|
@command.options[ :nexus_secrets ] = false
|
196
201
|
@command.execute
|
197
|
-
assert_equal( File.
|
202
|
+
assert_equal( File.exist?( @with + ".secrets" ), false )
|
198
203
|
|
199
204
|
@command.options.delete( :nexus_secrets )
|
200
205
|
mock(@command).send_gem
|
@@ -206,7 +211,7 @@ class NexusCommandTest < CommandTest
|
|
206
211
|
@command.options[ :nexus_config ] = @with
|
207
212
|
@command.options[ :nexus_secrets ] = @with + '.newsecrets'
|
208
213
|
@command.execute
|
209
|
-
assert_equal( File.
|
214
|
+
assert_equal( File.exist?( @with + ".newsecrets" ), true )
|
210
215
|
|
211
216
|
@command.options.delete( :nexus_secrets )
|
212
217
|
mock(@command).send_gem
|
@@ -218,8 +223,8 @@ class NexusCommandTest < CommandTest
|
|
218
223
|
@command.options[ :nexus_config ] = @with + ".config"
|
219
224
|
@command.options[ :nexus_secrets ] = @with + '.newsecrets'
|
220
225
|
@command.execute
|
221
|
-
assert_equal( File.
|
222
|
-
assert_equal( File.
|
226
|
+
assert_equal( File.exist?( @with + ".secrets" ), false )
|
227
|
+
assert_equal( File.exist?( @with + ".newsecrets" ), true )
|
223
228
|
|
224
229
|
@command.options.delete( :nexus_secrets )
|
225
230
|
mock(@command).send_gem
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
|
9
|
-
autorequire:
|
7
|
+
- Sonatype
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
@@ -17,28 +16,14 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
19
|
+
version: '13.1'
|
21
20
|
type: :development
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - "~>"
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: ruby-maven
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 3.1.0.0.0
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 3.1.0.0.0
|
26
|
+
version: '13.1'
|
42
27
|
- !ruby/object:Gem::Dependency
|
43
28
|
name: shoulda
|
44
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,16 +56,16 @@ dependencies:
|
|
71
56
|
name: activesupport
|
72
57
|
requirement: !ruby/object:Gem::Requirement
|
73
58
|
requirements:
|
74
|
-
- -
|
59
|
+
- - '='
|
75
60
|
- !ruby/object:Gem::Version
|
76
|
-
version: 4.0.
|
61
|
+
version: 4.0.13
|
77
62
|
type: :development
|
78
63
|
prerelease: false
|
79
64
|
version_requirements: !ruby/object:Gem::Requirement
|
80
65
|
requirements:
|
81
|
-
- -
|
66
|
+
- - '='
|
82
67
|
- !ruby/object:Gem::Version
|
83
|
-
version: 4.0.
|
68
|
+
version: 4.0.13
|
84
69
|
- !ruby/object:Gem::Dependency
|
85
70
|
name: webmock
|
86
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,18 +92,17 @@ dependencies:
|
|
107
92
|
requirements:
|
108
93
|
- - "~>"
|
109
94
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.4
|
95
|
+
version: '2.4'
|
111
96
|
type: :development
|
112
97
|
prerelease: false
|
113
98
|
version_requirements: !ruby/object:Gem::Requirement
|
114
99
|
requirements:
|
115
100
|
- - "~>"
|
116
101
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2.4
|
102
|
+
version: '2.4'
|
118
103
|
description: Adds a command to RubyGems for uploading gems to a nexus server.
|
119
104
|
email:
|
120
|
-
-
|
121
|
-
- m.kristian@web.de
|
105
|
+
- nexus-gem@sonatype.com
|
122
106
|
executables:
|
123
107
|
- nbundle
|
124
108
|
extensions: []
|
@@ -140,28 +124,11 @@ files:
|
|
140
124
|
- test/config_test.rb
|
141
125
|
- test/configfile_test.rb
|
142
126
|
- test/nexus_command_test.rb
|
143
|
-
homepage: https://
|
127
|
+
homepage: https://links.sonatype.com/products/nxrm3/docs/nexus-gem
|
144
128
|
licenses:
|
145
|
-
- MIT
|
129
|
+
- MIT
|
146
130
|
metadata: {}
|
147
|
-
post_install_message:
|
148
|
-
|
149
|
-
========================================================================
|
150
|
-
|
151
|
-
Thanks for installing Nexus gem! You can now run:
|
152
|
-
|
153
|
-
gem nexus publish your gems onto Nexus server
|
154
|
-
|
155
|
-
nbundle a bundler fork with mirror support. for bundler before 1.5.0
|
156
|
-
|
157
|
-
add a mirror with:
|
158
|
-
|
159
|
-
bundle config mirror.http://rubygems.org http://localhost:8081/nexus/content/repositories/rubygems.org
|
160
|
-
|
161
|
-
for bundler before 1.5.0 use 'nbundle' instead of 'bundle' to use the mirror
|
162
|
-
|
163
|
-
========================================================================
|
164
|
-
|
131
|
+
post_install_message:
|
165
132
|
rdoc_options: []
|
166
133
|
require_paths:
|
167
134
|
- lib
|
@@ -176,9 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
143
|
- !ruby/object:Gem::Version
|
177
144
|
version: '0'
|
178
145
|
requirements: []
|
179
|
-
|
180
|
-
|
181
|
-
signing_key:
|
146
|
+
rubygems_version: 3.5.3
|
147
|
+
signing_key:
|
182
148
|
specification_version: 4
|
183
149
|
summary: Gem Command to interact with Nexus server
|
184
150
|
test_files: []
|