ynab_convert 0.1.0.pre
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +18 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.solargraph.yml +15 -0
- data/.travis.yml +18 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +135 -0
- data/Guardfile +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +40 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/bin/ynab_convert +29 -0
- data/lib/core_extensions/string.rb +17 -0
- data/lib/slop/symbol.rb +12 -0
- data/lib/ynab_convert/error.rb +6 -0
- data/lib/ynab_convert/logger.rb +14 -0
- data/lib/ynab_convert/processor/base.rb +171 -0
- data/lib/ynab_convert/processor/example.rb +124 -0
- data/lib/ynab_convert/processor/revolut.rb +103 -0
- data/lib/ynab_convert/processor/ubs_chequing.rb +101 -0
- data/lib/ynab_convert/processor/ubs_credit.rb +83 -0
- data/lib/ynab_convert/processors.rb +7 -0
- data/lib/ynab_convert/version.rb +5 -0
- data/lib/ynab_convert.rb +125 -0
- data/ynab_convert.gemspec +52 -0
- metadata +260 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08086730d5b1a483d48378a5f2a10937accd45b695a4b2f07c94dd0c19e27daf'
|
4
|
+
data.tar.gz: 9586296b18ee416fd083b9477d58570da2559d1d3b68b3385ce0bd0bb1f6ded2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c0579fda3f49407a92345875fcbb95bb30cd65d4ffe0e59dd1bddecc6e5ee72aeafe592ef566cd756d4a6307b417e85dd85dd9df68a0375c5b410e08a1ed614
|
7
|
+
data.tar.gz: 5dc8cfa674d17766f7dec08e1b8652f5aa891158355062c5ac75bd33a21bc1ac980401cd5c8eb49fa077081295cc9079de87c8c6cbfbde91a1dc3af66d896bf9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
require: rubocop-rake
|
3
|
+
|
4
|
+
Metrics/LineLength:
|
5
|
+
Exclude:
|
6
|
+
- ynab_convert.gemspec
|
7
|
+
|
8
|
+
Metrics/BlockLength:
|
9
|
+
Exclude:
|
10
|
+
- Guardfile
|
11
|
+
- ynab_convert.gemspec
|
12
|
+
- 'spec/**/*_spec.rb'
|
13
|
+
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Max: 25
|
16
|
+
|
17
|
+
Metrics/AbcSize:
|
18
|
+
Enabled: false
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ynab_convert
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.6.5
|
data/.solargraph.yml
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.6
|
6
|
+
before_install: gem install bundler
|
7
|
+
script: echo "Running tests for $(ruby -v)..." && bundle exec rake ci
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
include:
|
11
|
+
- stage: gem release
|
12
|
+
rvm: 2.6
|
13
|
+
script: echo "Publishing to rubygems.org..."
|
14
|
+
deploy:
|
15
|
+
provider: rubygems
|
16
|
+
gem: ynab_convert
|
17
|
+
api_key: $RUBYGEMS_API_KEY
|
18
|
+
on: master
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ynab_convert (0.1.0.pre)
|
5
|
+
i18n
|
6
|
+
slop
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.0)
|
12
|
+
backport (1.1.2)
|
13
|
+
byebug (11.0.1)
|
14
|
+
coderay (1.1.2)
|
15
|
+
concurrent-ruby (1.1.8)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
docile (1.3.2)
|
18
|
+
ffi (1.11.2)
|
19
|
+
formatador (0.2.5)
|
20
|
+
guard (2.16.1)
|
21
|
+
formatador (>= 0.2.4)
|
22
|
+
listen (>= 2.7, < 4.0)
|
23
|
+
lumberjack (>= 1.0.12, < 2.0)
|
24
|
+
nenv (~> 0.1)
|
25
|
+
notiffany (~> 0.0)
|
26
|
+
pry (>= 0.9.12)
|
27
|
+
shellany (~> 0.0)
|
28
|
+
thor (>= 0.18.1)
|
29
|
+
guard-compat (1.2.1)
|
30
|
+
guard-rspec (4.7.3)
|
31
|
+
guard (~> 2.1)
|
32
|
+
guard-compat (~> 1.1)
|
33
|
+
rspec (>= 2.99.0, < 4.0)
|
34
|
+
guard-rubocop (1.3.0)
|
35
|
+
guard (~> 2.0)
|
36
|
+
rubocop (~> 0.20)
|
37
|
+
htmlentities (4.3.4)
|
38
|
+
i18n (1.8.9)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
jaro_winkler (1.5.4)
|
41
|
+
json (2.2.0)
|
42
|
+
listen (3.2.0)
|
43
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
44
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
45
|
+
lumberjack (1.0.13)
|
46
|
+
method_source (0.9.2)
|
47
|
+
mini_portile2 (2.4.0)
|
48
|
+
nenv (0.3.0)
|
49
|
+
nokogiri (1.10.9)
|
50
|
+
mini_portile2 (~> 2.4.0)
|
51
|
+
notiffany (0.1.3)
|
52
|
+
nenv (~> 0.1)
|
53
|
+
shellany (~> 0.0)
|
54
|
+
parallel (1.19.0)
|
55
|
+
parser (2.6.5.0)
|
56
|
+
ast (~> 2.4.0)
|
57
|
+
pry (0.12.2)
|
58
|
+
coderay (~> 1.1.0)
|
59
|
+
method_source (~> 0.9.0)
|
60
|
+
pry-byebug (3.7.0)
|
61
|
+
byebug (~> 11.0)
|
62
|
+
pry (~> 0.10)
|
63
|
+
rainbow (3.0.0)
|
64
|
+
rake (13.0.1)
|
65
|
+
rb-fsevent (0.10.3)
|
66
|
+
rb-inotify (0.10.0)
|
67
|
+
ffi (~> 1.0)
|
68
|
+
reverse_markdown (1.3.0)
|
69
|
+
nokogiri
|
70
|
+
rspec (3.9.0)
|
71
|
+
rspec-core (~> 3.9.0)
|
72
|
+
rspec-expectations (~> 3.9.0)
|
73
|
+
rspec-mocks (~> 3.9.0)
|
74
|
+
rspec-core (3.9.0)
|
75
|
+
rspec-support (~> 3.9.0)
|
76
|
+
rspec-expectations (3.9.0)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.9.0)
|
79
|
+
rspec-mocks (3.9.0)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.9.0)
|
82
|
+
rspec-support (3.9.0)
|
83
|
+
rubocop (0.76.0)
|
84
|
+
jaro_winkler (~> 1.5.1)
|
85
|
+
parallel (~> 1.10)
|
86
|
+
parser (>= 2.6)
|
87
|
+
rainbow (>= 2.2.2, < 4.0)
|
88
|
+
ruby-progressbar (~> 1.7)
|
89
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
90
|
+
rubocop-rake (0.5.0)
|
91
|
+
rubocop
|
92
|
+
ruby-progressbar (1.10.1)
|
93
|
+
shellany (0.0.1)
|
94
|
+
simplecov (0.17.1)
|
95
|
+
docile (~> 1.1)
|
96
|
+
json (>= 1.8, < 3)
|
97
|
+
simplecov-html (~> 0.10.0)
|
98
|
+
simplecov-html (0.10.2)
|
99
|
+
slop (4.8.2)
|
100
|
+
solargraph (0.37.2)
|
101
|
+
backport (~> 1.1)
|
102
|
+
bundler (>= 1.17.2)
|
103
|
+
htmlentities (~> 4.3, >= 4.3.4)
|
104
|
+
jaro_winkler (~> 1.5)
|
105
|
+
nokogiri (~> 1.9, >= 1.9.1)
|
106
|
+
parser (~> 2.3)
|
107
|
+
reverse_markdown (~> 1.0, >= 1.0.5)
|
108
|
+
rubocop (~> 0.52)
|
109
|
+
thor (~> 0.19, >= 0.19.4)
|
110
|
+
tilt (~> 2.0)
|
111
|
+
yard (~> 0.9)
|
112
|
+
thor (0.20.3)
|
113
|
+
tilt (2.0.10)
|
114
|
+
unicode-display_width (1.6.0)
|
115
|
+
yard (0.9.20)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
|
120
|
+
DEPENDENCIES
|
121
|
+
bundler (~> 2.0)
|
122
|
+
guard-rspec
|
123
|
+
guard-rubocop
|
124
|
+
pry-byebug
|
125
|
+
rake (~> 13.0)
|
126
|
+
rspec (~> 3.0)
|
127
|
+
rspec-core
|
128
|
+
rubocop
|
129
|
+
rubocop-rake
|
130
|
+
simplecov
|
131
|
+
solargraph
|
132
|
+
ynab_convert!
|
133
|
+
|
134
|
+
BUNDLED WITH
|
135
|
+
2.2.11
|
data/Guardfile
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# vi: set ft=ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# A sample Guardfile
|
5
|
+
# More info at https://github.com/guard/guard#readme
|
6
|
+
|
7
|
+
## Uncomment and set this to only include directories you want to watch
|
8
|
+
# directories %w(app lib config test spec features) \
|
9
|
+
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
10
|
+
|
11
|
+
## Note: if you are using the `directories` clause above and you are not
|
12
|
+
## watching the project directory ('.'), then you will want to move
|
13
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
14
|
+
#
|
15
|
+
# $ mkdir config
|
16
|
+
# $ mv Guardfile config/
|
17
|
+
# $ ln -s config/Guardfile .
|
18
|
+
#
|
19
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
20
|
+
|
21
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
22
|
+
# rspec may be run, below are examples of the most common uses.
|
23
|
+
# * bundler: 'bundle exec rspec'
|
24
|
+
# * bundler binstubs: 'bin/rspec'
|
25
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
26
|
+
# installed the spring binstubs per the docs)
|
27
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
28
|
+
# * 'just' rspec: 'rspec'
|
29
|
+
group :red_green_refactor, halt_on_fail: true do
|
30
|
+
# Can't use the rake task here because guard appends rspec options to the
|
31
|
+
# command that aren't compatible with rake
|
32
|
+
guard :rspec, cmd: 'YNAB_CONVERT_ENV=test bundle exec rspec' do
|
33
|
+
require 'guard/rspec/dsl'
|
34
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
35
|
+
|
36
|
+
# Feel free to open issues for suggestions and improvements
|
37
|
+
|
38
|
+
# RSpec files
|
39
|
+
rspec = dsl.rspec
|
40
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
41
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
42
|
+
watch(rspec.spec_files)
|
43
|
+
|
44
|
+
# Ruby files
|
45
|
+
ruby = dsl.ruby
|
46
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
47
|
+
|
48
|
+
# Rails files
|
49
|
+
rails = dsl.rails(view_extensions: %w[erb haml slim])
|
50
|
+
dsl.watch_spec_files_for(rails.app_files)
|
51
|
+
dsl.watch_spec_files_for(rails.views)
|
52
|
+
|
53
|
+
watch(rails.controllers) do |m|
|
54
|
+
[
|
55
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
56
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
57
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
# Rails config changes
|
62
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
63
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
64
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
65
|
+
|
66
|
+
# Capybara features specs
|
67
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
68
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
69
|
+
|
70
|
+
# Turnip features and steps
|
71
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
72
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
73
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
guard :rubocop, cli: ['--auto-correct'] do
|
78
|
+
watch('Gemfile')
|
79
|
+
watch('Rakefile')
|
80
|
+
watch('bin/convert')
|
81
|
+
watch(/.+\.rb$/)
|
82
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
83
|
+
end
|
84
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 coaxial
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# YnabConvert
|
2
|
+
|
3
|
+
Convert CSV files from online banking to a [format YNAB 4 can consume](https://docs.youneedabudget.com/article/921-formatting-csv-file).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install ynab_convert
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
```shell
|
12
|
+
$ ynab_convert -f my_transactions.csv -i example
|
13
|
+
```
|
14
|
+
|
15
|
+
This will process the file `my_transactions.csv` downloaded from Example Bank's
|
16
|
+
online banking platform, using the `example` processor (see list of available
|
17
|
+
processors below.)
|
18
|
+
|
19
|
+
It will then output the converted file as
|
20
|
+
`my_transactions_example_bank_20191101-2019-1201_ynab4.csv`. The dates in the
|
21
|
+
filename match the interval of the transactions found in the original CSV file.
|
22
|
+
In that case, the earliest transaction recorded happened on 2019-11-01 and the
|
23
|
+
latest one on 2019-12-01.
|
24
|
+
|
25
|
+
## Available processors
|
26
|
+
|
27
|
+
`-i` argument | Institution's full name | Institution's website | Remarks
|
28
|
+
---|---|---|---
|
29
|
+
`example` | Example Bank | N/A | Reference processor implementation, not a real institution
|
30
|
+
`revolut` | Revolut Ltd | [revolut.com](https://www.revolut.com/) | The processor isn't aware of currencies. Make sure the statements processed with `revolut` are in the same currency that your YNAB is in
|
31
|
+
`ubs_chequing` | UBS Switzerland (private banking) | [ubs.ch](https://ubs.ch) | Private chequing and joint accounts
|
32
|
+
`ubs_credit` | UBS Switzerland (credit cards) | [ubs.ch](https://ubs.ch) | Both MasterCard and Visa
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
37
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
38
|
+
prompt that will allow you to experiment.
|
39
|
+
|
40
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
41
|
+
|
42
|
+
Bug reports and pull requests are welcome on GitHub at
|
43
|
+
https://github.com/coaxial/ynab_convert.
|
44
|
+
|
45
|
+
### Enable debug output
|
46
|
+
|
47
|
+
Run `ynab_convert` with `YNAB_CONVERT_DEBUG=true`, or use the rake task `spec:debug`. Debug logging goes to STDERR.
|
48
|
+
|
49
|
+
### Adding a new financial institution
|
50
|
+
|
51
|
+
If there is no processor for your financial institution, you can contribute one
|
52
|
+
to the project.
|
53
|
+
|
54
|
+
There is a commented example processor located at
|
55
|
+
`lib/ynab_convert/processor/example.rb`. Looking at the other, real-world
|
56
|
+
processors in that directory can also help.
|
57
|
+
|
58
|
+
Be sure to add tests to your processor as well before you make a PR.
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
The gem is available as open source under the terms of the [MIT
|
63
|
+
License](https://opensource.org/licenses/MIT).
|
64
|
+
|
65
|
+
(c) coaxial 2019
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
7
|
+
desc 'Run all specs'
|
8
|
+
task :spec do
|
9
|
+
ENV['YNAB_CONVERT_ENV'] = 'test'
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
+
t.pattern = Dir.glob('spec/**/*_spec.rb')
|
13
|
+
t.rspec_opts = '--format documentation'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run all tests (synonym for spec)'
|
18
|
+
task :test do
|
19
|
+
Rake::Task[:spec].invoke
|
20
|
+
end
|
21
|
+
|
22
|
+
namespace 'spec' do
|
23
|
+
desc 'Enable debug logging'
|
24
|
+
task :debug do
|
25
|
+
ENV['YNAB_CONVERT_DEBUG'] = 'true'
|
26
|
+
|
27
|
+
Rake::Task[:spec].invoke
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Check code format'
|
32
|
+
RuboCop::RakeTask.new
|
33
|
+
|
34
|
+
desc 'Run tests and check code format'
|
35
|
+
task :ci do
|
36
|
+
Rake::Task[:spec].invoke
|
37
|
+
Rake::Task[:rubocop].invoke
|
38
|
+
end
|
39
|
+
|
40
|
+
task default: :ci
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'ynab_convert'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/ynab_convert
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# vi: ft=ruby
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'ynab_convert'
|
7
|
+
require 'core_extensions/string'
|
8
|
+
require 'ynab_convert/processors'
|
9
|
+
require 'ynab_convert/logger'
|
10
|
+
require 'ynab_convert/error'
|
11
|
+
require 'slop/symbol'
|
12
|
+
require 'pry'
|
13
|
+
|
14
|
+
# Add mixins and run converter
|
15
|
+
class Convert
|
16
|
+
String.include CoreExtensions::String::Inflections
|
17
|
+
YnabConvert.include YnabLogger
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@yc = YnabConvert::CLI.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def start
|
24
|
+
@yc.start
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
yc = Convert.new
|
29
|
+
yc.start
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Mimics the module by the same name from Rails, to add convenience methods
|
4
|
+
module CoreExtensions
|
5
|
+
module String
|
6
|
+
# Adds convenience methods
|
7
|
+
module Inflections
|
8
|
+
def snake_case
|
9
|
+
downcase.tr(' ', '_').gsub(/[^a-z_]/, '')
|
10
|
+
end
|
11
|
+
|
12
|
+
def camel_case
|
13
|
+
split('_').collect(&:capitalize).join
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/slop/symbol.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
# Add logging to classes
|
6
|
+
module YnabLogger
|
7
|
+
def logger
|
8
|
+
@logger unless @logger.nil?
|
9
|
+
@logger ||= Logger.new(STDERR)
|
10
|
+
@logger.level = Logger::FATAL
|
11
|
+
@logger.level = Logger::DEBUG if ENV['YNAB_CONVERT_DEBUG'] == 'true'
|
12
|
+
@logger
|
13
|
+
end
|
14
|
+
end
|