class Bashly::Commands::Render
Attributes
Public Instance Methods
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
Source
# File lib/bashly/commands/render.rb, line 70 def render render_source.render target, show: args['--show'] end
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
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
Source
# File lib/bashly/commands/render.rb, line 58 def show_about puts TTY::Markdown.parse(render_source.readme) end
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 16}` #{source.summary}" end end
Source
# File lib/bashly/commands/render.rb, line 62 def start_render @target = args['TARGET'] @watching = args['--watch'] render watch if watching end
Source
# File lib/bashly/commands/render.rb, line 74 def watch say "g`watching`\n" Watch.new(*watchables).on_change do render say "g`waiting`\n" end end
Source
# File lib/bashly/commands/render.rb, line 98 def watchables @watchables ||= [Settings.config_path, render_source.path] end