Class: Propaganda::Fop::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/propaganda/fop/shell.rb

Instance Method Summary collapse

Constructor Details

#initialize(verbose = false) ⇒ Shell

Returns a new instance of Shell.



6
7
8
# File 'lib/propaganda/fop/shell.rb', line 6

def initialize(verbose=false)
  @verbose = verbose
end

Instance Method Details

#invoke(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/propaganda/fop/shell.rb', line 10

def invoke(*args)
  command = "java -Djava.awt.headless=true -jar #{jarpath} #{args.join(' ')}"
  if @verbose
    `#{command}`
  else
    stdin, stdout, stderr = Open3.popen3(command)
    @errors = stderr.read
    @output = stdout.read
    @output
  end  
end