Merge branch 'master' of https://github.com/stereobooster/guard into stereobooster-master
Conflicts: lib/guard/interactor.rb
This commit is contained in:
commit
5352528530
3
Gemfile
3
Gemfile
@ -12,3 +12,6 @@ if Config::CONFIG['target_os'] =~ /linux/i
|
||||
gem 'rb-inotify', '>= 0.5.1', :require => false
|
||||
gem 'libnotify', '~> 0.1.3', :require => false
|
||||
end
|
||||
if Config::CONFIG['target_os'] =~ /mswin|mingw/i
|
||||
gem 'win32console'
|
||||
end
|
||||
|
@ -23,19 +23,32 @@ module Guard
|
||||
|
||||
def self.init_signal_traps
|
||||
# Run all (Ctrl-\)
|
||||
Signal.trap('QUIT') do
|
||||
run_all
|
||||
if Signal.list.has_key?('QUIT')
|
||||
Signal.trap('QUIT') do
|
||||
run_all
|
||||
end
|
||||
else
|
||||
UI.info "Your system doesn't support QUIT signal, so Ctrl-\\ (Run all) won't work"
|
||||
end
|
||||
|
||||
# Stop (Ctrl-C)
|
||||
Signal.trap('INT') do
|
||||
stop
|
||||
if Signal.list.has_key?('INT')
|
||||
Signal.trap('INT') do
|
||||
stop
|
||||
end
|
||||
else
|
||||
UI.info "Your system doesn't support INT signal, so Ctrl-C (stop) won't work"
|
||||
end
|
||||
|
||||
# Reload (Ctrl-Z)
|
||||
Signal.trap('TSTP') do
|
||||
reload
|
||||
if Signal.list.has_key?('TSTP')
|
||||
Signal.trap('TSTP') do
|
||||
reload
|
||||
end
|
||||
else
|
||||
UI.info "Your system doesn't support TSTP signal, so Ctrl-Z (Reload) won't work"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,11 @@ module Guard
|
||||
end
|
||||
|
||||
def reset_line
|
||||
print "\r\e[0m"
|
||||
if color_enabled?
|
||||
print "\r\e[0m"
|
||||
else
|
||||
print "\r\n"
|
||||
end
|
||||
end
|
||||
|
||||
def clear
|
||||
@ -38,7 +42,27 @@ module Guard
|
||||
end
|
||||
|
||||
def color(text, color_code)
|
||||
"#{color_code}#{text}\e[0m"
|
||||
if color_enabled?
|
||||
return "#{color_code}#{text}\e[0m"
|
||||
else
|
||||
return text
|
||||
end
|
||||
end
|
||||
|
||||
def color_enabled?
|
||||
@color_enabled ||= if Config::CONFIG['target_os'] =~ /mswin|mingw/i
|
||||
unless ENV['ANSICON']
|
||||
begin
|
||||
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
||||
require 'Win32/Console/ANSI'
|
||||
rescue LoadError
|
||||
info "You must 'gem install win32console' to use color on Windows"
|
||||
false
|
||||
end
|
||||
end
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user