libnotify 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2bcfd117df48e5384d691c66a805033e0369143
4
- data.tar.gz: d24ba5860ea43e6a6c788a0886b4df6fdb0f4361
3
+ metadata.gz: b63e50058a9da68a35d1d2fb5ac925fae73b9d29
4
+ data.tar.gz: 6ec3c03838c89e913c3e1a480ab808d9fd414a3c
5
5
  SHA512:
6
- metadata.gz: 66e36c1c87195c608392f0b70c12736efb87cd7d4ae4e284b36d164be5643da6e17ed95233e54d8e656c64b14ced46e57e78b296a314cec592b8e0929d5733f9
7
- data.tar.gz: b759bbacff327753c782e6b8263abac997c10aab0e0f276a15399964ddc57e87d04e63d79a8d5ccad5e8428a0369b802668ebd654b68efe7deed883af3b238bf
6
+ metadata.gz: fea56dca62dd646121b9e36ead774b5b41ef7a76ffd02f5e88baa3ba4257c7e71a0b71c8634ffa0b463d276d6e8dc36a3314454e235fcfecb892d8c214a67bf5
7
+ data.tar.gz: 597a3eb5dac8cae5d053c3aba6783603463d66467943eb1d74dbf13e29e7a7ad0eb9756b28ac64167a4bc9c58fba5f2815937d174ec02d5020717304130d7c7b
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - ree
4
3
  - 1.9.3
5
- - 2.0.0
6
- - jruby-19mode
7
- #- rbx-19mode
4
+ - 2.0
5
+ - 2.1
6
+ - jruby
8
7
  before_install:
9
8
  - "sudo apt-get install libnotify4"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Libnotify
2
2
 
3
- [![Build Status](https://travis-ci.org/splattael/libnotify.png?branch=master)](https://travis-ci.org/splattael/libnotify) [![Gem Version](https://badge.fury.io/rb/libnotify.png)](http://badge.fury.io/rb/libnotify) [![Code Climate](https://codeclimate.com/github/splattael/libnotify.png)](https://codeclimate.com/github/splattael/libnotify) [![Inline docs](http://inch-pages.github.io/github/splattael/libnotify.png)](http://inch-pages.github.io/github/splattael/libnotify)
3
+ [![Build Status](https://img.shields.io/travis/splattael/libnotify.svg?branch=master)](https://travis-ci.org/splattael/libnotify) [![Gem Version](https://img.shields.io/gem/v/libnotify.svg)](https://rubygems.org/gems/libnotify) [![Code Climate](https://img.shields.io/codeclimate/github/splattael/libnotify.svg)](https://codeclimate.com/github/splattael/libnotify) [![Inline docs](http://inch-ci.org/github/splattael/libnotify.svg?branch=master)](http://inch-ci.org/github/splattael/libnotify)
4
4
 
5
5
  Ruby bindings for libnotify using FFI.
6
6
 
@@ -8,7 +8,8 @@ Ruby bindings for libnotify using FFI.
8
8
  [Source](https://github.com/splattael/libnotify) |
9
9
  [RDoc](http://rubydoc.info/github/splattael/libnotify/master)
10
10
 
11
- ![libnotify](http://github.com/splattael/libnotify/raw/master/libnotify.png)
11
+ ![libnotify](https://github.com/splattael/libnotify/raw/master/etc/libnotify-gnome3.png)
12
+ ![libnotify](https://github.com/splattael/libnotify/raw/master/etc/libnotify-ubuntu.png)
12
13
 
13
14
  ## Usage
14
15
 
Binary file
@@ -55,7 +55,7 @@ module Libnotify
55
55
 
56
56
  # Shows an existing notification.
57
57
  def show
58
- notify_notification_set_urgency(@notification, lookup_urgency(urgency))
58
+ notify_notification_set_urgency(@notification, urgency)
59
59
  notify_notification_set_timeout(@notification, timeout || -1)
60
60
  set_hints
61
61
  notify_notification_show(@notification, nil)
@@ -4,6 +4,9 @@ module Libnotify
4
4
  require 'ffi'
5
5
  extend ::FFI::Library
6
6
 
7
+ enum :urgency, [ :low, :normal, :critical ]
8
+
9
+ # Load libnotify library and attach functions from C to Ruby via FFI.
7
10
  def self.included(base)
8
11
  load_libs
9
12
  attach_functions!
@@ -11,7 +14,7 @@ module Libnotify
11
14
  warn e.message
12
15
  end
13
16
 
14
- def self.load_libs
17
+ def self.load_libs # :nodoc:
15
18
  libnotify_libs = %w[libnotify libnotify.so.4 libnotify.so.3 libnotify.so.2 libnotify.so.1 libnotify.so]
16
19
 
17
20
  # Workaround for "half-linked" libnotify.so. Does not work on rubinius (no ffi_lib_flags there)!
@@ -25,14 +28,12 @@ module Libnotify
25
28
  libnotify_libs
26
29
  end
27
30
 
28
- URGENCY = [ :low, :normal, :critical ]
29
-
30
- def self.attach_functions!
31
+ def self.attach_functions! # :nodoc:
31
32
  attach_function :notify_init, [:string], :bool
32
33
  attach_function :notify_uninit, [], :void
33
34
  attach_function :notify_notification_new, [:string, :string, :string, :pointer], :pointer
34
35
  attach_function :notify_notification_update, [:pointer, :string, :string, :string, :pointer], :pointer
35
- attach_function :notify_notification_set_urgency, [:pointer, :int], :void
36
+ attach_function :notify_notification_set_urgency, [:pointer, :urgency], :void
36
37
  attach_function :notify_notification_set_timeout, [:pointer, :long], :void
37
38
  attach_function :notify_notification_set_hint_string, [:pointer, :string, :string], :void
38
39
  attach_function :notify_notification_set_hint_uint32, [:pointer, :string, :int], :void
@@ -41,11 +42,7 @@ module Libnotify
41
42
  attach_function :notify_notification_close, [:pointer, :pointer], :bool
42
43
  end
43
44
 
44
- def lookup_urgency(urgency)
45
- URGENCY.index(urgency)
46
- end
47
-
48
- def method_missing(method, *args, &block)
45
+ def method_missing(method, *args, &block) # :nodoc:
49
46
  if method.to_s =~ /^notify_/
50
47
  warn "libnotify.so not found!"
51
48
  end
@@ -1,3 +1,3 @@
1
1
  module Libnotify
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
File without changes
@@ -38,11 +38,11 @@ class LibnotifyAPITest < LibnotifyTestCase
38
38
  end
39
39
 
40
40
  test "icon_path=" do
41
- Libnotify::API.icon_dirs << File.expand_path("../../..", __FILE__)
41
+ Libnotify::API.icon_dirs << File.expand_path("../../fixtures", __FILE__)
42
42
  assert_icon_path "/some/path/image.jpg", "/some/path/image.jpg", "with absolute path"
43
43
  assert_icon_path "some-invalid-path.jpg", "some-invalid-path.jpg", "with non-existant relative path"
44
- assert_icon_path %r{^/.*/libnotify.png}, "libnotify.png", "with relative path"
45
- assert_icon_path %r{^/.*/libnotify.png}, :"libnotify", "with symbol"
44
+ assert_icon_path %r{^/.*/test/fixtures/libnotify.png}, "libnotify.png", "with relative path"
45
+ assert_icon_path %r{^/.*/test/fixtures/libnotify.png}, :"libnotify", "with symbol"
46
46
  end
47
47
 
48
48
  test "update" do
@@ -54,4 +54,11 @@ class LibnotifyAPITest < LibnotifyTestCase
54
54
  assert_equal "yeah", libnotify.body
55
55
  libnotify.close
56
56
  end
57
+
58
+ test "raise ArgumentError for unknown urgency" do
59
+ e = assert_raises ArgumentError do
60
+ libnotify(:urgency => :unknown).show!
61
+ end
62
+ assert_equal "invalid enum value, :unknown", e.message
63
+ end
57
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libnotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Suschlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -94,6 +94,8 @@ files:
94
94
  - LICENSE
95
95
  - README.md
96
96
  - Rakefile
97
+ - etc/libnotify-gnome3.png
98
+ - etc/libnotify-ubuntu.png
97
99
  - lib/libnotify.rb
98
100
  - lib/libnotify/api.rb
99
101
  - lib/libnotify/ffi.rb
@@ -101,7 +103,6 @@ files:
101
103
  - lib/libnotify/tasks/rubies.rake
102
104
  - lib/libnotify/version.rb
103
105
  - libnotify.gemspec
104
- - libnotify.png
105
106
  - test/fixtures/.keep
106
107
  - test/fixtures/emoticons/128x128/happy.jpg
107
108
  - test/fixtures/icons/128x128/happy.jpg
@@ -110,6 +111,7 @@ files:
110
111
  - test/fixtures/icons/other/happy.jpg
111
112
  - test/fixtures/images/another/happy.jpg
112
113
  - test/fixtures/images/other/happy.jpg
114
+ - test/fixtures/libnotify.png
113
115
  - test/helper.rb
114
116
  - test/integration_test.rb
115
117
  - test/libnotify/api_test.rb