burglar 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/burglar +0 -9
- data/lib/burglar/heist.rb +19 -1
- data/lib/burglar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6216d1a78c1c8cf040d1f05fbc23cd210db14c33d5946e6ebc35bfe143ef782c
|
4
|
+
data.tar.gz: 6ecaaa773f6d408c63ebf6d235d4732e49e46753add3eaec57e77f1d14917868
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5459f2dd460a78461633502456f28a1602681992692ddb026c6674408ca19438b9b936cba146d3cc7c1ac684c0253a3632c19131ef4de2c551ce1f26ca9f6f0
|
7
|
+
data.tar.gz: 65277338a161f948b1873b854068c2e291026b4fd53d481e69732d7d251a1e4a592b3772d0ea89976a3c13b9650d0a1d6eccc9530c4ab704d67b1f351b126205
|
data/bin/burglar
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'burglar'
|
4
4
|
require 'mercenary'
|
5
|
-
require 'cymbal'
|
6
|
-
require 'yaml'
|
7
5
|
require 'date'
|
8
6
|
|
9
7
|
def add_common_opts(c)
|
@@ -13,12 +11,6 @@ def add_common_opts(c)
|
|
13
11
|
c.option :pending, '-p', '--pending', 'Include pending transactions'
|
14
12
|
end
|
15
13
|
|
16
|
-
def load_config(file)
|
17
|
-
file ||= '~/.burglar.yml'
|
18
|
-
file = File.expand_path file
|
19
|
-
Cymbal.symbolize YAML.safe_load(File.read(file))
|
20
|
-
end
|
21
|
-
|
22
14
|
def date_parse_or_default(string, default)
|
23
15
|
return default unless string
|
24
16
|
Date.parse(string)
|
@@ -34,7 +26,6 @@ Mercenary.program(:burglar) do |p|
|
|
34
26
|
p.action do |_, options|
|
35
27
|
options[:end] = date_parse_or_default(options[:end], Date.today)
|
36
28
|
options[:begin] = date_parse_or_default(options[:begin], options[:end] - 30)
|
37
|
-
config = load_config(options[:config]).merge(options)
|
38
29
|
puts Burglar.new(config).transactions
|
39
30
|
end
|
40
31
|
end
|
data/lib/burglar/heist.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
require 'cymbal'
|
2
|
+
require 'yaml'
|
3
|
+
|
1
4
|
module Burglar
|
5
|
+
# Default config file
|
6
|
+
DEFAULT_CONFIG_FILE = '~/.burglar.yml'.freeze
|
7
|
+
|
2
8
|
##
|
3
9
|
# Collection of banks
|
4
10
|
class Heist
|
5
11
|
def initialize(params = {})
|
6
|
-
@options = params
|
12
|
+
@options = load_options(params)
|
7
13
|
end
|
8
14
|
|
9
15
|
def banks
|
@@ -17,5 +23,17 @@ module Burglar
|
|
17
23
|
entries: banks.map { |_, v| v.transactions.entries }.flatten.sort
|
18
24
|
)
|
19
25
|
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def load_config(file)
|
30
|
+
file ||= DEFAULT_CONFIG_FILE
|
31
|
+
file = File.expand_path file
|
32
|
+
Cymbal.symbolize YAML.safe_load(File.read(file))
|
33
|
+
end
|
34
|
+
|
35
|
+
def load_options(params)
|
36
|
+
load_config(params[:config]).merge(params)
|
37
|
+
end
|
20
38
|
end
|
21
39
|
end
|
data/lib/burglar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: burglar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cymbal
|