hledger-forecast 1.5.1 → 2.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 +4 -4
- data/.github/workflows/release.yml +22 -0
- data/.github/workflows/{ci.yml → test.yml} +5 -5
- data/.rubocop.yml +17 -17
- data/README.md +8 -172
- data/example.journal +14 -14
- data/hledger-forecast.gemspec +1 -1
- data/lib/hledger_forecast/calculator.rb +5 -1
- data/lib/hledger_forecast/cli.rb +5 -18
- data/lib/hledger_forecast/generator.rb +52 -35
- data/lib/hledger_forecast/settings.rb +42 -27
- data/lib/hledger_forecast/summarizer.rb +28 -62
- data/lib/hledger_forecast/summarizer_formatter.rb +12 -3
- data/lib/hledger_forecast/transactions/default.rb +28 -57
- data/lib/hledger_forecast/transactions/trackers.rb +34 -40
- data/lib/hledger_forecast/utilities.rb +14 -0
- data/lib/hledger_forecast/version.rb +1 -1
- data/lib/hledger_forecast.rb +1 -2
- data/spec/cli_spec.rb +3 -12
- data/spec/computed_amounts_spec.rb +11 -22
- data/spec/custom_spec.rb +15 -35
- data/spec/half-yearly_spec.rb +6 -13
- data/spec/monthly_end_date_spec.rb +8 -18
- data/spec/monthly_end_date_transaction_spec.rb +20 -45
- data/spec/monthly_spec.rb +11 -28
- data/spec/once_spec.rb +6 -13
- data/spec/quarterly_spec.rb +5 -12
- data/spec/summarizer_spec.rb +11 -42
- data/spec/track_spec.rb +19 -49
- data/spec/verbose_output_spec.rb +3 -3
- data/spec/yearly_spec.rb +5 -12
- metadata +10 -18
- data/example.yml +0 -98
- data/lib/hledger_forecast/csv_parser.rb +0 -106
- data/spec/csv_and_yml_comparison_spec.rb +0 -32
- data/spec/csv_parser_spec.rb +0 -110
- data/spec/modifier_spec.rb +0 -102
- data/spec/stubs/forecast.yml +0 -19
data/spec/custom_spec.rb
CHANGED
@@ -1,52 +1,32 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
base_config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
category: "[Expenses:Personal Care]"
|
10
|
-
description: Hair and beauty
|
11
|
-
frequency: "every 2 weeks"
|
12
|
-
- amount: 50
|
13
|
-
category: "[Expenses:Groceries]"
|
14
|
-
description: Gotta feed that stomach
|
15
|
-
frequency: "every 5 days"
|
16
|
-
|
17
|
-
settings:
|
18
|
-
currency: GBP
|
19
|
-
YAML
|
3
|
+
base_config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
custom,every 2 weeks,[Assets:Bank],01/05/2023,,Hair and beauty,[Expenses:Personal Care],80,,,
|
6
|
+
custom,every 5 days,[Assets:Bank],01/05/2023,,Food,[Expenses:Groceries],50,,,
|
7
|
+
settings,currency,GBP,,,,,,,,
|
8
|
+
CSV
|
20
9
|
|
21
10
|
base_output = <<~JOURNAL
|
22
11
|
~ every 2 weeks from 2023-05-01 * Hair and beauty
|
23
|
-
[Expenses:Personal Care] £80.00; Hair and beauty
|
12
|
+
[Expenses:Personal Care] £80.00 ; Hair and beauty
|
24
13
|
[Assets:Bank]
|
25
14
|
|
26
|
-
~ every 5 days from 2023-05-01 *
|
27
|
-
[Expenses:Groceries] £50.00;
|
15
|
+
~ every 5 days from 2023-05-01 * Food
|
16
|
+
[Expenses:Groceries] £50.00 ; Food
|
28
17
|
[Assets:Bank]
|
29
18
|
|
30
19
|
JOURNAL
|
31
20
|
|
32
|
-
calculated_config = <<~
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
- amount: 80
|
38
|
-
category: "[Expenses:Personal Care]"
|
39
|
-
description: Hair and beauty
|
40
|
-
frequency: "every 2 weeks"
|
41
|
-
to: "=6"
|
42
|
-
|
43
|
-
settings:
|
44
|
-
currency: GBP
|
45
|
-
YAML
|
21
|
+
calculated_config = <<~CSV
|
22
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
23
|
+
custom,every 2 weeks,[Assets:Bank],01/05/2023,=6,Hair and beauty,[Expenses:Personal Care],80,,,
|
24
|
+
settings,currency,GBP,,,,,,,,
|
25
|
+
CSV
|
46
26
|
|
47
27
|
calculated_output = <<~JOURNAL
|
48
28
|
~ every 2 weeks from 2023-05-01 to 2023-10-31 * Hair and beauty
|
49
|
-
[Expenses:Personal Care] £80.00; Hair and beauty
|
29
|
+
[Expenses:Personal Care] £80.00 ; Hair and beauty
|
50
30
|
[Assets:Bank]
|
51
31
|
|
52
32
|
JOURNAL
|
data/spec/half-yearly_spec.rb
CHANGED
@@ -1,21 +1,14 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- from: "2023-04-01"
|
9
|
-
account: "Assets:Bank"
|
10
|
-
transactions:
|
11
|
-
- description: Holiday
|
12
|
-
category: "Expenses:Holiday"
|
13
|
-
amount: 500
|
14
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
half-yearly,,Assets:Bank,01/04/2023,,Holiday,Expenses:Holiday,500,,,
|
6
|
+
settings,currency,GBP,,,,,,,,
|
7
|
+
CSV
|
15
8
|
|
16
9
|
output = <<~JOURNAL
|
17
10
|
~ every 6 months from 2023-04-01 * Holiday
|
18
|
-
Expenses:Holiday £500.00; Holiday
|
11
|
+
Expenses:Holiday £500.00 ; Holiday
|
19
12
|
Assets:Bank
|
20
13
|
|
21
14
|
JOURNAL
|
@@ -1,26 +1,16 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
to: "2023-06-01"
|
10
|
-
account: "Assets:Bank"
|
11
|
-
transactions:
|
12
|
-
- description: Mortgage
|
13
|
-
category: "Expenses:Mortgage"
|
14
|
-
amount: 2000.00
|
15
|
-
- description: Food
|
16
|
-
category: "Expenses:Food"
|
17
|
-
amount: 100.00
|
18
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
monthly,,Assets:Bank,01/03/2023,01/06/2023,Mortgage,Expenses:Mortgage,2000.00,,,
|
6
|
+
monthly,,Assets:Bank,01/03/2023,01/06/2023,Food,Expenses:Food,100.00,,,
|
7
|
+
settings,currency,GBP,,,,,,,,
|
8
|
+
CSV
|
19
9
|
|
20
10
|
output = <<~JOURNAL
|
21
11
|
~ monthly from 2023-03-01 to 2023-06-01 * Mortgage, Food
|
22
|
-
Expenses:Mortgage £2,000.00; Mortgage
|
23
|
-
Expenses:Food £100.00
|
12
|
+
Expenses:Mortgage £2,000.00 ; Mortgage
|
13
|
+
Expenses:Food £100.00 ; Food
|
24
14
|
Assets:Bank
|
25
15
|
|
26
16
|
JOURNAL
|
@@ -1,66 +1,41 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
monthly:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
to: "2023-06-01"
|
13
|
-
category: "Expenses:Mortgage"
|
14
|
-
amount: 2000.00
|
15
|
-
- description: Mortgage top up
|
16
|
-
to: "2023-06-01"
|
17
|
-
category: "Expenses:Mortgage Top Up"
|
18
|
-
amount: 200.00
|
19
|
-
- description: Food
|
20
|
-
category: "Expenses:Food"
|
21
|
-
amount: 100.00
|
22
|
-
- description: Party time
|
23
|
-
category: "Expenses:Going Out"
|
24
|
-
amount: 50.00
|
25
|
-
YAML
|
26
|
-
|
27
|
-
base_output = <<~JOURNAL
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
monthly,,Assets:Bank,01/03/2023,01/06/2023,Mortgage,Expenses:Mortgage,2000.00,,,
|
6
|
+
monthly,,Assets:Bank,01/03/2023,01/06/2023,Mortgage top up,Expenses:Mortgage,200.00,,,
|
7
|
+
monthly,,Assets:Bank,01/03/2023,,Food,Expenses:Food,100.00,,,
|
8
|
+
settings,currency,GBP,,,,,,,,
|
9
|
+
CSV
|
10
|
+
|
11
|
+
output = <<~JOURNAL
|
28
12
|
~ monthly from 2023-03-01 to 2023-06-01 * Mortgage, Mortgage top up
|
29
|
-
Expenses:Mortgage
|
30
|
-
Expenses:Mortgage
|
13
|
+
Expenses:Mortgage £2,000.00 ; Mortgage
|
14
|
+
Expenses:Mortgage £200.00 ; Mortgage top up
|
31
15
|
Assets:Bank
|
32
16
|
|
33
|
-
~ monthly from 2023-03-01 * Food
|
34
|
-
Expenses:Food
|
35
|
-
Expenses:Going Out £50.00 ; Party time
|
17
|
+
~ monthly from 2023-03-01 * Food
|
18
|
+
Expenses:Food £100.00 ; Food
|
36
19
|
Assets:Bank
|
37
20
|
|
38
21
|
JOURNAL
|
39
22
|
|
40
|
-
computed_config = <<~
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
- from: "2023-03-01"
|
46
|
-
account: "Assets:Bank"
|
47
|
-
transactions:
|
48
|
-
- description: Mortgage
|
49
|
-
category: "Expenses:Mortgage"
|
50
|
-
to: "=12"
|
51
|
-
amount: 2000.00
|
52
|
-
YAML
|
23
|
+
computed_config = <<~CSV
|
24
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
25
|
+
monthly,,Assets:Bank,01/03/2023,=12,Mortgage,Expenses:Mortgage,2000.00,,,
|
26
|
+
settings,currency,GBP,,,,,,,,
|
27
|
+
CSV
|
53
28
|
|
54
29
|
computed_output = <<~JOURNAL
|
55
30
|
~ monthly from 2023-03-01 to 2024-02-29 * Mortgage
|
56
|
-
Expenses:Mortgage £2,000.00; Mortgage
|
31
|
+
Expenses:Mortgage £2,000.00 ; Mortgage
|
57
32
|
Assets:Bank
|
58
33
|
|
59
34
|
JOURNAL
|
60
35
|
|
61
36
|
RSpec.describe 'generate' do
|
62
37
|
it 'generates a forecast with correct MONTHLY transactions that have an end date' do
|
63
|
-
expect(HledgerForecast::Generator.generate(
|
38
|
+
expect(HledgerForecast::Generator.generate(config)).to eq(output)
|
64
39
|
end
|
65
40
|
|
66
41
|
it 'generates a forecast with correct MONTHLY transactions that have a COMPUTED end date' do
|
data/spec/monthly_spec.rb
CHANGED
@@ -1,37 +1,20 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
description: Mortgage
|
11
|
-
- amount: 100
|
12
|
-
category: "Expenses:Food"
|
13
|
-
description: Food
|
14
|
-
- account: "Assets:Savings"
|
15
|
-
from: "2023-03-01"
|
16
|
-
transactions:
|
17
|
-
- amount: -1000
|
18
|
-
category: "Assets:Bank"
|
19
|
-
description: Savings
|
20
|
-
|
21
|
-
settings:
|
22
|
-
currency: GBP
|
23
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
monthly,,Assets:Bank,01/03/2023,,Bills,Expenses:Bills,175,,,
|
6
|
+
monthly,,Assets:Bank,01/03/2023,,Food,Expenses:Food,500,,,
|
7
|
+
monthly,,Assets:Bank,01/03/2023,,Savings,Assets:Savings,-1000,,,
|
8
|
+
settings,currency,GBP,,,,,,,,
|
9
|
+
CSV
|
24
10
|
|
25
11
|
output = <<~JOURNAL
|
26
|
-
~ monthly from 2023-03-01 *
|
27
|
-
Expenses:
|
28
|
-
Expenses:Food
|
12
|
+
~ monthly from 2023-03-01 * Bills, Food, Savings
|
13
|
+
Expenses:Bills £175.00 ; Bills
|
14
|
+
Expenses:Food £500.00 ; Food
|
15
|
+
Assets:Savings £-1,000.00; Savings
|
29
16
|
Assets:Bank
|
30
17
|
|
31
|
-
~ monthly from 2023-03-01 * Savings
|
32
|
-
Assets:Bank £-1,000.00; Savings
|
33
|
-
Assets:Savings
|
34
|
-
|
35
18
|
JOURNAL
|
36
19
|
|
37
20
|
RSpec.describe 'generate' do
|
data/spec/once_spec.rb
CHANGED
@@ -1,21 +1,14 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- from: "2023-07-01"
|
9
|
-
account: "Assets:Bank"
|
10
|
-
transactions:
|
11
|
-
- description: New Kitchen
|
12
|
-
category: "Expense:House"
|
13
|
-
amount: 5,000.00
|
14
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
once,,Assets:Bank,01/07/2023,,New Kitchen,Expenses:House,5000,,,
|
6
|
+
settings,currency,GBP,,,,,,,,
|
7
|
+
CSV
|
15
8
|
|
16
9
|
output = <<~JOURNAL
|
17
10
|
~ 2023-07-01 * New Kitchen
|
18
|
-
|
11
|
+
Expenses:House £5,000.00; New Kitchen
|
19
12
|
Assets:Bank
|
20
13
|
|
21
14
|
JOURNAL
|
data/spec/quarterly_spec.rb
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- from: "2023-04-01"
|
9
|
-
account: "Assets:Bank"
|
10
|
-
transactions:
|
11
|
-
- description: Bonus
|
12
|
-
category: "Income:Bonus"
|
13
|
-
amount: -1,000.00
|
14
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
quarterly,,Assets:Bank,01/04/2023,,Bonus,Income:Bonus,-1000,,,
|
6
|
+
settings,currency,GBP,,,,,,,,
|
7
|
+
CSV
|
15
8
|
|
16
9
|
output = <<~JOURNAL
|
17
10
|
~ every 3 months from 2023-04-01 * Bonus
|
data/spec/summarizer_spec.rb
CHANGED
@@ -1,51 +1,20 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
- amount: 100
|
13
|
-
category: "Expenses:Food"
|
14
|
-
description: Food
|
15
|
-
- account: "Assets:Savings"
|
16
|
-
from: "2023-03-01"
|
17
|
-
transactions:
|
18
|
-
- amount: -1000
|
19
|
-
category: "Assets:Bank"
|
20
|
-
description: Savings
|
21
|
-
|
22
|
-
custom:
|
23
|
-
- account: "[Assets:Bank]"
|
24
|
-
from: "2023-05-01"
|
25
|
-
transactions:
|
26
|
-
- amount: 80
|
27
|
-
category: "[Expenses:Personal Care]"
|
28
|
-
description: Hair and beauty
|
29
|
-
frequency: "every 2 weeks"
|
30
|
-
roll-up: 26
|
31
|
-
- account: "[Assets:Checking]"
|
32
|
-
from: "2023-05-01"
|
33
|
-
transactions:
|
34
|
-
- amount: 50
|
35
|
-
category: "[Expenses:Groceries]"
|
36
|
-
description: Gotta feed that stomach
|
37
|
-
frequency: "every 5 days"
|
38
|
-
roll-up: 73
|
39
|
-
|
40
|
-
settings:
|
41
|
-
currency: GBP
|
42
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
monthly,,Assets:Bank,01/03/2023,=24,Mortgage,Expenses:Mortgage,2000.55,,,
|
6
|
+
monthly,,Assets:Bank,01/03/2023,,Food,Expenses:Food,100,,,
|
7
|
+
monthly,,Assets:Savings,01/03/2023,,Savings,Assets:Bank,-1000,,,
|
8
|
+
custom,every 2 weeks,[Assets:Bank],01/05/2023,,Hair and beauty,[Expenses:Personal Care],80,26,,
|
9
|
+
custom,every 2 weeks,[Assets:Checking],01/05/2023,,Extra Food,[Expenses:Groceries],50,73,,
|
10
|
+
settings,currency,GBP,,,,,,,,
|
11
|
+
CSV
|
43
12
|
|
44
13
|
RSpec.describe HledgerForecast::Summarizer do
|
45
14
|
let(:summarizer) { described_class.new }
|
46
15
|
|
47
16
|
describe '#generate with roll_up' do
|
48
|
-
let(:forecast) {
|
17
|
+
let(:forecast) { CSV.parse(config, headers: true) }
|
49
18
|
let(:cli_options) { { roll_up: 'monthly' } }
|
50
19
|
|
51
20
|
before do
|
@@ -69,7 +38,7 @@ RSpec.describe HledgerForecast::Summarizer do
|
|
69
38
|
end
|
70
39
|
|
71
40
|
describe '#generate' do
|
72
|
-
let(:forecast) {
|
41
|
+
let(:forecast) { CSV.parse(config, headers: true) }
|
73
42
|
let(:cli_options) { nil }
|
74
43
|
|
75
44
|
before do
|
data/spec/track_spec.rb
CHANGED
@@ -4,31 +4,17 @@ current_month = Date.new(Date.today.year, Date.today.month, 1)
|
|
4
4
|
previous_month = current_month.prev_month
|
5
5
|
next_month = current_month.next_month
|
6
6
|
|
7
|
-
base_config = <<~
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
description: Tax owed
|
15
|
-
track: true
|
16
|
-
- amount: 100
|
17
|
-
category: "Expenses:Food"
|
18
|
-
description: Food expenses
|
19
|
-
- amount: -1500
|
20
|
-
category: "Income:Salary"
|
21
|
-
description: Salary
|
22
|
-
to: "2023-08-01"
|
23
|
-
track: true
|
24
|
-
|
25
|
-
settings:
|
26
|
-
currency: GBP
|
27
|
-
YAML
|
7
|
+
base_config = <<~CSV
|
8
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
9
|
+
once,,Assets:Bank,05/03/2023,,Tax owed,Expenses:Tax,3000,,,true
|
10
|
+
once,,Assets:Bank,05/03/2023,,Food expenses,Expenses:Food,100,,,
|
11
|
+
once,,Assets:Bank,05/03/2023,01/08/2023,Salary,Income:Salary,-1500,,,true
|
12
|
+
settings,currency,GBP,,,,,,,,
|
13
|
+
CSV
|
28
14
|
|
29
15
|
base_output = <<~JOURNAL
|
30
16
|
~ 2023-03-05 * Food expenses
|
31
|
-
Expenses:Food £100.00
|
17
|
+
Expenses:Food £100.00 ; Food expenses
|
32
18
|
Assets:Bank
|
33
19
|
|
34
20
|
~ #{next_month} * [TRACKED] Tax owed
|
@@ -54,19 +40,11 @@ RSpec.describe 'Tracking transactions -' do
|
|
54
40
|
it 'writes a NON-FOUND entry for dates that are close to the current period' do
|
55
41
|
require 'tempfile'
|
56
42
|
|
57
|
-
forecast_config = <<~
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
- amount: 5000
|
63
|
-
category: "Expenses:House"
|
64
|
-
description: New kitchen
|
65
|
-
track: true
|
66
|
-
|
67
|
-
settings:
|
68
|
-
currency: GBP
|
69
|
-
YAML
|
43
|
+
forecast_config = <<~CSV
|
44
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
45
|
+
once,,Assets:Bank,"#{previous_month}",,New kitchen,Expenses:House,5000,,,true
|
46
|
+
settings,currency,GBP,,,,,,,,
|
47
|
+
CSV
|
70
48
|
|
71
49
|
journal = <<~JOURNAL
|
72
50
|
#{previous_month} * Opening balance
|
@@ -104,19 +82,11 @@ RSpec.describe 'Tracking transactions -' do
|
|
104
82
|
end
|
105
83
|
|
106
84
|
it 'treats a future tracked transaction as a regular transaction' do
|
107
|
-
forecast_config = <<~
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
- amount: 100
|
113
|
-
category: "Expenses:Food"
|
114
|
-
description: Food expenses
|
115
|
-
track: true
|
116
|
-
|
117
|
-
settings:
|
118
|
-
currency: GBP
|
119
|
-
YAML
|
85
|
+
forecast_config = <<~CSV
|
86
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
87
|
+
monthly,,Assets:Bank,"#{next_month}",,Food expenses,Expenses:Food,100,,,true
|
88
|
+
settings,currency,GBP,,,,,,,,
|
89
|
+
CSV
|
120
90
|
|
121
91
|
options = {}
|
122
92
|
options[:transaction_file] = 'spec/stubs/transactions_not_found.journal'
|
@@ -125,7 +95,7 @@ RSpec.describe 'Tracking transactions -' do
|
|
125
95
|
|
126
96
|
output = <<~JOURNAL
|
127
97
|
~ monthly from #{next_month} * Food expenses
|
128
|
-
Expenses:Food £100.00; Food expenses
|
98
|
+
Expenses:Food £100.00 ; Food expenses
|
129
99
|
Assets:Bank
|
130
100
|
|
131
101
|
JOURNAL
|
data/spec/verbose_output_spec.rb
CHANGED
@@ -2,15 +2,15 @@ require_relative '../lib/hledger_forecast'
|
|
2
2
|
|
3
3
|
output = <<~JOURNAL
|
4
4
|
~ monthly from 2023-03-01 * Mortgage
|
5
|
-
Expenses:Mortgage £2,000.55; Mortgage
|
5
|
+
Expenses:Mortgage £2,000.55 ; Mortgage
|
6
6
|
Assets:Bank
|
7
7
|
|
8
8
|
~ monthly from 2023-03-01 * Food
|
9
|
-
Expenses:Food £100.00
|
9
|
+
Expenses:Food £100.00 ; Food
|
10
10
|
Assets:Bank
|
11
11
|
|
12
12
|
~ monthly from 2023-03-01 * Savings
|
13
|
-
Assets:Bank £-1,000.00; Savings
|
13
|
+
Assets:Bank £-1,000.00 ; Savings
|
14
14
|
Assets:Savings
|
15
15
|
|
16
16
|
JOURNAL
|
data/spec/yearly_spec.rb
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
require_relative '../lib/hledger_forecast'
|
2
2
|
|
3
|
-
config = <<~
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- account: "Assets:Bank"
|
9
|
-
from: "2023-04-01"
|
10
|
-
transactions:
|
11
|
-
- description: Bonus
|
12
|
-
category: "Income:Bonus"
|
13
|
-
amount: -3,000.00
|
14
|
-
YAML
|
3
|
+
config = <<~CSV
|
4
|
+
type,frequency,account,from,to,description,category,amount,roll-up,summary_exclude,track
|
5
|
+
yearly,,Assets:Bank,01/04/2023,,Bonus,Income:Bonus,-3000,,,
|
6
|
+
settings,currency,GBP,,,,,,,,
|
7
|
+
CSV
|
15
8
|
|
16
9
|
output = <<~JOURNAL
|
17
10
|
~ yearly from 2023-04-01 * Bonus
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hledger-forecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oli Morris
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -94,14 +94,15 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.12'
|
97
|
-
description: Use a CSV
|
97
|
+
description: Use a CSV file for improved forecasting with hledger
|
98
98
|
email: olimorris@users.noreply.github.com
|
99
99
|
executables:
|
100
100
|
- hledger-forecast
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- ".github/workflows/
|
104
|
+
- ".github/workflows/release.yml"
|
105
|
+
- ".github/workflows/test.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".rubocop.yml"
|
107
108
|
- Gemfile
|
@@ -110,13 +111,11 @@ files:
|
|
110
111
|
- bin/hledger-forecast
|
111
112
|
- example.csv
|
112
113
|
- example.journal
|
113
|
-
- example.yml
|
114
114
|
- hledger-forecast.gemspec
|
115
115
|
- lib/hledger_forecast.rb
|
116
116
|
- lib/hledger_forecast/calculator.rb
|
117
117
|
- lib/hledger_forecast/cli.rb
|
118
118
|
- lib/hledger_forecast/comparator.rb
|
119
|
-
- lib/hledger_forecast/csv_parser.rb
|
120
119
|
- lib/hledger_forecast/formatter.rb
|
121
120
|
- lib/hledger_forecast/generator.rb
|
122
121
|
- lib/hledger_forecast/settings.rb
|
@@ -125,22 +124,19 @@ files:
|
|
125
124
|
- lib/hledger_forecast/transactions/default.rb
|
126
125
|
- lib/hledger_forecast/transactions/modifiers.rb
|
127
126
|
- lib/hledger_forecast/transactions/trackers.rb
|
127
|
+
- lib/hledger_forecast/utilities.rb
|
128
128
|
- lib/hledger_forecast/version.rb
|
129
129
|
- spec/cli_spec.rb
|
130
130
|
- spec/compare_spec.rb
|
131
131
|
- spec/computed_amounts_spec.rb
|
132
|
-
- spec/csv_and_yml_comparison_spec.rb
|
133
|
-
- spec/csv_parser_spec.rb
|
134
132
|
- spec/custom_spec.rb
|
135
133
|
- spec/half-yearly_spec.rb
|
136
|
-
- spec/modifier_spec.rb
|
137
134
|
- spec/monthly_end_date_spec.rb
|
138
135
|
- spec/monthly_end_date_transaction_spec.rb
|
139
136
|
- spec/monthly_spec.rb
|
140
137
|
- spec/once_spec.rb
|
141
138
|
- spec/quarterly_spec.rb
|
142
139
|
- spec/stubs/forecast.csv
|
143
|
-
- spec/stubs/forecast.yml
|
144
140
|
- spec/stubs/output1.csv
|
145
141
|
- spec/stubs/output2.csv
|
146
142
|
- spec/stubs/transactions_found.journal
|
@@ -154,7 +150,7 @@ homepage: https://github.com/olimorris/hledger-forecast
|
|
154
150
|
licenses:
|
155
151
|
- MIT
|
156
152
|
metadata: {}
|
157
|
-
post_install_message:
|
153
|
+
post_install_message:
|
158
154
|
rdoc_options: []
|
159
155
|
require_paths:
|
160
156
|
- lib
|
@@ -169,26 +165,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
165
|
- !ruby/object:Gem::Version
|
170
166
|
version: '0'
|
171
167
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
173
|
-
signing_key:
|
168
|
+
rubygems_version: 3.3.5
|
169
|
+
signing_key:
|
174
170
|
specification_version: 4
|
175
171
|
summary: An extended wrapper around hledger's forecasting functionality
|
176
172
|
test_files:
|
177
173
|
- spec/cli_spec.rb
|
178
174
|
- spec/compare_spec.rb
|
179
175
|
- spec/computed_amounts_spec.rb
|
180
|
-
- spec/csv_and_yml_comparison_spec.rb
|
181
|
-
- spec/csv_parser_spec.rb
|
182
176
|
- spec/custom_spec.rb
|
183
177
|
- spec/half-yearly_spec.rb
|
184
|
-
- spec/modifier_spec.rb
|
185
178
|
- spec/monthly_end_date_spec.rb
|
186
179
|
- spec/monthly_end_date_transaction_spec.rb
|
187
180
|
- spec/monthly_spec.rb
|
188
181
|
- spec/once_spec.rb
|
189
182
|
- spec/quarterly_spec.rb
|
190
183
|
- spec/stubs/forecast.csv
|
191
|
-
- spec/stubs/forecast.yml
|
192
184
|
- spec/stubs/output1.csv
|
193
185
|
- spec/stubs/output2.csv
|
194
186
|
- spec/stubs/transactions_found.journal
|