kpm 0.7.0 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +73 -0
  3. data/Gemfile +2 -0
  4. data/README.adoc +111 -109
  5. data/Rakefile +2 -1
  6. data/bin/kpm +4 -2
  7. data/kpm.gemspec +8 -6
  8. data/lib/kpm.rb +3 -0
  9. data/lib/kpm/account.rb +268 -337
  10. data/lib/kpm/base_artifact.rb +40 -36
  11. data/lib/kpm/base_installer.rb +71 -84
  12. data/lib/kpm/blob.rb +29 -0
  13. data/lib/kpm/cli.rb +3 -1
  14. data/lib/kpm/coordinates.rb +6 -9
  15. data/lib/kpm/database.rb +92 -103
  16. data/lib/kpm/diagnostic_file.rb +126 -146
  17. data/lib/kpm/formatter.rb +74 -46
  18. data/lib/kpm/inspector.rb +22 -32
  19. data/lib/kpm/installer.rb +53 -46
  20. data/lib/kpm/kaui_artifact.rb +4 -3
  21. data/lib/kpm/killbill_plugin_artifact.rb +10 -7
  22. data/lib/kpm/killbill_server_artifact.rb +24 -10
  23. data/lib/kpm/migrations.rb +8 -7
  24. data/lib/kpm/nexus_helper/actions.rb +47 -8
  25. data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +87 -94
  26. data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
  27. data/lib/kpm/plugins_directory.rb +14 -9
  28. data/lib/kpm/plugins_directory.yml +16 -175
  29. data/lib/kpm/plugins_manager.rb +29 -24
  30. data/lib/kpm/sha1_checker.rb +56 -15
  31. data/lib/kpm/system.rb +104 -135
  32. data/lib/kpm/system_helpers/cpu_information.rb +56 -55
  33. data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
  34. data/lib/kpm/system_helpers/entropy_available.rb +37 -39
  35. data/lib/kpm/system_helpers/memory_information.rb +52 -51
  36. data/lib/kpm/system_helpers/os_information.rb +45 -47
  37. data/lib/kpm/system_helpers/system_proxy.rb +10 -10
  38. data/lib/kpm/tasks.rb +370 -443
  39. data/lib/kpm/tenant_config.rb +68 -83
  40. data/lib/kpm/tomcat_manager.rb +9 -8
  41. data/lib/kpm/trace_logger.rb +18 -16
  42. data/lib/kpm/uninstaller.rb +81 -14
  43. data/lib/kpm/utils.rb +13 -14
  44. data/lib/kpm/version.rb +3 -1
  45. data/packaging/Gemfile +2 -0
  46. data/pom.xml +1 -1
  47. data/spec/kpm/remote/base_artifact_spec.rb +26 -12
  48. data/spec/kpm/remote/base_installer_spec.rb +30 -29
  49. data/spec/kpm/remote/installer_spec.rb +74 -72
  50. data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
  51. data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -24
  52. data/spec/kpm/remote/killbill_server_artifact_spec.rb +30 -13
  53. data/spec/kpm/remote/migrations_spec.rb +12 -11
  54. data/spec/kpm/remote/nexus_facade_spec.rb +30 -26
  55. data/spec/kpm/remote/tenant_config_spec.rb +27 -26
  56. data/spec/kpm/remote/tomcat_manager_spec.rb +2 -1
  57. data/spec/kpm/unit/actions_spec.rb +52 -0
  58. data/spec/kpm/unit/base_artifact_spec.rb +17 -16
  59. data/spec/kpm/unit/cpu_information_spec.rb +67 -0
  60. data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
  61. data/spec/kpm/unit/entropy_information_spec.rb +36 -0
  62. data/spec/kpm/unit/formatter_spec.rb +163 -0
  63. data/spec/kpm/unit/inspector_spec.rb +34 -42
  64. data/spec/kpm/unit/installer_spec.rb +5 -4
  65. data/spec/kpm/unit/memory_information_spec.rb +102 -0
  66. data/spec/kpm/unit/os_information_spec.rb +38 -0
  67. data/spec/kpm/unit/plugins_directory_spec.rb +34 -18
  68. data/spec/kpm/unit/plugins_manager_spec.rb +61 -65
  69. data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
  70. data/spec/kpm/unit/uninstaller_spec.rb +107 -61
  71. data/spec/kpm/unit_mysql/account_spec.rb +137 -136
  72. data/spec/spec_helper.rb +19 -17
  73. data/tasks/package.rake +18 -18
  74. metadata +19 -34
@@ -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 :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
@@ -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.0
4
+ version: 0.8.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: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2020-07-17 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,19 +53,19 @@ 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
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
@@ -201,32 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
210
  - !ruby/object:Gem::Version
202
211
  version: '0'
203
212
  requirements: []
204
- rubyforge_project:
205
- rubygems_version: 2.4.8
213
+ rubygems_version: 3.0.8
206
214
  signing_key:
207
215
  specification_version: 4
208
216
  summary: Kill Bill package manager.
209
- test_files:
210
- - spec/kpm/remote/base_artifact_spec.rb
211
- - spec/kpm/remote/base_installer_spec.rb
212
- - spec/kpm/remote/installer_spec.rb
213
- - spec/kpm/remote/kaui_artifact_spec.rb
214
- - spec/kpm/remote/killbill_plugin_artifact_spec.rb
215
- - spec/kpm/remote/killbill_server_artifact_spec.rb
216
- - spec/kpm/remote/migrations_spec.rb
217
- - spec/kpm/remote/nexus_facade_spec.rb
218
- - spec/kpm/remote/tenant_config_spec.rb
219
- - spec/kpm/remote/tenant_config_spec.yml
220
- - spec/kpm/remote/tomcat_manager_spec.rb
221
- - spec/kpm/unit/base_artifact_spec.rb
222
- - spec/kpm/unit/inspector_spec.rb
223
- - spec/kpm/unit/installer_spec.rb
224
- - spec/kpm/unit/plugins_directory_spec.rb
225
- - spec/kpm/unit/plugins_manager_spec.rb
226
- - spec/kpm/unit/sha1_checker_spec.rb
227
- - spec/kpm/unit/sha1_test.yml
228
- - spec/kpm/unit/uninstaller_spec.rb
229
- - spec/kpm/unit_mysql/account_spec.rb
230
- - spec/kpm/unit_mysql/account_spec.yml
231
- - spec/kpm/unit_mysql/account_test_ddl.sql
232
- - spec/spec_helper.rb
217
+ test_files: []