scholar-rename 0.1.1 → 0.1.2
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/bin/scholar-rename +2 -1
- data/lib/renamer.rb +5 -2
- data/lib/selector.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d039aaa0b17ca8cbc90f85c2451bddece6057ddb
|
4
|
+
data.tar.gz: 4815af5eb0879eeabd6cae2b460e2bc9ddde8676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1b4510e462585608e88f6058c22565ca572d66dc55dcc4fb2858bb885800aa40094282b7a16cf9599f68132edfb5d19a8ecde839d3800e864d2a3acda41bea
|
7
|
+
data.tar.gz: 77bdc55ea52ac0c6fd3deff70ac13e61b8dd10419c986582f899ea566ca072e77a4451ee3e7f77e3f98cfb001d22d0f7b3d1680eeff0b0b7f48b68056ce96390
|
data/bin/scholar-rename
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# by jeremy warner, fall 2016
|
4
4
|
# scholar-rename, interactive pdf-namer
|
5
|
+
|
5
6
|
# prereq: pdftotext installation for text dump
|
6
7
|
# renames a pdf file to author-title-year.pdf
|
7
8
|
# or other formats based on your selection
|
@@ -10,4 +11,4 @@
|
|
10
11
|
require_relative '../lib/selector'
|
11
12
|
require_relative '../lib/renamer'
|
12
13
|
|
13
|
-
|
14
|
+
Renamer.new ARGV
|
data/lib/renamer.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
class Renamer
|
2
2
|
def initialize(*args)
|
3
|
-
|
3
|
+
a1 = args.first
|
4
|
+
@file = File.join(Dir.pwd, a1)
|
4
5
|
|
5
6
|
if @file == Dir.pwd.to_s + '/'
|
6
7
|
puts "scholar-rename: provide a file"
|
8
|
+
elsif a1 == "-v"
|
9
|
+
puts SR::Version
|
7
10
|
else
|
8
11
|
rename
|
9
12
|
end
|
@@ -22,7 +25,7 @@ class Renamer
|
|
22
25
|
conf = STDIN.gets.chomp # confirm title
|
23
26
|
|
24
27
|
begin # file read in from first ARGV above
|
25
|
-
File.rename(@file, s.title) unless conf.match
|
28
|
+
File.rename(@file, s.title) unless conf.match(/^(n|N).*/)
|
26
29
|
ensure # cleaning up @file cleanup from pdftotext
|
27
30
|
puts "Cleaning up..."
|
28
31
|
File.delete(temp)
|
data/lib/selector.rb
CHANGED
@@ -49,7 +49,7 @@ class Selector
|
|
49
49
|
# Generate different forms for author selection, enumerating the different
|
50
50
|
# author that you want to save the file as. Split based on a comma.
|
51
51
|
def gen_authors(aline)
|
52
|
-
lines = aline.split(", ").map {|a| a.sub
|
52
|
+
lines = aline.split(", ").map {|a| a.sub(/\d$/, '') } # delete ref number.
|
53
53
|
if lines.is_a?(String)
|
54
54
|
aline # return first
|
55
55
|
else # its an array, augment w/ lname and choose
|
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
module SR; Version = "0.1.
|
1
|
+
module SR; Version = "0.1.2"; end
|