libnotify 0.8.4 → 0.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b63e50058a9da68a35d1d2fb5ac925fae73b9d29
4
- data.tar.gz: 6ec3c03838c89e913c3e1a480ab808d9fd414a3c
3
+ metadata.gz: cb813d3d2936bb55cb12711456685b480016bfd1
4
+ data.tar.gz: 18ad99e58546d9a2c175f64d80f995b082d3d618
5
5
  SHA512:
6
- metadata.gz: fea56dca62dd646121b9e36ead774b5b41ef7a76ffd02f5e88baa3ba4257c7e71a0b71c8634ffa0b463d276d6e8dc36a3314454e235fcfecb892d8c214a67bf5
7
- data.tar.gz: 597a3eb5dac8cae5d053c3aba6783603463d66467943eb1d74dbf13e29e7a7ad0eb9756b28ac64167a4bc9c58fba5f2815937d174ec02d5020717304130d7c7b
6
+ metadata.gz: cc495ae64b4864152f44f6ca1a022a6832db9ab9f49876e67fd7e27b7d60d44743e6518e043791135169646921e06dd1a81de7ef66e420c74e268b1182bb25c9
7
+ data.tar.gz: 6d7c9f9a9835f7619c7a6413b72f1182d236d16783c12c9d824af2868f7cd81906f3da927387cb94a6d7ec3e701f84c1ffb44158bbdfba0cbdbee9d214458cbd
@@ -4,5 +4,11 @@ rvm:
4
4
  - 2.0
5
5
  - 2.1
6
6
  - jruby
7
+ - jruby-head
8
+ - rbx-2
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: jruby-head
12
+ fast_finish: true
7
13
  before_install:
8
14
  - "sudo apt-get install libnotify4"
data/README.md CHANGED
@@ -13,10 +13,18 @@ Ruby bindings for libnotify using FFI.
13
13
 
14
14
  ## Usage
15
15
 
16
+ ### Hash Syntax
17
+
18
+ ```ruby
19
+ require 'libnotify'
20
+ Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
21
+ ```
22
+
23
+ ### Block Syntax
24
+
16
25
  ```ruby
17
26
  require 'libnotify'
18
27
 
19
- # Block syntax
20
28
  n = Libnotify.new do |notify|
21
29
  notify.summary = "hello"
22
30
  notify.body = "world"
@@ -26,29 +34,50 @@ n = Libnotify.new do |notify|
26
34
  notify.transient = true # default false - keep the notifications around after display
27
35
  notify.icon_path = "/usr/share/icons/gnome/scalable/emblems/emblem-default.svg"
28
36
  end
37
+
29
38
  n.show!
39
+ ```
30
40
 
31
- # Hash syntax
32
- Libnotify.show(:body => "hello", :summary => "world", :timeout => 2.5)
41
+ ### Mixed Syntax
42
+
43
+ ```ruby
44
+ require 'libnotify'
33
45
 
34
46
  # Mixed syntax
35
- Libnotify.show(options) do |n|
36
- n.timeout = 1.5 # overrides :timeout in options
47
+ options = {:body => "world", :timeout => 20}
48
+ Libnotify.show(options) do |opts|
49
+ opts.timeout = 1.5 # overrides :timeout in options
37
50
  end
51
+ ```
52
+
53
+
54
+ ### Managing Icon Paths
55
+
56
+ ```ruby
57
+ require 'libnotify'
38
58
 
39
59
  # Icon path auto-detection
40
60
  Libnotify.icon_dirs << "/usr/share/icons/gnome/*/"
41
61
  Libnotify.show(:icon_path => "emblem-default.png")
42
62
  Libnotify.show(:icon_path => :"emblem-default")
63
+ ```
64
+
43
65
 
66
+ ### Updating existing notification and closing it
67
+
68
+ ```ruby
44
69
  # Update pre-existing notification then close it
45
70
  n = Libnotify.new(:summary => "hello", :body => "world")
46
71
  n.update # identical to show! if not shown before
72
+
47
73
  Kernel.sleep 1
74
+
48
75
  n.update(:body => "my love") do |notify|
49
76
  notify.summary = "goodbye"
50
77
  end
78
+
51
79
  Kernel.sleep 1
80
+
52
81
  n.close
53
82
  ```
54
83
 
@@ -101,6 +130,7 @@ https://github.com/splattael/libnotify/issues/21#issuecomment-19114127
101
130
  * Jeremy Lawler (https://github.com/jlawler)
102
131
  * Kero van Gelder (https://github.com/keroami)
103
132
  * René Föhring (https://github.com/rrrene)
133
+ * Cezary Baginski (https://github.com/e2)
104
134
 
105
135
  ## License
106
136
 
@@ -65,4 +65,17 @@ module Libnotify
65
65
  def self.show(options={}, &block)
66
66
  API.show(options, &block)
67
67
  end
68
+
69
+ # Exposes a list of icon directories to resolve `icon_path`.
70
+ #
71
+ # @see Libnotify.show
72
+ #
73
+ # @example
74
+ # Libnotify.icon_dirs << "/usr/share/icons/gnome/*/"
75
+ # Libnotify.show(:icon_path => "emblem-default.png")
76
+ #
77
+ # @return Array<String> list of icon directories
78
+ def self.icon_dirs
79
+ API.icon_dirs
80
+ end
68
81
  end
@@ -29,7 +29,7 @@ module Libnotify
29
29
  apply_options(options, &block)
30
30
  end
31
31
 
32
- def apply_options(options={}, &block)
32
+ def apply_options(options={})
33
33
  options.each { |key, value| send("#{key}=", value) if respond_to?(key) }
34
34
  yield(self) if block_given?
35
35
  end
@@ -7,7 +7,7 @@ module Libnotify
7
7
  enum :urgency, [ :low, :normal, :critical ]
8
8
 
9
9
  # Load libnotify library and attach functions from C to Ruby via FFI.
10
- def self.included(base)
10
+ def self.included(_base)
11
11
  load_libs
12
12
  attach_functions!
13
13
  rescue LoadError => e
@@ -14,8 +14,6 @@ module Libnotify
14
14
  end
15
15
  end
16
16
 
17
- private
18
-
19
17
  class Icon
20
18
  attr_reader :fullpath
21
19
 
@@ -1,3 +1,3 @@
1
1
  module Libnotify
2
- VERSION = "0.8.4"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -13,4 +13,8 @@ class LibnotifyTest < LibnotifyTestCase
13
13
  assert defined?(Libnotify::VERSION), "version is defined"
14
14
  assert Libnotify::VERSION
15
15
  end
16
+
17
+ test "delegates icons_dir" do
18
+ assert_equal Libnotify::API.icon_dirs, Libnotify.icon_dirs
19
+ end
16
20
  end
metadata CHANGED
@@ -1,86 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libnotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.11
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
20
+ requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - ">="
25
23
  - !ruby/object:Gem::Version
26
24
  version: 1.0.11
25
+ prerelease: false
26
+ type: :runtime
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
- requirement: !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.8.6.1
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
37
35
  requirements:
38
36
  - - "~>"
39
37
  - !ruby/object:Gem::Version
40
38
  version: 0.8.6.1
39
+ prerelease: false
40
+ type: :development
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
- requirement: !ruby/object:Gem::Requirement
43
+ version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 4.7.4
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
51
49
  requirements:
52
50
  - - "~>"
53
51
  - !ruby/object:Gem::Version
54
52
  version: 4.7.4
53
+ prerelease: false
54
+ type: :development
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest-libnotify
57
- requirement: !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.2.2
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
62
+ requirement: !ruby/object:Gem::Requirement
65
63
  requirements:
66
64
  - - "~>"
67
65
  - !ruby/object:Gem::Version
68
66
  version: 0.2.2
67
+ prerelease: false
68
+ type: :development
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: !ruby/object:Gem::Requirement
71
+ version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
76
+ requirement: !ruby/object:Gem::Requirement
79
77
  requirements:
80
78
  - - ">="
81
79
  - !ruby/object:Gem::Version
82
80
  version: '0'
83
- description:
81
+ prerelease: false
82
+ type: :development
83
+ description:
84
84
  email:
85
85
  - peter-libnotify@suschlik.de
86
86
  executables: []
@@ -121,7 +121,7 @@ homepage: http://rubygems.org/gems/libnotify
121
121
  licenses:
122
122
  - MIT
123
123
  metadata: {}
124
- post_install_message:
124
+ post_install_message:
125
125
  rdoc_options: []
126
126
  require_paths:
127
127
  - lib
@@ -136,10 +136,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubyforge_project:
140
- rubygems_version: 2.2.2
141
- signing_key:
139
+ rubyforge_project:
140
+ rubygems_version: 2.4.4
141
+ signing_key:
142
142
  specification_version: 4
143
143
  summary: Ruby bindings for libnotify using FFI
144
144
  test_files: []
145
- has_rdoc:
145
+ has_rdoc: