Sha256: d87058448ecace870915c65071e6d3d08655a542a3864dab09fc7d65784f440d

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

require 'open3'

module Propaganda    
  module Fop
    class Shell
      def initialize(verbose=false)
        @verbose = verbose
      end
      
      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

      private 
      
      def jarpath
        path = File.join(File.dirname(__FILE__), '..', '..', '..', 'java')
        File.expand_path(File.join(path, 'fop.jar'))
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
propaganda-0.5.0 lib/propaganda/fop/shell.rb
propaganda-0.4.0 lib/propaganda/fop/shell.rb