Permalink
Browse files

Removing argument_parser.rb, passing tests.

  • Loading branch information...
1 parent 7ecff43 commit af904044770e36175e3fd409931ee4bfcb2df70d @jashkenas jashkenas committed Aug 5, 2010
Showing with 12 additions and 4 deletions.
  1. +11 −3 lib/docsplit.rb
  2. +1 −1 lib/docsplit/command_line.rb
View
@@ -75,19 +75,27 @@ def self.extract_#{key}(pdfs, opts={})
# Runs a Java command, with quieted logging, and the classpath set properly.
def self.run(command, pdfs, opts, return_output=false)
pdfs = [pdfs].flatten.map{|pdf| "\"#{pdf}\""}.join(' ')
- args = parse_options(opts)
- cmd = "java #{HEADLESS} #{LOGGING} -cp #{CLASSPATH} #{command} #{args} #{pdfs} 2>&1"
+ cmd = "java #{HEADLESS} #{LOGGING} -cp #{CLASSPATH} #{command} #{pdfs} 2>&1"
result = `#{cmd}`.chomp
raise ExtractionFailed, result if $? != 0
return return_output ? (result.empty? ? nil : result) : true
end
+ # Normalize a value in an options hash for the command line.
+ # Ranges look like: 1-10, Arrays like: 1,2,3.
+ def self.normalize_value(value)
+ case value
+ when Range then normalize_range(value)
+ when Array then value.map! {|v| v.is_a?(Range) ? normalize_range(v) : v }.join(',')
+ else value.to_s
+ end
+ end
+
end
require 'tmpdir'
require 'fileutils'
require "#{Docsplit::ROOT}/lib/docsplit/image_extractor"
-require "#{Docsplit::ROOT}/lib/docsplit/argument_parser"
require "#{Docsplit::ROOT}/lib/docsplit/transparent_pdfs"
require "#{Docsplit::ROOT}/lib/docsplit/text_extractor"
require "#{Docsplit::ROOT}/lib/docsplit/page_extractor"
@@ -92,7 +92,7 @@ def parse_options
@options[:rolling] = true
end
opts.on_tail('-v', '--version', 'display docsplit version') do
- puts "docsplit version #{Docsplit::VERSION}"
+ puts "Docsplit version #{Docsplit::VERSION}"
exit
end
opts.on_tail('-h', '--help', 'display this help message') do

0 comments on commit af90404

Please sign in to comment.