thefox-wallet 0.12.1 → 0.13.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/Makefile +5 -1
- data/README.md +3 -2
- data/bin/wallet +4 -0
- data/lib/wallet/command_add.rb +6 -1
- data/lib/wallet/version.rb +3 -2
- data/lib/wallet/wallet.rb +3 -6
- data/thefox-wallet.gemspec +1 -0
- data/wallet.sublime-project +2 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4e8feceab54fde2f7ffb5ce5782cb48ca3213b
|
4
|
+
data.tar.gz: 00b9ca606122f5fd4c0f181442b3a0a044105169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d37b581624f6f9895f29a8639a5625894c0438916b38c6ddec5058d4c489bd242d67570326475c4b31cf2a3cd5b8cd52b50db0c3638b4978336cdb10b839908
|
7
|
+
data.tar.gz: 34eb1d12045a4cd6792b455df3bfb06c6c7077507ef4ffa8d8e1309cd5853593192678bb3ebd30df1aec51c5c977aa3221bcb5ce6136910a47cea0fb567fbe3c
|
data/Makefile
CHANGED
@@ -5,7 +5,11 @@ include Makefile.common
|
|
5
5
|
|
6
6
|
.PHONY: test
|
7
7
|
test:
|
8
|
-
RUBYOPT=-w $(BUNDLER) exec ./test/suite_all.rb
|
8
|
+
RUBYOPT=-w $(BUNDLER) exec ./test/suite_all.rb -v
|
9
|
+
|
10
|
+
.PHONY: cov
|
11
|
+
cov:
|
12
|
+
RUBYOPT=-w TZ=Europe/Vienna COVERAGE=1 $(BUNDLER) exec ./test/suite_all.rb -v
|
9
13
|
|
10
14
|
dev:
|
11
15
|
RUBYOPT=-rbundler/setup ruby ./bin/wallet
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ The preferred method of installation is via RubyGems.org:
|
|
24
24
|
|
25
25
|
or via `Gemfile`:
|
26
26
|
|
27
|
-
gem 'thefox-wallet', '~>0.
|
27
|
+
gem 'thefox-wallet', '~>0.13'
|
28
28
|
|
29
29
|
Use it in your sources:
|
30
30
|
|
@@ -37,7 +37,8 @@ Use it in your sources:
|
|
37
37
|
- [Travis CI Repository](https://travis-ci.org/TheFox/wallet)
|
38
38
|
|
39
39
|
## License
|
40
|
-
|
40
|
+
|
41
|
+
Copyright (C) 2015 Christian Mayer <https://fox21.at>
|
41
42
|
|
42
43
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
43
44
|
|
data/bin/wallet
CHANGED
@@ -75,6 +75,10 @@ opts = OptionParser.new do |o|
|
|
75
75
|
options[:force] = true
|
76
76
|
end
|
77
77
|
|
78
|
+
o.on('--no-force', 'Do not force add command.') do
|
79
|
+
options[:force] = false
|
80
|
+
end
|
81
|
+
|
78
82
|
o.on_tail('-V', '--version', 'Show version.') do
|
79
83
|
puts "#{::TheFox::Wallet::NAME} #{::TheFox::Wallet::VERSION} (#{::TheFox::Wallet::DATE})"
|
80
84
|
puts TheFox::Wallet::HOMEPAGE
|
data/lib/wallet/command_add.rb
CHANGED
@@ -53,6 +53,8 @@ module TheFox::Wallet
|
|
53
53
|
raise "Option --title is required for command '#{NAME}'"
|
54
54
|
end
|
55
55
|
|
56
|
+
is_unique = !@options[:force] && @options[:entry_id]
|
57
|
+
|
56
58
|
puts "id: '#{@options[:entry_id]}'"
|
57
59
|
puts "title: '#{@options[:entry_title]}'"
|
58
60
|
puts "date: " + Date.parse(@options[:entry_date]).to_s
|
@@ -62,12 +64,15 @@ module TheFox::Wallet
|
|
62
64
|
puts "category: #{@options[:entry_category]}"
|
63
65
|
puts "comment: '#{@options[:entry_comment]}'"
|
64
66
|
puts "force: #{@options[:force] ? 'YES' : 'NO'}"
|
67
|
+
puts "unique: #{is_unique ? 'YES' : 'NO'}"
|
65
68
|
|
66
69
|
entry = Entry.new(@options[:entry_id], @options[:entry_title], @options[:entry_date], @options[:entry_revenue], @options[:entry_expense], @options[:entry_category], @options[:entry_comment])
|
67
70
|
wallet = Wallet.new(@options[:wallet_path])
|
68
|
-
added = wallet.add(entry,
|
71
|
+
added = wallet.add(entry, is_unique)
|
69
72
|
|
70
73
|
puts "added: #{added ? 'YES' : 'NO'}"
|
74
|
+
|
75
|
+
added
|
71
76
|
end
|
72
77
|
|
73
78
|
def revenue(revenue_s)
|
data/lib/wallet/version.rb
CHANGED
data/lib/wallet/wallet.rb
CHANGED
@@ -17,11 +17,12 @@ module TheFox
|
|
17
17
|
|
18
18
|
class Wallet
|
19
19
|
|
20
|
+
attr_writer :logger
|
20
21
|
attr_reader :html_path
|
21
22
|
|
22
23
|
def initialize(dir_path = 'wallet')
|
23
24
|
@exit = false
|
24
|
-
@
|
25
|
+
@logger = nil
|
25
26
|
@dir_path = dir_path
|
26
27
|
@data_path = File.expand_path('data', @dir_path)
|
27
28
|
@html_path = File.expand_path('html', @dir_path)
|
@@ -39,10 +40,6 @@ module TheFox
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
def log=(log)
|
43
|
-
@log = log
|
44
|
-
end
|
45
|
-
|
46
43
|
def add(entry, is_unique = false)
|
47
44
|
if !entry.is_a?(Entry)
|
48
45
|
raise ArgumentError, 'variable must be a Entry instance'
|
@@ -841,7 +838,7 @@ module TheFox
|
|
841
838
|
|
842
839
|
def build_entry_by_id_index(force = false)
|
843
840
|
if @entries_by_ids.nil? || force
|
844
|
-
@
|
841
|
+
@logger.debug('build entry-by-id index') if @logger
|
845
842
|
|
846
843
|
glob = File.expand_path('month_*.yml', @data_path)
|
847
844
|
|
data/thefox-wallet.gemspec
CHANGED
data/wallet.sublime-project
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thefox-wallet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov-phpunit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.2'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: uuid
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|