docsplit 0.7.3 → 0.7.4

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
  SHA512:
3
- data.tar.gz: e50c360ba40c1aa51cd563d9a08d0c5a444b50c4e97635133aec13f17fcc4e541e20d2bb9867ca316486df9a501852ed482801bed26986e88dbc472bd2609d65
4
- metadata.gz: 5da217d234a3b390963f2c6259ab859ecf805d71c60138c335eebdd9ae4c166cce63e825cee2e10c7e3029c47e4530e53b2d84dbdc91ab222c0a98c6f342d32a
3
+ metadata.gz: b275fe3c2adc1c24cdd0f82d443e4d435ca94b872763649519b2d30bd66a3af5b6e184d8dda521f7ae2bdb5f5e4054a16d157f97498dfbb4decbd195497153fc
4
+ data.tar.gz: 8630bc27e04716940919f00014e6d4cd2bfd9830a8d132c6ce6ad8b01f9068dd63579041b8d281e752e83a9b77641a0e7f53cd639d63db0699205cee77d4ae76
5
5
  SHA1:
6
- data.tar.gz: 03c2ec2439773679080a055463d35e7004d1decf
7
- metadata.gz: ddd8d4475b4a34fcfd2abb013d2824295718aa8c
6
+ metadata.gz: a31b827c0439da61d1d38584a0c482866dca0cb0
7
+ data.tar.gz: 25afa3c6aabc5190c6850f4da2016494df7ef4ed
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'docsplit'
3
- s.version = '0.7.3' # Keep version in sync with docsplit.rb
3
+ s.version = '0.7.4' # Keep version in sync with docsplit.rb
4
4
  s.date = '2014-02-16'
5
5
 
6
6
  s.homepage = "http://documentcloud.github.com/docsplit/"
@@ -5,7 +5,7 @@ require 'shellwords'
5
5
  # The Docsplit module delegates to the Java PDF extractors.
6
6
  module Docsplit
7
7
 
8
- VERSION = '0.7.3' # Keep in sync with gemspec.
8
+ VERSION = '0.7.4' # Keep in sync with gemspec.
9
9
 
10
10
  ESCAPE = lambda {|x| Shellwords.shellescape(x) }
11
11
 
@@ -2,7 +2,8 @@ require 'rbconfig'
2
2
 
3
3
  module Docsplit
4
4
  class PdfExtractor
5
- @@executable = nil
5
+ @@executable = nil
6
+ @@version_string = nil
6
7
 
7
8
  # Provide a set of helper functions to determine the OS.
8
9
  HOST_OS = (defined?("RbConfig") ? RbConfig : Config)::CONFIG['host_os']
@@ -19,12 +20,14 @@ module Docsplit
19
20
  # The first line of the help output holds the name and version number
20
21
  # of the office software to be used for extraction.
21
22
  def version_string
22
- versionstr = `#{office_executable} -h 2>&1`.split("\n").first
23
- if !!versionstr.match(/[0-9]*/)
24
- versionstr = `#{office_executable} --version`.split("\n").first
23
+ unless @@version_string
24
+ null = windows? ? "NUL" : "/dev/null"
25
+ @@version_string = `#{office_executable} -h 2>#{null}`.split("\n").first
26
+ if !!@@version_string.match(/[0-9]*/)
27
+ @@version_string = `#{office_executable} --version`.split("\n").first
25
28
  end
26
- @@help ||= versionstr
27
-
29
+ end
30
+ @@version_string
28
31
  end
29
32
  def libre_office?
30
33
  !!version_string.match(/^LibreOffice/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docsplit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas