Module: HJ7::Notifier

Defined in:
lib/hj7/notifier.rb

Constant Summary collapse

APPLICATION_NAME =
"Jekyll"

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/hj7/notifier.rb', line 39

def self.enabled?
  ENV["JEKYLL_NOTIFY"] == "true"
end

.notify(message, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hj7/notifier.rb', line 23

def self.notify(message, options = {})
  if enabled?
    image = options.delete(:image)
    title = options.delete(:title) || "Jekyll"

    case RbConfig::CONFIG["target_os"]
    when /darwin/i
      notify_mac(title, message, image, options)
    when /linux/i
      notify_linux(title, message, image, options)
    when /mswin|mingw/i
      notify_windows(title, message, image, options)
    end
  end
end

.turn_offObject



6
7
8
# File 'lib/hj7/notifier.rb', line 6

def self.turn_off
  ENV["JEKYLL_NOTIFY"] = "false"
end

.turn_onObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hj7/notifier.rb', line 10

def self.turn_on
  ENV["JEKYLL_NOTIFY"] = "true"

  case RbConfig::CONFIG["target_os"]
  when /darwin/i
    require_growl
  when /linux/i
    require_libnotify
  when /mswin|mingw/i
    require_rbnotifu
  end
end