Permalink
Browse files

start the comman with 'A' not 'B', also quote the file names for inputs

  • Loading branch information...
1 parent a822124 commit 185adac6830cca683a4178d12fe30053082edab7 @tcocca committed Jun 1, 2012
Showing with 7 additions and 6 deletions.
  1. +2 −1 lib/active_pdftk/call.rb
  2. +4 −4 spec/active_pdftk/call_spec.rb
  3. +1 −1 spec/support/inputs_helper.rb
@@ -333,9 +333,10 @@ def build_input(args)
when Hash
@input_file_map = {}
args.each do |file, pass|
- out.first << "#{i.next!}=#{file}"
+ out.first << "#{i}=\"#{file}\""
out.last << "#{i}=#{pass}" if pass
@input_file_map[file] = "#{i}"
+ i.next!
end
when String
out.first << args
@@ -112,16 +112,16 @@
cmd = @pdftk.set_cmd(cat_options)
input_pdfs = cmd.split(' cat ').first
input_map = map_inputs(input_pdfs)
- cmd.should == "#{input_pdfs} cat #{input_map['multi.pdf']}1-end #{input_map['poly.pdf']}12-16evenE output -"
+ cmd.should == "#{input_pdfs} cat #{input_map['"multi.pdf"']}1-end #{input_map['"poly.pdf"']}12-16evenE output -"
- @pdftk.set_cmd(:input => {'multi.pdf' => nil}, :operation => {:cat => [{:pdf => 'multi.pdf', :start => 1, :end => 'end'}]}).should == "B=multi.pdf cat B1-end output -"
- @pdftk.set_cmd(:input => {'multi.pdf' => nil}, :operation => {:cat => [{:pdf => 'multi.pdf'}]}).should == "B=multi.pdf cat B output -"
+ @pdftk.set_cmd(:input => {'multi.pdf' => nil}, :operation => {:cat => [{:pdf => 'multi.pdf', :start => 1, :end => 'end'}]}).should == "A=\"multi.pdf\" cat A1-end output -"
+ @pdftk.set_cmd(:input => {'multi.pdf' => nil}, :operation => {:cat => [{:pdf => 'multi.pdf'}]}).should == "A=\"multi.pdf\" cat A output -"
cat_options = {:input => {'multi.pdf' => nil, 'poly.pdf' => nil}, :operation => {:cat => [{:pdf => 'multi.pdf'}, {:pdf => 'poly.pdf'}]}}
cmd = @pdftk.set_cmd(cat_options)
input_pdfs = cmd.split(' cat ').first
input_map = map_inputs(input_pdfs)
- cmd.should == "#{input_pdfs} cat #{input_map['multi.pdf']} #{input_map['poly.pdf']} output -"
+ cmd.should == "#{input_pdfs} cat #{input_map['"multi.pdf"']} #{input_map['"poly.pdf"']} output -"
@pdftk.set_cmd(:input => 'multi.pdf', :operation => {:cat => [{:pdf => 'multi.pdf', :start => 1, :end => 'end'}]}).should == "multi.pdf cat 1-end output -"
@pdftk.set_cmd(:input => 'multi.pdf', :operation => {:cat => [{:pdf => 'multi.pdf', :end => 'end'}]}).should == "multi.pdf cat 1-end output -"
@@ -21,7 +21,7 @@ def fixtures_path(entry, expand = false)
# Anybody with a better solution should make a proposal.
def reconstruct_inputs(chain)
tested_inputs = Hash.new
- chain.scan(/([A-Z])=(\S*)/).each do |item|
+ chain.scan(/([A-Z])="?([^\s"]*)/).each do |item|
if tested_inputs[item.first]
tested_inputs[item.first] = [tested_inputs[item.first].first, item.last]
else

0 comments on commit 185adac

Please sign in to comment.