kpm 0.7.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +138 -0
  4. data/Gemfile +2 -0
  5. data/README.adoc +144 -107
  6. data/Rakefile +2 -1
  7. data/bin/kpm +4 -2
  8. data/kpm.gemspec +11 -8
  9. data/lib/kpm.rb +3 -0
  10. data/lib/kpm/account.rb +268 -338
  11. data/lib/kpm/base_artifact.rb +33 -39
  12. data/lib/kpm/base_installer.rb +69 -83
  13. data/lib/kpm/blob.rb +29 -0
  14. data/lib/kpm/cli.rb +3 -1
  15. data/lib/kpm/coordinates.rb +10 -12
  16. data/lib/kpm/database.rb +94 -113
  17. data/lib/kpm/diagnostic_file.rb +126 -147
  18. data/lib/kpm/formatter.rb +76 -48
  19. data/lib/kpm/inspector.rb +24 -34
  20. data/lib/kpm/installer.rb +53 -46
  21. data/lib/kpm/kaui_artifact.rb +4 -3
  22. data/lib/kpm/killbill_plugin_artifact.rb +10 -7
  23. data/lib/kpm/killbill_server_artifact.rb +13 -12
  24. data/lib/kpm/migrations.rb +26 -11
  25. data/lib/kpm/nexus_helper/actions.rb +52 -9
  26. data/lib/kpm/nexus_helper/cloudsmith_api_calls.rb +83 -0
  27. data/lib/kpm/nexus_helper/github_api_calls.rb +70 -0
  28. data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +130 -108
  29. data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
  30. data/lib/kpm/plugins_directory.rb +9 -8
  31. data/lib/kpm/plugins_directory.yml +14 -173
  32. data/lib/kpm/plugins_manager.rb +29 -24
  33. data/lib/kpm/sha1_checker.rb +31 -18
  34. data/lib/kpm/system.rb +104 -135
  35. data/lib/kpm/system_helpers/cpu_information.rb +56 -55
  36. data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
  37. data/lib/kpm/system_helpers/entropy_available.rb +37 -39
  38. data/lib/kpm/system_helpers/memory_information.rb +52 -51
  39. data/lib/kpm/system_helpers/os_information.rb +45 -47
  40. data/lib/kpm/system_helpers/system_proxy.rb +10 -10
  41. data/lib/kpm/tasks.rb +381 -438
  42. data/lib/kpm/tenant_config.rb +68 -83
  43. data/lib/kpm/tomcat_manager.rb +10 -8
  44. data/lib/kpm/trace_logger.rb +18 -16
  45. data/lib/kpm/uninstaller.rb +81 -14
  46. data/lib/kpm/utils.rb +13 -14
  47. data/lib/kpm/version.rb +3 -1
  48. data/packaging/Gemfile +2 -0
  49. data/pom.xml +211 -40
  50. data/spec/kpm/remote/base_artifact_spec.rb +20 -20
  51. data/spec/kpm/remote/base_installer_spec.rb +35 -34
  52. data/spec/kpm/remote/cloudsmith_api_calls_spec.rb +40 -0
  53. data/spec/kpm/remote/github_api_calls_spec.rb +40 -0
  54. data/spec/kpm/remote/installer_spec.rb +80 -79
  55. data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
  56. data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +25 -30
  57. data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
  58. data/spec/kpm/remote/migrations_spec.rb +12 -11
  59. data/spec/kpm/remote/nexus_facade_spec.rb +32 -28
  60. data/spec/kpm/remote/tenant_config_spec.rb +30 -29
  61. data/spec/kpm/remote/tomcat_manager_spec.rb +4 -3
  62. data/spec/kpm/unit/actions_spec.rb +52 -0
  63. data/spec/kpm/unit/base_artifact_spec.rb +19 -18
  64. data/spec/kpm/unit/cpu_information_spec.rb +67 -0
  65. data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
  66. data/spec/kpm/unit/entropy_information_spec.rb +36 -0
  67. data/spec/kpm/unit/formatter_spec.rb +163 -0
  68. data/spec/kpm/unit/inspector_spec.rb +34 -42
  69. data/spec/kpm/unit/installer_spec.rb +7 -6
  70. data/spec/kpm/unit/memory_information_spec.rb +102 -0
  71. data/spec/kpm/unit/os_information_spec.rb +38 -0
  72. data/spec/kpm/unit/plugins_directory_spec.rb +38 -22
  73. data/spec/kpm/unit/plugins_manager_spec.rb +62 -66
  74. data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
  75. data/spec/kpm/unit/uninstaller_spec.rb +118 -72
  76. data/spec/kpm/unit_mysql/account_spec.rb +127 -142
  77. data/spec/spec_helper.rb +20 -18
  78. data/tasks/package.rake +18 -18
  79. metadata +42 -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.color_enabled = true
13
+ config.color_mode = :on
12
14
  config.tty = true
13
15
  config.formatter = 'documentation'
14
- config.filter_run_excluding :skip_me_if_nil => true
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
- logger = ::Logger.new(STDOUT)
20
- logger.level = Logger::FATAL
21
- logger
21
+ logger = ::Logger.new(STDOUT)
22
+ logger.level = Logger::FATAL
23
+ logger
22
24
  end
23
- let(:yml_file) {YAML::load_file(Dir["#{Dir.pwd}/**/account_spec.yml"][0])}
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(:killbill_api_secrets) {yml_file['killbill']['api_secret']}
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(test tests spec README* CHANGE* Change* COPYING* LICENSE* MIT-LICENSE* doc docs examples ext/*/Makefile .gitignore .travis.yml)
16
- REMOVE_EXTENSIONS = %w(*.md *.c *.h *.rl extconf.rb *.java *.class *.so *.o)
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 :package => %w(package:linux:x86 package:linux:x86_64 package:osx)
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 :x86 => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz"] do
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 :x86_64 => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz"] do
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 :osx => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz"] do
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 :bundle_install => [:clean] do
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 !ENV['DIR_ONLY']
112
- sh "tar -czf #{package_dir}.tar.gz #{package_dir}"
113
- sh "rm -rf #{package_dir}"
114
- end
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
- "https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz"
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::load(response)
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.7.2
4
+ version: 0.10.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: 2019-05-02 00:00:00.000000000 Z
11
+ date: 2021-03-22 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: thor
28
+ name: killbill-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.19.1
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: 0.19.1
40
+ version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubyzip
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,53 +53,61 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: killbill-client
56
+ name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.5.0
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: 2.5.0
68
+ version: 0.19.1
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
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: 11.0.0
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: 10.0.0
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: 11.0.0
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: 2.12.0
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: 2.12.0
110
+ version: '3.9'
103
111
  description: A package manager for Kill Bill.
104
112
  email: killbilling-users@googlegroups.com
105
113
  executables:
@@ -109,6 +117,7 @@ extra_rdoc_files: []
109
117
  files:
110
118
  - ".gemrelease"
111
119
  - ".gitignore"
120
+ - ".rubocop.yml"
112
121
  - Gemfile
113
122
  - README.adoc
114
123
  - Rakefile
@@ -119,6 +128,7 @@ files:
119
128
  - lib/kpm/account.rb
120
129
  - lib/kpm/base_artifact.rb
121
130
  - lib/kpm/base_installer.rb
131
+ - lib/kpm/blob.rb
122
132
  - lib/kpm/cli.rb
123
133
  - lib/kpm/coordinates.rb
124
134
  - lib/kpm/database.rb
@@ -131,6 +141,8 @@ files:
131
141
  - lib/kpm/killbill_server_artifact.rb
132
142
  - lib/kpm/migrations.rb
133
143
  - lib/kpm/nexus_helper/actions.rb
144
+ - lib/kpm/nexus_helper/cloudsmith_api_calls.rb
145
+ - lib/kpm/nexus_helper/github_api_calls.rb
134
146
  - lib/kpm/nexus_helper/nexus_api_calls_v2.rb
135
147
  - lib/kpm/nexus_helper/nexus_facade.rb
136
148
  - lib/kpm/plugins_directory.rb
@@ -158,6 +170,8 @@ files:
158
170
  - release.sh
159
171
  - spec/kpm/remote/base_artifact_spec.rb
160
172
  - spec/kpm/remote/base_installer_spec.rb
173
+ - spec/kpm/remote/cloudsmith_api_calls_spec.rb
174
+ - spec/kpm/remote/github_api_calls_spec.rb
161
175
  - spec/kpm/remote/installer_spec.rb
162
176
  - spec/kpm/remote/kaui_artifact_spec.rb
163
177
  - spec/kpm/remote/killbill_plugin_artifact_spec.rb
@@ -167,9 +181,16 @@ files:
167
181
  - spec/kpm/remote/tenant_config_spec.rb
168
182
  - spec/kpm/remote/tenant_config_spec.yml
169
183
  - spec/kpm/remote/tomcat_manager_spec.rb
184
+ - spec/kpm/unit/actions_spec.rb
170
185
  - spec/kpm/unit/base_artifact_spec.rb
186
+ - spec/kpm/unit/cpu_information_spec.rb
187
+ - spec/kpm/unit/disk_space_information_spec.rb
188
+ - spec/kpm/unit/entropy_information_spec.rb
189
+ - spec/kpm/unit/formatter_spec.rb
171
190
  - spec/kpm/unit/inspector_spec.rb
172
191
  - spec/kpm/unit/installer_spec.rb
192
+ - spec/kpm/unit/memory_information_spec.rb
193
+ - spec/kpm/unit/os_information_spec.rb
173
194
  - spec/kpm/unit/plugins_directory_spec.rb
174
195
  - spec/kpm/unit/plugins_manager_spec.rb
175
196
  - spec/kpm/unit/sha1_checker_spec.rb
@@ -201,8 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
222
  - !ruby/object:Gem::Version
202
223
  version: '0'
203
224
  requirements: []
204
- rubyforge_project:
205
- rubygems_version: 2.6.14
225
+ rubygems_version: 3.0.8
206
226
  signing_key:
207
227
  specification_version: 4
208
228
  summary: Kill Bill package manager.