Method: Rundoc::CodeCommand::RundocCommand::Require#call

Defined in:
lib/rundoc/code_command/rundoc/require.rb

#call(env = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rundoc/code_command/rundoc/require.rb', line 16

def call(env = {})
  execution_context = env[:context]
  document_path = @path.expand_path(execution_context.source_dir)

  output = Rundoc::Parser.new(
    document_path.read,
    context: Rundoc::Context::Execution.new(
      source_path: document_path,
      output_dir: execution_context.output_dir,
      screenshots_dirname: execution_context.screenshots_dir,
      with_contents_dir: execution_context.with_contents_dir
    )
  ).to_md

  if render_result?
    puts "rundoc.require: Done executing #{@path.to_s.inspect}, putting contents into document"
    env[:before] << output
  else
    puts "rundoc.require: Done executing #{@path.to_s.inspect}, quietly"
  end

  ""
end