pais_legacy 0.9.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -11
- data/lib/pais_legacy/version.rb +1 -1
- data/lib/pais_legacy.rb +55 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7781a195d6ca0b1a5646d9b54f94dfb6e5c191e6faae253583edce96d91c3abd
|
4
|
+
data.tar.gz: 23f333dfbc02f52d9dc37479513a4803b0bfabae087445dcb96b62b29327f282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca824af258bda5c602d6cd8b2e6c4da5415aae44ea2f01386351adf785401d43411642e4dac15687a180ecd852c237ee1dc647bd8ed31e291d713121ec67b4df
|
7
|
+
data.tar.gz: fcf6d12e7d531e14487675c7214ebecb51522350b355e6f5e214a1b19540679d67a759bfc6c6a40a9bfe3cf75bfe108a4a5d560d69fe892ade9a13ac8b0a9a53
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pais_legacy (0.
|
4
|
+
pais_legacy (0.9.5)
|
5
5
|
byebug (~> 11.0)
|
6
6
|
minitest (~> 5.0)
|
7
7
|
mocha (~> 1.0)
|
@@ -14,30 +14,32 @@ GEM
|
|
14
14
|
ast (2.4.2)
|
15
15
|
byebug (11.1.3)
|
16
16
|
json (2.6.3)
|
17
|
-
minitest (5.
|
17
|
+
minitest (5.18.0)
|
18
18
|
mocha (1.16.1)
|
19
|
-
parallel (1.
|
20
|
-
parser (3.2.
|
19
|
+
parallel (1.23.0)
|
20
|
+
parser (3.2.2.3)
|
21
21
|
ast (~> 2.4.1)
|
22
|
+
racc
|
22
23
|
pastel (0.8.0)
|
23
24
|
tty-color (~> 0.5)
|
25
|
+
racc (1.7.0)
|
24
26
|
rainbow (3.1.1)
|
25
27
|
rake (13.0.6)
|
26
|
-
regexp_parser (2.
|
28
|
+
regexp_parser (2.8.1)
|
27
29
|
rexml (3.2.5)
|
28
|
-
rubocop (1.
|
30
|
+
rubocop (1.52.1)
|
29
31
|
json (~> 2.3)
|
30
32
|
parallel (~> 1.10)
|
31
|
-
parser (>= 3.2.
|
33
|
+
parser (>= 3.2.2.3)
|
32
34
|
rainbow (>= 2.2.2, < 4.0)
|
33
35
|
regexp_parser (>= 1.8, < 3.0)
|
34
36
|
rexml (>= 3.2.5, < 4.0)
|
35
|
-
rubocop-ast (>= 1.
|
37
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
36
38
|
ruby-progressbar (~> 1.7)
|
37
39
|
unicode-display_width (>= 2.4.0, < 3.0)
|
38
|
-
rubocop-ast (1.
|
39
|
-
parser (>= 3.
|
40
|
-
ruby-progressbar (1.
|
40
|
+
rubocop-ast (1.29.0)
|
41
|
+
parser (>= 3.2.1.0)
|
42
|
+
ruby-progressbar (1.13.0)
|
41
43
|
timecop (0.9.6)
|
42
44
|
tty-color (0.6.0)
|
43
45
|
unicode-display_width (2.4.2)
|
data/lib/pais_legacy/version.rb
CHANGED
data/lib/pais_legacy.rb
CHANGED
@@ -40,12 +40,12 @@ module PaisLegacy
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.glch_read(ledger)
|
43
|
-
out,_,_=Open3.capture2(glch_read_cmd(ledger.to_s))
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
# out,_,_=Open3.capture2(glch_read_cmd(ledger.to_s))
|
44
|
+
# out.
|
45
|
+
# split("\n").
|
46
|
+
# map{|line| line.split(",")}.
|
47
|
+
# map{|line| {value: line[0], text: "#{line[0]}-#{line[1]}"}}
|
48
|
+
glch_read_all(ledger)["accounts"].map {|h| {value: h["code"], text: "#{h['code']}-#{h['description']}"}}
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.glch_read_all(ledger)
|
@@ -122,7 +122,7 @@ module PaisLegacy
|
|
122
122
|
# end
|
123
123
|
# end
|
124
124
|
|
125
|
-
|
125
|
+
out.split("\n")
|
126
126
|
end
|
127
127
|
|
128
128
|
# Get the accounts using the trial balance
|
@@ -268,6 +268,50 @@ module PaisLegacy
|
|
268
268
|
end
|
269
269
|
end
|
270
270
|
|
271
|
+
# --------------------------------------------------------------------------------
|
272
|
+
# DB related
|
273
|
+
# --------------------------------------------------------------------------------
|
274
|
+
def self.table_schema_cmd(table)
|
275
|
+
ssh + ' "bash -l -c \"' + fglgo("db") + ' schema {{table}}\""'
|
276
|
+
.gsub("{{table}}",table)
|
277
|
+
end
|
278
|
+
|
279
|
+
def self.table_schema_raw(table)
|
280
|
+
out,_,_=Open3.capture2(table_schema_cmd(table))
|
281
|
+
out.split("\n")
|
282
|
+
end
|
283
|
+
|
284
|
+
def self.table_schema(table)
|
285
|
+
table_schema_raw(table).map {|line|
|
286
|
+
array=line.split("|")
|
287
|
+
{name: array[0].strip, type_id: array[1].strip, type_name: array[2].strip}
|
288
|
+
}
|
289
|
+
end
|
290
|
+
|
291
|
+
def self.table_data_cmd(table)
|
292
|
+
ssh_with_tty + ' "bash -l -c \"' + fglgo("db") + ' data {{table}}\""'
|
293
|
+
.gsub("{{table}}",table)
|
294
|
+
end
|
295
|
+
|
296
|
+
def self.table_data_raw(table)
|
297
|
+
out,_,_=Open3.capture2(table_data_cmd(table))
|
298
|
+
out.split("\n")
|
299
|
+
end
|
300
|
+
|
301
|
+
def self.table_data(table)
|
302
|
+
columns=table_schema(table)
|
303
|
+
|
304
|
+
table_data_raw(table).map {|line|
|
305
|
+
array=line.split("|")
|
306
|
+
hash = Hash.new
|
307
|
+
|
308
|
+
columns.each_with_index do |col,i|
|
309
|
+
hash[col[:name].to_sym] = array[i].strip
|
310
|
+
end
|
311
|
+
hash
|
312
|
+
}
|
313
|
+
end
|
314
|
+
|
271
315
|
private
|
272
316
|
def self.accounts(account)
|
273
317
|
account = account.split("/")
|
@@ -294,6 +338,10 @@ module PaisLegacy
|
|
294
338
|
"ssh -oHostKeyAlgorithms=+ssh-dss #{PAISTRAM} -T"
|
295
339
|
end
|
296
340
|
|
341
|
+
def self.ssh_with_tty
|
342
|
+
"ssh -oHostKeyAlgorithms=+ssh-dss #{PAISTRAM} -tt"
|
343
|
+
end
|
344
|
+
|
297
345
|
def self.fglgo(file)
|
298
346
|
"fglgo /hd0a/u/pais/live/prod/#{file}"
|
299
347
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pais_legacy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Pope
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|