pdfmd 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9a3ab542e0996fa6a51d24668010afcbaf2bbb9
4
- data.tar.gz: b3d3da094eb90f1c1e8d9f00f77404e2bec38393
3
+ metadata.gz: 8e4dab486ed68d69f67afc23637cc18389c0e83d
4
+ data.tar.gz: 893abb0820f6828ccb60b9ce18780d4e4608dc1d
5
5
  SHA512:
6
- metadata.gz: 47cdb550ad5259ab7578b43844cd1c34a423cbd8674fe7710f823360de2fde6ba1b8f6a597b5fff801cc9ced87f202363f822806397ba98ce35747a49014d360
7
- data.tar.gz: c6df8ae93e2dddcd91c16e886a4672c6ce9b6e17d619a62ba7bba958f8a9dfa645250a2e419a7c9aeeea1cb3395ab5bfcafe2103718e0b9c96a1984cb431906f
6
+ metadata.gz: 2ef3bfde7c7b34cb1633d4857709bb8470618f31d07a4b58759ee1e3899a16b8c97fbb382c0c7d34e5e31025b0ea4d26c40e10641ba15f48543effd042a1740c
7
+ data.tar.gz: cbbb4db188e3aea5c1c6edd88b71288da1ef8dfa5ee779582da66af135cd38926d2354d47226119da3ba2e3ebce2e64bb7a810648cbde8ce184d35ade7ade9ff
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # Version 2.1.0
2
+ - Added command 'clean' to delete values for Metatags
3
+ - Added multiple file support for commands 'clean', 'edit', 'rename', 'show'
4
+ - Bugfix: Renaming
5
+ - Bugfix: Sorting
6
+ - Added abort when renaming a file with incomplete metadata.
7
+
1
8
  # Version 2.0.0
2
9
  - Rewritten the gem using classes.
3
10
  - Shorter Code (optimizing)
@@ -16,7 +23,7 @@
16
23
  - Added parameter '-r' which shows the revision of the gem.
17
24
  - Bug: Renaming files with a '/' in the metadatafield 'author'.
18
25
  - Bug: Renaming files with spaces in the metadatafield 'subject'.
19
- - Collected Todo's in `TODO.mkd`.
26
+ - Collected Todos in `TODO.mkd`.
20
27
 
21
28
  # Version 1.9.1
22
29
  - Removed some inactive Code
data/README.md CHANGED
@@ -144,8 +144,6 @@ pdfmd::config:
144
144
 
145
145
  Information about which hiera configuration settings are available can be either found in `pdfmd help <command>` or `pdfmd explain hiera`.
146
146
 
147
- **PDFMD** expects currently the hiera configuration file to be at `/etc/hiera.yaml`. With Hiera2 the default location has changed to `/etc/puppetlabs/code/hiera.yaml`. This might be addressed in a future version. Currently you have to create at least a symlink to `/etc/hiera.yaml`.
148
-
149
147
  Test your hiera configuration with
150
148
 
151
149
  ``` bash
@@ -155,4 +153,4 @@ $ hiera pdfmd::config
155
153
  # Contact
156
154
 
157
155
  If you have improvements and suggestions -> let me know.
158
-
156
+ If you can help me writing tests for this, please let me know as well.
data/TODO.mkd CHANGED
@@ -3,18 +3,12 @@
3
3
  ## pdfmd.rb
4
4
  * The logfile is a bit annoying. It should be possible to configure the logfile to be placed whereever convenient without creating double log files.
5
5
  * Replace system copy command with fileutils.copy.
6
- * Run commands on multiple PDF documents as one.
7
- * Method for removing all metadata from a PDF document.
8
6
 
9
7
  ### Method: _stat_
10
8
  * Parameter to ignore differences in upper and lowercase
11
9
  * Parameter to disable percentage output
12
10
  * Parameter to set output format: json,yaml, hash
13
11
 
14
- ## pdfmdrename.rb
15
-
16
- * Refuse renaming if values are missing for either: author, title, subject or createdate. Keywords are optional.
17
-
18
12
  ## pdfmdedit.rb
19
13
 
20
14
  * keywords are added differently according to the documentation, http://www.sno.phy.queensu.ca/~phil/exiftool/faq.html
data/bin/pdfmd CHANGED
@@ -7,7 +7,7 @@ require "fileutils"
7
7
  require "i18n"
8
8
  require 'pathname'
9
9
 
10
- VERSION = '2.0.0'
10
+ VERSION = '2.1.0'
11
11
  NAME = 'pdfmd'
12
12
 
13
13
  #
@@ -53,16 +53,49 @@ class DOC < Thor
53
53
  method_option :tag, :type => :string, :aliases => '-t', :desc => 'Show specific tag(s), comma separated', :required => false
54
54
  method_option :format, :type => :string, :aliases => '-f', :desc => 'Define output format', :required => false
55
55
  method_option :includepdf, :type => :boolean, :aliases => '-i', :desc => 'Include the filename in output', :required => false
56
- def show(filename)
57
-
58
- pdfdoc = Pdfmdshow.new filename
59
- format = pdfdoc.determineValidSetting(options[:format], 'show:format')
60
- show_filename = pdfdoc.determineValidSetting(options[:includepdf], 'show:includepdf')
61
- show_tags = pdfdoc.determineValidSetting(options[:tag], 'show:tags')
62
- pdfdoc.set_outputformat format
63
- pdfdoc.show_filename show_filename
64
- pdfdoc.set_tags show_tags
65
- puts pdfdoc.show_metatags
56
+ def show(*filename)
57
+
58
+ filename.each do |current_file|
59
+
60
+ # Skip non-pdf documents
61
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
62
+
63
+ pdfdoc = Pdfmdshow.new current_file
64
+ format = pdfdoc.determineValidSetting(options[:format], 'show:format')
65
+ show_filename = pdfdoc.determineValidSetting(options[:includepdf], 'show:includepdf')
66
+ show_tags = pdfdoc.determineValidSetting(options[:tag], 'show:tags')
67
+ pdfdoc.set_outputformat format
68
+ pdfdoc.show_filename show_filename
69
+ pdfdoc.set_tags show_tags
70
+ puts pdfdoc.show_metatags
71
+
72
+ # Unset
73
+ pdfdoc = ''
74
+
75
+ end
76
+
77
+ end
78
+
79
+ # Clean all metadata from a document
80
+ #
81
+ desc 'clean', 'Clean metadata from file'
82
+ long_desc readLongDesc 'pdfmd/long_desc.pdfmdclean.txt'
83
+ method_option :tags, :aliases => '-t', :type => :string, :required => false
84
+ def clean(*filename)
85
+
86
+ filename.each do |current_file|
87
+
88
+ # Skip non-pdf documents
89
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
90
+
91
+ pdfdoc = Pdfmdclean.new current_file
92
+ pdfdoc.tags = options[:tags]
93
+ pdfdoc.run
94
+
95
+ # Unset
96
+ pdfdoc = ''
97
+
98
+ end
66
99
  end
67
100
 
68
101
 
@@ -88,22 +121,29 @@ long_desc readLongDesc 'pdfmd/long_desc.pdfmdedit.txt'
88
121
  method_option :tag, :type => :string, :aliases => '-t', :desc => 'Name of the Tag(s) to Edit', :required => true, :lazy_default => 'all'
89
122
  method_option :rename, :type => :boolean, :aliases => '-r', :desc => 'Rename file after changing meta-tags', :required => false
90
123
  method_option :opendoc, :type => :boolean, :aliases => '-o', :desc => 'Open the PDF document in a separate window.', :required => false, :lazy_default => true
91
- def edit(filename)
124
+ def edit(*filename)
125
+
126
+ filename.each do |current_file|
92
127
 
93
- pdfdoc = Pdfmdedit.new filename
94
- tags = pdfdoc.determineValidSetting(options[:tag],'edit:tags')
95
- pdfdoc.opendoc = pdfdoc.determineValidSetting(options[:opendoc], 'edit:opendoc')
96
- pdfdoc.pdfviewer = pdfdoc.determineValidSetting(nil, 'edit:pdfviewer')
97
- pdfdoc.set_tags tags
98
- pdfdoc.update_tags
99
- pdfdoc.write_tags filename
128
+ # Skip non-pdf documents
129
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
100
130
 
101
- # If the file shall be renamed at the same time, trigger the other task
102
- if pdfdoc.determineValidSetting(options[:rename], 'edit:rename')
131
+ pdfdoc = Pdfmdedit.new current_file
132
+ tags = pdfdoc.determineValidSetting(options[:tag],'edit:tags')
133
+ pdfdoc.opendoc = pdfdoc.determineValidSetting(options[:opendoc], 'edit:opendoc')
134
+ pdfdoc.pdfviewer = pdfdoc.determineValidSetting(nil, 'edit:pdfviewer')
135
+ pdfdoc.set_tags tags
136
+ pdfdoc.update_tags
137
+ pdfdoc.write_tags current_file
103
138
 
104
- #rename filename
105
- pdfdoc.log('info', 'Running rename command.')
106
- rename filename
139
+ # If the file shall be renamed at the same time, trigger the other task
140
+ if pdfdoc.determineValidSetting(options[:rename], 'edit:rename')
141
+
142
+ #rename filename
143
+ pdfdoc.log('info', 'Running rename command.')
144
+ rename current_file
145
+
146
+ end
107
147
 
108
148
  end
109
149
 
@@ -205,17 +245,27 @@ end
205
245
  method_option :nrkeywords, :type => :string, :aliases => '-k', :desc => 'Number of keywords to include (Default: 3)', :required => false
206
246
  method_option :outputdir, :aliases => '-o', :type => :string, :desc => 'Specify output directory', :required => false
207
247
  method_option :copy, :aliases => '-c', :type => :boolean, :desc => 'Copy instead of moving the file when renaming', :lazy_default => true
208
- def rename(filename)
209
-
210
- pdfdoc = Pdfmdrename.new filename
211
- pdfdoc.dryrun = pdfdoc.determineValidSetting(options[:dryrun],'rename:dryrun')
212
- pdfdoc.allkeywords = pdfdoc.determineValidSetting(options[:allkeywords],'rename:allkeywords')
213
- pdfdoc.outputdir = pdfdoc.determineValidSetting(options[:outputdir], 'rename:outputdir')
214
- if nrkeywords = pdfdoc.determineValidSetting(options[:nrkeywords], 'rename:nrkeywords' )
215
- pdfdoc.nrkeywords = nrkeywords
248
+ def rename(*filename)
249
+
250
+ filename.each do |current_file|
251
+
252
+ # Skip non-pdf documents
253
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
254
+
255
+ pdfdoc = Pdfmdrename.new current_file
256
+ pdfdoc.dryrun = pdfdoc.determineValidSetting(options[:dryrun],'rename:dryrun')
257
+ pdfdoc.allkeywords = pdfdoc.determineValidSetting(options[:allkeywords],'rename:allkeywords')
258
+ pdfdoc.outputdir = pdfdoc.determineValidSetting(options[:outputdir], 'rename:outputdir')
259
+ if nrkeywords = pdfdoc.determineValidSetting(options[:nrkeywords], 'rename:nrkeywords' )
260
+ pdfdoc.nrkeywords = nrkeywords
261
+ end
262
+ pdfdoc.copy = pdfdoc.determineValidSetting(options[:copy], 'rename:copy')
263
+ pdfdoc.rename
264
+
265
+ # Unset
266
+ pdfdoc = ''
267
+
216
268
  end
217
- pdfdoc.copy = pdfdoc.determineValidSetting(options[:copy], 'rename:copy')
218
- pdfdoc.rename
219
269
 
220
270
  end
221
271
 
data/lib/pdfmd.rb CHANGED
@@ -21,6 +21,7 @@ class Pdfmd
21
21
  require_relative 'pdfmd/pdfmdrename.rb'
22
22
  require_relative 'pdfmd/pdfmdsort.rb'
23
23
  require_relative 'pdfmd/string_extend.rb'
24
+ require_relative 'pdfmd/pdfmdclean.rb'
24
25
  require 'logger'
25
26
 
26
27
  @@default_tags = ['createdate', 'author', 'title', 'subject', 'keywords']
@@ -0,0 +1,3 @@
1
+ # Logfile created on 2015-07-07 20:42:01 +0200 by logger.rb/44203
2
+ I, [2015-07-07T20:42:01.345848 #14145] INFO -- : Starting with file '/home/jt/Nedlastinger/pdfsort/test.pdf'.
3
+ I, [2015-07-07T20:42:02.000264 #14145] INFO -- : Showing metatags for '/home/jt/Nedlastinger/pdfsort/test.pdf' in format 'yaml'.
@@ -0,0 +1,28 @@
1
+ == General
2
+
3
+ Clean metatags of a PDF document.
4
+
5
+ == Usage
6
+
7
+ Example: `pdfmd clean <file>`
8
+
9
+
10
+
11
+ == Parameter
12
+
13
+
14
+ <file>
15
+
16
+
17
+ Path to file to work with.
18
+
19
+
20
+ --tags, -t <list_of_tags>
21
+
22
+ Tags to remove from the file. If no tag is provided, all tags are assumed (all Tags managed by pdfmd, not really all available tags ;) ).
23
+ Tags are listed as a comma separated string.
24
+ Additionally the value 'all' is allowed.
25
+
26
+ Example: `pdfmd clean -t author,title example.pdf`
27
+
28
+
@@ -31,10 +31,3 @@ Enables/Disables logging.
31
31
 
32
32
  Default: true
33
33
 
34
-
35
-
36
- --logfile, -p
37
-
38
-
39
- Path to the logfile. Default: `./.pdfmd.log`
40
-
@@ -0,0 +1,37 @@
1
+ # == Class: pdfmdclean
2
+ #
3
+ # Clean metadata from a document
4
+ #
5
+ class Pdfmdclean < Pdfmd
6
+
7
+ attr_accessor :filename, :tags
8
+
9
+ def initialize(filename)
10
+ super(filename)
11
+ end
12
+
13
+ # Run the actual cleaning
14
+ def run()
15
+
16
+ # Figure out which tags actually to reset.
17
+ if @tags.nil? or @tags == 'all'
18
+ @tags = @@default_tags
19
+ elsif @tags.is_a?(String)
20
+ @tags = @tags.split(',')
21
+ end
22
+
23
+ # Create the command to delete all the metatags
24
+ command = 'exiftool'
25
+ parameter = ' -overwrite_original'
26
+ @tags.each do |current_tag|
27
+ parameter << " -#{current_tag}="
28
+ end
29
+ parameter << ' '
30
+
31
+ `#{command} #{parameter} #{@filename}`
32
+ self.log('info', "Cleaning tags '#{@tags.join(', ').to_s}' from file '#{@filename}'.")
33
+ end
34
+
35
+
36
+
37
+ end
@@ -47,6 +47,11 @@ class Pdfmdrename < Pdfmd
47
47
  newFilename[:extension] = @fileextension
48
48
  newFilename[:outputdir] = get_outputdir(@outputdir)
49
49
 
50
+ # Verify that all data is available for renaming and fail otherwise
51
+ if !verifyDocumentData(newFilename)
52
+ abort 'Document metadata not complete. Abort renaming.'
53
+ end
54
+
50
55
  command = @copy ? 'cp' : 'mv'
51
56
 
52
57
  filetarget = get_filename(newFilename)
@@ -72,6 +77,30 @@ class Pdfmdrename < Pdfmd
72
77
  end
73
78
  end
74
79
 
80
+ #
81
+ # Data verification
82
+ # returns false is any metatadag is missing
83
+ # other than keywords
84
+ def verifyDocumentData(filedata = {})
85
+
86
+ @@default_tags.each do |current_tag|
87
+
88
+ if not @@metadata[current_tag].nil? and not @@metadata[current_tag] == ''
89
+
90
+ # Skip over keywords (optional tag)
91
+ current_tag.match(/keywords/) ? next : ''
92
+
93
+ else
94
+
95
+ return false
96
+
97
+ end
98
+
99
+ end
100
+
101
+ end
102
+
103
+
75
104
  #
76
105
  # Return the filename from the available filedata
77
106
  def get_filename(filedata = {})
@@ -200,7 +229,7 @@ class Pdfmdrename < Pdfmd
200
229
  end
201
230
 
202
231
  if !filedata[:subject].nil? and !filedata[:subject].empty? and
203
- !filedata[:doctype] == @defaultDoctype
232
+ filedata[:doctype] != @defaultDoctype
204
233
 
205
234
  I18n.transliterate(filedata[:subject])
206
235
 
@@ -235,7 +264,7 @@ class Pdfmdrename < Pdfmd
235
264
  # Get the author from the metatags and
236
265
  # normalize the string
237
266
  def get_author()
238
- author = @@metadata['author'].gsub(/\./,'_').gsub(/\&/,'').gsub(/\-/,'').gsub(/\s|\//,'_').gsub(/\,/,'_').gsub(/\_\_/,'_')
267
+ author = @@metadata['author'].gsub(/\./,'_').gsub(/\&/,'').gsub(/\-/,'_').gsub(/\s|\//,'_').gsub(/\,/,'_').gsub(/\_\_/,'_')
239
268
  I18n.enforce_available_locales = false
240
269
  I18n.transliterate(author).downcase # Normalising
241
270
  end
@@ -39,7 +39,7 @@ class Pdfmdsort < Pdfmd
39
39
  if not self.check_metatags('author')
40
40
  return false
41
41
  end
42
- author = @@metadata['author'].gsub(/\./,'_').gsub(/\&/,'').gsub(/\-/,'').gsub(/\s/,'_').gsub(/\,/,'_').gsub(/\_\_/,'_')
42
+ author = @@metadata['author'].gsub(/\./,'_').gsub(/\&/,'').gsub(/\-/,'_').gsub(/\s/,'_').gsub(/\,/,'_').gsub(/\_\_/,'_')
43
43
  I18n.enforce_available_locales = false
44
44
  I18n.transliterate(author).downcase # Normalising
45
45
  end
data/lib/run.rb CHANGED
@@ -3,7 +3,7 @@ require './pdfmd.rb'
3
3
  require './pdfmd/pdfmdstat.rb'
4
4
  require "thor"
5
5
 
6
- VERSION = '2.0.0'
6
+ VERSION = '2.1.0'
7
7
  NAME = 'pdfmd'
8
8
 
9
9
  #
@@ -49,16 +49,47 @@ class DOC < Thor
49
49
  method_option :tag, :type => :string, :aliases => '-t', :desc => 'Show specific tag(s), comma separated', :required => false
50
50
  method_option :format, :type => :string, :aliases => '-f', :desc => 'Define output format', :required => false
51
51
  method_option :includepdf, :type => :boolean, :aliases => '-i', :desc => 'Include the filename in output', :required => false
52
- def show(filename)
53
-
54
- pdfdoc = Pdfmdshow.new filename
55
- format = pdfdoc.determineValidSetting(options[:format], 'show:format')
56
- show_filename = pdfdoc.determineValidSetting(options[:includepdf], 'show:includepdf')
57
- show_tags = pdfdoc.determineValidSetting(options[:tag], 'show:tags')
58
- pdfdoc.set_outputformat format
59
- pdfdoc.show_filename show_filename
60
- pdfdoc.set_tags show_tags
61
- puts pdfdoc.show_metatags
52
+ def show(*filename)
53
+
54
+ filename.each do |current_file|
55
+
56
+ # Skip non-pdf documents
57
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
58
+
59
+ pdfdoc = Pdfmdshow.new current_file
60
+ format = pdfdoc.determineValidSetting(options[:format], 'show:format')
61
+ show_filename = pdfdoc.determineValidSetting(options[:includepdf], 'show:includepdf')
62
+ show_tags = pdfdoc.determineValidSetting(options[:tag], 'show:tags')
63
+ pdfdoc.set_outputformat format
64
+ pdfdoc.show_filename show_filename
65
+ pdfdoc.set_tags show_tags
66
+ puts pdfdoc.show_metatags
67
+
68
+ pdfdoc = ''
69
+
70
+ end
71
+ end
72
+
73
+ # Clean all metadata from a document
74
+ #
75
+ desc 'clean', 'Clean metadata from file'
76
+ long_desc readLongDesc 'pdfmd/long_desc.pdfmdclean.txt'
77
+ method_option :tags, :aliases => '-t', :type => :string, :required => false
78
+ def clean(*filename)
79
+
80
+ filename.each do |current_file|
81
+
82
+ # Skip non-pdf documents
83
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
84
+
85
+ pdfdoc = Pdfmdclean.new current_file
86
+ pdfdoc.tags = options[:tags]
87
+ pdfdoc.run
88
+
89
+ # Unset
90
+ pdfdoc = ''
91
+
92
+ end
62
93
  end
63
94
 
64
95
 
@@ -82,22 +113,32 @@ class DOC < Thor
82
113
  method_option :tag, :type => :string, :aliases => '-t', :desc => 'Name of the Tag(s) to Edit', :required => true, :lazy_default => 'all'
83
114
  method_option :rename, :type => :boolean, :aliases => '-r', :desc => 'Rename file after changing meta-tags', :required => false
84
115
  method_option :opendoc, :type => :boolean, :aliases => '-o', :desc => 'Open the PDF document in a separate window.', :required => false, :lazy_default => true
85
- def edit(filename)
116
+ def edit(*filename)
117
+
118
+ filename.each do |current_file|
119
+
120
+ # Skip non-pdf documents
121
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
86
122
 
87
- pdfdoc = Pdfmdedit.new filename
88
- tags = pdfdoc.determineValidSetting(options[:tag],'edit:tags')
89
- pdfdoc.opendoc = pdfdoc.determineValidSetting(options[:opendoc], 'edit:opendoc')
90
- pdfdoc.pdfviewer = pdfdoc.determineValidSetting(nil, 'edit:pdfviewer')
91
- pdfdoc.set_tags tags
92
- pdfdoc.update_tags
93
- pdfdoc.write_tags filename
123
+ pdfdoc = Pdfmdedit.new current_file
124
+ tags = pdfdoc.determineValidSetting(options[:tag],'edit:tags')
125
+ pdfdoc.opendoc = pdfdoc.determineValidSetting(options[:opendoc], 'edit:opendoc')
126
+ pdfdoc.pdfviewer = pdfdoc.determineValidSetting(nil, 'edit:pdfviewer')
127
+ pdfdoc.set_tags tags
128
+ pdfdoc.update_tags
129
+ pdfdoc.write_tags current_file
94
130
 
95
- # If the file shall be renamed at the same time, trigger the other task
96
- if pdfdoc.determineValidSetting(options[:rename], 'edit:rename')
131
+ # If the file shall be renamed at the same time, trigger the other task
132
+ if pdfdoc.determineValidSetting(options[:rename], 'edit:rename')
133
+
134
+ #rename filename
135
+ pdfdoc.log('info', 'Running rename command.')
136
+ rename current_file
137
+
138
+ end
97
139
 
98
- #rename filename
99
- pdfdoc.log('info', 'Running rename command.')
100
- rename filename
140
+ # Unset the object
141
+ pdfdoc = ''
101
142
 
102
143
  end
103
144
 
@@ -200,17 +241,27 @@ class DOC < Thor
200
241
  method_option :nrkeywords, :type => :string, :aliases => '-k', :desc => 'Number of keywords to include (Default: 3)', :required => false
201
242
  method_option :outputdir, :aliases => '-o', :type => :string, :desc => 'Specify output directory', :required => false
202
243
  method_option :copy, :aliases => '-c', :type => :boolean, :desc => 'Copy instead of moving the file when renaming', :lazy_default => true
203
- def rename(filename)
204
-
205
- pdfdoc = Pdfmdrename.new filename
206
- pdfdoc.dryrun = pdfdoc.determineValidSetting(options[:dryrun],'rename:dryrun')
207
- pdfdoc.allkeywords = pdfdoc.determineValidSetting(options[:allkeywords],'rename:allkeywords')
208
- pdfdoc.outputdir = pdfdoc.determineValidSetting(options[:outputdir], 'rename:outputdir')
209
- if nrkeywords = pdfdoc.determineValidSetting(options[:nrkeywords], 'rename:nrkeywords' )
210
- pdfdoc.nrkeywords = nrkeywords
244
+ def rename(*filename)
245
+
246
+ filename.each do |current_file|
247
+
248
+ # Skip non-pdf documents
249
+ ! File.extname(current_file).match(/\.pdf/) ? next : ''
250
+
251
+ pdfdoc = Pdfmdrename.new current_file
252
+ pdfdoc.dryrun = pdfdoc.determineValidSetting(options[:dryrun],'rename:dryrun')
253
+ pdfdoc.allkeywords = pdfdoc.determineValidSetting(options[:allkeywords],'rename:allkeywords')
254
+ pdfdoc.outputdir = pdfdoc.determineValidSetting(options[:outputdir], 'rename:outputdir')
255
+ if nrkeywords = pdfdoc.determineValidSetting(options[:nrkeywords], 'rename:nrkeywords' )
256
+ pdfdoc.nrkeywords = nrkeywords
257
+ end
258
+ pdfdoc.copy = pdfdoc.determineValidSetting(options[:copy], 'rename:copy')
259
+ pdfdoc.rename
260
+
261
+ # Unset
262
+ pdfdoc = ''
263
+
211
264
  end
212
- pdfdoc.copy = pdfdoc.determineValidSetting(options[:copy], 'rename:copy')
213
- pdfdoc.rename
214
265
 
215
266
  end
216
267
 
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.0.0
4
+ version: 2.1.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-07-07 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,6 +108,7 @@ files:
108
108
  - TODO.mkd
109
109
  - bin/pdfmd
110
110
  - lib/pdfmd.rb
111
+ - lib/pdfmd/.pdfmd.log
111
112
  - lib/pdfmd/explain.author.md
112
113
  - lib/pdfmd/explain.createdate.md
113
114
  - lib/pdfmd/explain.csv.md
@@ -118,6 +119,7 @@ files:
118
119
  - lib/pdfmd/explain.rb
119
120
  - lib/pdfmd/explain.subject.md
120
121
  - lib/pdfmd/explain.title.md
122
+ - lib/pdfmd/long_desc.pdfmdclean.txt
121
123
  - lib/pdfmd/long_desc.pdfmdconfig.txt
122
124
  - lib/pdfmd/long_desc.pdfmdedit.txt
123
125
  - lib/pdfmd/long_desc.pdfmdexplain.txt
@@ -126,6 +128,7 @@ files:
126
128
  - lib/pdfmd/long_desc.pdfmdsort.txt
127
129
  - lib/pdfmd/long_desc.pdfmdstat.txt
128
130
  - lib/pdfmd/methods.rb
131
+ - lib/pdfmd/pdfmdclean.rb
129
132
  - lib/pdfmd/pdfmdconfig.rb
130
133
  - lib/pdfmd/pdfmdedit.rb
131
134
  - lib/pdfmd/pdfmdmethods.rb
@@ -144,8 +147,8 @@ homepage: https://github.com/Micronarrativ/ruby-pmd
144
147
  licenses:
145
148
  - MIT
146
149
  metadata:
147
- created: '2015-07-07 08:08:08'
148
- revision: '20150707080808'
150
+ created: '2015-07-08 17:21:15'
151
+ revision: '20150708172115'
149
152
  post_install_message: ". Run `pdfmd` to see the command help."
150
153
  rdoc_options: []
151
154
  require_paths: