kpm 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54d00edd1b9f88c7eb6e660e218000eaa72d363a
4
- data.tar.gz: a5ee8a5d0b1854fdcecbd1c08f226b80c34e2c7f
3
+ metadata.gz: d681ccb516730f4bf0cf48d27e479474f6fa6bec
4
+ data.tar.gz: d77e83aa18b676cd26f5485c640d6eacd506c86d
5
5
  SHA512:
6
- metadata.gz: fd91bdd724b44246083d9e4ea3ead7baaa9af7aa84478c0566122e39fa54cc85805a9a1c986e1196050884c1ae8f05cd263e54c137256411a070a76e8132c4ba
7
- data.tar.gz: b22f48d3e9d889736daf7e3ba7ea7d91bd117e597d8ea025b7c444d956a241c788c69e5002e2a1eabe58a1b44e575b83e652ffa34d2df2300f24ca4454b89c04
6
+ metadata.gz: 597c2535cb5b1b59d506b4696e93d6b09f29f218dafaa55a62aae61d62bd3aa4bad8346b4b1a11ba55eb19ba547bdf0f06e8a6c4311d0914980e0808ee99b610
7
+ data.tar.gz: 025362e93a5479ccaf715ab24e0579172ffd708dd7fd99b6477488b1833495b0b219383ba5d3bab68484d759d7559276158e0a322bb7f3d6eae7560a18e634c3
data/lib/kpm/account.rb CHANGED
@@ -99,7 +99,7 @@ module KPM
99
99
  export_data = fetch_export_data(account_id)
100
100
  export_file = export(export_data)
101
101
 
102
- if not File.exist?(export_file)
102
+ unless File.exist?(export_file)
103
103
  raise Interrupt, 'Account id not found'
104
104
  else
105
105
  @logger.info "\e[32mData exported under #{export_file}\e[0m"
@@ -108,7 +108,7 @@ module KPM
108
108
  export_file
109
109
  end
110
110
 
111
- def import_data(source_file,tenant_record_id, skip_payment_methods, round_trip_export_import = false, generate_record_id = false)
111
+ def import_data(source_file, tenant_record_id, skip_payment_methods, round_trip_export_import = false, generate_record_id = false)
112
112
 
113
113
  @generate_record_id = generate_record_id
114
114
  @tenant_record_id = tenant_record_id
@@ -118,7 +118,7 @@ module KPM
118
118
  raise Interrupt, 'Need to specify a file'
119
119
  end
120
120
 
121
- if not File.exist?(source_file)
121
+ unless File.exist?(source_file)
122
122
  raise Interrupt, 'Need to specify a valid file'
123
123
  end
124
124
 
@@ -219,7 +219,7 @@ module KPM
219
219
  words = line.strip.split(" ")
220
220
 
221
221
  if /--/.match(words[0])
222
- if not table_name.nil?
222
+ unless table_name.nil?
223
223
  if @generate_record_id
224
224
  cols_names.shift
225
225
  end
@@ -256,7 +256,7 @@ module KPM
256
256
  end
257
257
  end
258
258
 
259
- if not error_importing_data
259
+ unless error_importing_data
260
260
  import(tables)
261
261
  else
262
262
  raise Interrupt, "Data on #{source_file} is invalid"
@@ -265,7 +265,8 @@ module KPM
265
265
  end
266
266
 
267
267
  def process_import_data(line, table_name, cols_names, skip_payment_methods, rows)
268
- cols = line.strip.split(@delimiter)
268
+ # to make sure that the last column is not omitted if is empty
269
+ cols = line.strip.split(@delimiter,line.count(@delimiter)+1)
269
270
 
270
271
  if cols_names.size != cols.size
271
272
  @logger.warn "\e[32mWARNING!!! On #{table_name} table there is a mismatch on column count[#{cols.size}] versus header count[#{cols_names.size}]\e[0m"
@@ -222,7 +222,7 @@ module KPM
222
222
  classifier = nil
223
223
 
224
224
  version = specified_version
225
- if version.nil?
225
+ if version.nil? || version == LATEST_VERSION
226
226
  info = KPM::KillbillServerArtifact.info(kb_version || LATEST_VERSION, @nexus_config, @nexus_ssl_verify)
227
227
  version = info['killbill-platform']
228
228
  end
data/lib/kpm/database.rb CHANGED
@@ -56,7 +56,7 @@ module KPM
56
56
 
57
57
  def execute_insert_statement(table_name, query, qty_to_insert, table_data, record_id = nil)
58
58
 
59
- if not record_id.nil?
59
+ unless record_id.nil?
60
60
  query = "set #{record_id[:variable]}=#{record_id[:value]}; #{query}"
61
61
  end
62
62
  query = "SET autocommit=0; #{query} COMMIT;"
data/lib/kpm/installer.rb CHANGED
@@ -51,13 +51,15 @@ module KPM
51
51
  latest_stable_version = version if version > latest_stable_version
52
52
  end
53
53
 
54
- latest_stable_version
54
+ latest_stable_version.to_s
55
55
  end
56
56
 
57
57
  def initialize(raw_config, logger=nil)
58
58
  @config = raw_config['killbill']
59
59
  @kaui_config = raw_config['kaui']
60
60
 
61
+ @config['version'] = KPM::Installer.get_kb_latest_stable_version if !@config.nil? && (@config['version'].nil? || @config['version'] == 'LATEST')
62
+
61
63
  if logger.nil?
62
64
  logger = Logger.new(STDOUT)
63
65
  logger.level = Logger::INFO
@@ -17,6 +17,8 @@ module KPM
17
17
  logger = Logger.new(STDOUT)
18
18
  logger.level = Logger::ERROR
19
19
 
20
+ version = KPM::Installer.get_kb_latest_stable_version if version == 'LATEST'
21
+
20
22
  versions = {}
21
23
  Dir.mktmpdir do |dir|
22
24
  # Retrieve the main Kill Bill pom
data/lib/kpm/utils.rb CHANGED
@@ -67,7 +67,7 @@ module KPM
67
67
  # this will remove SNAPSHOT and any dash that appear before it (ex --SNAPSHOT).
68
68
  name = name.gsub(/((-+){,1}SNAPSHOT){,1}/,'')
69
69
  last_dash = name.rindex('-')
70
- name = name[0..last_dash]
70
+ name = name[0..last_dash] unless last_dash.nil?
71
71
  else
72
72
  name = name.gsub(ver,'')
73
73
  end
data/lib/kpm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module KPM
2
- VERSION = '0.6.3'
2
+ VERSION = '0.6.4'
3
3
  end
data/pom.xml CHANGED
@@ -26,7 +26,7 @@
26
26
  <groupId>org.kill-bill.billing.installer</groupId>
27
27
  <artifactId>kpm</artifactId>
28
28
  <packaging>pom</packaging>
29
- <version>0.6.3</version>
29
+ <version>0.6.4</version>
30
30
  <name>KPM</name>
31
31
  <url>http://github.com/killbill/killbill-cloud</url>
32
32
  <description>KPM: the Kill Bill Package Manager</description>
@@ -5,8 +5,6 @@ describe KPM::Account do
5
5
  shared_context 'account' do
6
6
  include_context 'connection_setup'
7
7
 
8
- let(:db_host) {'localhost'}
9
- let(:db_port) {'3306'}
10
8
  let(:account_class) { described_class.new(nil,[killbill_api_key,killbill_api_secrets],
11
9
  [killbill_user, killbill_password],url,
12
10
  db_name, [db_username, db_password],db_host,db_port,nil,logger)}
@@ -22,7 +20,7 @@ describe KPM::Account do
22
20
  let(:cols_data) {dummy_data.split("\n")[1]}
23
21
  let(:table_name) {dummy_data.split("\n")[0].split(" ")[1]}
24
22
  let(:obfuscating_marker) {:email}
25
- let(:mysql_cli) {"mysql #{db_name} --user=#{db_username} --password=#{db_password} "}
23
+ let(:mysql_cli) {"mysql --user=#{db_username} --password=#{db_password} --host=#{db_host} --port=#{db_port} "}
26
24
  let(:test_ddl) {Dir["#{Dir.pwd}/**/account_test_ddl.sql"][0]}
27
25
 
28
26
  end
@@ -393,7 +391,7 @@ describe KPM::Account do
393
391
  end
394
392
 
395
393
  def delete_statement(table_name,column_name,account_id)
396
- response = `#{mysql_cli} -e "DELETE FROM #{table_name} WHERE #{column_name} = '#{account_id}'; SELECT ROW_COUNT();" 2>&1`
394
+ response = `#{mysql_cli} #{db_name} -e "DELETE FROM #{table_name} WHERE #{column_name} = '#{account_id}'; SELECT ROW_COUNT();" 2>&1`
397
395
  response_msg = response.split("\n")
398
396
  row_count_inserted = response_msg[response_msg.size - 1]
399
397
 
@@ -401,8 +399,8 @@ describe KPM::Account do
401
399
  end
402
400
 
403
401
  def create_test_schema
404
- response = `mysql --user=#{db_username} --password=#{db_password} -e "CREATE DATABASE IF NOT EXISTS #{db_name};"`
405
- response = `#{mysql_cli} < "#{test_ddl}" 2>&1`
402
+ response = `#{mysql_cli} -e "CREATE DATABASE IF NOT EXISTS #{db_name};"`
403
+ response = `#{mysql_cli} #{db_name} < "#{test_ddl}" 2>&1`
406
404
  response_msg = response.split("\n")
407
405
  used_database = response_msg[response_msg.size - 1]
408
406
 
@@ -410,7 +408,7 @@ describe KPM::Account do
410
408
  end
411
409
 
412
410
  def drop_test_schema
413
- response = `mysql --user=#{db_username} --password=#{db_password} -e "DROP DATABASE #{db_name};"`;
411
+ response = `#{mysql_cli} -e "DROP DATABASE #{db_name};"`;
414
412
  response
415
413
  end
416
414
 
@@ -2,6 +2,8 @@ database:
2
2
  name: test_kpm
3
3
  user: test_user
4
4
  password: test_password
5
+ host: 127.0.0.1
6
+ port: 3306
5
7
 
6
8
  killbill:
7
9
  user: admin
@@ -9,4 +11,4 @@ killbill:
9
11
  api_key: bob
10
12
  api_secret: lazar
11
13
  host: 127.0.0.1
12
- port: 8080
14
+ port: 8080
data/spec/spec_helper.rb CHANGED
@@ -30,4 +30,6 @@ shared_context 'connection_setup' do
30
30
  let(:db_name) {yml_file['database']['name']}
31
31
  let(:db_username) {yml_file['database']['user']}
32
32
  let(:db_password) {yml_file['database']['password']}
33
+ let(:db_host) {yml_file['database']['host']}
34
+ let(:db_port) {yml_file['database']['port']}
33
35
  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.6.3
4
+ version: 0.6.4
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-01-29 00:00:00.000000000 Z
11
+ date: 2018-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline