Class: Guard::Bundler::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/bundler/notifier.rb

Class Method Summary collapse

Class Method Details

.guard_image(result) ⇒ Object

failed | success


20
21
22
# File 'lib/guard/bundler/notifier.rb', line 20

def self.guard_image(result)
  result ?  :success : :failed
end

.guard_message(result, duration) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/guard/bundler/notifier.rb', line 6

def self.guard_message(result, duration)
  case result
  when 'up-to-date'
    "Bundle already up-to-date"
  when 'bundle_check_install'
    "Bundle installed using local gems"
  when true
    "Bundle has been installed\nin %.1f seconds." % [duration]
  else
    "Bundle can't be installed,\nplease check manually."
  end
end

.notify(result, duration) ⇒ Object


24
25
26
27
28
29
# File 'lib/guard/bundler/notifier.rb', line 24

def self.notify(result, duration)
  message = guard_message(result, duration)
  image   = guard_image(result)

  Guard::Compat::UI.notify(message, title: 'bundle install', image: image)
end