hledger-forecast 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.gitignore +18 -1
- data/README.md +5 -1
- data/bin/hledger-forecast +0 -1
- data/hledger-forecast.gemspec +0 -2
- 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 +5 -5
- data/.ruby-version +0 -1
- 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: 6d7bd2190c7f86b3d6a1fe76583a8f7e959f4429719b9903de343d25e0bf3b51
|
4
|
+
data.tar.gz: 7bb59da35fc2f9f3c47b6ed8b45d2ef38fb9c5c084c6bce9d6ee66fd004157a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3251f466cd2072685cf063268aca5c9ddc6231e9ac5c217049369c3e6b1c1d729967059441d4318247b7477ebaf357dc317e4f40df6b8e44dbe59a14b5005b9a
|
7
|
+
data.tar.gz: 55251b35a8cfea885fbbcb861ad650635a0fed4c91e618942ddd4eb76c38b9d3826d1b35e9078c1fae9c2ea96aa311cef750cc37fd88d5e4aed75ecb5c6db21f
|
data/.github/workflows/ci.yml
CHANGED
data/.gitignore
CHANGED
@@ -1,4 +1,21 @@
|
|
1
|
+
# Bundler
|
2
|
+
.bundle
|
3
|
+
Gemfile.lock
|
4
|
+
pkg/*
|
1
5
|
*.gem
|
2
|
-
|
6
|
+
|
7
|
+
# Project
|
8
|
+
.rbenv-version
|
9
|
+
.rbx
|
10
|
+
.rvmrc
|
11
|
+
.ruby-version
|
12
|
+
.ruby-gemset
|
13
|
+
|
14
|
+
# Spec artifacts
|
15
|
+
/coverage
|
16
|
+
|
17
|
+
# Misc
|
3
18
|
forecast.yml
|
19
|
+
forecast.journal
|
20
|
+
test_output.journal
|
4
21
|
todo.md
|
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
data/hledger-forecast.gemspec
CHANGED
@@ -12,8 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = 'https://github.com/olimorris/hledger-forecast'
|
13
13
|
s.license = 'MIT'
|
14
14
|
|
15
|
-
s.required_ruby_version = '>= 3.0.0'
|
16
|
-
|
17
15
|
s.add_dependency "highline", "~> 2.1.0"
|
18
16
|
s.add_dependency "money", "~> 6.16.0"
|
19
17
|
s.add_development_dependency 'rspec', '~> 3.12'
|
@@ -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.4
|
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
|
@@ -63,9 +63,7 @@ files:
|
|
63
63
|
- ".github/workflows/ci.yml"
|
64
64
|
- ".gitignore"
|
65
65
|
- ".rubocop.yml"
|
66
|
-
- ".ruby-version"
|
67
66
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
67
|
- LICENSE
|
70
68
|
- README.md
|
71
69
|
- bin/hledger-forecast
|
@@ -76,6 +74,7 @@ files:
|
|
76
74
|
- lib/hledger_forecast/generator.rb
|
77
75
|
- lib/hledger_forecast/options.rb
|
78
76
|
- lib/hledger_forecast/version.rb
|
77
|
+
- spec/command_spec.rb
|
79
78
|
- spec/monthly_spec.rb
|
80
79
|
- spec/once_spec.rb
|
81
80
|
- spec/quarterly_spec.rb
|
@@ -107,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
106
|
requirements:
|
108
107
|
- - ">="
|
109
108
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
109
|
+
version: '0'
|
111
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
111
|
requirements:
|
113
112
|
- - ">="
|
@@ -119,6 +118,7 @@ signing_key:
|
|
119
118
|
specification_version: 4
|
120
119
|
summary: Utility to generate forecasts in Hledger
|
121
120
|
test_files:
|
121
|
+
- spec/command_spec.rb
|
122
122
|
- spec/monthly_spec.rb
|
123
123
|
- spec/once_spec.rb
|
124
124
|
- spec/quarterly_spec.rb
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.0
|
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
|