libnotify 0.8.0 → 0.8.1
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 +7 -0
- data/.ruby-version +1 -0
- data/.simplecov +2 -0
- data/.travis.yml +9 -0
- data/README.rdoc +12 -0
- data/Rakefile +1 -1
- data/lib/libnotify/api.rb +9 -22
- data/lib/libnotify/icon_finder.rb +42 -0
- data/lib/libnotify/tasks/rubies.rake +2 -2
- data/lib/libnotify/version.rb +1 -1
- data/libnotify.gemspec +4 -3
- data/test/fixtures/.keep +0 -0
- data/test/fixtures/emoticons/128x128/happy.jpg +0 -0
- data/test/fixtures/icons/128x128/happy.jpg +0 -0
- data/test/fixtures/icons/16x16/happy.jpg +0 -0
- data/test/fixtures/icons/32x32/happy.jpg +0 -0
- data/test/fixtures/icons/other/happy.jpg +0 -0
- data/test/fixtures/images/another/happy.jpg +0 -0
- data/test/fixtures/images/other/happy.jpg +0 -0
- data/test/helper.rb +8 -0
- data/test/integration_test.rb +14 -0
- data/test/libnotify/api_test.rb +57 -0
- data/test/libnotify/icon_finder_test.rb +41 -0
- data/test/libnotify_test.rb +16 -0
- metadata +49 -37
- data/.rvmrc +0 -1
- data/test/test_libnotify.rb +0 -87
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 82a615e051a8e0dba67bdf342658f77916da91a5
         | 
| 4 | 
            +
              data.tar.gz: 12fb683c69feb30e8566205c011a88ec18769f11
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: d5d6f9d9ce4d443b8a213f7836b5ef95f48d3f5c53ea41995b812d317a881a495418748d7697e2fc2ab46849c0a037a1269d74883a162d501758f54164e2e59d
         | 
| 7 | 
            +
              data.tar.gz: 08c63a7b19b8cd9e000b7106f6c7d64326c837bc2719d65a85968409c98634ab87457ca27cbbfeb759c934648fde4fe6ca9aac56d7e413020752e2415c6ae975
         | 
    
        data/.ruby-version
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            2.0.0
         | 
    
        data/.simplecov
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/README.rdoc
    CHANGED
    
    | @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            = Libnotify
         | 
| 2 2 |  | 
| 3 | 
            +
            {<img src="https://travis-ci.org/splattael/libnotify.png?branch=master" alt="Build Status" />}[https://travis-ci.org/splattael/libnotify] {<img src="https://badge.fury.io/rb/libnotify.png" alt="Gem Version" />}[http://badge.fury.io/rb/libnotify] {<img src="https://codeclimate.com/github/splattael/libnotify.png" />}[https://codeclimate.com/github/splattael/libnotify]
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
            Ruby bindings for libnotify using FFI.
         | 
| 4 6 |  | 
| 5 7 | 
             
            Gem[https://rubygems.org/gems/libnotify] |
         | 
| @@ -64,6 +66,16 @@ You'll need libnotify. On Debian just type: | |
| 64 66 | 
             
              bundle install
         | 
| 65 67 | 
             
              rake
         | 
| 66 68 |  | 
| 69 | 
            +
            === Code coverage
         | 
| 70 | 
            +
             | 
| 71 | 
            +
              COVERAGE=1 rake
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            == Caveats
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            * +timeout+ and +append+ options might not work on Ubuntu.
         | 
| 76 | 
            +
              See GH #21 for details.
         | 
| 77 | 
            +
              https://github.com/splattael/libnotify/issues/21#issuecomment-19114127
         | 
| 78 | 
            +
             | 
| 67 79 | 
             
            == Authors
         | 
| 68 80 |  | 
| 69 81 | 
             
            * Peter Suschlik (https://github.com/splattael)
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/libnotify/api.rb
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            require 'libnotify/ffi'
         | 
| 2 | 
            +
            require 'libnotify/icon_finder'
         | 
| 2 3 |  | 
| 3 4 | 
             
            module Libnotify
         | 
| 4 5 | 
             
              # API for Libnotify
         | 
| @@ -20,23 +21,6 @@ module Libnotify | |
| 20 21 | 
             
                  "/usr/share/icons/gnome/*/emotes"
         | 
| 21 22 | 
             
                ]
         | 
| 22 23 |  | 
| 23 | 
            -
                # TODO refactor & test!
         | 
| 24 | 
            -
                ICON_REGEX = /(\d+)x\d/
         | 
| 25 | 
            -
                ICON_SORTER = proc do |a, b|
         | 
| 26 | 
            -
                  ma = a.scan ICON_REGEX
         | 
| 27 | 
            -
                  mb = b.scan ICON_REGEX
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  if ma.first && mb.first
         | 
| 30 | 
            -
                    mb.first.first.to_i <=> ma.first.first.to_i
         | 
| 31 | 
            -
                  elsif ma.first && !mb.first
         | 
| 32 | 
            -
                    1
         | 
| 33 | 
            -
                  elsif !ma.first && ma.first
         | 
| 34 | 
            -
                    -1
         | 
| 35 | 
            -
                  else
         | 
| 36 | 
            -
                    a <=> b
         | 
| 37 | 
            -
                  end
         | 
| 38 | 
            -
                end
         | 
| 39 | 
            -
             | 
| 40 24 | 
             
                # Creates a notification object.
         | 
| 41 25 | 
             
                #
         | 
| 42 26 | 
             
                # @see Libnotify.new
         | 
| @@ -100,7 +84,6 @@ module Libnotify | |
| 100 84 | 
             
                def timeout=(timeout)
         | 
| 101 85 | 
             
                  @timeout = case timeout
         | 
| 102 86 | 
             
                  when Float
         | 
| 103 | 
            -
                    timeout /= 10 if RUBY_VERSION == "1.8.6" # Strange workaround?
         | 
| 104 87 | 
             
                    (timeout * 1000).to_i
         | 
| 105 88 | 
             
                  when Fixnum
         | 
| 106 89 | 
             
                    if timeout >= 100 # assume miliseconds
         | 
| @@ -117,16 +100,15 @@ module Libnotify | |
| 117 100 |  | 
| 118 101 | 
             
                # Sets icon path.
         | 
| 119 102 | 
             
                #
         | 
| 120 | 
            -
                # Path can be absolute, relative (will be resolved) or  | 
| 103 | 
            +
                # Path can be absolute, relative (will be resolved) or a symbol.
         | 
| 121 104 | 
             
                #
         | 
| 122 105 | 
             
                # @todo document and refactor
         | 
| 123 106 | 
             
                def icon_path=(path)
         | 
| 124 107 | 
             
                  case path
         | 
| 125 | 
            -
                  when  | 
| 108 | 
            +
                  when %r{^/} # absolute
         | 
| 126 109 | 
             
                    @icon_path = path
         | 
| 127 110 | 
             
                  when String
         | 
| 128 | 
            -
                     | 
| 129 | 
            -
                    @icon_path = list.detect { |full_path| File.exist?(full_path) } || path
         | 
| 111 | 
            +
                    @icon_path = icon_for(path)
         | 
| 130 112 | 
             
                  when Symbol
         | 
| 131 113 | 
             
                    self.icon_path = "#{path}.png"
         | 
| 132 114 | 
             
                  else
         | 
| @@ -142,5 +124,10 @@ module Libnotify | |
| 142 124 | 
             
                  new(options, &block).show!
         | 
| 143 125 | 
             
                end
         | 
| 144 126 |  | 
| 127 | 
            +
                private
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                def icon_for(name)
         | 
| 130 | 
            +
                  IconFinder.new(self.class.icon_dirs).icon_path(name) || name
         | 
| 131 | 
            +
                end
         | 
| 145 132 | 
             
              end
         | 
| 146 133 | 
             
            end
         | 
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            module Libnotify
         | 
| 2 | 
            +
              class IconFinder
         | 
| 3 | 
            +
                def initialize(dirs)
         | 
| 4 | 
            +
                  @dirs = dirs
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def icon_path(name)
         | 
| 8 | 
            +
                  list = @dirs.map do |dir|
         | 
| 9 | 
            +
                    glob = File.join(dir, name)
         | 
| 10 | 
            +
                    Dir[glob].map { |fullpath| Icon.new(fullpath) }
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
                  if found = list.flatten.sort.first
         | 
| 13 | 
            +
                    found.to_s
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                private
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                class Icon
         | 
| 20 | 
            +
                  attr_reader :fullpath
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  def initialize(fullpath)
         | 
| 23 | 
            +
                    @fullpath = fullpath
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  ICON_REGEX = /(\d+)x\d+/
         | 
| 27 | 
            +
                  def resolution
         | 
| 28 | 
            +
                    @resolution ||= @fullpath[ICON_REGEX, 1].to_i
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  def to_s
         | 
| 32 | 
            +
                    fullpath
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  def <=>(other)
         | 
| 36 | 
            +
                    result = other.resolution <=> self.resolution
         | 
| 37 | 
            +
                    result = self.fullpath    <=> other.fullpath if result == 0
         | 
| 38 | 
            +
                    result
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            SUPPORTED_RUBIES = %w[ree 1.9.2 | 
| 1 | 
            +
            SUPPORTED_RUBIES = %w[ree 1.9.3 2.0.0 jruby rbx]
         | 
| 2 2 | 
             
            GEMSPEC = Bundler::GemHelper.new(Dir.pwd).gemspec
         | 
| 3 3 |  | 
| 4 4 | 
             
            def with_ruby(ruby, command)
         | 
| @@ -15,7 +15,7 @@ end | |
| 15 15 | 
             
            namespace :rubies do
         | 
| 16 16 | 
             
              desc "Run tests for following supported platforms #{SUPPORTED_RUBIES.join ", "}"
         | 
| 17 17 | 
             
              task :test do
         | 
| 18 | 
            -
                command = " | 
| 18 | 
            +
                command = "rm -f Gemfile.lock && bundle install && bundle exec rake"
         | 
| 19 19 | 
             
                SUPPORTED_RUBIES.each { |ruby| with_ruby(ruby, command) }
         | 
| 20 20 | 
             
              end
         | 
| 21 21 | 
             
            end
         | 
    
        data/lib/libnotify/version.rb
    CHANGED
    
    
    
        data/libnotify.gemspec
    CHANGED
    
    | @@ -17,7 +17,8 @@ Gem::Specification.new do |s| | |
| 17 17 |  | 
| 18 18 | 
             
              s.add_runtime_dependency 'ffi', '>= 1.0.11'
         | 
| 19 19 |  | 
| 20 | 
            -
              s.add_development_dependency 'yard', ' | 
| 21 | 
            -
              s.add_development_dependency 'minitest', ' | 
| 22 | 
            -
              s.add_development_dependency 'minitest-libnotify', ' | 
| 20 | 
            +
              s.add_development_dependency 'yard', '~> 0.8.6.1'
         | 
| 21 | 
            +
              s.add_development_dependency 'minitest', '~> 4.7.4'
         | 
| 22 | 
            +
              s.add_development_dependency 'minitest-libnotify', '~> 0.2.2'
         | 
| 23 | 
            +
              s.add_development_dependency 'simplecov'
         | 
| 23 24 | 
             
            end
         | 
    
        data/test/fixtures/.keep
    ADDED
    
    | 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/test/helper.rb
    CHANGED
    
    | @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            require 'rubygems'
         | 
| 2 2 | 
             
            require 'bundler/setup'
         | 
| 3 | 
            +
            require 'simplecov' if ENV['COVERAGE'] == '1'
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
            require 'minitest/autorun'
         | 
| 4 6 | 
             
            require 'minitest/libnotify'
         | 
| 5 7 |  | 
| @@ -24,6 +26,10 @@ module LibnotifyAssertions | |
| 24 26 | 
             
                  assert_equal expected, got, message
         | 
| 25 27 | 
             
                end
         | 
| 26 28 | 
             
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              def fixture_file(path)
         | 
| 31 | 
            +
                File.expand_path(File.join(File.dirname(__FILE__), "fixtures", path))
         | 
| 32 | 
            +
              end
         | 
| 27 33 | 
             
            end
         | 
| 28 34 |  | 
| 29 35 | 
             
            class LibnotifyTestCase < MiniTest::Spec
         | 
| @@ -32,6 +38,8 @@ class LibnotifyTestCase < MiniTest::Spec | |
| 32 38 | 
             
              class << self
         | 
| 33 39 | 
             
                alias :test :it
         | 
| 34 40 | 
             
                alias :context :describe
         | 
| 41 | 
            +
                alias :setup :before
         | 
| 42 | 
            +
                alias :teardown :after
         | 
| 35 43 | 
             
              end
         | 
| 36 44 |  | 
| 37 45 | 
             
              def libnotify(options={}, &block)
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            require 'helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class IntegrationTest < LibnotifyTestCase
         | 
| 4 | 
            +
              test "display notification" do
         | 
| 5 | 
            +
                libnotify = Libnotify::API.new(:timeout => 0.5, :icon_path => :"emblem-favorite", :append => true)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                [ :low, :normal, :critical ].each do |urgency|
         | 
| 8 | 
            +
                  libnotify.summary = "#{RUBY_VERSION} at #{RUBY_PLATFORM}"
         | 
| 9 | 
            +
                  libnotify.body    = [ urgency, defined?(RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : '?' ].join(" ")
         | 
| 10 | 
            +
                  libnotify.urgency = urgency
         | 
| 11 | 
            +
                  libnotify.show!
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
            end
         | 
| @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            require 'helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class LibnotifyAPITest < LibnotifyTestCase
         | 
| 4 | 
            +
              test "instance default values" do
         | 
| 5 | 
            +
                assert_equal " ",     libnotify.summary
         | 
| 6 | 
            +
                assert_equal " ",     libnotify.body
         | 
| 7 | 
            +
                assert_equal :normal, libnotify.urgency
         | 
| 8 | 
            +
                assert_nil            libnotify.timeout
         | 
| 9 | 
            +
                assert_nil            libnotify.icon_path
         | 
| 10 | 
            +
                assert                libnotify.append
         | 
| 11 | 
            +
                refute                libnotify.transient
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              test "instance with options and block" do
         | 
| 15 | 
            +
                libnotify(:summary => "hello", :body => "body", :invalid_option => 23) do |n|
         | 
| 16 | 
            +
                  n.body      = "overwritten"
         | 
| 17 | 
            +
                  n.icon_path = "/path/to/icon"
         | 
| 18 | 
            +
                  n.append    = false
         | 
| 19 | 
            +
                  n.transient = true
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                assert_equal "hello",         libnotify.summary
         | 
| 23 | 
            +
                assert_equal "overwritten",   libnotify.body
         | 
| 24 | 
            +
                assert_equal "/path/to/icon", libnotify.icon_path
         | 
| 25 | 
            +
                refute                        libnotify.append
         | 
| 26 | 
            +
                assert                        libnotify.transient
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              test "timeout=" do
         | 
| 30 | 
            +
                assert_timeout 2500,  2.5,    "with float"
         | 
| 31 | 
            +
                assert_timeout 100,   100,    "with fixnum ms"
         | 
| 32 | 
            +
                assert_timeout 101,   101,    "with fixnum ms"
         | 
| 33 | 
            +
                assert_timeout 1000,  1,      "with fixnum seconds"
         | 
| 34 | 
            +
                assert_timeout 99000, 99,     "with fixnum seconds"
         | 
| 35 | 
            +
                assert_timeout nil,   nil,    "with nil"
         | 
| 36 | 
            +
                assert_timeout nil,   false,  "with false"
         | 
| 37 | 
            +
                assert_timeout 2,     :"2 s", "with to_s.to_i"
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              test "icon_path=" do
         | 
| 41 | 
            +
                Libnotify::API.icon_dirs << File.expand_path("../../..", __FILE__)
         | 
| 42 | 
            +
                assert_icon_path "/some/path/image.jpg",  "/some/path/image.jpg",   "with absolute path"
         | 
| 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"
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              test "update" do
         | 
| 49 | 
            +
                libnotify(:summary => "hello", :body => "world").show!
         | 
| 50 | 
            +
                libnotify.update(:summary => "hell") do |n|
         | 
| 51 | 
            +
                  n.body = "yeah"
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
                assert_equal "hell", libnotify.summary
         | 
| 54 | 
            +
                assert_equal "yeah", libnotify.body
         | 
| 55 | 
            +
                libnotify.close
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            require 'helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'fileutils'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            class LibnotifyIconFinderTest < LibnotifyTestCase
         | 
| 6 | 
            +
              test "find icon with highest resolution" do
         | 
| 7 | 
            +
                dir = fixture_file("/icons/*")
         | 
| 8 | 
            +
                assert_icon_path [ dir ], "/icons/128x128/happy.jpg", "happy.jpg"
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              test "search all provided dirs" do
         | 
| 12 | 
            +
                dirs = [ fixture_file("/icons/*"), fixture_file("/emoticons/*") ]
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                assert_icon_path dirs, "/emoticons/128x128/happy.jpg", "happy.jpg"
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              test "does not find unknown icons" do
         | 
| 18 | 
            +
                dir = fixture_file("/icons/*")
         | 
| 19 | 
            +
                refute icon_finder([ dir ]).icon_path("unknown.jpg")
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              test "does not find known icon in unknown dirs" do
         | 
| 23 | 
            +
                dir = fixture_file("/unknown/*")
         | 
| 24 | 
            +
                refute icon_finder([ dir ]).icon_path("happy.jpg")
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              test "find icon alphabetically w/o resolution" do
         | 
| 28 | 
            +
                dir = fixture_file("/images/*")
         | 
| 29 | 
            +
                assert_icon_path [ dir ], "/images/another/happy.jpg", "happy.jpg"
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
              private
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              def icon_finder(*dirs)
         | 
| 35 | 
            +
                Libnotify::IconFinder.new(dirs)
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              def assert_icon_path(dirs, expected, name)
         | 
| 39 | 
            +
                assert_equal fixture_file(expected), icon_finder(*dirs).icon_path(name)
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            require 'helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class LibnotifyTest < LibnotifyTestCase
         | 
| 4 | 
            +
              test "responds to new" do
         | 
| 5 | 
            +
                assert_respond_to Libnotify, :new
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              test "responds to show" do
         | 
| 9 | 
            +
                assert_respond_to Libnotify, :show
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              test "has version" do
         | 
| 13 | 
            +
                assert defined?(Libnotify::VERSION), "version is defined"
         | 
| 14 | 
            +
                assert Libnotify::VERSION
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,80 +1,85 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: libnotify
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.8. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 0.8.1
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - Peter Suschlik
         | 
| 9 8 | 
             
            autorequire: 
         | 
| 10 9 | 
             
            bindir: bin
         | 
| 11 10 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 11 | 
            +
            date: 2013-07-02 00:00:00.000000000 Z
         | 
| 13 12 | 
             
            dependencies:
         | 
| 14 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 14 | 
             
              name: ffi
         | 
| 16 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 16 | 
             
                requirements:
         | 
| 19 | 
            -
                - -  | 
| 17 | 
            +
                - - '>='
         | 
| 20 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 19 | 
             
                    version: 1.0.11
         | 
| 22 20 | 
             
              type: :runtime
         | 
| 23 21 | 
             
              prerelease: false
         | 
| 24 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            -
                none: false
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 | 
            -
                - -  | 
| 24 | 
            +
                - - '>='
         | 
| 28 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 26 | 
             
                    version: 1.0.11
         | 
| 30 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 28 | 
             
              name: yard
         | 
| 32 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            -
                none: false
         | 
| 34 30 | 
             
                requirements:
         | 
| 35 | 
            -
                - -  | 
| 31 | 
            +
                - - ~>
         | 
| 36 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            -
                    version: 0.8. | 
| 33 | 
            +
                    version: 0.8.6.1
         | 
| 38 34 | 
             
              type: :development
         | 
| 39 35 | 
             
              prerelease: false
         | 
| 40 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 37 | 
             
                requirements:
         | 
| 43 | 
            -
                - -  | 
| 38 | 
            +
                - - ~>
         | 
| 44 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            -
                    version: 0.8. | 
| 40 | 
            +
                    version: 0.8.6.1
         | 
| 46 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 42 | 
             
              name: minitest
         | 
| 48 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 44 | 
             
                requirements:
         | 
| 51 | 
            -
                - -  | 
| 45 | 
            +
                - - ~>
         | 
| 52 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            -
                    version:  | 
| 47 | 
            +
                    version: 4.7.4
         | 
| 54 48 | 
             
              type: :development
         | 
| 55 49 | 
             
              prerelease: false
         | 
| 56 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            -
                none: false
         | 
| 58 51 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 52 | 
            +
                - - ~>
         | 
| 60 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version:  | 
| 54 | 
            +
                    version: 4.7.4
         | 
| 62 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 56 | 
             
              name: minitest-libnotify
         | 
| 64 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 58 | 
             
                requirements:
         | 
| 67 | 
            -
                - -  | 
| 59 | 
            +
                - - ~>
         | 
| 68 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 61 | 
             
                    version: 0.2.2
         | 
| 70 62 | 
             
              type: :development
         | 
| 71 63 | 
             
              prerelease: false
         | 
| 72 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            -
                none: false
         | 
| 74 65 | 
             
                requirements:
         | 
| 75 | 
            -
                - -  | 
| 66 | 
            +
                - - ~>
         | 
| 76 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 68 | 
             
                    version: 0.2.2
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: simplecov
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - '>='
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: '0'
         | 
| 76 | 
            +
              type: :development
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - '>='
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: '0'
         | 
| 78 83 | 
             
            description: 
         | 
| 79 84 | 
             
            email:
         | 
| 80 85 | 
             
            - peter-libnotify@suschlik.de
         | 
| @@ -83,7 +88,9 @@ extensions: [] | |
| 83 88 | 
             
            extra_rdoc_files: []
         | 
| 84 89 | 
             
            files:
         | 
| 85 90 | 
             
            - .gitignore
         | 
| 86 | 
            -
            - . | 
| 91 | 
            +
            - .ruby-version
         | 
| 92 | 
            +
            - .simplecov
         | 
| 93 | 
            +
            - .travis.yml
         | 
| 87 94 | 
             
            - Gemfile
         | 
| 88 95 | 
             
            - LICENSE
         | 
| 89 96 | 
             
            - README.rdoc
         | 
| @@ -91,41 +98,46 @@ files: | |
| 91 98 | 
             
            - lib/libnotify.rb
         | 
| 92 99 | 
             
            - lib/libnotify/api.rb
         | 
| 93 100 | 
             
            - lib/libnotify/ffi.rb
         | 
| 101 | 
            +
            - lib/libnotify/icon_finder.rb
         | 
| 94 102 | 
             
            - lib/libnotify/tasks/rubies.rake
         | 
| 95 103 | 
             
            - lib/libnotify/version.rb
         | 
| 96 104 | 
             
            - libnotify.gemspec
         | 
| 97 105 | 
             
            - libnotify.png
         | 
| 106 | 
            +
            - test/fixtures/.keep
         | 
| 107 | 
            +
            - test/fixtures/emoticons/128x128/happy.jpg
         | 
| 108 | 
            +
            - test/fixtures/icons/128x128/happy.jpg
         | 
| 109 | 
            +
            - test/fixtures/icons/16x16/happy.jpg
         | 
| 110 | 
            +
            - test/fixtures/icons/32x32/happy.jpg
         | 
| 111 | 
            +
            - test/fixtures/icons/other/happy.jpg
         | 
| 112 | 
            +
            - test/fixtures/images/another/happy.jpg
         | 
| 113 | 
            +
            - test/fixtures/images/other/happy.jpg
         | 
| 98 114 | 
             
            - test/helper.rb
         | 
| 99 | 
            -
            - test/ | 
| 115 | 
            +
            - test/integration_test.rb
         | 
| 116 | 
            +
            - test/libnotify/api_test.rb
         | 
| 117 | 
            +
            - test/libnotify/icon_finder_test.rb
         | 
| 118 | 
            +
            - test/libnotify_test.rb
         | 
| 100 119 | 
             
            homepage: http://rubygems.org/gems/libnotify
         | 
| 101 120 | 
             
            licenses: []
         | 
| 121 | 
            +
            metadata: {}
         | 
| 102 122 | 
             
            post_install_message: 
         | 
| 103 123 | 
             
            rdoc_options: []
         | 
| 104 124 | 
             
            require_paths:
         | 
| 105 125 | 
             
            - lib
         | 
| 106 126 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 107 | 
            -
              none: false
         | 
| 108 127 | 
             
              requirements:
         | 
| 109 | 
            -
              - -  | 
| 128 | 
            +
              - - '>='
         | 
| 110 129 | 
             
                - !ruby/object:Gem::Version
         | 
| 111 130 | 
             
                  version: '0'
         | 
| 112 | 
            -
                  segments:
         | 
| 113 | 
            -
                  - 0
         | 
| 114 | 
            -
                  hash: 3247068429593286265
         | 
| 115 131 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 116 | 
            -
              none: false
         | 
| 117 132 | 
             
              requirements:
         | 
| 118 | 
            -
              - -  | 
| 133 | 
            +
              - - '>='
         | 
| 119 134 | 
             
                - !ruby/object:Gem::Version
         | 
| 120 135 | 
             
                  version: '0'
         | 
| 121 | 
            -
                  segments:
         | 
| 122 | 
            -
                  - 0
         | 
| 123 | 
            -
                  hash: 3247068429593286265
         | 
| 124 136 | 
             
            requirements: []
         | 
| 125 137 | 
             
            rubyforge_project: 
         | 
| 126 | 
            -
            rubygems_version:  | 
| 138 | 
            +
            rubygems_version: 2.0.3
         | 
| 127 139 | 
             
            signing_key: 
         | 
| 128 | 
            -
            specification_version:  | 
| 140 | 
            +
            specification_version: 4
         | 
| 129 141 | 
             
            summary: Ruby bindings for libnotify using FFI
         | 
| 130 142 | 
             
            test_files: []
         | 
| 131 143 | 
             
            has_rdoc: 
         | 
    
        data/.rvmrc
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            rvm @libnotify --create
         | 
    
        data/test/test_libnotify.rb
    DELETED
    
    | @@ -1,87 +0,0 @@ | |
| 1 | 
            -
            require 'helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            class TestLibnotify < LibnotifyTestCase
         | 
| 4 | 
            -
              context Libnotify do
         | 
| 5 | 
            -
                test "responds to new" do
         | 
| 6 | 
            -
                  assert_respond_to Libnotify, :new
         | 
| 7 | 
            -
                end
         | 
| 8 | 
            -
             | 
| 9 | 
            -
                test "responds to show" do
         | 
| 10 | 
            -
                  assert_respond_to Libnotify, :show
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                test "has version" do
         | 
| 14 | 
            -
                  assert defined?(Libnotify::VERSION), "version is defined"
         | 
| 15 | 
            -
                  assert Libnotify::VERSION
         | 
| 16 | 
            -
                end
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
              context Libnotify::API do
         | 
| 20 | 
            -
                test "instance default values" do
         | 
| 21 | 
            -
                  assert_equal " ",     libnotify.summary
         | 
| 22 | 
            -
                  assert_equal " ",     libnotify.body
         | 
| 23 | 
            -
                  assert_equal :normal, libnotify.urgency
         | 
| 24 | 
            -
                  assert_nil            libnotify.timeout
         | 
| 25 | 
            -
                  assert_nil            libnotify.icon_path
         | 
| 26 | 
            -
                  assert                libnotify.append
         | 
| 27 | 
            -
                  refute                libnotify.transient
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                test "instance with options and block" do
         | 
| 31 | 
            -
                  libnotify(:summary => "hello", :body => "body", :invalid_option => 23) do |n|
         | 
| 32 | 
            -
                    n.body      = "overwritten"
         | 
| 33 | 
            -
                    n.icon_path = "/path/to/icon"
         | 
| 34 | 
            -
                    n.append    = false
         | 
| 35 | 
            -
                    n.transient = true
         | 
| 36 | 
            -
                  end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                  assert_equal "hello",         libnotify.summary
         | 
| 39 | 
            -
                  assert_equal "overwritten",   libnotify.body
         | 
| 40 | 
            -
                  assert_equal "/path/to/icon", libnotify.icon_path
         | 
| 41 | 
            -
                  refute                        libnotify.append
         | 
| 42 | 
            -
                  assert                        libnotify.transient
         | 
| 43 | 
            -
                end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                test "timeout=" do
         | 
| 46 | 
            -
                  assert_timeout 2500,  2.5,    "with float"
         | 
| 47 | 
            -
                  assert_timeout 100,   100,    "with fixnum ms"
         | 
| 48 | 
            -
                  assert_timeout 101,   101,    "with fixnum ms"
         | 
| 49 | 
            -
                  assert_timeout 1000,  1,      "with fixnum seconds"
         | 
| 50 | 
            -
                  assert_timeout 99000, 99,     "with fixnum seconds"
         | 
| 51 | 
            -
                  assert_timeout nil,   nil,    "with nil"
         | 
| 52 | 
            -
                  assert_timeout nil,   false,  "with false"
         | 
| 53 | 
            -
                  assert_timeout 2,     :"2 s", "with to_s.to_i"
         | 
| 54 | 
            -
                end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                test "icon_path=" do
         | 
| 57 | 
            -
                  Libnotify::API.icon_dirs << File.expand_path("../..", __FILE__)
         | 
| 58 | 
            -
                  assert_icon_path "/some/path/image.jpg",  "/some/path/image.jpg",   "with absolute path"
         | 
| 59 | 
            -
                  assert_icon_path "some-invalid-path.jpg", "some-invalid-path.jpg",  "with non-existant relative path"
         | 
| 60 | 
            -
                  assert_icon_path %r{^/.*/libnotify.png},  "libnotify.png",          "with relative path"
         | 
| 61 | 
            -
                  assert_icon_path %r{^/.*/libnotify.png},  :"libnotify",             "with symbol"
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                test "update" do
         | 
| 65 | 
            -
                  libnotify(:summary => "hello", :body => "world").show!
         | 
| 66 | 
            -
                  libnotify.update(:summary => "hell") do |n|
         | 
| 67 | 
            -
                    n.body = "yeah"
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
                  assert_equal "hell", libnotify.summary
         | 
| 70 | 
            -
                  assert_equal "yeah", libnotify.body
         | 
| 71 | 
            -
                  libnotify.close
         | 
| 72 | 
            -
                end
         | 
| 73 | 
            -
              end
         | 
| 74 | 
            -
             | 
| 75 | 
            -
              context "integration" do
         | 
| 76 | 
            -
                test "works" do
         | 
| 77 | 
            -
                  libnotify = Libnotify::API.new(:timeout => 0.5, :icon_path => :"emblem-favorite", :append => true)
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                  [ :low, :normal, :critical ].each do |urgency|
         | 
| 80 | 
            -
                    libnotify.summary = "#{RUBY_VERSION} at #{RUBY_PLATFORM}"
         | 
| 81 | 
            -
                    libnotify.body    = [ urgency, defined?(RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : '?' ].join(" ")
         | 
| 82 | 
            -
                    libnotify.urgency = urgency
         | 
| 83 | 
            -
                    libnotify.show!
         | 
| 84 | 
            -
                  end
         | 
| 85 | 
            -
                end
         | 
| 86 | 
            -
              end
         | 
| 87 | 
            -
            end
         |