Class: Jekyll::RunTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::RunTag
- Defined in:
- run.rb
Overview
Executes a program and returns the output from STDOUT.
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(tag_name, command_line, tokens) ⇒ void
constructor
Constructor.
-
#render(context) ⇒ String
Method prescribed by the Jekyll plugin lifecycle.
Constructor Details
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'run.rb', line 15 def logger @logger end |
Instance Method Details
#render(context) ⇒ String
Method prescribed by the Jekyll plugin lifecycle.
32 33 34 35 36 37 |
# File 'run.rb', line 32 def render(context) RunTag.logger = Jekyll::LoggerFactory.new('run', context.config, :warn) RunTag.logger.info "Running #{@command}".green output = `#{@command}`.rstrip "<span class='unselectable'>$ </span>#{@command}\n<span class='unselectable'>#{output}</span>" end |