thefox-wallet 0.17.1 → 0.18.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 +5 -5
- data/.editorconfig +5 -4
- data/.env.example +4 -0
- data/.gitignore +6 -9
- data/.gitlab-ci.yml +53 -43
- data/.travis.yml +17 -15
- data/Gemfile +4 -4
- data/README.md +37 -13
- data/Vagrantfile +34 -0
- data/bin/build_coverage.sh +24 -0
- data/bin/dev +1 -1
- data/bin/dev_data.sh +18 -0
- data/bin/dev_setup.sh +21 -0
- data/bin/install.sh +51 -0
- data/bin/release.sh +37 -0
- data/bin/test.sh +16 -0
- data/bin/uninstall.sh +24 -0
- data/bin/wallet +104 -104
- data/lib/wallet/command.rb +57 -57
- data/lib/wallet/command_add.rb +113 -113
- data/lib/wallet/command_categories.rb +13 -13
- data/lib/wallet/command_clear.rb +13 -13
- data/lib/wallet/command_csv.rb +30 -30
- data/lib/wallet/command_html.rb +20 -20
- data/lib/wallet/command_list.rb +168 -173
- data/lib/wallet/entry.rb +137 -137
- data/lib/wallet/version.rb +9 -9
- data/lib/wallet/wallet.rb +1051 -1051
- data/thefox-wallet.gemspec +23 -23
- data/wallet.sublime-project +8 -8
- metadata +12 -6
- data/.ackrc +0 -7
- data/Makefile +0 -29
- data/Makefile.common +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0fffbb8179bacdf2090fea639b32169a971c74cc41a3aa9a6b4cd618232a42ea
|
4
|
+
data.tar.gz: e67c28cb3d33b3836fc0f1a3ff9340ef97203bb41c9fdd73dd81eb18f568b9fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2e9b2af441f797323b91d8904a31e357080a0b367e80479b94c3ce9680af9a999a00e4d77c04d9147e4f532ba14f9bd65e582942bf420c3b14cf075437e860
|
7
|
+
data.tar.gz: dd07b9c48990f1e207ee8225c86dad436e62467d109e507bf7de3fc741f0f510afad97ca4540d173a560921bedb27f322616c224d011e93dd8b5a9f6d3e40780
|
data/.editorconfig
CHANGED
@@ -3,12 +3,13 @@
|
|
3
3
|
root = true
|
4
4
|
|
5
5
|
[*]
|
6
|
-
indent_style =
|
7
|
-
indent_size =
|
6
|
+
indent_style = space
|
7
|
+
indent_size = 2
|
8
8
|
end_of_line = lf
|
9
9
|
charset = utf-8
|
10
10
|
trim_trailing_whitespace = false
|
11
11
|
insert_final_newline = true
|
12
12
|
|
13
|
-
[*.
|
14
|
-
indent_style =
|
13
|
+
[*.{sh}]
|
14
|
+
indent_style = tab
|
15
|
+
indent_size = 4
|
data/.env.example
ADDED
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,56 +1,66 @@
|
|
1
1
|
before_script:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
- gem update --system
|
3
|
+
- gem install bundler -v '1.15.4'
|
4
|
+
- bundler --version
|
5
|
+
- bundler install
|
6
|
+
- ./bin/dev_setup.sh
|
6
7
|
|
7
8
|
stages:
|
8
|
-
|
9
|
-
|
9
|
+
- test
|
10
|
+
- release
|
10
11
|
|
11
12
|
test_21:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
image: ruby:2.1
|
14
|
+
stage: test
|
15
|
+
environment: test
|
16
|
+
only:
|
17
|
+
- tags
|
18
|
+
script:
|
19
|
+
- ./bin/test.sh
|
19
20
|
|
20
21
|
test_22:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
image: ruby:2.2
|
23
|
+
stage: test
|
24
|
+
environment: test
|
25
|
+
only:
|
26
|
+
- tags
|
27
|
+
script:
|
28
|
+
- ./bin/test.sh
|
28
29
|
|
29
30
|
test_23:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
image: ruby:2.3
|
32
|
+
stage: test
|
33
|
+
environment: test
|
34
|
+
only:
|
35
|
+
- tags
|
36
|
+
script:
|
37
|
+
- ./bin/test.sh
|
37
38
|
|
38
39
|
test_24:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
image: ruby:2.4
|
41
|
+
stage: test
|
42
|
+
environment: test
|
43
|
+
only:
|
44
|
+
- tags
|
45
|
+
script:
|
46
|
+
- ./bin/test.sh
|
47
|
+
|
48
|
+
test_25:
|
49
|
+
image: ruby:2.5
|
50
|
+
stage: test
|
51
|
+
environment: test
|
52
|
+
only:
|
53
|
+
- tags
|
54
|
+
script:
|
55
|
+
- ./bin/test.sh
|
46
56
|
|
47
57
|
release:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
58
|
+
image: ruby:2.4
|
59
|
+
stage: release
|
60
|
+
environment: gem
|
61
|
+
only:
|
62
|
+
- tags
|
63
|
+
script:
|
64
|
+
- mkdir -p ~/.gem
|
65
|
+
- 'printf "%s\n:rubygems_api_key: %s" "---" "${RUBYGEMSORG_API_KEY}" > ~/.gem/credentials; chmod 0600 ~/.gem/credentials'
|
66
|
+
- ./bin/release.sh
|
data/.travis.yml
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
- 2.1
|
4
|
+
- 2.2
|
5
|
+
- 2.3
|
6
|
+
- 2.4.0
|
7
|
+
- 2.5.0
|
8
|
+
- ruby-head
|
8
9
|
sudo: required
|
9
10
|
before_install:
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
- gem update --system
|
12
|
+
- gem install bundler -v '1.15.4'
|
13
|
+
- bundler --version
|
13
14
|
install:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
- bundler install
|
16
|
+
- ./bin/dev_setup.sh
|
17
|
+
- gem build thefox-wallet.gemspec
|
18
|
+
- gem install thefox-wallet-*.gem
|
19
|
+
- gem list -l thefox-wallet
|
18
20
|
script:
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
- ./bin/test.sh
|
22
|
+
- cd
|
23
|
+
- which -a wallet
|
data/Gemfile
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
source 'https://rubygems.org'
|
3
3
|
|
4
4
|
group(:development) do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
if ENV['SIMPLECOV_PHPUNIT_LOAD_PATH']
|
6
|
+
# Load SimpleCov PHPUnit Formatter from a local path.
|
7
|
+
gem 'simplecov-phpunit', :path => ENV['SIMPLECOV_PHPUNIT_LOAD_PATH']
|
8
|
+
end
|
9
9
|
end
|
10
10
|
|
11
11
|
gemspec
|
data/README.md
CHANGED
@@ -20,15 +20,21 @@ While conventionally programs like Microsoft Excel or [LibreOffice](https://www.
|
|
20
20
|
The preferred method of installation is via RubyGems.org:
|
21
21
|
<https://rubygems.org/gems/thefox-wallet>
|
22
22
|
|
23
|
-
|
23
|
+
```sh
|
24
|
+
$ gem install thefox-wallet
|
25
|
+
```
|
24
26
|
|
25
27
|
or via `Gemfile`:
|
26
28
|
|
27
|
-
|
29
|
+
```sh
|
30
|
+
$ gem 'thefox-wallet', '~>0.18'
|
31
|
+
```
|
28
32
|
|
29
33
|
Use it in your sources:
|
30
34
|
|
31
|
-
|
35
|
+
```ruby
|
36
|
+
require 'thefox-wallet'
|
37
|
+
```
|
32
38
|
|
33
39
|
## Options
|
34
40
|
|
@@ -73,17 +79,21 @@ Use it in your sources:
|
|
73
79
|
|
74
80
|
Add a new entry.
|
75
81
|
|
76
|
-
|
82
|
+
```sh
|
83
|
+
$ wallet add [-w <path>] [--id <id>] [-r <revenue>] [-e <expense>] [-c <category>] [-o <comment>] [-i] [-f|--no-force] -t|--title <title>
|
84
|
+
```
|
77
85
|
|
78
86
|
When `--interactive` (`-i`) option is used, parse `%d` with `printf`. Separate multiple `%`-variables with `,`. This feature can be used on template scripts that run the `wallet add` command with pre-defined texts.
|
79
87
|
|
80
88
|
For example. To use the following in a template script
|
81
89
|
|
82
|
-
|
90
|
+
```sh
|
91
|
+
$ wallet add --title 'Income tax %d/Q%d' --interactive
|
92
|
+
```
|
83
93
|
|
84
94
|
and set the values on interactive input when the command is running.
|
85
95
|
|
86
|
-
```
|
96
|
+
```sh
|
87
97
|
$ wallet add --title 'Income tax %d/Q%d' --interactive
|
88
98
|
title: [Income tax %d/Q%d] 2017,1
|
89
99
|
```
|
@@ -94,13 +104,17 @@ Expenses are always converted to minus.
|
|
94
104
|
|
95
105
|
Calculations will be `eval`ed as Ruby code. For example:
|
96
106
|
|
97
|
-
|
107
|
+
```sh
|
108
|
+
$ wallet add --title Test --expense 14+7
|
109
|
+
```
|
98
110
|
|
99
111
|
The expense will be `-21`. Expenses are always minus.
|
100
112
|
|
101
113
|
In the following example the expense will be `-3`:
|
102
114
|
|
103
|
-
|
115
|
+
```sh
|
116
|
+
$ wallet add --title Test --expense 10-7
|
117
|
+
```
|
104
118
|
|
105
119
|
The same applies to revenue.
|
106
120
|
|
@@ -110,7 +124,9 @@ See `AddCommand::revenue` and `AddCommand::expense` functions.
|
|
110
124
|
|
111
125
|
List all used categories.
|
112
126
|
|
113
|
-
|
127
|
+
```sh
|
128
|
+
$ wallet categories [-w <path>]
|
129
|
+
```
|
114
130
|
|
115
131
|
Each entry can have one category. It's planned to implement [Multiple Categories](https://github.com/TheFox/wallet/issues/3) for entries.
|
116
132
|
|
@@ -120,7 +136,9 @@ You can define the categories yourself. The `list` command has a filter option `
|
|
120
136
|
|
121
137
|
Clear temp and cache files.
|
122
138
|
|
123
|
-
|
139
|
+
```sh
|
140
|
+
$ wallet clear [-w <path>]
|
141
|
+
```
|
124
142
|
|
125
143
|
If the html directory path (`-p`) provided to the `html` command is outside of the wallet base path (`-w`) this directory will **NOT** be deleted by the `clear` command. If the default html directory (`wallet/html`) is used this directory will be removed. This command does **NOT** delete any entries stored at `wallet/data`.
|
126
144
|
|
@@ -128,13 +146,17 @@ If the html directory path (`-p`) provided to the `html` command is outside of t
|
|
128
146
|
|
129
147
|
Import or export to/from CSV file format.
|
130
148
|
|
131
|
-
|
149
|
+
```sh
|
150
|
+
$ wallet csv [-w <path>] [--import|--export] -p <path>
|
151
|
+
```
|
132
152
|
|
133
153
|
### HTML Command
|
134
154
|
|
135
155
|
Exports a wallet as HTML. List all years in an index HTML file and all months for each year. Generates a HTML file for each month based on entries.
|
136
156
|
|
137
|
-
|
157
|
+
```sh
|
158
|
+
$ wallet html [-w <path>] [--start <date>] [--end <date>] [-c <category,...>] [-p <path>] [-v]
|
159
|
+
```
|
138
160
|
|
139
161
|
Option `-c` can take multiple categories separated by `,`.
|
140
162
|
|
@@ -142,7 +164,9 @@ Option `-c` can take multiple categories separated by `,`.
|
|
142
164
|
|
143
165
|
List entries. Per default this command lists all entries of today's date.
|
144
166
|
|
145
|
-
|
167
|
+
```sh
|
168
|
+
$ wallet list [-w <path>] [-d <YYYY>[-<MM>[-<DD>]]] [-c <category>]
|
169
|
+
```
|
146
170
|
|
147
171
|
You can either provide a year `YYYY`, a month `YYYY-MM` or a day `YYYY-MM-DD`.
|
148
172
|
|
data/Vagrantfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.box = "generic/debian9"
|
6
|
+
config.vm.box_check_update = false
|
7
|
+
|
8
|
+
# config.vm.network "forwarded_port", guest: 4000, host: 4001
|
9
|
+
|
10
|
+
# config.vm.network "private_network", ip: "192.168.33.10"
|
11
|
+
config.vm.synced_folder ".", "/app"
|
12
|
+
|
13
|
+
config.vm.provider "virtualbox" do |vb|
|
14
|
+
vb.gui = false
|
15
|
+
vb.memory = 1024
|
16
|
+
end
|
17
|
+
|
18
|
+
config.vm.provision "shell" do |s|
|
19
|
+
s.env = {
|
20
|
+
'DEBIAN_FRONTEND' => 'noninteractive',
|
21
|
+
}
|
22
|
+
s.inline = <<-SHELL
|
23
|
+
apt-get update -yqq
|
24
|
+
apt-get upgrade -y
|
25
|
+
apt-get install -y htop vim lsof net-tools rsync ruby ruby-dev
|
26
|
+
|
27
|
+
gem update --system && \
|
28
|
+
gem install bundler -v '1.15.4' && \
|
29
|
+
gem install pry -v '~>0.11'
|
30
|
+
|
31
|
+
echo 'done'
|
32
|
+
SHELL
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Build code coverage.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
RUBYOPT=-w
|
7
|
+
TZ=Europe/Vienna
|
8
|
+
export COVERAGE=1
|
9
|
+
|
10
|
+
|
11
|
+
set -e
|
12
|
+
which bundler &> /dev/null || { echo 'ERROR: bundler not found in PATH'; exit 1; }
|
13
|
+
|
14
|
+
cd "${SCRIPT_BASEDIR}/.."
|
15
|
+
|
16
|
+
is_local=$1
|
17
|
+
|
18
|
+
if [[ "$is_local" = -l ]]; then
|
19
|
+
echo 'use local SimpleCov PHPUnit Formatter'
|
20
|
+
SIMPLECOV_PHPUNIT_LOAD_PATH=../simplecov-phpunit
|
21
|
+
fi
|
22
|
+
|
23
|
+
mkdir -p tmp
|
24
|
+
bundler exec ./test/suite_all.rb
|
data/bin/dev
CHANGED
data/bin/dev_data.sh
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Generate dev data.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
|
8
|
+
set -e
|
9
|
+
cd "${SCRIPT_BASEDIR}/.."
|
10
|
+
|
11
|
+
cwd="tmp/dev"
|
12
|
+
mkdir -p tmp/test_wallet
|
13
|
+
|
14
|
+
bundler exec bin/wallet -w tmp/test_wallet add -t 'test1' -d 2016-2-3 -e 10
|
15
|
+
bundler exec bin/wallet -w tmp/test_wallet add -t 'test2' -d 2016-2-1 -e 10 -r 20
|
16
|
+
bundler exec bin/wallet -w tmp/test_wallet add -t 'test3' -d 2016-1-1 -r 20
|
17
|
+
bundler exec bin/wallet -w tmp/test_wallet add -t 'test4' -d 2015-1-1 -r 20
|
18
|
+
bundler exec bin/wallet -w tmp/test_wallet add -t 'test5' -d 2014-1-1 -r 20
|
data/bin/dev_setup.sh
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Development setup.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
|
8
|
+
set -e
|
9
|
+
which cp &> /dev/null || { echo 'ERROR: cp not found in PATH'; exit 1; }
|
10
|
+
which bundler &> /dev/null || { echo 'ERROR: bundler not found in PATH'; exit 1; }
|
11
|
+
|
12
|
+
cd "${SCRIPT_BASEDIR}/.."
|
13
|
+
|
14
|
+
# Create .env file.
|
15
|
+
if [[ ! -f .env ]]; then
|
16
|
+
cp .env.example .env
|
17
|
+
fi
|
18
|
+
|
19
|
+
bundler install
|
20
|
+
|
21
|
+
./bin/dev_data.sh
|