thefox-wallet 0.17.1 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 54d22dd7375ab5d853142bd46bb4abb8a34b652c
4
- data.tar.gz: 6ec6de3481a67d3dcb4ad2817e9236685adf2f8d
2
+ SHA256:
3
+ metadata.gz: 0fffbb8179bacdf2090fea639b32169a971c74cc41a3aa9a6b4cd618232a42ea
4
+ data.tar.gz: e67c28cb3d33b3836fc0f1a3ff9340ef97203bb41c9fdd73dd81eb18f568b9fe
5
5
  SHA512:
6
- metadata.gz: 9477cffe182a79d0297a1f549fdfef756660952471d5906ecfcf9a0d11f12d904c75b3c092e49c84daeca1e2d9a50a844db25bef7cf39e545a85d8e9b9be3e28
7
- data.tar.gz: 2306c77008b56bc704ed1ece8b76d655673a9037699a1c37ef3e60363461f820f0879385f1ef2909b190234fbc3403bdc97560a25d3f8b8394eb04ec309cf087
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 = tab
7
- indent_size = 4
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
- [*.yml]
14
- indent_style = space
13
+ [*.{sh}]
14
+ indent_style = tab
15
+ indent_size = 4
data/.env.example ADDED
@@ -0,0 +1,4 @@
1
+ GEM_NAME=timr
2
+ GEMSPEC_FILE=timr.gemspec
3
+ IMAGE_NAME="thefox/wallet"
4
+ IMAGE_NAME_SHORT="wallet"
data/.gitignore CHANGED
@@ -1,13 +1,10 @@
1
- /.bundle/
2
- .setup
1
+ .env
3
2
  CHANGELOG-*.txt
4
- /coverage/
5
3
  Gemfile.lock
6
- /releases/
7
- /test_wallet/
8
- /tmp/
9
- /wallet/
10
- /wallet_test/
11
- /wallet_test2/
12
4
  *.csv
13
5
  *.txt
6
+ *.gem
7
+ /coverage/
8
+ /tmp/
9
+ /.idea/
10
+ /.vagrant/
data/.gitlab-ci.yml CHANGED
@@ -1,56 +1,66 @@
1
1
  before_script:
2
- - gem update --system
3
- - gem install bundler -v '~>1.13'
4
- - bundler --version
5
- - make
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
- - test
9
- - release
9
+ - test
10
+ - release
10
11
 
11
12
  test_21:
12
- image: ruby:2.1
13
- stage: test
14
- environment: test
15
- only:
16
- - tags
17
- script:
18
- - make test
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
- image: ruby:2.2
22
- stage: test
23
- environment: test
24
- only:
25
- - tags
26
- script:
27
- - make test
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
- image: ruby:2.3
31
- stage: test
32
- environment: test
33
- only:
34
- - tags
35
- script:
36
- - make test
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
- image: ruby:2.4
40
- stage: test
41
- environment: test
42
- only:
43
- - tags
44
- script:
45
- - make test
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
- image: ruby:2.4
49
- stage: release
50
- environment: gem
51
- only:
52
- - tags
53
- script:
54
- - mkdir -p ~/.gem
55
- - 'printf "%s\n:rubygems_api_key: %s" "---" "${RUBYGEMSORG_API_KEY}" > ~/.gem/credentials; chmod 0600 ~/.gem/credentials'
56
- - make release
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
- - 2.1
4
- - 2.2
5
- - 2.3
6
- - 2.4.0
7
- - ruby-head
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
- - gem update --system
11
- - gem install bundler -v '~>1.13'
12
- - bundler --version
11
+ - gem update --system
12
+ - gem install bundler -v '1.15.4'
13
+ - bundler --version
13
14
  install:
14
- - make
15
- - gem build thefox-wallet.gemspec
16
- - gem install thefox-wallet-*.gem
17
- - gem list -l thefox-wallet
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
- - make test
20
- - cd
21
- - which -a wallet
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
- 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
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
- gem install thefox-wallet
23
+ ```sh
24
+ $ gem install thefox-wallet
25
+ ```
24
26
 
25
27
  or via `Gemfile`:
26
28
 
27
- gem 'thefox-wallet', '~>0.16'
29
+ ```sh
30
+ $ gem 'thefox-wallet', '~>0.18'
31
+ ```
28
32
 
29
33
  Use it in your sources:
30
34
 
31
- require 'thefox-wallet'
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
- $ wallet add [-w <path>] [--id <id>] [-r <revenue>] [-e <expense>] [-c <category>] [-o <comment>] [-i] [-f|--no-force] -t|--title <title>
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
- $ wallet add --title 'Income tax %d/Q%d' --interactive
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
- ```bash
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
- $ wallet add --title Test --expense 14+7
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
- $ wallet add --title Test --expense 10-7
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
- $ wallet categories [-w <path>]
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
- $ wallet clear [-w <path>]
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
- $ wallet csv [-w <path>] [--import|--export] -p <path>
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
- $ wallet html [-w <path>] [--start <date>] [--end <date>] [-c <category,...>] [-p <path>] [-v]
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
- $ wallet list [-w <path>] [-d <YYYY>[-<MM>[-<DD>]]] [-c <category>]
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
@@ -7,6 +7,6 @@ require 'wallet'
7
7
 
8
8
  include TheFox::Wallet
9
9
 
10
- wallet = Wallet.new(Pathname.new('wallet_test2'))
10
+ wallet = Wallet.new(Pathname.new('tmp/test_wallet'))
11
11
 
12
12
  binding.pry
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