pdfh 0.1.4 → 0.1.9
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 +4 -4
- data/.gitignore +37 -10
- data/.rubocop.yml +22 -5
- data/.rubocop_todo.yml +152 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile +14 -3
- data/Gemfile.lock +76 -30
- data/README.md +14 -2
- data/Rakefile +19 -2
- data/bin/console +6 -6
- data/exe/pdfh +19 -8
- data/lib/ext/string.rb +13 -0
- data/lib/pdfh.rb +65 -47
- data/lib/pdfh/document.rb +83 -109
- data/lib/pdfh/month.rb +41 -0
- data/lib/pdfh/pdf_handler.rb +54 -0
- data/lib/pdfh/settings.rb +21 -11
- data/lib/pdfh/utils.rb +9 -4
- data/lib/pdfh/version.rb +1 -1
- data/pdfh.gemspec +22 -27
- metadata +13 -81
- data/.ruby-gemset +0 -1
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14832944087c61f4949fe3fd42cdb848ebfd8a8931826cbd3e4fc111f5813a31
|
4
|
+
data.tar.gz: 16c139cc38b766307fe4fe9a21b740161af8fffcc05b5c8397cfdde843b1b943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c320fcead6ae5e09a37ba17100837d392017b73fa0cd54b5d4126bebc52bd07f009457af741128df8197c67fb52d82eee2422a16b6240930f9e72ff795a950
|
7
|
+
data.tar.gz: 335af04d4f5753d39e4464be53a24986f89dff1cc1e9fa2866e8340680317337cf3b24eb043cdbcdef5051fa47d45dcfe67ab685b289173dc42e789d5014e3c6
|
data/.gitignore
CHANGED
@@ -1,13 +1,40 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
/
|
4
|
-
/
|
5
|
-
/
|
6
|
-
/
|
7
|
-
/
|
8
|
-
/tmp/
|
1
|
+
.yardoc/
|
2
|
+
_yardoc/
|
3
|
+
coverage/
|
4
|
+
pkg/
|
5
|
+
spec/reports/
|
6
|
+
spec/coverage/
|
7
|
+
tmp/
|
9
8
|
|
10
9
|
# rspec failure tracking
|
11
10
|
.rspec_status
|
12
|
-
|
13
|
-
|
11
|
+
|
12
|
+
### macOS
|
13
|
+
# General
|
14
|
+
.DS_Store
|
15
|
+
.AppleDouble
|
16
|
+
.LSOverride
|
17
|
+
|
18
|
+
# Icon must end with two \r
|
19
|
+
Icon
|
20
|
+
|
21
|
+
|
22
|
+
# Thumbnails
|
23
|
+
._*
|
24
|
+
|
25
|
+
# Files that might appear in the root of a volume
|
26
|
+
.DocumentRevisions-V100
|
27
|
+
.fseventsd
|
28
|
+
.Spotlight-V100
|
29
|
+
.TemporaryItems
|
30
|
+
.Trashes
|
31
|
+
.VolumeIcon.icns
|
32
|
+
.com.apple.timemachine.donotpresent
|
33
|
+
|
34
|
+
# Directories potentially created on remote AFP share
|
35
|
+
.AppleDB
|
36
|
+
.AppleDesktop
|
37
|
+
Network Trash Folder
|
38
|
+
Temporary Items
|
39
|
+
.apdisk
|
40
|
+
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,25 @@
|
|
1
|
-
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
7
|
+
|
2
8
|
AllCops:
|
9
|
+
NewCops: enable
|
10
|
+
TargetRubyVersion: 2.5
|
3
11
|
Exclude:
|
4
|
-
-
|
5
|
-
-
|
12
|
+
- pkg/**/*
|
13
|
+
- tmp/**/*
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
IgnoredPatterns: ['^\s*#']
|
18
|
+
|
19
|
+
Style/StringLiterals:
|
20
|
+
Enabled: true
|
21
|
+
EnforcedStyle: double_quotes
|
6
22
|
|
7
|
-
|
8
|
-
Enabled:
|
23
|
+
Style/StringLiteralsInInterpolation:
|
24
|
+
Enabled: true
|
25
|
+
EnforcedStyle: double_quotes
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2021-03-02 12:13:30 UTC using RuboCop version 1.11.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Max: 23
|
13
|
+
|
14
|
+
# Offense count: 4
|
15
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
16
|
+
# IgnoredMethods: refine
|
17
|
+
Metrics/BlockLength:
|
18
|
+
Max: 144
|
19
|
+
|
20
|
+
# Offense count: 1
|
21
|
+
# Configuration parameters: CountComments, CountAsOne.
|
22
|
+
Metrics/ClassLength:
|
23
|
+
Max: 149
|
24
|
+
|
25
|
+
# Offense count: 5
|
26
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
27
|
+
Metrics/MethodLength:
|
28
|
+
Max: 13
|
29
|
+
|
30
|
+
# Offense count: 2
|
31
|
+
RSpec/AnyInstance:
|
32
|
+
Exclude:
|
33
|
+
- 'spec/pdfh_spec.rb'
|
34
|
+
|
35
|
+
# Offense count: 13
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
RSpec/ContextMethod:
|
38
|
+
Exclude:
|
39
|
+
- 'spec/classes/document_spec.rb'
|
40
|
+
- 'spec/classes/month_spec.rb'
|
41
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
42
|
+
- 'spec/classes/settings_spec.rb'
|
43
|
+
- 'spec/pdfh_spec.rb'
|
44
|
+
|
45
|
+
# Offense count: 13
|
46
|
+
# Configuration parameters: Prefixes.
|
47
|
+
# Prefixes: when, with, without
|
48
|
+
RSpec/ContextWording:
|
49
|
+
Exclude:
|
50
|
+
- 'spec/classes/document_spec.rb'
|
51
|
+
- 'spec/classes/month_spec.rb'
|
52
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
53
|
+
- 'spec/classes/settings_spec.rb'
|
54
|
+
- 'spec/pdfh_spec.rb'
|
55
|
+
|
56
|
+
# Offense count: 1
|
57
|
+
# Cop supports --auto-correct.
|
58
|
+
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
59
|
+
# SupportedStyles: described_class, explicit
|
60
|
+
RSpec/DescribedClass:
|
61
|
+
Exclude:
|
62
|
+
- 'spec/classes/settings_spec.rb'
|
63
|
+
|
64
|
+
# Offense count: 16
|
65
|
+
# Cop supports --auto-correct.
|
66
|
+
# Configuration parameters: AllowConsecutiveOneLiners.
|
67
|
+
RSpec/EmptyLineAfterExample:
|
68
|
+
Exclude:
|
69
|
+
- 'spec/classes/document_spec.rb'
|
70
|
+
- 'spec/classes/dry_spec.rb'
|
71
|
+
- 'spec/classes/month_spec.rb'
|
72
|
+
- 'spec/classes/settings_spec.rb'
|
73
|
+
- 'spec/classes/verbose_spec.rb'
|
74
|
+
|
75
|
+
# Offense count: 2
|
76
|
+
# Cop supports --auto-correct.
|
77
|
+
RSpec/EmptyLineAfterFinalLet:
|
78
|
+
Exclude:
|
79
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
80
|
+
- 'spec/classes/settings_spec.rb'
|
81
|
+
|
82
|
+
# Offense count: 1
|
83
|
+
# Configuration parameters: Max.
|
84
|
+
RSpec/ExampleLength:
|
85
|
+
Exclude:
|
86
|
+
- 'spec/pdfh_spec.rb'
|
87
|
+
|
88
|
+
# Offense count: 1
|
89
|
+
RSpec/ExpectInHook:
|
90
|
+
Exclude:
|
91
|
+
- 'spec/pdfh_spec.rb'
|
92
|
+
|
93
|
+
# Offense count: 6
|
94
|
+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
95
|
+
# Include: **/*_spec*rb*, **/spec/**/*
|
96
|
+
RSpec/FilePath:
|
97
|
+
Exclude:
|
98
|
+
- 'spec/classes/document_spec.rb'
|
99
|
+
- 'spec/classes/dry_spec.rb'
|
100
|
+
- 'spec/classes/month_spec.rb'
|
101
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
102
|
+
- 'spec/classes/settings_spec.rb'
|
103
|
+
- 'spec/classes/verbose_spec.rb'
|
104
|
+
|
105
|
+
# Offense count: 3
|
106
|
+
# Cop supports --auto-correct.
|
107
|
+
RSpec/LeadingSubject:
|
108
|
+
Exclude:
|
109
|
+
- 'spec/classes/document_spec.rb'
|
110
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
111
|
+
- 'spec/classes/settings_spec.rb'
|
112
|
+
|
113
|
+
# Offense count: 18
|
114
|
+
# Configuration parameters: .
|
115
|
+
# SupportedStyles: have_received, receive
|
116
|
+
RSpec/MessageSpies:
|
117
|
+
EnforcedStyle: receive
|
118
|
+
|
119
|
+
# Offense count: 15
|
120
|
+
RSpec/MultipleExpectations:
|
121
|
+
Max: 4
|
122
|
+
|
123
|
+
# Offense count: 71
|
124
|
+
# Configuration parameters: IgnoreSharedExamples.
|
125
|
+
RSpec/NamedSubject:
|
126
|
+
Exclude:
|
127
|
+
- 'spec/classes/document_spec.rb'
|
128
|
+
- 'spec/classes/month_spec.rb'
|
129
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
130
|
+
- 'spec/classes/settings_spec.rb'
|
131
|
+
- 'spec/pdfh_spec.rb'
|
132
|
+
|
133
|
+
# Offense count: 16
|
134
|
+
RSpec/StubbedMock:
|
135
|
+
Exclude:
|
136
|
+
- 'spec/classes/document_spec.rb'
|
137
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
138
|
+
- 'spec/pdfh_spec.rb'
|
139
|
+
|
140
|
+
# Offense count: 7
|
141
|
+
RSpec/SubjectStub:
|
142
|
+
Exclude:
|
143
|
+
- 'spec/classes/document_spec.rb'
|
144
|
+
- 'spec/classes/pdf_handler_spec.rb'
|
145
|
+
- 'spec/pdfh_spec.rb'
|
146
|
+
|
147
|
+
# Offense count: 4
|
148
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
149
|
+
RSpec/VerifiedDoubles:
|
150
|
+
Exclude:
|
151
|
+
- 'spec/classes/document_spec.rb'
|
152
|
+
- 'spec/pdfh_spec.rb'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-
|
1
|
+
ruby-3.0.0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## v0.1.9
|
2
|
+
* Add dependencies validation at run
|
3
|
+
|
4
|
+
## v0.1.5
|
5
|
+
* Add print_cmd field in config file for information purposes
|
6
|
+
* Settings now validates a no existing directory
|
7
|
+
* Refactor for easier maintenance
|
8
|
+
|
9
|
+
## v0.1.4
|
10
|
+
* Add titleize format when writing new file
|
11
|
+
|
1
12
|
## v0.1.3
|
2
13
|
* Fixed copy companion files, which was not copying the files.
|
3
14
|
|
data/Gemfile
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
4
|
-
|
5
|
-
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
source "https://rubygems.org"
|
6
4
|
|
7
5
|
# Specify your gem's dependencies in pdfh.gemspec
|
8
6
|
gemspec
|
7
|
+
|
8
|
+
gem "bundler", "~> 2.0"
|
9
|
+
gem "pry", "~> 0.14"
|
10
|
+
gem "rake", "~> 13.0"
|
11
|
+
gem "rspec", "~> 3.9"
|
12
|
+
gem "rspec_junit_formatter", "~> 0.4"
|
13
|
+
gem "rubocop", "~> 1.0"
|
14
|
+
gem "rubocop-performance", "~> 1.9"
|
15
|
+
gem "rubocop-rake", "~> 0.5"
|
16
|
+
gem "rubocop-rspec", "~> 2.2"
|
17
|
+
gem "simplecov", "~> 0.21"
|
18
|
+
gem "simplecov-console", "~> 0.9"
|
19
|
+
gem "versionomy", "~> 0.5"
|
data/Gemfile.lock
CHANGED
@@ -1,52 +1,98 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pdfh (0.1.
|
5
|
-
colorize (~> 0.8.
|
4
|
+
pdfh (0.1.9)
|
5
|
+
colorize (~> 0.8.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ansi (1.5.0)
|
11
|
+
ast (2.4.2)
|
12
|
+
blockenspiel (0.5.0)
|
13
|
+
coderay (1.1.3)
|
11
14
|
colorize (0.8.1)
|
12
|
-
diff-lcs (1.
|
13
|
-
docile (1.3.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
docile (1.3.5)
|
17
|
+
method_source (1.0.0)
|
18
|
+
parallel (1.20.1)
|
19
|
+
parser (3.0.0.0)
|
20
|
+
ast (~> 2.4.1)
|
21
|
+
pry (0.14.0)
|
22
|
+
coderay (~> 1.1)
|
23
|
+
method_source (~> 1.0)
|
24
|
+
rainbow (3.0.0)
|
25
|
+
rake (13.0.3)
|
26
|
+
regexp_parser (2.1.1)
|
27
|
+
rexml (3.2.4)
|
28
|
+
rspec (3.10.0)
|
29
|
+
rspec-core (~> 3.10.0)
|
30
|
+
rspec-expectations (~> 3.10.0)
|
31
|
+
rspec-mocks (~> 3.10.0)
|
32
|
+
rspec-core (3.10.1)
|
33
|
+
rspec-support (~> 3.10.0)
|
34
|
+
rspec-expectations (3.10.1)
|
24
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-mocks (3.
|
36
|
+
rspec-support (~> 3.10.0)
|
37
|
+
rspec-mocks (3.10.2)
|
27
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-support (3.
|
30
|
-
|
39
|
+
rspec-support (~> 3.10.0)
|
40
|
+
rspec-support (3.10.2)
|
41
|
+
rspec_junit_formatter (0.4.1)
|
42
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
43
|
+
rubocop (1.11.0)
|
44
|
+
parallel (~> 1.10)
|
45
|
+
parser (>= 3.0.0.0)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
regexp_parser (>= 1.8, < 3.0)
|
48
|
+
rexml
|
49
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
50
|
+
ruby-progressbar (~> 1.7)
|
51
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
52
|
+
rubocop-ast (1.4.1)
|
53
|
+
parser (>= 2.7.1.5)
|
54
|
+
rubocop-performance (1.10.1)
|
55
|
+
rubocop (>= 0.90.0, < 2.0)
|
56
|
+
rubocop-ast (>= 0.4.0)
|
57
|
+
rubocop-rake (0.5.1)
|
58
|
+
rubocop
|
59
|
+
rubocop-rspec (2.2.0)
|
60
|
+
rubocop (~> 1.0)
|
61
|
+
rubocop-ast (>= 1.1.0)
|
62
|
+
ruby-progressbar (1.11.0)
|
63
|
+
simplecov (0.21.2)
|
31
64
|
docile (~> 1.1)
|
32
|
-
|
33
|
-
|
34
|
-
simplecov-console (0.
|
65
|
+
simplecov-html (~> 0.11)
|
66
|
+
simplecov_json_formatter (~> 0.1)
|
67
|
+
simplecov-console (0.9.1)
|
35
68
|
ansi
|
36
|
-
hirb
|
37
69
|
simplecov
|
38
|
-
|
70
|
+
terminal-table
|
71
|
+
simplecov-html (0.12.3)
|
72
|
+
simplecov_json_formatter (0.1.2)
|
73
|
+
terminal-table (3.0.0)
|
74
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
75
|
+
unicode-display_width (1.7.0)
|
76
|
+
versionomy (0.5.0)
|
77
|
+
blockenspiel (~> 0.5)
|
39
78
|
|
40
79
|
PLATFORMS
|
41
80
|
ruby
|
42
81
|
|
43
82
|
DEPENDENCIES
|
44
|
-
bundler (~>
|
83
|
+
bundler (~> 2.0)
|
45
84
|
pdfh!
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
85
|
+
pry (~> 0.14)
|
86
|
+
rake (~> 13.0)
|
87
|
+
rspec (~> 3.9)
|
88
|
+
rspec_junit_formatter (~> 0.4)
|
89
|
+
rubocop (~> 1.0)
|
90
|
+
rubocop-performance (~> 1.9)
|
91
|
+
rubocop-rake (~> 0.5)
|
92
|
+
rubocop-rspec (~> 2.2)
|
93
|
+
simplecov (~> 0.21)
|
94
|
+
simplecov-console (~> 0.9)
|
95
|
+
versionomy (~> 0.5)
|
50
96
|
|
51
97
|
BUNDLED WITH
|
52
|
-
|
98
|
+
2.2.12
|
data/README.md
CHANGED
@@ -8,6 +8,15 @@ Examine all PDF files in scrape directories, remove password (if has one), renam
|
|
8
8
|
gem install pdfh
|
9
9
|
```
|
10
10
|
|
11
|
+
### Dependencies
|
12
|
+
|
13
|
+
You need to install pdf handling dependencies in order to use this gem. (I have only tested it on macOS)
|
14
|
+
|
15
|
+
```bash
|
16
|
+
brew install qpdf
|
17
|
+
brew install xpdf
|
18
|
+
```
|
19
|
+
|
11
20
|
## Usage
|
12
21
|
|
13
22
|
After installing this gem you need to create your configuration file on your home folder.
|
@@ -24,7 +33,7 @@ document_types:
|
|
24
33
|
pwd: base64string # [OPTIONAL] Password if the document is protected
|
25
34
|
store_path: "{YEAR}/bank_docs" # Relative path to copy this document
|
26
35
|
name_template: '{period} {subtype}' # Template for new filename when copied
|
27
|
-
sub_types: # [OPTIONAL] In case your need an extra category
|
36
|
+
sub_types: # [OPTIONAL] In case your need an extra category
|
28
37
|
- name: Account1 # Regular expresion to match this subtype
|
29
38
|
month_offset: -1 # [OPTIONAL] Integer value to adjust month
|
30
39
|
```
|
@@ -33,9 +42,12 @@ document_types:
|
|
33
42
|
|
34
43
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
44
|
|
36
|
-
To install this gem onto your local machine, run `
|
45
|
+
To install this gem onto your local machine, run `rake install`. To release a new version, run `rake bump`, and then run `rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
46
|
|
38
47
|
```bash
|
48
|
+
rake install
|
49
|
+
|
50
|
+
# step by step
|
39
51
|
build pdfh.gemspec
|
40
52
|
gem install pdfh-*
|
41
53
|
```
|