bankocr 0.0.2 → 0.0.3

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: 722d178bd4372da2e4cec0c87c005a617b396bb0
4
- data.tar.gz: eb2ed4d90d0837e247f1fc5eef8b256eecf4356d
3
+ metadata.gz: 88a16391bafc7e1f8c59f0d1490d5ec75ddadb1a
4
+ data.tar.gz: 9cd73c8055978b7732ca36a0700077536ab03424
5
5
  SHA512:
6
- metadata.gz: 1daa5a1d719c3a28941013a1185d6c76f1ef737afeee208705c3b83f539c8a9473f80f7e6dbe7bf7aa8812b6de4a512d7ccd5d70bec36119e267cabdaf345c59
7
- data.tar.gz: a106a880bb7cf204ba731794be2295c936f1a4380809049bb7a65db2433d4421d6c78dbb7d4e614c405fcbf0ffacc8e1540a80730add2ae97ba2df1ca1138bcc
6
+ metadata.gz: ed392b2fce5cf57bea88fc1a57348d6743f793523685e7faabd6e7976fb1d5efc036c9c14bad397e07a80d1f367323cf860fcd2821914d2a33bbb4b7496a2e98
7
+ data.tar.gz: 41b514e56b802f7192291033b577e58a00697f57008ed44f16fe1777c23b28e7f1c9547e27713ec4fb0479a353916381d03f71305802d40bb3548bddaae4af75
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bankocr (0.0.1)
4
+ bankocr (0.0.3)
5
+ thor (~> 0.19)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
@@ -19,6 +20,7 @@ GEM
19
20
  rspec-mocks (3.0.2)
20
21
  rspec-support (~> 3.0.0)
21
22
  rspec-support (3.0.2)
23
+ thor (0.19.1)
22
24
 
23
25
  PLATFORMS
24
26
  ruby
data/README.md CHANGED
@@ -15,7 +15,7 @@ Use the following commands:
15
15
 
16
16
  ```
17
17
  gem install backocr
18
- bankocr ./bin/input.in ./bin/output
18
+ bankocr process ./bin/input.in ./bin/output
19
19
  ```
20
20
 
21
21
  * It will generate a file under /bin directory with results
data/bankocr.gemspec CHANGED
@@ -20,4 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rspec', '~> 3.0'
23
+
24
+ spec.add_runtime_dependency 'thor', '~> 0.19'
23
25
  end
data/bin/bankocr CHANGED
@@ -1,7 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'thor'
3
4
  require 'bankocr'
4
5
 
5
- BankOCR.process(ARGV[0], ARGV[1])
6
+ module BankOCR
7
+ class ProcessCommand < Thor
8
+ desc 'process input_path output_path',
9
+ 'Generates a report for account numbers read from input'
6
10
 
7
- p 'OCR accounts report generated succesfully'
11
+ def process(input, output)
12
+ begin
13
+ BankOCR.process(input, output)
14
+ p 'OCR accounts report generated succesfully'
15
+ rescue Exception => ex
16
+ p ex.message
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ BankOCR::ProcessCommand.start
@@ -1,3 +1,3 @@
1
1
  module BankOCR
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/file_parser.rb CHANGED
@@ -16,7 +16,7 @@ module BankOCR
16
16
 
17
17
  @entries
18
18
  rescue
19
- []
19
+ raise 'Error reading input file, please validate'
20
20
  ensure
21
21
  file.close if file
22
22
  end
@@ -8,10 +8,6 @@ describe BankOCR::AccountNumber do
8
8
  let(:invalid_numbers) { %w(888888888 490067715 012345678) }
9
9
  let(:wrong_numbers) { %w(86110?356) }
10
10
 
11
- let(:wrong_accounts) do
12
- [{ account_number: '86110??36', valid: false, message: 'ILL' }]
13
- end
14
-
15
11
  it 'validates valid account numbers' do
16
12
  valid_numbers.each do |n|
17
13
  account = described_class.new(n)
@@ -20,7 +20,7 @@ describe BankOCR::FileParser do
20
20
  it 'returns empty account_numbers if error reading file' do
21
21
  parser = described_class.new('invalid_path')
22
22
 
23
- expect(parser.entries).to eq([])
23
+ expect{parser.entries}.to raise_error('Error reading input file, please validate')
24
24
  end
25
25
 
26
26
  end
@@ -35,4 +35,5 @@ describe BankOCR::ReportGenerator do
35
35
 
36
36
  expect(generated_content).to eq(expected_content)
37
37
  end
38
+
38
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankocr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Cervantes
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.19'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.19'
41
55
  description: '["Solution", "in", "ruby", "of", "BankOCR", "Kata:", "http://code.joejag.com/coding-dojo-bank-ocr/"]'
42
56
  email:
43
57
  - 1.27201@gmail.com