ledger_tiller_export 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ledger_tiller_export.rb +23 -29
- data/lib/ledger_tiller_export/version.rb +1 -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: dca9cd455a804f83b08934969616fd39bd5821c8
|
4
|
+
data.tar.gz: 14fe0a7365a1f4245ab95aa3f581782e8c3b4ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6971651ad421854977106cb545a618f5cab00c7fcf090974552f0ca0e77c0765dc65cf12a3074dff3a038633ff0ad605b0ac0159e64daaa39e44ea688cca432f
|
7
|
+
data.tar.gz: 75284c5af67a757b5b3d4880fc1ba21538a47cfb0a14ecb46b52a4f9bb4e823f89e0d693fdb6cc511d954afbdb3b86afab4653447549c3b438e96cba3c62a031
|
data/README.md
CHANGED
@@ -91,7 +91,7 @@ class CheckingAccountRule
|
|
91
91
|
end
|
92
92
|
|
93
93
|
CHECKING_ACCOUNTS = T.let([
|
94
|
-
CheckingAccount.new(account: 'Assets:SomeBank:Checking', check_account_prefix: 'Liabilities:Checks:SomeBank),
|
94
|
+
CheckingAccount.new(account: 'Assets:SomeBank:Checking', check_account_prefix: 'Liabilities:Checks:SomeBank'),
|
95
95
|
CheckingAccount.new(account: 'Assets:OtherBank:Checking', check_account_prefix: 'Liabilities:Checks:OtherBank'),
|
96
96
|
], T::Array[CheckingAccount])
|
97
97
|
|
data/lib/ledger_tiller_export.rb
CHANGED
@@ -41,8 +41,12 @@ module LedgerTillerExport
|
|
41
41
|
def account_for_row(row); end
|
42
42
|
end
|
43
43
|
|
44
|
-
class RegexpRule
|
44
|
+
class RegexpRule
|
45
45
|
extend T::Sig
|
46
|
+
|
47
|
+
include T::Props
|
48
|
+
include T::Props::Constructor
|
49
|
+
|
46
50
|
include RuleInterface
|
47
51
|
|
48
52
|
const :match, Regexp
|
@@ -61,26 +65,17 @@ module LedgerTillerExport
|
|
61
65
|
class Exporter
|
62
66
|
extend T::Sig
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
sig {returns(String)}
|
68
|
-
attr_reader :spreadsheet
|
69
|
-
|
70
|
-
sig {returns(String)}
|
71
|
-
attr_reader :worksheet
|
68
|
+
include T::Props
|
69
|
+
include T::Props::Constructor
|
72
70
|
|
73
|
-
|
74
|
-
|
71
|
+
const :rules, T::Array[RuleInterface]
|
72
|
+
const :spreadsheet, String
|
73
|
+
const :worksheet, String
|
74
|
+
const :default_account, String
|
75
|
+
const :ledger_pretty_print_options, String
|
75
76
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
sig {returns(GoogleDrive::Session)}
|
80
|
-
attr_reader :session
|
81
|
-
|
82
|
-
sig {returns(LedgerGen::Journal)}
|
83
|
-
attr_reader :journal
|
77
|
+
const :session, GoogleDrive::Session, factory: ->{GoogleDrive::Session.from_config('.config.json')}
|
78
|
+
const :journal, LedgerGen::Journal, factory: ->{LedgerGen::Journal.new}
|
84
79
|
|
85
80
|
sig do
|
86
81
|
params(
|
@@ -93,16 +88,15 @@ module LedgerTillerExport
|
|
93
88
|
).void
|
94
89
|
end
|
95
90
|
def initialize(rules:, spreadsheet:, worksheet: 'Transactions', default_account: 'Expenses:Misc', ledger_pretty_print_options: '--sort=date', ledger_date_format: '%m/%d')
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
@journal = T.let(LedgerGen::Journal.new, LedgerGen::Journal)
|
91
|
+
super(
|
92
|
+
rules: rules,
|
93
|
+
spreadsheet: spreadsheet,
|
94
|
+
worksheet: worksheet,
|
95
|
+
default_account: default_account,
|
96
|
+
ledger_pretty_print_options: ledger_pretty_print_options,
|
97
|
+
)
|
104
98
|
|
105
|
-
|
99
|
+
self.journal.date_format = ledger_date_format
|
106
100
|
end
|
107
101
|
|
108
102
|
sig {void}
|
@@ -125,7 +119,7 @@ module LedgerTillerExport
|
|
125
119
|
journal_transaction(row)
|
126
120
|
end
|
127
121
|
|
128
|
-
puts
|
122
|
+
puts journal.pretty_print(ledger_pretty_print_options)
|
129
123
|
end
|
130
124
|
|
131
125
|
sig {params(row: Row).returns(T::Boolean)}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ledger_tiller_export
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Keen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|