nsnotify 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,14 +7,28 @@ module Nsnotify
7
7
  attr_accessor :use, :app_bundle_identifier, :app_name
8
8
  alias_method :use?, :use
9
9
 
10
+ # Determines whether you are running OS X 10.8 or later, which
11
+ # is the minimum required for the Notification Center.
12
+ #
10
13
  def usable?
11
14
  @usable ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
12
15
  end
13
16
 
14
- def result(status)
15
- status.success? ? succeeded(status) : failed(status)
16
- end
17
-
17
+ # Convenience methods for common message types (success, warning,
18
+ # error, pending, info, broken).
19
+ #
20
+ # ==== Parameters
21
+ #
22
+ # message<String>:: the message to show
23
+ #
24
+ # ==== Examples
25
+ #
26
+ # Nsnotify.success "That went well"
27
+ #
28
+ # Nsnotify.error "That went not so well!"
29
+ #
30
+ # Nsnotify.pending "This test still needs some work."
31
+ #
18
32
  [:success, :error, :warning, :pending, :info, :broken].each do |type|
19
33
  define_method type do |message|
20
34
  title = "#{app_name}: #{type.capitalize}"
@@ -22,6 +36,17 @@ module Nsnotify
22
36
  end
23
37
  end
24
38
 
39
+ # Calls the notification service.
40
+ #
41
+ # ==== Parameters
42
+ #
43
+ # title<String>:: the title of the notification
44
+ # message<String>:: the actual message
45
+ #
46
+ # ==== Example
47
+ #
48
+ # Nsnotify.notify "Testing!", "Can you see me?!"
49
+ #
25
50
  def notify(title, message)
26
51
  throw "This gem needs OSX 10.8 Mountain Lion to work!" if not usable?
27
52
  `'#{TERMINAL_NOTIFICATION_BIN}' #{Dir.pwd} '#{title}' '#{message}' '#{app_bundle_identifier}'`
@@ -34,4 +59,4 @@ module Nsnotify
34
59
  end
35
60
 
36
61
  Nsnotify.use = true
37
- Nsnotify.app_bundle_identifier = 'com.googlecode.iterm2'
62
+ Nsnotify.app_bundle_identifier = 'com.apple.Terminal'
@@ -1,3 +1,3 @@
1
1
  module Nsnotify
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsnotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: