kpm 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/kpm/account.rb +7 -11
- data/lib/kpm/database.rb +8 -1
- data/lib/kpm/tasks.rb +6 -2
- data/lib/kpm/version.rb +1 -1
- data/pom.xml +1 -1
- data/release.sh +2 -0
- data/spec/kpm/unit_mysql/account_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d42c3f647760630bf77cd1b747651801726d523
|
4
|
+
data.tar.gz: b8bb3427daf343b4b58da5381241bfddda7c038f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 321702e297c7ef18cb523e474e59ba12780d289b336cc541f58964e95fd72b5cb841b66826528b4cbac424cb7c858f307377e4c71fd7ac3d663b4947b7d71417
|
7
|
+
data.tar.gz: 6c60dceeba121d962c8d71e953ece53f427638be7531f9351174cba8e3824008cf7aedae34eacf0c044c49f1e118ce33071f6696c1151c8382564b69e2c2ddbb
|
data/.gitignore
CHANGED
data/lib/kpm/account.rb
CHANGED
@@ -72,7 +72,7 @@ module KPM
|
|
72
72
|
DEFAULT_DELIMITER = "|"
|
73
73
|
|
74
74
|
def initialize(config_file = nil, killbill_api_credentials = nil, killbill_credentials = nil, killbill_url = nil,
|
75
|
-
database_name = nil, database_credentials = nil, data_delimiter = nil, logger = nil)
|
75
|
+
database_name = nil, database_credentials = nil, database_host = nil, data_delimiter = nil, logger = nil)
|
76
76
|
@killbill_api_key = KILLBILL_API_KEY
|
77
77
|
@killbill_api_secrets = KILLBILL_API_SECRET
|
78
78
|
@killbill_url = KILLBILL_URL
|
@@ -84,7 +84,7 @@ module KPM
|
|
84
84
|
|
85
85
|
|
86
86
|
set_killbill_options(killbill_api_credentials,killbill_credentials,killbill_url)
|
87
|
-
set_database_options(database_name,database_credentials,logger)
|
87
|
+
set_database_options(database_host,database_name,database_credentials,logger)
|
88
88
|
|
89
89
|
load_config_from_file(config_file)
|
90
90
|
|
@@ -460,7 +460,7 @@ module KPM
|
|
460
460
|
config_db = @config['database']
|
461
461
|
|
462
462
|
if not config_db.nil?
|
463
|
-
set_database_options(config_db['
|
463
|
+
set_database_options(config_db['host'],config_db['name'],
|
464
464
|
[config_db['username'],config_db['password']],
|
465
465
|
@logger)
|
466
466
|
|
@@ -479,17 +479,13 @@ module KPM
|
|
479
479
|
|
480
480
|
end
|
481
481
|
|
482
|
-
def set_database_options(database_name = nil, database_credentials = nil, logger)
|
482
|
+
def set_database_options(database_host = nil, database_name = nil, database_credentials = nil, logger)
|
483
483
|
|
484
484
|
Database.set_logger(logger)
|
485
485
|
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
if not database_name.nil?
|
491
|
-
Database.set_database_name(database_name)
|
492
|
-
end
|
486
|
+
Database.set_credentials(database_credentials[0],database_credentials[1]) unless database_credentials.nil?
|
487
|
+
Database.set_database_name(database_name) unless database_name.nil?
|
488
|
+
Database.set_host(database_host) unless database_host.nil?
|
493
489
|
|
494
490
|
Database.set_mysql_command_line
|
495
491
|
end
|
data/lib/kpm/database.rb
CHANGED
@@ -13,6 +13,8 @@ module KPM
|
|
13
13
|
DATABASE = ENV['DATABASE'] || 'killbill'
|
14
14
|
USERNAME = ENV['USERNAME'] || 'root'
|
15
15
|
PASSWORD = ENV['PASSWORD'] || 'root'
|
16
|
+
HOST = ENV['HOST'] || 'localhost'
|
17
|
+
|
16
18
|
COLUMN_NAME_POS = 3
|
17
19
|
|
18
20
|
STATEMENT_TMP_FILE = Dir.mktmpdir('statement') + File::SEPARATOR + 'statement.sql'
|
@@ -23,6 +25,7 @@ module KPM
|
|
23
25
|
@@username = USERNAME
|
24
26
|
@@password = PASSWORD
|
25
27
|
@@database = DATABASE
|
28
|
+
@@host = HOST
|
26
29
|
|
27
30
|
def set_logger(logger)
|
28
31
|
@@logger = logger
|
@@ -33,12 +36,16 @@ module KPM
|
|
33
36
|
@@password = password
|
34
37
|
end
|
35
38
|
|
39
|
+
def set_host(host)
|
40
|
+
@@host = host
|
41
|
+
end
|
42
|
+
|
36
43
|
def set_database_name(database_name = nil)
|
37
44
|
@@database = database_name
|
38
45
|
end
|
39
46
|
|
40
47
|
def set_mysql_command_line
|
41
|
-
@@mysql_command_line = "mysql #{@@database} --user=#{@@username} --password=#{@@password} "
|
48
|
+
@@mysql_command_line = "mysql #{@@database} --host=#{@@host} --user=#{@@username} --password=#{@@password} "
|
42
49
|
end
|
43
50
|
|
44
51
|
def execute_insert_statement(table_name, query, qty_to_insert, table_data, record_id = nil)
|
data/lib/kpm/tasks.rb
CHANGED
@@ -479,7 +479,11 @@ module KPM
|
|
479
479
|
method_option :data_delimiter,
|
480
480
|
:type => :string,
|
481
481
|
:default => "|",
|
482
|
-
:desc => 'Data delimiter'
|
482
|
+
:desc => 'Data delimiter'
|
483
|
+
method_option :database_host,
|
484
|
+
:type => :string,
|
485
|
+
:default => nil,
|
486
|
+
:desc => 'Database Host name'
|
483
487
|
desc 'account', 'export/import accounts'
|
484
488
|
def account
|
485
489
|
logger.info 'Please wait processing the request!!!'
|
@@ -515,7 +519,7 @@ module KPM
|
|
515
519
|
|
516
520
|
|
517
521
|
account = KPM::Account.new(config_file || options[:config_file],options[:killbill_api_credentials],options[:killbill_credentials],
|
518
|
-
options[:killbill_url],options[:database_name],options[:database_credentials],options[:data_delimiter], logger)
|
522
|
+
options[:killbill_url],options[:database_name],options[:database_credentials],options[:database_host],options[:data_delimiter], logger)
|
519
523
|
export_file = nil
|
520
524
|
round_trip_export_import = false
|
521
525
|
|
data/lib/kpm/version.rb
CHANGED
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.5.
|
29
|
+
<version>0.5.3</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>
|
data/release.sh
CHANGED
@@ -5,9 +5,10 @@ describe KPM::Account do
|
|
5
5
|
shared_context 'account' do
|
6
6
|
include_context 'connection_setup'
|
7
7
|
|
8
|
+
let(:db_host) {'localhost'}
|
8
9
|
let(:account_class) { described_class.new(nil,[killbill_api_key,killbill_api_secrets],
|
9
10
|
[killbill_user, killbill_password],url,
|
10
|
-
db_name, [db_username, db_password],nil,logger)}
|
11
|
+
db_name, [db_username, db_password],db_host,nil,logger)}
|
11
12
|
let(:dummy_account_id) {SecureRandom.uuid}
|
12
13
|
let(:account_id_invalid) {SecureRandom.uuid}
|
13
14
|
let(:dummy_data) {
|
@@ -22,6 +23,7 @@ describe KPM::Account do
|
|
22
23
|
let(:obfuscating_marker) {:email}
|
23
24
|
let(:mysql_cli) {"mysql #{db_name} --user=#{db_username} --password=#{db_password} "}
|
24
25
|
let(:test_ddl) {Dir["#{Dir.pwd}/**/account_test_ddl.sql"][0]}
|
26
|
+
|
25
27
|
end
|
26
28
|
|
27
29
|
describe '#initialize' do
|
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.5.
|
4
|
+
version: 0.5.3
|
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: 2017-06-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|