pdfmd 2.2.0 → 2.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/bin/pdfmd +2 -1
- data/lib/pdfmd/long_desc.pdfmdsort.txt +9 -3
- data/lib/pdfmd/pdfmdsort.rb +31 -11
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ab7c496da55c93341b8d97bd94fc511bc150bab
|
4
|
+
data.tar.gz: 1c9a4416bdd38052ca3e009576dfc1b98d001381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 174bbd13886843c0bdd9294ce4ef589834ce043db9693e790ff3f74857e299b6fba490eed342f6b03aff41bbe5fa4ff12fabc65335902113f2ea843b7443574f
|
7
|
+
data.tar.gz: 794fa5246df3c0efc53091272e04162a4da7d6c6313cd33a5cbe9a91dc07c9cd11c04ac33585da73f2c09d458a72832a03307ee11393ea7e7687e25e8eb4c8d1
|
data/CHANGELOG.md
CHANGED
data/bin/pdfmd
CHANGED
@@ -7,7 +7,7 @@ require "fileutils"
|
|
7
7
|
require "i18n"
|
8
8
|
require 'pathname'
|
9
9
|
|
10
|
-
VERSION = '2.
|
10
|
+
VERSION = '2.3.0'
|
11
11
|
NAME = 'pdfmd'
|
12
12
|
|
13
13
|
#
|
@@ -220,6 +220,7 @@ def sort(*input)
|
|
220
220
|
pdfdoc.overwrite = pdfdoc.determineValidSetting(options[:overwrite], 'sort:overwrite')
|
221
221
|
pdfdoc.dryrun = pdfdoc.determineValidSetting(options[:dryrun], 'sort:dryrun')
|
222
222
|
pdfdoc.typo = pdfdoc.determineValidSetting(options[:typo], 'sort:typo')
|
223
|
+
pdfdoc.dest_create = pdfdoc.determineValidSetting('', 'sort:dest_create')
|
223
224
|
pdfdoc.sort
|
224
225
|
|
225
226
|
else
|
@@ -4,7 +4,7 @@ Will sort pdf documents into subdirectories according to the value of the meta-t
|
|
4
4
|
|
5
5
|
If a document does not have an entry in the meta tag 'author', the file will not be processed.
|
6
6
|
|
7
|
-
=== Parameter
|
7
|
+
=== Parameter (commandline)
|
8
8
|
|
9
9
|
--destination, -d
|
10
10
|
|
@@ -58,6 +58,11 @@ If set to 'true' the command will overwrite any existing file at the target dest
|
|
58
58
|
|
59
59
|
If set to 'true' (or set at all) similar sub-directories in the sorting target directory will be reported before a new folder is being created. Similar sub-directories can be caused by typos in the author field for the document.
|
60
60
|
|
61
|
+
=== Parameter (hiera)
|
62
|
+
|
63
|
+
dest_create
|
64
|
+
|
65
|
+
if set to true, this will create a the destination directory if missing. If not set and the destination directory is not existing, the program will abort.
|
61
66
|
|
62
67
|
|
63
68
|
=== Replacement rules
|
@@ -87,16 +92,17 @@ pdfmd::config:
|
|
87
92
|
sort:
|
88
93
|
copy : true|false
|
89
94
|
destination : /tmp
|
95
|
+
dest_create : true|false
|
90
96
|
dryrun : true|false
|
91
97
|
interactive : true|false
|
92
98
|
log : true|false
|
93
99
|
logfile : /var/log/pdfmd.log
|
94
100
|
overwrite : true|false
|
95
|
-
|
101
|
+
typo : true|false
|
102
|
+
|
96
103
|
See the README file for an example how to define the values in Hiera or run `pdfmd explain hiera`.
|
97
104
|
|
98
105
|
|
99
|
-
|
100
106
|
=== Example
|
101
107
|
|
102
108
|
This command does the following:
|
data/lib/pdfmd/pdfmdsort.rb
CHANGED
@@ -5,22 +5,21 @@ class Pdfmdsort < Pdfmd
|
|
5
5
|
|
6
6
|
require 'fuzzystringmatch'
|
7
7
|
|
8
|
-
attr_accessor :filename, :dryrun, :copy, :interactive, :destination, :overwrite, :typo
|
8
|
+
attr_accessor :filename, :dryrun, :copy, :interactive, :destination, :overwrite, :typo, :dest_create
|
9
9
|
|
10
10
|
# Initialize
|
11
11
|
def initialize(input)
|
12
12
|
super input
|
13
|
-
@stringSimBorder
|
14
|
-
@destination
|
15
|
-
@interactive
|
16
|
-
@copy
|
17
|
-
@dryrun
|
18
|
-
@overwrite
|
19
|
-
@typo
|
13
|
+
@stringSimBorder = 0.8 # Defines the value of the typo check
|
14
|
+
@destination = '.' # Sorting Base directory
|
15
|
+
@interactive = false # Switch for interactive Sorting
|
16
|
+
@copy = false # Switch for copy instead of moving
|
17
|
+
@dryrun = false # Switch for dry-run process
|
18
|
+
@overwrite = false # Switch for overwrite existing files
|
19
|
+
@typo = false # Switch for detecting Author typos
|
20
|
+
@destinationCreate = false # Switch to create the base directory if missing
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
-
#
|
24
23
|
# Check if the destination is valid
|
25
24
|
def checkDestination
|
26
25
|
|
@@ -28,10 +27,31 @@ class Pdfmdsort < Pdfmd
|
|
28
27
|
|
29
28
|
if File.file?(@destination)
|
30
29
|
log('error', "Destination '#{@destination}' is a file.")
|
31
|
-
|
30
|
+
puts "Abort. Destination '#{@destination}' is a file."
|
31
|
+
exit 1
|
32
|
+
end
|
33
|
+
|
34
|
+
# Create destination if switch is 'true'
|
35
|
+
if @dest_create
|
36
|
+
|
37
|
+
if @dryrun and !File.directory?(@destination)
|
38
|
+
log('info', "Dryrun: Folder '#{@destination}' created.")
|
39
|
+
elsif !File.directory?(@destination)
|
40
|
+
FileUtils.mkdir_p(@destination)
|
41
|
+
log('info', "Folder '#{@destination}' created.")
|
42
|
+
end
|
43
|
+
|
32
44
|
else
|
45
|
+
log('debug', "Destination not created")
|
46
|
+
end
|
47
|
+
|
48
|
+
if File.directory?(@destination)
|
33
49
|
log('debug', "Destination '#{@destination}' as directory confirmed.")
|
34
50
|
true
|
51
|
+
else
|
52
|
+
log('error', "Destination '#{@destination}' as directory not confirmed.")
|
53
|
+
puts "Abort. Destination '#{@destination}' not available!"
|
54
|
+
exit 1
|
35
55
|
end
|
36
56
|
|
37
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Roos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -171,8 +171,8 @@ homepage: https://github.com/Micronarrativ/ruby-pmd
|
|
171
171
|
licenses:
|
172
172
|
- MIT
|
173
173
|
metadata:
|
174
|
-
created: '2015-10-
|
175
|
-
revision: '
|
174
|
+
created: '2015-10-15 10:52:22'
|
175
|
+
revision: '20151015105222'
|
176
176
|
post_install_message: ". Run `pdfmd` to see the command help."
|
177
177
|
rdoc_options: []
|
178
178
|
require_paths:
|