windows notifiaction works (tested with guard-bundler)
This commit is contained in:
parent
02448b8575
commit
18d2db9ff1
2
Gemfile
2
Gemfile
@ -15,5 +15,5 @@ end
|
|||||||
if Config::CONFIG['target_os'] =~ /mswin|mingw/i
|
if Config::CONFIG['target_os'] =~ /mswin|mingw/i
|
||||||
gem 'win32console', :require => false
|
gem 'win32console', :require => false
|
||||||
gem 'rb-fchange', '>= 0.0.2', :require => false
|
gem 'rb-fchange', '>= 0.0.2', :require => false
|
||||||
gem 'rb-notifu', :require => false
|
gem 'rb-notifu', '>= 0.0.3', :require => false
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ module Guard
|
|||||||
Libnotify.show :body => message, :summary => title, :icon_path => image_path(image)
|
Libnotify.show :body => message, :summary => title, :icon_path => image_path(image)
|
||||||
when /mswin|mingw/i
|
when /mswin|mingw/i
|
||||||
require_rbnotifu
|
require_rbnotifu
|
||||||
RbNotifu.show :message => message, :title => title, :type => image_level(image)
|
RbNotifu.show :message => message, :title => title, :type => image_level(image), :display => 3000
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -87,10 +87,10 @@ module Guard
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.require_rbnotifu
|
def self.require_rbnotifu
|
||||||
require 'rbnotifu'
|
require 'rb-notifu'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
turn_off
|
turn_off
|
||||||
UI.info "Please install rbnotifu gem for Windows notification support and add it to your Gemfile"
|
UI.info "Please install rb-notifu gem for Windows notification support and add it to your Gemfile"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -39,12 +39,13 @@ describe Guard::Notifier do
|
|||||||
|
|
||||||
if windows?
|
if windows?
|
||||||
if rbnotifu_installed?
|
if rbnotifu_installed?
|
||||||
it "uses rbnotifu on Windows" do
|
it "uses rb-notifu on Windows" do
|
||||||
RbNotifu::show(
|
@result = -1
|
||||||
:message => "great",
|
RbNotifu::show :message => "great", :title => 'Guard' do |status|
|
||||||
:title => 'Guard',
|
@result = status
|
||||||
:type => :info
|
end
|
||||||
)
|
sleep 1.5
|
||||||
|
RbNotifu::ERRORS.include?(@result).should be_false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
it { should_not be_enabled }
|
it { should_not be_enabled }
|
||||||
@ -64,10 +65,6 @@ describe Guard::Notifier do
|
|||||||
Libnotify.should_not_receive(:show)
|
Libnotify.should_not_receive(:show)
|
||||||
subject.notify 'great', :title => 'Guard'
|
subject.notify 'great', :title => 'Guard'
|
||||||
end
|
end
|
||||||
elsif windows? && rbnotifu_installed?
|
|
||||||
it "prevents the notifications" do
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should_not be_enabled }
|
it { should_not be_enabled }
|
||||||
|
Loading…
Reference in New Issue
Block a user