Class: Germinate::ShellPublisher

Inherits:
Publisher show all
Defined in:
lib/germinate/shell_publisher.rb

Instance Method Summary collapse

Methods inherited from Publisher

identifier, #input, make, register_publisher_type

Constructor Details

#initialize(name, librarian, options) ⇒ ShellPublisher

Returns a new instance of ShellPublisher.



4
5
6
7
8
9
10
# File 'lib/germinate/shell_publisher.rb', line 4

def initialize(name, librarian, options)
  @command = options.delete(:command) do
    raise ArgumentError, 
          "A 'command' option must be supplied for publisher type 'shell'"
  end
  super
end

Instance Method Details

#publish!(output, extra_options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/germinate/shell_publisher.rb', line 12

def publish!(output, extra_options={})
  process = Germinate::ShellProcess.new(name, @command, librarian.variables)
  processed = process.call(input)
  processed.each do |line|
    output.print(line)
  end
end