kpm 0.7.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +138 -0
- data/Gemfile +2 -0
- data/README.adoc +126 -109
- data/Rakefile +2 -1
- data/bin/kpm +4 -2
- data/kpm.gemspec +10 -8
- data/lib/kpm.rb +3 -0
- data/lib/kpm/account.rb +269 -337
- data/lib/kpm/base_artifact.rb +40 -36
- data/lib/kpm/base_installer.rb +71 -84
- data/lib/kpm/blob.rb +29 -0
- data/lib/kpm/cli.rb +3 -1
- data/lib/kpm/coordinates.rb +10 -12
- data/lib/kpm/database.rb +93 -103
- data/lib/kpm/diagnostic_file.rb +126 -146
- data/lib/kpm/formatter.rb +76 -48
- data/lib/kpm/inspector.rb +24 -34
- 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 +24 -10
- data/lib/kpm/migrations.rb +26 -11
- data/lib/kpm/nexus_helper/actions.rb +45 -9
- data/lib/kpm/nexus_helper/github_api_calls.rb +70 -0
- data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +130 -108
- data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
- data/lib/kpm/plugins_directory.rb +14 -9
- data/lib/kpm/plugins_directory.yml +16 -175
- data/lib/kpm/plugins_manager.rb +29 -24
- data/lib/kpm/sha1_checker.rb +56 -15
- data/lib/kpm/system.rb +104 -135
- 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 +370 -443
- data/lib/kpm/tenant_config.rb +68 -83
- data/lib/kpm/tomcat_manager.rb +10 -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 +33 -17
- data/spec/kpm/remote/base_installer_spec.rb +35 -34
- data/spec/kpm/remote/github_api_calls_spec.rb +40 -0
- data/spec/kpm/remote/installer_spec.rb +80 -78
- data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
- data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +25 -30
- data/spec/kpm/remote/killbill_server_artifact_spec.rb +30 -13
- data/spec/kpm/remote/migrations_spec.rb +12 -11
- data/spec/kpm/remote/nexus_facade_spec.rb +32 -28
- data/spec/kpm/remote/tenant_config_spec.rb +30 -29
- data/spec/kpm/remote/tomcat_manager_spec.rb +4 -3
- data/spec/kpm/unit/actions_spec.rb +52 -0
- data/spec/kpm/unit/base_artifact_spec.rb +19 -18
- 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 +7 -6
- 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 +38 -22
- data/spec/kpm/unit/plugins_manager_spec.rb +62 -66
- data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
- data/spec/kpm/unit/uninstaller_spec.rb +118 -72
- data/spec/kpm/unit_mysql/account_spec.rb +144 -143
- data/spec/spec_helper.rb +20 -18
- data/tasks/package.rake +18 -18
- metadata +26 -22
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'
|
@@ -8,28 +10,28 @@ require 'yaml'
|
|
8
10
|
require 'killbill_client'
|
9
11
|
|
10
12
|
RSpec.configure do |config|
|
11
|
-
config.
|
13
|
+
config.color_mode = :on
|
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.9.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-08-05 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,53 +53,47 @@ 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
|
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: '13.0'
|
79
76
|
type: :development
|
80
77
|
prerelease: false
|
81
78
|
version_requirements: !ruby/object:Gem::Requirement
|
82
79
|
requirements:
|
83
|
-
- - "
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 10.0.0
|
86
|
-
- - "<"
|
80
|
+
- - "~>"
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
82
|
+
version: '13.0'
|
89
83
|
- !ruby/object:Gem::Dependency
|
90
84
|
name: rspec
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
92
86
|
requirements:
|
93
87
|
- - "~>"
|
94
88
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
89
|
+
version: '3.9'
|
96
90
|
type: :development
|
97
91
|
prerelease: false
|
98
92
|
version_requirements: !ruby/object:Gem::Requirement
|
99
93
|
requirements:
|
100
94
|
- - "~>"
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
96
|
+
version: '3.9'
|
103
97
|
description: A package manager for Kill Bill.
|
104
98
|
email: killbilling-users@googlegroups.com
|
105
99
|
executables:
|
@@ -109,6 +103,7 @@ extra_rdoc_files: []
|
|
109
103
|
files:
|
110
104
|
- ".gemrelease"
|
111
105
|
- ".gitignore"
|
106
|
+
- ".rubocop.yml"
|
112
107
|
- Gemfile
|
113
108
|
- README.adoc
|
114
109
|
- Rakefile
|
@@ -119,6 +114,7 @@ files:
|
|
119
114
|
- lib/kpm/account.rb
|
120
115
|
- lib/kpm/base_artifact.rb
|
121
116
|
- lib/kpm/base_installer.rb
|
117
|
+
- lib/kpm/blob.rb
|
122
118
|
- lib/kpm/cli.rb
|
123
119
|
- lib/kpm/coordinates.rb
|
124
120
|
- lib/kpm/database.rb
|
@@ -131,6 +127,7 @@ files:
|
|
131
127
|
- lib/kpm/killbill_server_artifact.rb
|
132
128
|
- lib/kpm/migrations.rb
|
133
129
|
- lib/kpm/nexus_helper/actions.rb
|
130
|
+
- lib/kpm/nexus_helper/github_api_calls.rb
|
134
131
|
- lib/kpm/nexus_helper/nexus_api_calls_v2.rb
|
135
132
|
- lib/kpm/nexus_helper/nexus_facade.rb
|
136
133
|
- lib/kpm/plugins_directory.rb
|
@@ -158,6 +155,7 @@ files:
|
|
158
155
|
- release.sh
|
159
156
|
- spec/kpm/remote/base_artifact_spec.rb
|
160
157
|
- spec/kpm/remote/base_installer_spec.rb
|
158
|
+
- spec/kpm/remote/github_api_calls_spec.rb
|
161
159
|
- spec/kpm/remote/installer_spec.rb
|
162
160
|
- spec/kpm/remote/kaui_artifact_spec.rb
|
163
161
|
- spec/kpm/remote/killbill_plugin_artifact_spec.rb
|
@@ -167,9 +165,16 @@ files:
|
|
167
165
|
- spec/kpm/remote/tenant_config_spec.rb
|
168
166
|
- spec/kpm/remote/tenant_config_spec.yml
|
169
167
|
- spec/kpm/remote/tomcat_manager_spec.rb
|
168
|
+
- spec/kpm/unit/actions_spec.rb
|
170
169
|
- spec/kpm/unit/base_artifact_spec.rb
|
170
|
+
- spec/kpm/unit/cpu_information_spec.rb
|
171
|
+
- spec/kpm/unit/disk_space_information_spec.rb
|
172
|
+
- spec/kpm/unit/entropy_information_spec.rb
|
173
|
+
- spec/kpm/unit/formatter_spec.rb
|
171
174
|
- spec/kpm/unit/inspector_spec.rb
|
172
175
|
- spec/kpm/unit/installer_spec.rb
|
176
|
+
- spec/kpm/unit/memory_information_spec.rb
|
177
|
+
- spec/kpm/unit/os_information_spec.rb
|
173
178
|
- spec/kpm/unit/plugins_directory_spec.rb
|
174
179
|
- spec/kpm/unit/plugins_manager_spec.rb
|
175
180
|
- spec/kpm/unit/sha1_checker_spec.rb
|
@@ -201,8 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
206
|
- !ruby/object:Gem::Version
|
202
207
|
version: '0'
|
203
208
|
requirements: []
|
204
|
-
|
205
|
-
rubygems_version: 2.6.14
|
209
|
+
rubygems_version: 3.0.8
|
206
210
|
signing_key:
|
207
211
|
specification_version: 4
|
208
212
|
summary: Kill Bill package manager.
|