dblp 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.1 2008-05-29
2
+
3
+ * added documentation and more command line options
4
+
5
+
1
6
  == 0.0.1 2008-05-28
2
7
 
3
8
  * 1 major enhancement:
data/README.txt CHANGED
@@ -1,26 +1,25 @@
1
1
  = dblp
2
2
 
3
- * FIX (url)
4
-
5
3
  == DESCRIPTION:
6
4
 
7
- FIX (describe your package)
5
+ DBLP is a command line tool to fetch required bibtex entries directly from the DBLP servers. The idea is, that you don't have to maintain all entries in your own file, but youse well known bibtex identifiers instead and then fetch them from DBLP.
6
+
8
7
 
9
- == FEATURES/PROBLEMS:
10
8
 
11
- * FIX (list of features or problems)
12
9
 
13
10
  == SYNOPSIS:
14
11
 
15
- FIX (code sample of usage)
12
+ The first step is to build your latex document, so that dblp can parse the aux file for your document. Now call
16
13
 
17
- == REQUIREMENTS:
14
+ dblp my_tex_file[|.tex|.aux]
15
+
16
+ and this will scan for the citation commands in the aux file. The defined keys will be used to query DBLP. If an entry is available it is saved and as a result stored in the dblp.bib file. To use it in your Latex document just use \bibliography{my_own_file,..., dblp}
18
17
 
19
- * FIX (list of requirements)
18
+ For more command line options see
20
19
 
21
- == INSTALL:
20
+ dblp --help
21
+
22
22
 
23
- * FIX (sudo gem install, anything else)
24
23
 
25
24
  == LICENSE:
26
25
 
data/bin/dblp CHANGED
@@ -10,7 +10,48 @@ rescue LoadError
10
10
  end
11
11
 
12
12
  require 'dblp'
13
+ require 'optparse'
14
+ require 'ostruct'
13
15
 
14
- Dblp::run(ARGV.first)
16
+ opt = OpenStruct.new
17
+ opt.output = "dblp.bib"
18
+ opt.bibtex = true
19
+
20
+ if ARGV.size == 0
21
+ ARGV << "-h"
22
+ end
23
+
24
+ unless ARGV[0] == "-h"
25
+ file_to_parse = ARGV.shift
26
+ end
27
+
28
+ OptionParser.new do |opts|
29
+
30
+ opts.banner = <<BANNER
31
+ DBLP is a command line tool to fetch required bibtex entries
32
+ directly from the DBLP servers. The idea is, that you don't
33
+ have to maintain all entries in your own file, but youse well
34
+ known bibtex identifiers instead and then fetch them from DBLP.
35
+ BANNER
36
+
37
+ opts.separator("")
38
+ opts.separator("Specific Options:")
39
+
40
+ opts.on("-o", "--output [FILENAME]", "Specify FILENAME for output instead of dblp.bib") do |fn|
41
+ opt.output = fn
42
+ end
43
+
44
+ opts.on("-b", "--[no-]bibtex", "Run Bibtex after fetching bib entries") do |b|
45
+ opt.bibtex = b
46
+ end
47
+
48
+ opts.on_tail("-h", "--help", "Show this message") do
49
+ puts opts
50
+ exit
51
+ end
52
+ end.parse!
53
+
54
+
55
+ Dblp::run(file_to_parse, opt)
15
56
 
16
57
  # do stuff
data/lib/dblp/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Dblp #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 1
4
+ MINOR = 2
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/dblp.rb CHANGED
@@ -8,16 +8,30 @@ module Dblp
8
8
 
9
9
  class << self
10
10
 
11
- def run(file, out = "dblp.bib")
11
+ def run(file, options)
12
+
13
+ # Clean file to parse
14
+ file = File.basename(file, File.extname(file)) + ".aux"
15
+ overall_size = 0
12
16
 
13
17
  parser = Dblp::Parser.new(file)
14
18
  grabber = Dblp::Grabber.new
15
- File.open(out, "w+") do |f|
19
+ File.open(options.output, "w+") do |f|
16
20
  f.puts parser.parse.inject({}) {|m, l|
17
21
  m.merge!(grabber.grab(l))
22
+ overall_size = m.size
18
23
  m
19
24
  }.values.join("\n")
20
25
  end
26
+
27
+ if options.bibtex
28
+ res = system("bibtex #{File.basename(file, File.extname(file))}")
29
+ puts res
30
+ end
31
+
32
+ # Output
33
+ puts "Stored #{overall_size} entries in #{options.output}"
34
+
21
35
  end
22
36
 
23
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dblp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Grund