class Bashly::Commands::Render
Attributes
source[R]
target[R]
watching[R]
Public Instance Methods
run()
click to toggle source
# File lib/bashly/commands/render.rb, line 42 def run if args['--list'] then show_list elsif args['--about'] then show_about else start_render end end
Private Instance Methods
render()
click to toggle source
# File lib/bashly/commands/render.rb, line 70 def render render_source.render target, show: args['--show'] end
render_source()
click to toggle source
# File lib/bashly/commands/render.rb, line 83 def render_source @render_source ||= begin source = RenderSource.new selector raise "Invalid render source: #{args['SOURCE']}" unless source.exist? source end end
selector()
click to toggle source
# File lib/bashly/commands/render.rb, line 92 def selector return args['SOURCE'] unless args['SOURCE'].start_with? ':' args['SOURCE'][1..].to_sym end
show_about()
click to toggle source
# File lib/bashly/commands/render.rb, line 58 def show_about puts TTY::Markdown.parse(render_source.readme) end
show_list()
click to toggle source
# File lib/bashly/commands/render.rb, line 52 def show_list RenderSource.internal.each_value do |source| say "g`:#{source.selector.to_s.ljust 10}` #{source.summary}" end end
start_render()
click to toggle source
# File lib/bashly/commands/render.rb, line 62 def start_render @target = args['TARGET'] @watching = args['--watch'] render watch if watching end
watch()
click to toggle source
# File lib/bashly/commands/render.rb, line 74 def watch say "g`watching`\n" Filewatcher.new(watchables).watch do render say "g`waiting`\n" end end
watchables()
click to toggle source
# File lib/bashly/commands/render.rb, line 98 def watchables @watchables ||= [Settings.config_path, render_source.path] end