ldgr 0.2.0 → 0.2.1

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: fc54d8ad8843b07557dc9899ddcdb9e06660d04c
4
- data.tar.gz: 8ec9ca15d94b1ce04e50eb3016cd486a4e4c5211
3
+ metadata.gz: 2a0a2f9e78984a3bbd6ecf6a270ee2d1f970f6ce
4
+ data.tar.gz: 93ca35905feb22b01926478484b9e360f106ea20
5
5
  SHA512:
6
- metadata.gz: 355664a991caf16c7dcb27a89ebb8c36a01a2cf6c8ae040e8b7471262eeb022d2d1052a263f6618ac128ddba4aedacf48bbf4771551b3c7920dc6995f5fe25d8
7
- data.tar.gz: 9d6ae1acc579e2d0fdc4438a17078c0a93c266c4d909cf842f2c524e9328dccb699194cd06fc5c78ed3741138ff656d4465a613e7b17b28ffcd58ce47202fb89
6
+ metadata.gz: 15ba94f89da1f5e7beb00cb4f60c9ef4b0726e1ce3dac10d25e83ea15f6e7c5bd80f4c22e7866e037e53bb4063dc8d1cec9e8127244cbe4dc6bc5dc84148930f
7
+ data.tar.gz: 857f96b95e444e0a79f0206a2b5a2ac5e88c7ee37645a86b663f496fc6613cb09962c52edd8948b13af55e08b62a3bc6f2cc4b812abb9a5568c57416783cb9f7
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.0
data/ldgr.gemspec CHANGED
@@ -30,8 +30,6 @@ Gem::Specification.new do |spec|
30
30
  # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "highline"
34
-
35
33
  spec.add_development_dependency "bundler", "~> 1.14"
36
34
  spec.add_development_dependency "rake", "~> 10.0"
37
35
  spec.add_development_dependency "minitest", "~> 5.0"
data/lib/ldgr/parser.rb CHANGED
@@ -1,7 +1,7 @@
1
+ # frozen_string_literal: false
1
2
  require 'irb'
2
3
  require 'csv'
3
4
  require 'date'
4
- require 'highline/import'
5
5
  require 'optparse'
6
6
  require 'optparse/date'
7
7
  require 'pathname'
@@ -25,7 +25,7 @@ module Ldgr
25
25
  PROGRAM_NAME = 'ldgr'
26
26
  MATCH = /(?=(\n\d\d\d\d-\d\d-\d\d)(=\d\d\d\d-\d\d-\d\d)*)|\z/
27
27
  OTHER_MATCH = /(?=(\d\d\d\d-\d\d-\d\d)(=\d\d\d\d-\d\d-\d\d)*)/
28
- COMMANDS = %w(add sort tag clear open)
28
+ COMMANDS = %w(add sort tag clear open).freeze
29
29
 
30
30
  attr_accessor :transactions_file, :config
31
31
 
@@ -44,19 +44,6 @@ module Ldgr
44
44
  @config = defaults.merge(user_config).merge(config)
45
45
  end
46
46
 
47
- # Public: User-specified config options
48
- #
49
- # Examples
50
- #
51
- # user_config
52
- # # => {all the config options from the user's YAML file}
53
- #
54
- # Returns a hash of user-specified config options.
55
- def user_config
56
- path = Pathname(FILEBASE + 'ldgr.yaml')
57
- path.exist? ? YAML.load_file(path).to_h : {}
58
- end
59
-
60
47
  # Public: Kicks off the CLI
61
48
  #
62
49
  # Examples
@@ -138,11 +125,11 @@ module Ldgr
138
125
  count += 1
139
126
  front = match[1]
140
127
  back = match[4]
141
- puts "\n#{HighLine.color(transaction, :magenta)}"
128
+ puts transaction
142
129
  question = ask('Do you want to clear this? ') do |q|
143
130
  q.default = 'No'
144
131
  end
145
- transaction.gsub!(pattern, "#{front} * #{back}") if question =~ /y/i
132
+ transaction.gsub!(pattern, "#{front} * #{back}") if question.match?(/y/i)
146
133
  end
147
134
  output << transaction
148
135
  end
@@ -168,7 +155,7 @@ module Ldgr
168
155
  match = pattern.match(transaction)
169
156
  if match
170
157
  count += 1
171
- puts "\n#{HighLine.color(previous, :blue)} #{HighLine.color(match[2], :red)}"
158
+ puts "\n#{previous} #{match[2]}"
172
159
  question = ask('What account does this belong to? ') { |q| q.default = 'None' }
173
160
  transaction.gsub!(match[1], " #{question.capitalize} ") if question != 'None'
174
161
  end
@@ -201,7 +188,21 @@ module Ldgr
201
188
  end
202
189
  end
203
190
 
204
- # Public: Opens a settings file from ~/.config/ledger
191
+ private
192
+ # Private: User-specified config options
193
+ #
194
+ # Examples
195
+ #
196
+ # user_config
197
+ # # => {all the config options from the user's YAML file}
198
+ #
199
+ # Returns a hash of user-specified config options.
200
+ def user_config
201
+ path = Pathname(FILEBASE + 'ldgr.yaml')
202
+ path.exist? ? YAML.load_file(path).to_h : {}
203
+ end
204
+
205
+ # Private: Opens a settings file from ~/.config/ledger
205
206
  #
206
207
  # Examples
207
208
  #
@@ -212,16 +213,14 @@ module Ldgr
212
213
  def open
213
214
  def open_file(file_to_open)
214
215
  checked_file = "#{FILEBASE}#{file_to_open}.dat"
215
- raise "#{checked_file} doesn't exist." unless Pathname(checked_file).exist?
216
+ fail "#{checked_file} doesn't exist." unless Pathname(checked_file).exist?
216
217
  system(ENV['EDITOR'], checked_file)
217
218
  end
218
219
 
219
220
  open_file(ARGV[1])
220
221
  end
221
222
 
222
- private :open
223
-
224
- # Public: ldgr's default configuration options
223
+ # Private: ldgr's default configuration options
225
224
  #
226
225
  # Examples
227
226
  #
@@ -250,6 +249,5 @@ module Ldgr
250
249
  FileUtils.touch("#{FILEBASE}#{file}")
251
250
  end
252
251
  end
253
- private :setup
254
252
  end
255
253
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ldgr
2
3
  # Builds a transaction
3
4
  #
data/lib/ldgr/version.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Ldgr
2
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
3
4
  end
data/lib/ldgr.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'ldgr/version' # => true
2
3
  require 'ldgr/transaction' # => true
3
4
  require 'ldgr/parser' # => true
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Pittman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: highline
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +75,7 @@ extensions: []
89
75
  extra_rdoc_files: []
90
76
  files:
91
77
  - ".gitignore"
78
+ - ".ruby-version"
92
79
  - ".travis.yml"
93
80
  - Gemfile
94
81
  - LICENSE.txt
@@ -98,7 +85,6 @@ files:
98
85
  - bin/ldgr
99
86
  - bin/setup
100
87
  - ldgr.gemspec
101
- - ldgr.taskpaper
102
88
  - lib/ldgr.rb
103
89
  - lib/ldgr/parser.rb
104
90
  - lib/ldgr/transaction.rb
@@ -123,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
109
  version: '0'
124
110
  requirements: []
125
111
  rubyforge_project:
126
- rubygems_version: 2.6.10
112
+ rubygems_version: 2.6.14
127
113
  signing_key:
128
114
  specification_version: 4
129
115
  summary: A command-line tool for managing Ledger transactions.
data/ldgr.taskpaper DELETED
@@ -1,7 +0,0 @@
1
- Tests:
2
- - it can sort transactions
3
- - it can clear transactions
4
- - it can tag transactions
5
- - it can output version
6
- - it can output help
7
- - it can open setup files