pdfh 0.1.9 → 0.2.0

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.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfh
4
+ # rubocop:disable Layout/HashAlignment
5
+ SETTINGS_TEMPLATE = {
6
+ "lookup_dirs" => ["~/Downloads"].freeze,
7
+ "destination_base_path" => "~/Documents",
8
+ "document_types" => [
9
+ {
10
+ "name" => "Example Name",
11
+ "re_file" => ".*file_name\.pdf",
12
+ "re_date" => "(\d{2})\/(?<m>\w+)\/(?<y>\d{4})",
13
+ "pwd" => "BASE64_STRING",
14
+ "store_path" => "{YEAR}/sub folder",
15
+ "name_template" => "{period} {original}",
16
+ "sub_types" => []
17
+ }.freeze
18
+ ].freeze
19
+ }.freeze
20
+ # rubocop:enable Layout/HashAlignment
21
+ end
data/lib/pdfh/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pdfh
4
- VERSION = "0.1.9"
4
+ VERSION = "0.2.0"
5
5
  end
data/pdfh.gemspec CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # lib = File.expand_path("lib", __dir__)
4
- # $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "uri"
5
4
  require_relative "lib/pdfh/version"
6
5
 
7
6
  Gem::Specification.new do |spec|
@@ -11,33 +10,30 @@ Gem::Specification.new do |spec|
11
10
  spec.email = ["iax7@users.noreply.github.com"]
12
11
 
13
12
  spec.summary = "Organize PDF files"
14
- spec.description = "Examine all PDF files in scrape directories, remove password (if has one), "\
15
- "rename and copy to a new directory using regular expresions."
13
+ spec.description = "Examine all PDF files in Look up directories, remove password (if has one), "\
14
+ "rename and copy to a new directory using regular expressions."
16
15
  spec.homepage = "https://github.com/iax7/pdfh"
17
16
  spec.license = "MIT"
18
17
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
19
18
 
20
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
21
- # to allow pushing to a single host or delete this section to allow pushing to any host.
22
- if spec.respond_to?(:metadata)
23
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
24
-
25
- spec.metadata["homepage_uri"] = spec.homepage
26
- spec.metadata["source_code_uri"] = spec.homepage
27
- spec.metadata["changelog_uri"] = "https://raw.githubusercontent.com/iax7/pdfh/master/CHANGELOG.md"
28
- else
29
- raise "RubyGems 2.0 or newer is required to protect against " \
30
- "public gem pushes."
31
- end
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = spec.homepage
23
+ spec.metadata["changelog_uri"] = URI.join(spec.homepage, "CHANGELOG.md").to_s
32
24
 
33
25
  # Specify which files should be added to the gem when it is released.
34
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
35
27
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
36
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:\.\w+|docs|test|spec|features)/}) }
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:\.\w+|doc|test|spec|features)/}) }
37
29
  end
38
30
  spec.bindir = "exe"
39
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
40
32
  spec.require_paths = ["lib"]
41
33
 
34
+ # Uncomment to register a new dependency of your gem
42
35
  spec.add_dependency "colorize", "~> 0.8.0"
36
+
37
+ # For more information and examples about making a new gem, checkout our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
43
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaias Piña
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -24,8 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.0
27
- description: Examine all PDF files in scrape directories, remove password (if has
28
- one), rename and copy to a new directory using regular expresions.
27
+ description: Examine all PDF files in Look up directories, remove password (if has
28
+ one), rename and copy to a new directory using regular expressions.
29
29
  email:
30
30
  - iax7@users.noreply.github.com
31
31
  executables:
@@ -46,15 +46,20 @@ files:
46
46
  - README.md
47
47
  - Rakefile
48
48
  - bin/console
49
+ - bin/run
49
50
  - bin/setup
50
51
  - exe/pdfh
51
52
  - lib/ext/string.rb
52
53
  - lib/pdfh.rb
53
54
  - lib/pdfh/document.rb
55
+ - lib/pdfh/document_period.rb
56
+ - lib/pdfh/document_processor.rb
57
+ - lib/pdfh/document_type.rb
54
58
  - lib/pdfh/month.rb
59
+ - lib/pdfh/opt_parser.rb
55
60
  - lib/pdfh/pdf_handler.rb
56
61
  - lib/pdfh/settings.rb
57
- - lib/pdfh/utils.rb
62
+ - lib/pdfh/settings_template.rb
58
63
  - lib/pdfh/version.rb
59
64
  - pdfh.gemspec
60
65
  homepage: https://github.com/iax7/pdfh
@@ -64,7 +69,7 @@ metadata:
64
69
  allowed_push_host: https://rubygems.org
65
70
  homepage_uri: https://github.com/iax7/pdfh
66
71
  source_code_uri: https://github.com/iax7/pdfh
67
- changelog_uri: https://raw.githubusercontent.com/iax7/pdfh/master/CHANGELOG.md
72
+ changelog_uri: https://github.com/iax7/CHANGELOG.md
68
73
  post_install_message:
69
74
  rdoc_options: []
70
75
  require_paths:
@@ -80,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
85
  - !ruby/object:Gem::Version
81
86
  version: '0'
82
87
  requirements: []
83
- rubygems_version: 3.2.4
88
+ rubygems_version: 3.2.15
84
89
  signing_key:
85
90
  specification_version: 4
86
91
  summary: Organize PDF files
data/lib/pdfh/utils.rb DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "colorize"
4
-
5
- # Contains all generic short functionality
6
- module Pdfh
7
- ##
8
- # Keeps Verbose option in whole project
9
- class Verbose
10
- @active = false
11
- class << self
12
- attr_writer :active
13
-
14
- def active?
15
- @active
16
- end
17
-
18
- def print(msg = "")
19
- puts msg.colorize(:cyan) if active?
20
- end
21
- end
22
- end
23
-
24
- ##
25
- # Keeps Dry run option in whole project
26
- class Dry
27
- @active = false
28
- class << self
29
- attr_writer :active
30
-
31
- def active?
32
- @active
33
- end
34
- end
35
- end
36
-
37
- def self.print_error(exception, exit_app: true)
38
- line = exception.backtrace[0].match(/:(?<line>\d+)/)[:line]
39
- puts "Error, Line[#{line}]: #{exception.message}.".colorize(:red)
40
- exit 1 if exit_app
41
- end
42
- end