hledger-forecast 0.1.2 → 0.1.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 +7 -1
- data/README.md +5 -1
- data/bin/hledger-forecast +0 -1
- data/lib/hledger_forecast/command.rb +1 -1
- data/lib/hledger_forecast/options.rb +5 -1
- data/lib/hledger_forecast/version.rb +1 -1
- data/spec/command_spec.rb +12 -0
- metadata +4 -3
- data/Gemfile.lock +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5643f9c8df4ba13c316af221d62c02e91263948fe34e42dc1a50683b164a73ba
|
4
|
+
data.tar.gz: 10dad47f307b30f253db51b78aa26bfdd915323c120160e9c29e8e8981fb87fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f1b17f8f0f0dba931d208e1f94d55dedfa1f6ee8a6506fc4ca7d456893d5725b2fef0e3a3e8650ca6916ce9edd9b9d6ba9ceebdacd3225f8f0160719063cb5d
|
7
|
+
data.tar.gz: b64392b194aedad3db34478d59ee124b6d857b68c152659abf2611c9a5e5418be3b784a389201b858fa0a9395e5669995afeffc4dce23e4b8cde2d28556bdd9c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -36,6 +36,7 @@ Running `hledger-forecast -h` shows the available options:
|
|
36
36
|
-o, --output-file FILE The OUTPUT file to create
|
37
37
|
-s, --start-date DATE The date to start generating from (yyyy-mm-dd)
|
38
38
|
-e, --end-date DATE The date to start generating to (yyyy-mm-dd)
|
39
|
+
--force Force an overwrite of the output file
|
39
40
|
-h, --help Show this message
|
40
41
|
--version Show version
|
41
42
|
|
@@ -43,7 +44,10 @@ To then include in Hledger:
|
|
43
44
|
|
44
45
|
hledger -f transactions.journal -f forecast.journal
|
45
46
|
|
46
|
-
where
|
47
|
+
where:
|
48
|
+
|
49
|
+
- `transactions.journal` might be your bank transactions (your "_actuals_")
|
50
|
+
- `forecast.journal` is the generated forecast file
|
47
51
|
|
48
52
|
### A simple config file
|
49
53
|
|
data/bin/hledger-forecast
CHANGED
@@ -11,7 +11,7 @@ module HledgerForecast
|
|
11
11
|
transactions = Generator.create_journal_entries(transactions, forecast, start_date, end_date)
|
12
12
|
|
13
13
|
output_file = args[:output_file]
|
14
|
-
if File.exist?(output_file)
|
14
|
+
if File.exist?(output_file) && !args[:force]
|
15
15
|
print "File '#{output_file}' already exists. Overwrite? (y/n): "
|
16
16
|
overwrite = gets.chomp.downcase
|
17
17
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module HledgerForecast
|
2
2
|
class Options
|
3
3
|
def self.parse_command_line_options(args = ARGV, _stdin = $stdin)
|
4
|
-
cli = HighLine.new
|
5
4
|
options = {}
|
6
5
|
|
7
6
|
OptionParser.new do |opts|
|
@@ -33,6 +32,11 @@ module HledgerForecast
|
|
33
32
|
options[:end_date] = a
|
34
33
|
end
|
35
34
|
|
35
|
+
opts.on("--force",
|
36
|
+
"Force an overwrite of the output file") do |a|
|
37
|
+
options[:force] = a
|
38
|
+
end
|
39
|
+
|
36
40
|
opts.on_tail("-h", "--help", "Show this message") do
|
37
41
|
puts opts
|
38
42
|
exit
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative '../lib/hledger_forecast'
|
2
|
+
|
3
|
+
RSpec.describe 'command' do
|
4
|
+
it 'uses the CLI to generate an output' do
|
5
|
+
system("./bin/hledger-forecast -t ./spec/stubs/transactions.journal -f ./spec/stubs/monthly/forecast_monthly.yml -o ./test_output.journal -s 2023-03-01 -e 2023-05-30 --force")
|
6
|
+
|
7
|
+
expected_output = File.read('spec/stubs/monthly/output_monthly.journal')
|
8
|
+
generated_journal = File.read('./test_output.journal')
|
9
|
+
|
10
|
+
expect(generated_journal).to eq(expected_output)
|
11
|
+
end
|
12
|
+
end
|
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: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oli Morris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -65,7 +65,6 @@ files:
|
|
65
65
|
- ".rubocop.yml"
|
66
66
|
- ".ruby-version"
|
67
67
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
68
|
- LICENSE
|
70
69
|
- README.md
|
71
70
|
- bin/hledger-forecast
|
@@ -76,6 +75,7 @@ files:
|
|
76
75
|
- lib/hledger_forecast/generator.rb
|
77
76
|
- lib/hledger_forecast/options.rb
|
78
77
|
- lib/hledger_forecast/version.rb
|
78
|
+
- spec/command_spec.rb
|
79
79
|
- spec/monthly_spec.rb
|
80
80
|
- spec/once_spec.rb
|
81
81
|
- spec/quarterly_spec.rb
|
@@ -119,6 +119,7 @@ signing_key:
|
|
119
119
|
specification_version: 4
|
120
120
|
summary: Utility to generate forecasts in Hledger
|
121
121
|
test_files:
|
122
|
+
- spec/command_spec.rb
|
122
123
|
- spec/monthly_spec.rb
|
123
124
|
- spec/once_spec.rb
|
124
125
|
- spec/quarterly_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
hledger-forecast (0.1.1)
|
5
|
-
highline (~> 2.1.0)
|
6
|
-
money (~> 6.16.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
concurrent-ruby (1.2.2)
|
12
|
-
diff-lcs (1.5.0)
|
13
|
-
highline (2.1.0)
|
14
|
-
i18n (1.12.0)
|
15
|
-
concurrent-ruby (~> 1.0)
|
16
|
-
money (6.16.0)
|
17
|
-
i18n (>= 0.6.4, <= 2)
|
18
|
-
rspec (3.12.0)
|
19
|
-
rspec-core (~> 3.12.0)
|
20
|
-
rspec-expectations (~> 3.12.0)
|
21
|
-
rspec-mocks (~> 3.12.0)
|
22
|
-
rspec-core (3.12.1)
|
23
|
-
rspec-support (~> 3.12.0)
|
24
|
-
rspec-expectations (3.12.2)
|
25
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.12.0)
|
27
|
-
rspec-mocks (3.12.5)
|
28
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.12.0)
|
30
|
-
rspec-support (3.12.0)
|
31
|
-
|
32
|
-
PLATFORMS
|
33
|
-
arm64-darwin-21
|
34
|
-
x86_64-linux
|
35
|
-
|
36
|
-
DEPENDENCIES
|
37
|
-
hledger-forecast!
|
38
|
-
money
|
39
|
-
rspec (~> 3.12)
|
40
|
-
|
41
|
-
BUNDLED WITH
|
42
|
-
2.4.10
|