thefox-wallet 0.12.1 → 0.13.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
2
  SHA1:
3
- metadata.gz: 56796aa16f66d2b8b8b7b8652e96ea8902378868
4
- data.tar.gz: 6c0613faf7cf12813eeb2e6ba502ff465dc00d8c
3
+ metadata.gz: bd4e8feceab54fde2f7ffb5ce5782cb48ca3213b
4
+ data.tar.gz: 00b9ca606122f5fd4c0f181442b3a0a044105169
5
5
  SHA512:
6
- metadata.gz: f44c9aba9e010c71ff9e33a9718d593a2d9cee845c472afc3ca079f912374e1bd7483b42fb9b1f5fa5a50835230d47fa5224c468953bdc9c40280bbbc3d82de8
7
- data.tar.gz: 8e9dc9c815689b7accd033091b2e5228d41b05a18fc58bf2b43af5bc00f44637f292d7c6ab8a534834512219fbcf761165570784ebdc822c4397b7e02af3f626
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.12'
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
- Copyright (C) 2015 Christian Mayer <http://fox21.at>
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
@@ -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, !@options[:force])
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)
@@ -2,9 +2,10 @@
2
2
  module TheFox
3
3
  module Wallet
4
4
  NAME = 'Wallet'
5
- VERSION = '0.12.1'
6
- DATE = '2016-09-12'
5
+ VERSION = '0.13.0'
6
+ DATE = '2016-09-14'
7
7
  HOMEPAGE = 'https://github.com/TheFox/wallet'
8
+
8
9
  NUMBER_FORMAT = '%.2f'
9
10
  NUMBER_ROUND = 5
10
11
  end
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
- @log = nil
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
- @log.debug('build entry-by-id index') if @log
841
+ @logger.debug('build entry-by-id index') if @logger
845
842
 
846
843
  glob = File.expand_path('month_*.yml', @data_path)
847
844
 
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency 'minitest', '~>5.7'
27
27
  spec.add_development_dependency 'simplecov', '~>0.12'
28
+ spec.add_development_dependency 'simplecov-phpunit', '~>0.2'
28
29
 
29
30
  spec.add_dependency 'uuid', '~>2.3'
30
31
  end
@@ -3,8 +3,8 @@
3
3
  {
4
4
  "path": ".",
5
5
  "name": "Wallet",
6
- "folder_exclude_patterns": [ ],
6
+ "folder_exclude_patterns": [ "coverage", "releases" ],
7
7
  "file_exclude_patterns": [ ]
8
8
  }
9
9
  ]
10
- }
10
+ }
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.12.1
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-12 00:00:00.000000000 Z
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