Module: Blade::Runner
- Extended by:
- Runner
- Includes:
- Component
- Included in:
- Runner
- Defined in:
- lib/blade/interface/runner.rb
Defined Under Namespace
Classes: Tab
Constant Summary collapse
- COLOR_NAMES =
%w( white yellow green red )
- PADDING =
1
Instance Method Summary collapse
Methods included from Component
Instance Method Details
#colors ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/blade/interface/runner.rb', line 12 def colors @colors ||= OpenStruct.new.tap do |colors| COLOR_NAMES.each do |name| const = Curses.const_get("COLOR_#{name.upcase}") Curses.init_pair(const, const, Curses::COLOR_BLACK) colors[name] = Curses.color_pair(const) end end end |
#create_window(options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/blade/interface/runner.rb', line 22 def create_window( = {}) height = [:height] || 0 width = [:width] || 0 top = [:top] || 0 left = [:left] || PADDING parent = [:parent] || Curses.stdscr parent.subwin(height, width, top, left) end |
#run ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/blade/interface/runner.rb', line 41 def run start_screen init_windows handle_keys handle_stale_tabs Blade.subscribe("/results") do |details| session = Blade::Session.find(details[:session_id]) unless tab = Tab.find(session.id) tab = Tab.create(id: session.id) tab.activate if Tab.size == 1 end tab.draw Curses.doupdate end end |
#start ⇒ Object
32 33 34 35 |
# File 'lib/blade/interface/runner.rb', line 32 def start run Blade::Assets.watch_logical_paths end |
#stop ⇒ Object
37 38 39 |
# File 'lib/blade/interface/runner.rb', line 37 def stop Curses.close_screen end |