kpm 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +66 -0
- data/Gemfile +2 -0
- data/README.adoc +111 -109
- data/Rakefile +2 -1
- data/bin/kpm +4 -2
- data/kpm.gemspec +8 -6
- data/lib/kpm.rb +3 -0
- data/lib/kpm/account.rb +267 -338
- data/lib/kpm/base_artifact.rb +33 -39
- data/lib/kpm/base_installer.rb +69 -83
- data/lib/kpm/blob.rb +29 -0
- data/lib/kpm/cli.rb +3 -1
- data/lib/kpm/coordinates.rb +6 -9
- data/lib/kpm/database.rb +90 -114
- data/lib/kpm/diagnostic_file.rb +126 -147
- data/lib/kpm/formatter.rb +74 -46
- data/lib/kpm/inspector.rb +22 -32
- data/lib/kpm/installer.rb +53 -46
- data/lib/kpm/kaui_artifact.rb +4 -3
- data/lib/kpm/killbill_plugin_artifact.rb +10 -7
- data/lib/kpm/killbill_server_artifact.rb +13 -12
- data/lib/kpm/migrations.rb +8 -7
- data/lib/kpm/nexus_helper/actions.rb +47 -8
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +87 -94
- data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
- data/lib/kpm/plugins_directory.rb +9 -8
- data/lib/kpm/plugins_directory.yml +8 -175
- data/lib/kpm/plugins_manager.rb +29 -24
- data/lib/kpm/sha1_checker.rb +31 -18
- data/lib/kpm/system.rb +105 -136
- data/lib/kpm/system_helpers/cpu_information.rb +56 -55
- data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
- data/lib/kpm/system_helpers/entropy_available.rb +37 -39
- data/lib/kpm/system_helpers/memory_information.rb +52 -51
- data/lib/kpm/system_helpers/os_information.rb +45 -47
- data/lib/kpm/system_helpers/system_proxy.rb +10 -10
- data/lib/kpm/tasks.rb +364 -437
- data/lib/kpm/tenant_config.rb +68 -83
- data/lib/kpm/tomcat_manager.rb +9 -8
- data/lib/kpm/trace_logger.rb +18 -16
- data/lib/kpm/uninstaller.rb +81 -14
- data/lib/kpm/utils.rb +13 -14
- data/lib/kpm/version.rb +3 -1
- data/packaging/Gemfile +2 -0
- data/pom.xml +1 -1
- data/spec/kpm/remote/base_artifact_spec.rb +13 -15
- data/spec/kpm/remote/base_installer_spec.rb +30 -29
- data/spec/kpm/remote/installer_spec.rb +73 -73
- data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -24
- data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
- data/spec/kpm/remote/migrations_spec.rb +12 -11
- data/spec/kpm/remote/nexus_facade_spec.rb +30 -26
- data/spec/kpm/remote/tenant_config_spec.rb +27 -26
- data/spec/kpm/remote/tomcat_manager_spec.rb +2 -1
- data/spec/kpm/unit/actions_spec.rb +52 -0
- data/spec/kpm/unit/base_artifact_spec.rb +17 -16
- data/spec/kpm/unit/cpu_information_spec.rb +67 -0
- data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
- data/spec/kpm/unit/entropy_information_spec.rb +36 -0
- data/spec/kpm/unit/formatter_spec.rb +163 -0
- data/spec/kpm/unit/inspector_spec.rb +34 -42
- data/spec/kpm/unit/installer_spec.rb +5 -4
- data/spec/kpm/unit/memory_information_spec.rb +102 -0
- data/spec/kpm/unit/os_information_spec.rb +38 -0
- data/spec/kpm/unit/plugins_directory_spec.rb +34 -18
- data/spec/kpm/unit/plugins_manager_spec.rb +61 -65
- data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
- data/spec/kpm/unit/uninstaller_spec.rb +107 -61
- data/spec/kpm/unit_mysql/account_spec.rb +120 -135
- data/spec/spec_helper.rb +19 -17
- data/tasks/package.rake +18 -18
- metadata +17 -8
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'tmpdir'
|
2
4
|
require 'thor'
|
3
5
|
require 'kpm'
|
@@ -11,25 +13,25 @@ RSpec.configure do |config|
|
|
11
13
|
config.color_enabled = true
|
12
14
|
config.tty = true
|
13
15
|
config.formatter = 'documentation'
|
14
|
-
config.filter_run_excluding :
|
16
|
+
config.filter_run_excluding skip_me_if_nil: true
|
15
17
|
end
|
16
18
|
|
17
19
|
shared_context 'connection_setup' do
|
18
20
|
let(:logger) do
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
logger = ::Logger.new(STDOUT)
|
22
|
+
logger.level = Logger::FATAL
|
23
|
+
logger
|
22
24
|
end
|
23
|
-
let(:yml_file) {YAML
|
24
|
-
let(:dummy_data_file) {Dir.mktmpdir('dummy') + File::SEPARATOR + 'kbdump'}
|
25
|
-
let(:url) {"http://#{yml_file['killbill']['host']}:#{yml_file['killbill']['port']}"}
|
26
|
-
let(:killbill_api_key) {yml_file['killbill']['api_key']}
|
27
|
-
let(:
|
28
|
-
let(:killbill_user) {yml_file['killbill']['user']}
|
29
|
-
let(:killbill_password) {yml_file['killbill']['password']}
|
30
|
-
let(:db_name) {yml_file['database']['name']}
|
31
|
-
let(:db_username) {yml_file['database']['user']}
|
32
|
-
let(:db_password) {yml_file['database']['password']}
|
33
|
-
let(:db_host) {yml_file['database']['host']}
|
34
|
-
let(:db_port) {yml_file['database']['port']}
|
35
|
-
end
|
25
|
+
let(:yml_file) { YAML.load_file(Dir["#{Dir.pwd}/**/account_spec.yml"][0]) }
|
26
|
+
let(:dummy_data_file) { Dir.mktmpdir('dummy') + File::SEPARATOR + 'kbdump' }
|
27
|
+
let(:url) { "http://#{yml_file['killbill']['host']}:#{yml_file['killbill']['port']}" }
|
28
|
+
let(:killbill_api_key) { yml_file['killbill']['api_key'] }
|
29
|
+
let(:killbill_api_secret) { yml_file['killbill']['api_secret'] }
|
30
|
+
let(:killbill_user) { yml_file['killbill']['user'] }
|
31
|
+
let(:killbill_password) { yml_file['killbill']['password'] }
|
32
|
+
let(:db_name) { yml_file['database']['name'] }
|
33
|
+
let(:db_username) { yml_file['database']['user'] }
|
34
|
+
let(:db_password) { yml_file['database']['password'] }
|
35
|
+
let(:db_host) { yml_file['database']['host'] }
|
36
|
+
let(:db_port) { yml_file['database']['port'] }
|
37
|
+
end
|
data/tasks/package.rake
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# For Bundler.with_clean_env
|
2
4
|
require 'bundler/setup'
|
3
5
|
require 'yaml'
|
@@ -12,40 +14,38 @@ TRAVELING_RUBY_VERSION = '20150715-2.2.2'
|
|
12
14
|
|
13
15
|
# Remove unused files to reduce package size
|
14
16
|
GEMS_PATH = 'packaging/vendor/ruby/*/gems/*/'
|
15
|
-
REMOVE_FILES = %w
|
16
|
-
REMOVE_EXTENSIONS = %w
|
17
|
+
REMOVE_FILES = %w[test tests spec README* CHANGE* Change* COPYING* LICENSE* MIT-LICENSE* doc docs examples ext/*/Makefile .gitignore .travis.yml].freeze
|
18
|
+
REMOVE_EXTENSIONS = %w[*.md *.c *.h *.rl extconf.rb *.java *.class *.so *.o].freeze
|
17
19
|
|
18
20
|
desc 'Package your app'
|
19
|
-
task :
|
21
|
+
task package: %w[package:linux:x86 package:linux:x86_64 package:osx]
|
20
22
|
|
21
23
|
namespace :package do
|
22
24
|
namespace :linux do
|
23
25
|
desc 'Package KPM for Linux x86'
|
24
|
-
task :
|
26
|
+
task x86: [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz"] do
|
25
27
|
create_package('linux-x86')
|
26
28
|
end
|
27
29
|
|
28
30
|
desc 'Package KPM for Linux x86_64'
|
29
|
-
task :
|
31
|
+
task x86_64: [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz"] do
|
30
32
|
create_package('linux-x86_64')
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
36
|
desc 'Package KPM for OS X'
|
35
|
-
task :
|
37
|
+
task osx: [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz"] do
|
36
38
|
create_package('osx')
|
37
39
|
end
|
38
40
|
|
39
41
|
desc 'Install gems to local directory'
|
40
|
-
task :
|
42
|
+
task bundle_install: [:clean] do
|
41
43
|
# abort if version packaging does not exist on repository
|
42
44
|
abort "KPM #{VERSION} does not exists in the repository." unless gem_exists?
|
43
45
|
|
44
46
|
# Note! Must match TRAVELING_RUBY_VERSION above
|
45
47
|
expected_ruby_version = TRAVELING_RUBY_VERSION.split('-')[-1]
|
46
|
-
if RUBY_VERSION !~ /#{Regexp.quote(expected_ruby_version)}/
|
47
|
-
abort "You can only 'bundle install' using Ruby #{expected_ruby_version}, because that's what Traveling Ruby uses."
|
48
|
-
end
|
48
|
+
abort "You can only 'bundle install' using Ruby #{expected_ruby_version}, because that's what Traveling Ruby uses." if RUBY_VERSION !~ /#{Regexp.quote(expected_ruby_version)}/
|
49
49
|
sh 'rm -rf packaging/tmp'
|
50
50
|
sh 'mkdir -p packaging/tmp'
|
51
51
|
sh 'cp packaging/Gemfile packaging/tmp/'
|
@@ -108,21 +108,21 @@ def create_package(target)
|
|
108
108
|
sh "mkdir #{package_dir}/lib/vendor/.bundle"
|
109
109
|
sh "cp packaging/bundler-config #{package_dir}/lib/vendor/.bundle/config"
|
110
110
|
|
111
|
-
if
|
112
|
-
|
113
|
-
|
114
|
-
|
111
|
+
return if ENV['DIR_ONLY']
|
112
|
+
|
113
|
+
sh "tar -czf #{package_dir}.tar.gz #{package_dir}"
|
114
|
+
sh "rm -rf #{package_dir}"
|
115
115
|
end
|
116
116
|
|
117
117
|
def download_runtime(target)
|
118
|
-
sh 'mkdir -p packaging && cd packaging && curl -L -O --fail '
|
119
|
-
|
118
|
+
sh 'mkdir -p packaging && cd packaging && curl -L -O --fail ' \
|
119
|
+
"https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz"
|
120
120
|
end
|
121
121
|
|
122
122
|
def gem_exists?
|
123
123
|
response = `gem specification 'kpm' -r -v #{VERSION} 2>&1`
|
124
124
|
return false if response.nil?
|
125
125
|
|
126
|
-
specification = YAML
|
126
|
+
specification = YAML.load(response)
|
127
127
|
specification.instance_of?(Gem::Specification)
|
128
|
-
end
|
128
|
+
end
|
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.8.0
|
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: 2020-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.6.21
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: killbill-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubyzip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: thor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.19.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.19.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +109,7 @@ extra_rdoc_files: []
|
|
109
109
|
files:
|
110
110
|
- ".gemrelease"
|
111
111
|
- ".gitignore"
|
112
|
+
- ".rubocop.yml"
|
112
113
|
- Gemfile
|
113
114
|
- README.adoc
|
114
115
|
- Rakefile
|
@@ -119,6 +120,7 @@ files:
|
|
119
120
|
- lib/kpm/account.rb
|
120
121
|
- lib/kpm/base_artifact.rb
|
121
122
|
- lib/kpm/base_installer.rb
|
123
|
+
- lib/kpm/blob.rb
|
122
124
|
- lib/kpm/cli.rb
|
123
125
|
- lib/kpm/coordinates.rb
|
124
126
|
- lib/kpm/database.rb
|
@@ -167,9 +169,16 @@ files:
|
|
167
169
|
- spec/kpm/remote/tenant_config_spec.rb
|
168
170
|
- spec/kpm/remote/tenant_config_spec.yml
|
169
171
|
- spec/kpm/remote/tomcat_manager_spec.rb
|
172
|
+
- spec/kpm/unit/actions_spec.rb
|
170
173
|
- spec/kpm/unit/base_artifact_spec.rb
|
174
|
+
- spec/kpm/unit/cpu_information_spec.rb
|
175
|
+
- spec/kpm/unit/disk_space_information_spec.rb
|
176
|
+
- spec/kpm/unit/entropy_information_spec.rb
|
177
|
+
- spec/kpm/unit/formatter_spec.rb
|
171
178
|
- spec/kpm/unit/inspector_spec.rb
|
172
179
|
- spec/kpm/unit/installer_spec.rb
|
180
|
+
- spec/kpm/unit/memory_information_spec.rb
|
181
|
+
- spec/kpm/unit/os_information_spec.rb
|
173
182
|
- spec/kpm/unit/plugins_directory_spec.rb
|
174
183
|
- spec/kpm/unit/plugins_manager_spec.rb
|
175
184
|
- spec/kpm/unit/sha1_checker_spec.rb
|