bibsync 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ee82317ca7e8c3e5fa9de627bfd9b2f240dced2
4
- data.tar.gz: 547ff333dc6cb12d5b98e3280aed47aa539889b5
3
+ metadata.gz: cfc84d8c85a184b1e40e20bce407ebe42ab97dae
4
+ data.tar.gz: 2b17e69c62a67a2fd1fe92391ab3f8a256d40945
5
5
  SHA512:
6
- metadata.gz: 3778420afe0ea4faeedca5e56c74c7f518f258ddc4cc6ce1dcc09d63fc62b42fa77ec752bc9b5ae0c2c74fbf79138abd3aeb5ee4d00cfe75530e2a7b7540d0bd
7
- data.tar.gz: f68cd142a1f99b983df76b3b311def93d0a765d4af8ff1b7d2222d96812b2fd70d7ca5683362a42a31e84ca730a475a393e11303ef8c866907d203feb9860574
6
+ metadata.gz: 3b7deebd3df2fe20949d2abc47630d47143d36e44ad2a4ced0c5fc6435801f8d63932bb3a21cda2ba18697202cddcc43a20a70941cf15f551773feda4772201f
7
+ data.tar.gz: 3be3be46771336ee5c8dcca8fa8345710d71b0c079af2110e12145e764253f07b39894bf04436f48e7d86e591afb069c546f27de08936de0889dcd5e9d73fef4
@@ -9,17 +9,22 @@ module BibSync
9
9
  def initialize(options)
10
10
  raise 'Option --bib is required' unless @bib = options[:bib]
11
11
  raise 'Option --dir is required' unless @dir = options[:dir]
12
+ @dir = File.join(@dir, '**') unless options[:non_recursive]
12
13
  end
13
14
 
14
15
  def run
15
16
  notice 'Synchronize with files'
16
17
 
17
18
  files = {}
18
- Dir[File.join(@dir, "**/*.{#{FileTypes.join(',')}}")].sort.each do |file|
19
+ Dir[File.join(@dir, "*.{#{FileTypes.join(',')}}")].sort.each do |file|
19
20
  name = File.basename(file)
20
- key = name_without_ext(name)
21
- raise "Duplicate file #{name}" if files[key]
22
- files[key] = file
21
+ if name =~ /\A[\w\.\-]+\Z/
22
+ key = name_without_ext(name)
23
+ raise "Duplicate file #{name}" if files[key]
24
+ files[key] = file
25
+ else
26
+ warning('File with invalid name', key: name)
27
+ end
23
28
  end
24
29
 
25
30
  files.each do |key, file|
@@ -34,6 +34,10 @@ module BibSync
34
34
  @options[:dir] = dir
35
35
  end
36
36
 
37
+ opts.on('-n', '--non-recursive', 'Don\'t scan recursively') do |dir|
38
+ @options[:non_recursive] = true
39
+ end
40
+
37
41
  opts.on('-v', '--check-versions', 'Check for updated arXiv papers') do
38
42
  @options[:check_versions] = true
39
43
  end
@@ -1,3 +1,3 @@
1
1
  module BibSync
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-09 00:00:00.000000000 Z
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project: bibsync
142
- rubygems_version: 2.0.3
142
+ rubygems_version: 2.0.0
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: BibSync is a tool to synchronize scientific papers and BibTeX bibliography