Module: SpecWatchr::CommandLine

Included in:
SpecWatchr
Defined in:
lib/rspec-rails-watchr.rb

Instance Method Summary collapse

Instance Method Details

#clear!Object



22
23
24
# File 'lib/rspec-rails-watchr.rb', line 22

def clear!
  system 'clear'
end

#run(cmd) ⇒ Object



15
16
17
18
19
20
# File 'lib/rspec-rails-watchr.rb', line 15

def run cmd
  puts "=== running: #{cmd} ".ljust(terminal_columns, '=').cyan
  success = system cmd
  puts "===".ljust(terminal_columns, '=').cyan
  success
end

#terminal_columnsObject



10
11
12
13
# File 'lib/rspec-rails-watchr.rb', line 10

def terminal_columns
  cols = `stty -a`.scan(/ (\d+) columns/).flatten.first
  $?.success? ? cols.to_i : nil
end