pdfmd 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGELOG.md +9 -0
- data/README.md +24 -15
- data/lib/pdfmd.rb +1 -3
- data/lib/pdfmd/config.rb +3 -6
- data/lib/pdfmd/edit.rb +14 -2
- data/lib/pdfmd/explain.hiera.md +2 -0
- data/lib/pdfmd/explain.keywords.md +1 -1
- data/lib/pdfmd/explain.password.md +14 -0
- data/lib/pdfmd/explain.title.md +2 -0
- data/lib/pdfmd/methods.rb +67 -3
- data/lib/pdfmd/rename.rb +48 -27
- data/test/test_rename.rb +4 -4
- metadata +27 -26
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTY5MDkwYTcxZjliNTZiN2M2YjBhNWI0MTc2MDJmMjk3Zjc5YWFhZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGEwMDkwYTFmZjAyNmRlNTMzZmY1OTNkMjU5ZjFlNzhiNzhkMGY2NQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGM4Njk2Y2E4ZjlkY2QzZGVmZTM0ODZhNWFjNGI1ZTNmNjI4NTE0MDkyMTAz
|
10
|
+
YjUwYTMwOTMzNjZhOTBkMjExYWJmNTVmOWYwNjczOTdiZWIzMTUzMDQ1NzI1
|
11
|
+
YzdmMzM3YTY5NWQ5ZGZmYTU3MjIxZThjNDAyMTdmZDkxNzM0MmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGE5NzcyN2MzOGRlYWFkOTUzMzEyNDQ4YTllNzZmZDViOTNmZTBiZDIwZDRm
|
14
|
+
Nzg2MWRkNmE4ZTE0M2YxMTEzZTZkMTdjYTJhZGMyZGUyMDE4NDRkMWEzZmQ3
|
15
|
+
YWM4YzM5ZDg4ZjBlZDcxOWRmZTNmYjE5MzA1Y2RjYTdhNmY2M2M=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# Version 1.8.0
|
2
|
+
- Added Support for password protected pdf files in command 'show' and 'edit'
|
3
|
+
- Cleaned up renaming key-string and added all string for NO,EN an DE language.
|
4
|
+
- Cleaned the output of `pdfmd config`.
|
5
|
+
- Removed some TODOs
|
6
|
+
- Bugfix in the rename command
|
7
|
+
- Updated Tests
|
8
|
+
- Removed special characters in subject when used in the filename (bug)
|
9
|
+
|
1
10
|
# Version 1.7.0
|
2
11
|
- Rename option in command 'edit' on the Shell now overwrites the hiera setting.
|
3
12
|
- The command 'show' supports multiple output formats.
|
data/README.md
CHANGED
@@ -87,38 +87,47 @@ $ ./pdfmd.rb [show|edit|rename|sort] [options] <filename>
|
|
87
87
|
The interface has been setup using Thor.
|
88
88
|
So in order to get more information just run the required _help_ command:
|
89
89
|
|
90
|
-
```
|
91
|
-
#
|
92
|
-
$ pdfmd
|
93
|
-
|
94
|
-
# Show more information about <action>
|
95
|
-
$ pdfmd help <action>
|
90
|
+
```
|
91
|
+
$ pdfmd # General information
|
92
|
+
$ pdfmd help <action> # Command specific help
|
96
93
|
```
|
97
94
|
|
98
95
|
My usual workflow is like this:
|
99
96
|
|
100
97
|
```
|
101
|
-
$
|
102
|
-
$ pdfmd
|
103
|
-
|
104
|
-
$ pdfmd
|
105
|
-
$ mv 20150101-me-dok-testdocument.pdf /my/pdf/directory
|
106
|
-
...
|
107
|
-
$ pdfmd sort .
|
98
|
+
$ cd /my/pdf/directory # Step 1
|
99
|
+
$ pdfmd show test.pdf # Step 2
|
100
|
+
$ pdfmd edit -t all -r test.pdf # Step 3
|
101
|
+
$ pdfmd sort . # Step 4
|
108
102
|
```
|
109
103
|
|
110
|
-
|
104
|
+
* _Step 1_: Change into the directory with the mess of pdf documents. Here all the files from the scanning before end up.
|
105
|
+
* _Step 2_: A quick look at the currently set metadata does not hurt. If I find the metadata already in order, I skip this document.
|
106
|
+
* _Step 3_: For each document I update the PDF metadata to the settings I prefer. The command `pdfmd explain <topic>` explains what the value are used for. Some parameters like _-r_ are actually ommited on my systems, because they have been set by Hiera.
|
107
|
+
* _Step 4_: In the end I sort all documents according to their metadata into correct subdirectories. The parameter _-d_ is being set from Hiera and makes sure the files end up where they are supposed to be.
|
108
|
+
|
109
|
+
|
110
|
+
There's an underlying logic in the renaming and sorting of the files according to the metadata. Make sure you read at least the help-information before you use it or it might be confusing.
|
111
111
|
|
112
112
|
It's also usefull to define some default settings in Hiera to avoid unnecessary typing.
|
113
113
|
|
114
114
|
__HINT__: Before you start using the script, make sure you have a backup of your files or you know what you're doing. If you loose information/files I will not be able to help you.
|
115
115
|
|
116
|
-
# Hiera
|
117
116
|
|
117
|
+
## Password protected files
|
118
|
+
|
119
|
+
_pdfmd_ recognises if a pdf file is password protected and will ask for the password.
|
120
|
+
A password string can be defined in hiera that will be used per default.
|
121
|
+
|
122
|
+
|
123
|
+
# Hiera
|
124
|
+
|
118
125
|
In order for Hiera to provide (default) configuration data, setup a configuration hash e.g. inside the YAML backend:
|
119
126
|
|
120
127
|
``` YAML
|
121
128
|
pdfmd::config:
|
129
|
+
default:
|
130
|
+
password : xxxxxxxxxx
|
122
131
|
sort:
|
123
132
|
destination : /data/tmp
|
124
133
|
copy : true
|
data/lib/pdfmd.rb
CHANGED
@@ -36,9 +36,7 @@
|
|
36
36
|
# * Subject
|
37
37
|
# * Keywords (optional)
|
38
38
|
#
|
39
|
-
# TODO: Include password protected PDF documents as well
|
40
39
|
# TODO: Fix broken PDF files automatically
|
41
|
-
# TODO: Enable logging in 'edit'
|
42
40
|
# TODO: Read this: http://lostechies.com/derickbailey/2011/04/29/writing-a-thor-application/
|
43
41
|
# TODO: ... and this: http://blog.paracode.com/2012/05/17/building-your-tools-with-thor/
|
44
42
|
# gs \
|
@@ -59,7 +57,7 @@ require "i18n"
|
|
59
57
|
require 'pathname'
|
60
58
|
require 'logger'
|
61
59
|
|
62
|
-
VERSION = '1.
|
60
|
+
VERSION = '1.8.0'
|
63
61
|
|
64
62
|
# Include general usage methods
|
65
63
|
require_relative('pdfmd/methods.rb')
|
data/lib/pdfmd/config.rb
CHANGED
@@ -11,9 +11,6 @@ require_relative '../string_extend.rb'
|
|
11
11
|
require 'yaml'
|
12
12
|
require 'pp'
|
13
13
|
|
14
|
-
# TODO: the output can be probably made more pretty without
|
15
|
-
# adding another requirement, can't it?
|
16
|
-
|
17
14
|
#
|
18
15
|
# If now options are set,
|
19
16
|
# show the current settings
|
@@ -21,8 +18,8 @@ if opt_show.blank? or opt_show == 'true'
|
|
21
18
|
opt_show = true
|
22
19
|
end
|
23
20
|
|
21
|
+
# Show the current settings
|
24
22
|
case opt_show
|
25
|
-
# Show the current settings
|
26
23
|
when true
|
27
24
|
|
28
25
|
# As long as only Hiera is supported as external storage
|
@@ -32,9 +29,9 @@ when true
|
|
32
29
|
puts ''
|
33
30
|
hieraConfig = eval `hiera pdfmd::config`
|
34
31
|
hieraConfig.sort.each do |key,value|
|
35
|
-
puts 'Command
|
32
|
+
puts 'Command: ' + key
|
36
33
|
puts value.to_yaml
|
37
|
-
puts
|
34
|
+
puts ''
|
38
35
|
end
|
39
36
|
|
40
37
|
end
|
data/lib/pdfmd/edit.rb
CHANGED
@@ -77,6 +77,14 @@ end
|
|
77
77
|
|
78
78
|
metadata = readMetadata(filename)
|
79
79
|
|
80
|
+
# Set the password for the exiftool if available
|
81
|
+
if metadata['password'].size > 0
|
82
|
+
logenable ? $logger.info("#{filename}: Using PDF password to edit metadata.") : ''
|
83
|
+
exifPdfPassword = "-password '#{metadata['password']}'"
|
84
|
+
else
|
85
|
+
exifPdfPassword = ''
|
86
|
+
end
|
87
|
+
|
80
88
|
if optTag == 'all'
|
81
89
|
tags = ['author','title','subject','createdate','keywords']
|
82
90
|
else
|
@@ -97,7 +105,9 @@ tags.each do |currentTag|
|
|
97
105
|
end
|
98
106
|
|
99
107
|
logenable ? $logger.info("#{filename}: Setting value for tag '#{tag.downcase}': '#{value}'") : ''
|
100
|
-
|
108
|
+
|
109
|
+
# Running the exiftool with optional PDF password parameter on the original file
|
110
|
+
`exiftool #{exifPdfPassword} -#{tag.downcase}='#{value}' -overwrite_original '#{filename}'`
|
101
111
|
|
102
112
|
else
|
103
113
|
|
@@ -115,7 +125,9 @@ tags.each do |currentTag|
|
|
115
125
|
end
|
116
126
|
puts "Changing value for #{currentTag}: '#{metadata[currentTag]}' => #{answer}"
|
117
127
|
logenable ? $logger.info("#{filename}: Setting value for tag '#{currentTag.downcase}': '#{answer}'") : ''
|
118
|
-
|
128
|
+
|
129
|
+
# Running the exiftool with optional PDF password parameter on the original file
|
130
|
+
`exiftool #{exifPdfPassword} -#{currentTag.downcase}='#{answer}' -overwrite_original '#{filename}'`
|
119
131
|
|
120
132
|
end # If interactive/batch mode
|
121
133
|
end
|
data/lib/pdfmd/explain.hiera.md
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
Passwords might be needed to access password protected files.
|
2
|
+
|
3
|
+
If a password is needed is automatically detected. If a password is required, the processing will stop and the user asked for a password,
|
4
|
+
|
5
|
+
A password can also be specified via Hiera:
|
6
|
+
|
7
|
+
``` YAML
|
8
|
+
pdfmd::config:
|
9
|
+
default:
|
10
|
+
password: xxxxxxxxx
|
11
|
+
```
|
12
|
+
|
13
|
+
The password request towards the user is only triggered when no password in Hiera had been found.
|
14
|
+
|
data/lib/pdfmd/explain.title.md
CHANGED
data/lib/pdfmd/methods.rb
CHANGED
@@ -54,6 +54,12 @@ end
|
|
54
54
|
# Function to read the metadata from a given file
|
55
55
|
# hash readMetadata(string)
|
56
56
|
#
|
57
|
+
# Besides the fields from the exif-fields two additional fields can be set:
|
58
|
+
#
|
59
|
+
# error: is being set with a string in case exiftools returns a warning field
|
60
|
+
# password: is being set when a password has been necessary to access the
|
61
|
+
# protected fields.
|
62
|
+
#
|
57
63
|
def readMetadata(pathFile = false)
|
58
64
|
metadata = Hash.new
|
59
65
|
metadata['keywords'] = ''
|
@@ -62,6 +68,8 @@ def readMetadata(pathFile = false)
|
|
62
68
|
metadata['author'] = ''
|
63
69
|
metadata['creator'] = ''
|
64
70
|
metadata['createdate'] = ''
|
71
|
+
metadata['password'] = ''
|
72
|
+
metadata['error'] = ''
|
65
73
|
if not File.file?(pathFile)
|
66
74
|
puts "Cannot access file #{pathFile}. Abort"
|
67
75
|
abort
|
@@ -69,10 +77,43 @@ def readMetadata(pathFile = false)
|
|
69
77
|
|
70
78
|
# Fetch the Metada with the help of exiftools (unless something better is
|
71
79
|
# found
|
72
|
-
|
80
|
+
tags = '^Creator\s+\:|^Author|Create Date|Subject|Keywords|Title|^Warning'
|
81
|
+
metaStrings = `exiftool '#{pathFile}' | egrep -i '#{tags}'`
|
73
82
|
|
74
|
-
#
|
83
|
+
# Create an array of all data
|
75
84
|
entries = metaStrings.split("\n")
|
85
|
+
|
86
|
+
# If this matches, the file is password protected.
|
87
|
+
# Grep the password from hiera or from the user
|
88
|
+
if entries.index{ |x| x.match(/Document is password protected/) }
|
89
|
+
|
90
|
+
# Grep data from hiera
|
91
|
+
hieraDefaults = queryHiera('pdfmd::config')
|
92
|
+
|
93
|
+
# Use Hiera default PW if possible
|
94
|
+
if not hieraDefaults['default'].nil? and
|
95
|
+
not hieraDefaults['default']['password'].nil? and
|
96
|
+
not hieraDefaults['default']['password'] == ''
|
97
|
+
|
98
|
+
documentPassword = hieraDefaults['default']['password']
|
99
|
+
|
100
|
+
# Ask the user for a password
|
101
|
+
else
|
102
|
+
|
103
|
+
documentPassword = readUserInput('Please provide user password: ')
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
# Try to get the metadata again, this time with the password
|
108
|
+
metaStrings = `exiftool -password '#{documentPassword}' '#{pathFile}' | egrep -i '#{tags}'`
|
109
|
+
# Add the password to the metadata and make it available to the other procedures
|
110
|
+
metadata['password'] = documentPassword
|
111
|
+
|
112
|
+
# Create an array of all entries
|
113
|
+
entries = metaStrings.split("\n")
|
114
|
+
|
115
|
+
end
|
116
|
+
|
76
117
|
entries.each do |entry|
|
77
118
|
values = entry.split(" : ")
|
78
119
|
values[0].match(/Creator/) and metadata['creator'] == '' ? metadata['creator'] = values[1]: metadata['creator'] = ''
|
@@ -81,7 +122,17 @@ def readMetadata(pathFile = false)
|
|
81
122
|
values[0].match(/Subject/) and metadata['subject'] == '' ? metadata['subject'] = values[1]: metadata['subject'] = ''
|
82
123
|
values[0].match(/Keywords/) and metadata['keywords'] == '' ? metadata['keywords'] = values[1]: metadata['keywords'] =''
|
83
124
|
values[0].match(/Title/) and metadata['title'] == '' ? metadata['title'] = values[1]: metadata['title'] =''
|
125
|
+
|
126
|
+
if values[0].match(/Warning/) and values[1].match(/Document is password protected/)
|
127
|
+
puts 'Document is protected'
|
128
|
+
end
|
129
|
+
|
130
|
+
# Password is not correct. Abort
|
131
|
+
if values[0].match(/Warning/) and values[1].match(/Incorrect password/)
|
132
|
+
abort values[1] + '. Abort!'
|
133
|
+
end
|
84
134
|
end
|
135
|
+
|
85
136
|
return metadata
|
86
137
|
end
|
87
138
|
|
@@ -90,7 +141,20 @@ end
|
|
90
141
|
# Read user input
|
91
142
|
#
|
92
143
|
def readUserInput(textstring = 'Enter value: ')
|
93
|
-
|
144
|
+
|
145
|
+
# if there is a password mentioned, hide the input
|
146
|
+
if textstring.match(/password/i)
|
147
|
+
|
148
|
+
print textstring
|
149
|
+
userinput = STDIN.noecho(&:gets).chomp
|
150
|
+
puts ''
|
151
|
+
return userinput
|
152
|
+
|
153
|
+
else
|
154
|
+
|
155
|
+
return ask textstring
|
156
|
+
|
157
|
+
end
|
94
158
|
end
|
95
159
|
|
96
160
|
|
data/lib/pdfmd/rename.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Thor command 'rename'
|
3
3
|
#
|
4
|
-
# TODO:
|
4
|
+
# TODO: Make keywords abbreviations configurable from Hiera
|
5
5
|
#
|
6
6
|
require_relative '../string_extend'
|
7
7
|
|
@@ -134,67 +134,88 @@ I18n.enforce_available_locales = false
|
|
134
134
|
author = I18n.transliterate(author) # Normalising
|
135
135
|
|
136
136
|
keywords_preface = ''
|
137
|
-
#
|
137
|
+
# Determine the document type from the title.
|
138
|
+
# Languages: DE|NO|EN
|
138
139
|
case metadata['title']
|
139
|
-
when /
|
140
|
+
when /Tilbudt/i
|
140
141
|
doktype = 'til'
|
141
|
-
|
142
|
+
when /Offer/i
|
143
|
+
doktype = 'off'
|
144
|
+
when /Angebot/i
|
145
|
+
doktype = 'ang'
|
142
146
|
when /Orderbekreftelse/i
|
143
147
|
doktype = 'odb'
|
144
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
145
148
|
when /faktura/i
|
146
149
|
doktype = 'fak'
|
147
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
148
150
|
when /invoice/i
|
149
151
|
doktype = 'inv'
|
150
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
151
152
|
when /rechnung/i
|
152
153
|
doktype = 'rec'
|
153
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
154
154
|
when /order/i
|
155
155
|
doktype = 'ord'
|
156
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
157
156
|
when /bestilling/i
|
158
157
|
doktype = 'bes'
|
159
|
-
|
160
|
-
when /(kontrakt|avtale|vertrag|contract)/i
|
158
|
+
when /(kontrakt|avtale)/i
|
161
159
|
doktype = 'avt'
|
162
|
-
|
160
|
+
when /vertrag/i
|
161
|
+
doktype = 'ver'
|
162
|
+
when /contract/i
|
163
|
+
doktype = 'con'
|
163
164
|
when /kvittering/i
|
164
165
|
doktype = 'kvi'
|
165
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
166
166
|
when /manual/i
|
167
167
|
doktype = 'man'
|
168
|
-
|
169
|
-
when /(billett|ticket)/i
|
168
|
+
when /billett/i
|
170
169
|
doktype = 'bil'
|
171
|
-
|
170
|
+
when /ticket/i
|
171
|
+
doktype = 'tik'
|
172
172
|
when /(informasjon|information)/i
|
173
173
|
doktype = 'inf'
|
174
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
175
174
|
else
|
176
175
|
doktype = 'dok'
|
177
|
-
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
178
176
|
end
|
177
|
+
# Set the preface from the doktype
|
178
|
+
keywords_preface = setKeywordsPreface(metadata,doktype.gsub(/\-/,''))
|
179
|
+
|
179
180
|
if not metadata['keywords'].empty?
|
180
181
|
keywords_preface == '' ? keywords = '' : keywords = keywords_preface
|
181
182
|
keywordsarray = metadata['keywords'].split(',')
|
182
183
|
|
183
184
|
#
|
184
185
|
# Sort array
|
186
|
+
# and replace key-strings with the abbreviations
|
187
|
+
# in combination with the titel information
|
188
|
+
# I need to make this one better and make it configurable from
|
189
|
+
# Hiera. But not right now.
|
185
190
|
#
|
186
191
|
keywordssorted = Array.new
|
187
192
|
keywordsarray.each_with_index do |value,index|
|
188
193
|
value = value.lstrip.chomp
|
189
|
-
|
190
|
-
|
191
|
-
value = value.gsub(/(
|
192
|
-
value = value.gsub(/(
|
193
|
-
value = value.gsub(/(
|
194
|
-
|
195
|
-
|
194
|
+
|
195
|
+
# Invoices
|
196
|
+
value = value.gsub(/Faktura(nummer)? /i,'fak')
|
197
|
+
value = value.gsub(/Rechnung(snummer)? /i, 'rec')
|
198
|
+
value = value.gsub(/Invoice(number)? /i, 'inv')
|
199
|
+
|
200
|
+
# Customernumbers
|
201
|
+
value = value.gsub(/Kunde(n)?(nummer)? /i,'kdn')
|
202
|
+
value = value.gsub(/Customer(number)? /i, 'cno')
|
203
|
+
|
204
|
+
# Ordernumbers
|
205
|
+
value = value.gsub(/Bestellung(s?nummer)? /i,'bes')
|
206
|
+
value = value.gsub(/(Ordre)(nummer)? /i,'ord')
|
207
|
+
value = value.gsub(/Bestilling(snummer)? /i,'bst')
|
208
|
+
|
209
|
+
# Receiptnumbers
|
210
|
+
value = value.gsub(/(Kvittering)(snummer)? /i,'kvi')
|
211
|
+
value = value.gsub(/Quittung(snummer)? /i,'qui')
|
212
|
+
value = value.gsub(/Receipt(number)? /i, 'rpt')
|
213
|
+
|
214
|
+
# Remove special characters from string
|
215
|
+
value = value.gsub(/\s|\/|\-|\./,'_')
|
216
|
+
|
196
217
|
keywordsarray[index] = value
|
197
|
-
if value.match(/^(fak|kdn|ord|kvi)/)
|
218
|
+
if value.match(/^(fak|rec|inv|cno|kdn|bes|ord|bst|kvi|qui|rpt)/)
|
198
219
|
keywordssorted.insert(0, value)
|
199
220
|
else
|
200
221
|
keywordssorted.push(value)
|
@@ -209,7 +230,7 @@ if not metadata['keywords'].empty?
|
|
209
230
|
if not opt_allkeywords
|
210
231
|
counter >= opt_numberKeywords-1 ? break : counter = counter + 1
|
211
232
|
end
|
212
|
-
if value.match(
|
233
|
+
if value.match(/^(fak|rec|inv|cno|kdn|bes|ord|bst|kvi|qui|rpt)/)
|
213
234
|
keywords == '' ? keywords = '-' + value : keywords = value + '-' + keywords
|
214
235
|
else
|
215
236
|
keywords == '' ? keywords = '-' + value : keywords.concat('-' + value)
|
data/test/test_rename.rb
CHANGED
@@ -5,7 +5,7 @@ commandparameter = " rename -o #{TMPDIR} -c false "
|
|
5
5
|
`#{PDFMD} #{commandparameter} #{TARGETPDF}`.chomp
|
6
6
|
files = readFilesInDir(TMPDIR)
|
7
7
|
if files.size == 1 and
|
8
|
-
File.basename(files.keys[0]) == '19700101-example_author-dok-
|
8
|
+
File.basename(files.keys[0]) == '19700101-example_author-dok-cno1111111-kdn1111111-test_subject.pdf'
|
9
9
|
result = 'OK'
|
10
10
|
else
|
11
11
|
result = 'failed'
|
@@ -20,7 +20,7 @@ commandparameter = " rename -c -o #{TMPDIR}"
|
|
20
20
|
`#{PDFMD} #{commandparameter} #{TARGETPDF}`.chomp
|
21
21
|
files = readFilesInDir(TMPDIR)
|
22
22
|
if files.size == 2 and
|
23
|
-
File.basename(files.keys[0]) == '19700101-example_author-dok-
|
23
|
+
File.basename(files.keys[0]) == '19700101-example_author-dok-cno1111111-kdn1111111-test_subject.pdf' and
|
24
24
|
File.basename(files.keys[1]) == 'test_default.pdf'
|
25
25
|
result = 'OK'
|
26
26
|
else
|
@@ -49,7 +49,7 @@ commandparameter = " rename -a -o #{TMPDIR} -c false"
|
|
49
49
|
`#{PDFMD} #{commandparameter} #{TARGETPDF}`.chomp
|
50
50
|
files = readFilesInDir(TMPDIR)
|
51
51
|
if files.size == 1 and
|
52
|
-
File.basename(files.keys[0]) == '19700101-example_author-dok-
|
52
|
+
File.basename(files.keys[0]) == '19700101-example_author-dok-cno1111111-kdn1111111-test_subject-some_keywords-author-some_feature.pdf'
|
53
53
|
result = 'OK'
|
54
54
|
else
|
55
55
|
result = 'failed'
|
@@ -78,7 +78,7 @@ commandparameter = " rename -l -p #{TMPDIR}/pdfmd.log -c false"
|
|
78
78
|
`#{PDFMD} #{commandparameter} #{TARGETPDF}`.chomp
|
79
79
|
files = readFilesInDir(TMPDIR)
|
80
80
|
if files.size == 1 and
|
81
|
-
File.basename(files.keys[0]) == '19700101-example_author-dok-
|
81
|
+
File.basename(files.keys[0]) == '19700101-example_author-dok-cno1111111-kdn1111111-test_subject.pdf' and
|
82
82
|
`tail -n 1 #{TMPDIR}/pdfmd.log | wc -l`.to_i == 1
|
83
83
|
result = 'OK'
|
84
84
|
else
|
metadata
CHANGED
@@ -1,106 +1,106 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.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-04-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.19'
|
20
|
-
- -
|
20
|
+
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.19.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.19'
|
30
|
-
- -
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.19.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: highline
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.7'
|
40
|
-
- -
|
40
|
+
- - ! '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.7.1
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '1.7'
|
50
|
-
- -
|
50
|
+
- - ! '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.7.1
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: fileutils
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ~>
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0.7'
|
60
|
-
- -
|
60
|
+
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0.7'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0.7'
|
70
|
-
- -
|
70
|
+
- - ! '>='
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0.7'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: i18n
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0.6'
|
80
|
-
- -
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.6.11
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.6'
|
90
|
-
- -
|
90
|
+
- - ! '>='
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 0.6.11
|
93
|
-
description:
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
description: ! " Managing the common pdf metadata values and renaming the pdf file
|
94
|
+
accordingly.\n Sets common tags like 'author', 'createdate', 'title', 'subject'
|
95
|
+
and 'keywords'\n and re-uses them for renaming the file with to a human-readable
|
96
|
+
identifier.\n"
|
97
97
|
email: pdfmd@micronarrativ.org
|
98
98
|
executables:
|
99
99
|
- pdfmd
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
-
-
|
103
|
+
- .gitignore
|
104
104
|
- CHANGELOG.md
|
105
105
|
- LICENSE
|
106
106
|
- README.md
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/pdfmd/explain.csv.md
|
116
116
|
- lib/pdfmd/explain.hiera.md
|
117
117
|
- lib/pdfmd/explain.keywords.md
|
118
|
+
- lib/pdfmd/explain.password.md
|
118
119
|
- lib/pdfmd/explain.rb
|
119
120
|
- lib/pdfmd/explain.subject.md
|
120
121
|
- lib/pdfmd/explain.title.md
|
@@ -138,16 +139,16 @@ require_paths:
|
|
138
139
|
- lib
|
139
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
141
|
requirements:
|
141
|
-
- -
|
142
|
+
- - ! '>='
|
142
143
|
- !ruby/object:Gem::Version
|
143
144
|
version: '0'
|
144
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
146
|
requirements:
|
146
|
-
- -
|
147
|
+
- - ! '>='
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements:
|
150
|
-
-
|
151
|
+
- ! '[exiftools](http://www.sno.phy.queensu.ca/~phil/exiftool/)'
|
151
152
|
rubyforge_project:
|
152
153
|
rubygems_version: 2.4.6
|
153
154
|
signing_key:
|