pais_legacy 0.9.4 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 442b94efb4e12d40767faceba204d73fb79698e8a0b44df85bb85492b3889519
4
- data.tar.gz: '018495ef13e576458bc21967706170ae91004fe095b24588b07fcb5cf2a1e5d8'
3
+ metadata.gz: 7781a195d6ca0b1a5646d9b54f94dfb6e5c191e6faae253583edce96d91c3abd
4
+ data.tar.gz: 23f333dfbc02f52d9dc37479513a4803b0bfabae087445dcb96b62b29327f282
5
5
  SHA512:
6
- metadata.gz: ab41c640a4f83a09fe1e46f44ba3aef0c69a442bdc4be91b64366fe2edd97788e37b88eaf7417dc89e1aec4be732df18628eed49626a4b8fc3776c31fc26fe76
7
- data.tar.gz: b5ebb005194d1a1075448b84bece5e6ed4ffa5b8b724d3ba227c468823ee44d3b1608b7bf110f85e6b3e56c271bb0cf06264f5de8d98218157f470cae8132393
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.7.3)
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.0)
17
+ minitest (5.18.0)
18
18
  mocha (1.16.1)
19
- parallel (1.22.1)
20
- parser (3.2.0.0)
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.6.1)
28
+ regexp_parser (2.8.1)
27
29
  rexml (3.2.5)
28
- rubocop (1.43.0)
30
+ rubocop (1.52.1)
29
31
  json (~> 2.3)
30
32
  parallel (~> 1.10)
31
- parser (>= 3.2.0.0)
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.24.1, < 2.0)
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.24.1)
39
- parser (>= 3.1.1.0)
40
- ruby-progressbar (1.11.0)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaisLegacy
4
- VERSION = "0.9.4"
4
+ VERSION = "1.0.0"
5
5
  end
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
- out.
46
- split("\n").
47
- map{|line| line.split(",")}.
48
- map{|line| {value: line[0], text: "#{line[0]}-#{line[1]}"}}
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)
@@ -61,7 +61,6 @@ module PaisLegacy
61
61
  cmd = ssh + ' "bash -l -c \"'+ fglgo("rptrun") +' pgs 1 pais '+program+' \''+ params + ' \' \""'
62
62
 
63
63
  out,_,_=Open3.capture2(cmd)
64
- byebug
65
64
  [out]
66
65
  end
67
66
 
@@ -123,7 +122,7 @@ module PaisLegacy
123
122
  # end
124
123
  # end
125
124
 
126
- [out]
125
+ out.split("\n")
127
126
  end
128
127
 
129
128
  # Get the accounts using the trial balance
@@ -269,6 +268,50 @@ module PaisLegacy
269
268
  end
270
269
  end
271
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
+
272
315
  private
273
316
  def self.accounts(account)
274
317
  account = account.split("/")
@@ -295,6 +338,10 @@ module PaisLegacy
295
338
  "ssh -oHostKeyAlgorithms=+ssh-dss #{PAISTRAM} -T"
296
339
  end
297
340
 
341
+ def self.ssh_with_tty
342
+ "ssh -oHostKeyAlgorithms=+ssh-dss #{PAISTRAM} -tt"
343
+ end
344
+
298
345
  def self.fglgo(file)
299
346
  "fglgo /hd0a/u/pais/live/prod/#{file}"
300
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.9.4
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-05-24 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug