kpm 0.8.2 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +73 -8
- data/README.adoc +37 -2
- data/docker/docker-compose.ci.mysql.yml +21 -0
- data/kpm.gemspec +4 -3
- data/lib/kpm/account.rb +3 -2
- data/lib/kpm/coordinates.rb +4 -3
- data/lib/kpm/database.rb +3 -2
- data/lib/kpm/formatter.rb +2 -2
- data/lib/kpm/inspector.rb +2 -2
- data/lib/kpm/killbill_server_artifact.rb +19 -10
- data/lib/kpm/migrations.rb +18 -4
- data/lib/kpm/nexus_helper/actions.rb +9 -5
- data/lib/kpm/nexus_helper/cloudsmith_api_calls.rb +85 -0
- data/lib/kpm/nexus_helper/github_api_calls.rb +70 -0
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +79 -50
- data/lib/kpm/plugins_directory.yml +8 -4
- data/lib/kpm/plugins_manager.rb +12 -5
- data/lib/kpm/tasks.rb +23 -7
- data/lib/kpm/tenant_config.rb +1 -1
- data/lib/kpm/tomcat_manager.rb +1 -0
- data/lib/kpm/version.rb +1 -1
- data/pom.xml +211 -40
- data/spec/kpm/remote/base_artifact_spec.rb +15 -13
- data/spec/kpm/remote/base_installer_spec.rb +13 -13
- data/spec/kpm/remote/cloudsmith_api_calls_spec.rb +109 -0
- data/spec/kpm/remote/github_api_calls_spec.rb +40 -0
- data/spec/kpm/remote/installer_spec.rb +30 -30
- data/spec/kpm/remote/kaui_artifact_spec.rb +4 -4
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -19
- data/spec/kpm/remote/killbill_server_artifact_spec.rb +13 -13
- data/spec/kpm/remote/migrations_spec.rb +9 -9
- data/spec/kpm/remote/nexus_facade_spec.rb +2 -2
- data/spec/kpm/remote/tenant_config_spec.rb +3 -3
- data/spec/kpm/remote/tomcat_manager_spec.rb +2 -2
- data/spec/kpm/unit/actions_spec.rb +2 -2
- data/spec/kpm/unit/base_artifact_spec.rb +14 -14
- data/spec/kpm/unit/inspector_spec.rb +28 -28
- data/spec/kpm/unit/installer_spec.rb +4 -4
- data/spec/kpm/unit/plugins_directory_spec.rb +31 -31
- data/spec/kpm/unit/plugins_manager_spec.rb +54 -54
- data/spec/kpm/unit/sha1_checker_spec.rb +2 -2
- data/spec/kpm/unit/uninstaller_spec.rb +21 -21
- data/spec/kpm/unit_mysql/account_spec.rb +13 -13
- data/spec/spec_helper.rb +1 -1
- metadata +27 -14
@@ -36,9 +36,9 @@ describe KPM::Sha1Checker do
|
|
36
36
|
it 'should create intermediate directories' do
|
37
37
|
Dir.mktmpdir do |dir|
|
38
38
|
config = File.join(dir, 'foo', 'bar', 'baz', 'sha1.yml')
|
39
|
-
expect(File.exist?(config)).to
|
39
|
+
expect(File.exist?(config)).to be_falsey
|
40
40
|
KPM::Sha1Checker.from_file(config)
|
41
|
-
expect(File.exist?(config)).to
|
41
|
+
expect(File.exist?(config)).to be_truthy
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -29,16 +29,16 @@ describe KPM::Uninstaller do
|
|
29
29
|
let(:version2) { '2.0' }
|
30
30
|
|
31
31
|
before do
|
32
|
-
KPM::PluginsManager.
|
33
|
-
KPM::Sha1Checker.
|
32
|
+
allow(KPM::PluginsManager).to receive(:new).and_return(plugins_manager_mock)
|
33
|
+
allow(KPM::Sha1Checker).to receive(:from_file).and_return(sha1_checker_mock)
|
34
34
|
|
35
35
|
# Calls by the Inspector
|
36
|
-
plugins_manager_mock.
|
36
|
+
allow(plugins_manager_mock).to receive(:get_identifier_key_and_entry) do
|
37
37
|
[plugin_key, { 'group_id' => plugin_info[:group_id],
|
38
38
|
'artifact_id' => plugin_info[:artifact_id],
|
39
39
|
'packaging' => plugin_info[:packaging] }]
|
40
40
|
end
|
41
|
-
sha1_checker_mock.
|
41
|
+
allow(sha1_checker_mock).to receive(:all_sha1) { {} }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'utility methods' do
|
@@ -94,33 +94,33 @@ describe KPM::Uninstaller do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'uninstalls if user confirms action' do
|
97
|
-
KPM.ui.
|
97
|
+
expect(KPM.ui).to receive(:ask).and_return('y')
|
98
98
|
|
99
|
-
plugins_manager_mock.
|
100
|
-
sha1_checker_mock.
|
101
|
-
sha1_checker_mock.
|
99
|
+
expect(plugins_manager_mock).to receive(:remove_plugin_identifier_key).with(plugin_key)
|
100
|
+
expect(sha1_checker_mock).to receive(:remove_entry!).with("group:artifact:jar:#{version1}")
|
101
|
+
expect(sha1_checker_mock).to receive(:remove_entry!).with("group:artifact:jar:#{version2}")
|
102
102
|
|
103
|
-
uninstaller.uninstall_plugin(plugin_name).
|
103
|
+
expect(uninstaller.uninstall_plugin(plugin_name)).to be_truthy
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'does nothing if user cancels' do
|
107
|
-
KPM.ui.
|
107
|
+
expect(KPM.ui).to receive(:ask).and_return('n')
|
108
108
|
|
109
|
-
uninstaller.uninstall_plugin(plugin_name).
|
109
|
+
expect(uninstaller.uninstall_plugin(plugin_name)).to be_falsey
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'uninstalls all plugins without confirmation if the force option is given' do
|
113
|
-
plugins_manager_mock.
|
114
|
-
sha1_checker_mock.
|
115
|
-
sha1_checker_mock.
|
113
|
+
expect(plugins_manager_mock).to receive(:remove_plugin_identifier_key).with(plugin_key)
|
114
|
+
expect(sha1_checker_mock).to receive(:remove_entry!).with("group:artifact:jar:#{version1}")
|
115
|
+
expect(sha1_checker_mock).to receive(:remove_entry!).with("group:artifact:jar:#{version2}")
|
116
116
|
|
117
|
-
uninstaller.uninstall_plugin(plugin_name, true).
|
117
|
+
expect(uninstaller.uninstall_plugin(plugin_name, true)).to be_truthy
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'uninstalls one version without confirmation if the force option is given' do
|
121
|
-
sha1_checker_mock.
|
121
|
+
expect(sha1_checker_mock).to receive(:remove_entry!).with("group:artifact:jar:#{version1}")
|
122
122
|
|
123
|
-
uninstaller.uninstall_plugin(plugin_name, true, version1).
|
123
|
+
expect(uninstaller.uninstall_plugin(plugin_name, true, version1)).to be_truthy
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'raises an error when uninstalling a version that does not exist' do
|
@@ -134,21 +134,21 @@ describe KPM::Uninstaller do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
it 'does not cleanup if dry-run is set' do
|
137
|
-
expect(uninstaller.uninstall_non_default_plugins(true)).to
|
137
|
+
expect(uninstaller.uninstall_non_default_plugins(true)).to be_falsey
|
138
138
|
end
|
139
139
|
|
140
140
|
it 'does cleanup if dry-run isn\'t set' do
|
141
|
-
sha1_checker_mock.
|
141
|
+
expect(sha1_checker_mock).to receive(:remove_entry!).with("group:artifact:jar:#{version1}")
|
142
142
|
|
143
143
|
plugin_info_copy = Marshal.load(Marshal.dump(plugin_info))
|
144
144
|
expect(KPM::Inspector.new.inspect(destination)).to eq({ plugin_name => plugin_info_copy })
|
145
145
|
|
146
|
-
expect(uninstaller.uninstall_non_default_plugins(false)).to
|
146
|
+
expect(uninstaller.uninstall_non_default_plugins(false)).to be_truthy
|
147
147
|
plugin_info_copy[:versions].delete_at(0)
|
148
148
|
expect(KPM::Inspector.new.inspect(destination)).to eq({ plugin_name => plugin_info_copy })
|
149
149
|
|
150
150
|
# Second time is a no-op
|
151
|
-
expect(uninstaller.uninstall_non_default_plugins).to
|
151
|
+
expect(uninstaller.uninstall_non_default_plugins).to be_falsey
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
@@ -37,7 +37,7 @@ describe KPM::Account do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'when initialized with options' do
|
40
|
-
account_class.
|
40
|
+
expect(account_class).to be_an_instance_of(KPM::Account)
|
41
41
|
expect(account_class.instance_variable_get(:@killbill_api_key)).to eq(killbill_api_key)
|
42
42
|
expect(account_class.instance_variable_get(:@killbill_api_secret)).to eq(killbill_api_secret)
|
43
43
|
expect(account_class.instance_variable_get(:@killbill_user)).to eq(killbill_user)
|
@@ -58,7 +58,7 @@ describe KPM::Account do
|
|
58
58
|
|
59
59
|
it 'when account id found' do
|
60
60
|
expect(account_id).to match(/\w{8}(-\w{4}){3}-\w{12}?/)
|
61
|
-
expect { account_class.send(:fetch_export_data, account_id) }.not_to raise_error
|
61
|
+
expect { account_class.send(:fetch_export_data, account_id) }.not_to raise_error
|
62
62
|
expect(account_class.send(:fetch_export_data, account_id)).to match(account_id)
|
63
63
|
end
|
64
64
|
end
|
@@ -99,12 +99,12 @@ describe KPM::Account do
|
|
99
99
|
|
100
100
|
context 'when exporting data' do
|
101
101
|
it 'when file created' do
|
102
|
-
expect(File.exist?(account_class.send(:export, dummy_data))).to
|
102
|
+
expect(File.exist?(account_class.send(:export, dummy_data))).to be_truthy
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'when file contains account record' do
|
106
|
-
expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{table_name}/)).to
|
107
|
-
expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{cols_names}/)).to
|
106
|
+
expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{table_name}/)).to be_truthy
|
107
|
+
expect(File.readlines(account_class.send(:export, dummy_data)).grep(/#{cols_names}/)).to be_truthy
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -119,13 +119,13 @@ describe KPM::Account do
|
|
119
119
|
|
120
120
|
it 'when file created' do
|
121
121
|
expect(account_id).to match(/\w{8}(-\w{4}){3}-\w{12}?/)
|
122
|
-
expect(File.exist?(account_class.export_data(account_id))).to
|
122
|
+
expect(File.exist?(account_class.export_data(account_id))).to be_truthy
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'when file contains account record' do
|
126
126
|
expect(account_id).to match(/\w{8}(-\w{4}){3}-\w{12}?/)
|
127
|
-
expect(File.readlines(account_class.export_data(account_id)).grep(/#{table_name}/)).to
|
128
|
-
expect(File.readlines(account_class.export_data(account_id)).grep(/#{cols_names}/)).to
|
127
|
+
expect(File.readlines(account_class.export_data(account_id)).grep(/#{table_name}/)).to be_truthy
|
128
|
+
expect(File.readlines(account_class.export_data(account_id)).grep(/#{cols_names}/)).to be_truthy
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -155,7 +155,7 @@ describe KPM::Account do
|
|
155
155
|
include_context 'account'
|
156
156
|
|
157
157
|
it 'when valid date value' do
|
158
|
-
expect { DateTime.parse(account_class.send(:fix_dates, '2017-04-05T15:01:39.000+0000')) }.not_to raise_error
|
158
|
+
expect { DateTime.parse(account_class.send(:fix_dates, '2017-04-05T15:01:39.000+0000')) }.not_to raise_error
|
159
159
|
end
|
160
160
|
|
161
161
|
it 'when valid date value match YYYY-MM-DD HH:MM:SS' do
|
@@ -307,7 +307,7 @@ describe KPM::Account do
|
|
307
307
|
File.open(dummy_data_file, 'w') do |io|
|
308
308
|
io.puts(dummy_data)
|
309
309
|
end
|
310
|
-
expect { account_class.import_data(dummy_data_file, nil, true, false, true) }.not_to raise_error
|
310
|
+
expect { account_class.import_data(dummy_data_file, nil, true, false, true) }.not_to raise_error
|
311
311
|
|
312
312
|
verify_data(dummy_account_id)
|
313
313
|
|
@@ -321,7 +321,7 @@ describe KPM::Account do
|
|
321
321
|
File.open(dummy_data_file, 'w') do |io|
|
322
322
|
io.puts(dummy_data)
|
323
323
|
end
|
324
|
-
expect { account_class.import_data(dummy_data_file, nil, true, false, false) }.not_to raise_error
|
324
|
+
expect { account_class.import_data(dummy_data_file, nil, true, false, false) }.not_to raise_error
|
325
325
|
|
326
326
|
verify_data(dummy_account_id)
|
327
327
|
|
@@ -335,7 +335,7 @@ describe KPM::Account do
|
|
335
335
|
File.open(dummy_data_file, 'w') do |io|
|
336
336
|
io.puts(dummy_data)
|
337
337
|
end
|
338
|
-
expect { account_class.import_data(dummy_data_file, 10, true, false, true) }.not_to raise_error
|
338
|
+
expect { account_class.import_data(dummy_data_file, 10, true, false, true) }.not_to raise_error
|
339
339
|
|
340
340
|
verify_data(dummy_account_id)
|
341
341
|
|
@@ -349,7 +349,7 @@ describe KPM::Account do
|
|
349
349
|
File.open(dummy_data_file, 'w') do |io|
|
350
350
|
io.puts(dummy_data)
|
351
351
|
end
|
352
|
-
expect { account_class.import_data(dummy_data_file, 10, true, true, true) }.not_to raise_error
|
352
|
+
expect { account_class.import_data(dummy_data_file, 10, true, true, true) }.not_to raise_error
|
353
353
|
new_account_id = account_class.instance_variable_get(:@tables_id)
|
354
354
|
|
355
355
|
verify_data(new_account_id['accounts_id'])
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -67,39 +67,47 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.19.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: gem-release
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 10.0.0
|
76
|
-
- - "<"
|
73
|
+
- - "~>"
|
77
74
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
75
|
+
version: '2.2'
|
79
76
|
type: :development
|
80
77
|
prerelease: false
|
81
78
|
version_requirements: !ruby/object:Gem::Requirement
|
82
79
|
requirements:
|
83
|
-
- - "
|
80
|
+
- - "~>"
|
84
81
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
86
|
-
|
82
|
+
version: '2.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '13.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
87
95
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
96
|
+
version: '13.0'
|
89
97
|
- !ruby/object:Gem::Dependency
|
90
98
|
name: rspec
|
91
99
|
requirement: !ruby/object:Gem::Requirement
|
92
100
|
requirements:
|
93
101
|
- - "~>"
|
94
102
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
103
|
+
version: '3.9'
|
96
104
|
type: :development
|
97
105
|
prerelease: false
|
98
106
|
version_requirements: !ruby/object:Gem::Requirement
|
99
107
|
requirements:
|
100
108
|
- - "~>"
|
101
109
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
110
|
+
version: '3.9'
|
103
111
|
description: A package manager for Kill Bill.
|
104
112
|
email: killbilling-users@googlegroups.com
|
105
113
|
executables:
|
@@ -114,6 +122,7 @@ files:
|
|
114
122
|
- README.adoc
|
115
123
|
- Rakefile
|
116
124
|
- bin/kpm
|
125
|
+
- docker/docker-compose.ci.mysql.yml
|
117
126
|
- install_example.yml
|
118
127
|
- kpm.gemspec
|
119
128
|
- lib/kpm.rb
|
@@ -133,6 +142,8 @@ files:
|
|
133
142
|
- lib/kpm/killbill_server_artifact.rb
|
134
143
|
- lib/kpm/migrations.rb
|
135
144
|
- lib/kpm/nexus_helper/actions.rb
|
145
|
+
- lib/kpm/nexus_helper/cloudsmith_api_calls.rb
|
146
|
+
- lib/kpm/nexus_helper/github_api_calls.rb
|
136
147
|
- lib/kpm/nexus_helper/nexus_api_calls_v2.rb
|
137
148
|
- lib/kpm/nexus_helper/nexus_facade.rb
|
138
149
|
- lib/kpm/plugins_directory.rb
|
@@ -160,6 +171,8 @@ files:
|
|
160
171
|
- release.sh
|
161
172
|
- spec/kpm/remote/base_artifact_spec.rb
|
162
173
|
- spec/kpm/remote/base_installer_spec.rb
|
174
|
+
- spec/kpm/remote/cloudsmith_api_calls_spec.rb
|
175
|
+
- spec/kpm/remote/github_api_calls_spec.rb
|
163
176
|
- spec/kpm/remote/installer_spec.rb
|
164
177
|
- spec/kpm/remote/kaui_artifact_spec.rb
|
165
178
|
- spec/kpm/remote/killbill_plugin_artifact_spec.rb
|