notify 0.3.0 → 0.4.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.
- data/VERSION +1 -1
 - data/lib/notify.rb +27 -14
 - data/lib/notify/growlnotify.rb +2 -2
 - data/lib/notify/kdialog.rb +2 -2
 - data/lib/notify/libnotify.rb +9 -0
 - data/lib/notify/notify-send.rb +3 -3
 - data/lib/notify/ruby-growl.rb +4 -4
 - data/lib/notify/ruby_gntp.rb +4 -4
 - data/lib/notify/terminal-notifier.rb +10 -0
 - data/notify.gemspec +51 -0
 - metadata +25 -40
 - data/lib/notify/lib_notify.rb +0 -9
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.4.0
         
     | 
    
        data/lib/notify.rb
    CHANGED
    
    | 
         @@ -1,24 +1,37 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'erb'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Notify
         
     | 
| 
      
 5 
     | 
    
         
            +
              def self.which(prog, path=ENV['PATH'])
         
     | 
| 
      
 6 
     | 
    
         
            +
                if RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin|cygwin/
         
     | 
| 
      
 7 
     | 
    
         
            +
                  path.split(File::PATH_SEPARATOR).each {|dir|
         
     | 
| 
      
 8 
     | 
    
         
            +
                    f = File.join(dir,prog+".exe")
         
     | 
| 
      
 9 
     | 
    
         
            +
                    return f if File.executable?(File.join(f)) && !File.directory?(f)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 12 
     | 
    
         
            +
                else
         
     | 
| 
      
 13 
     | 
    
         
            +
                  return system("which #{prog} > /dev/null 2>&1")
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def self.html_escape(text)
         
     | 
| 
      
 18 
     | 
    
         
            +
                ERB::Util.html_escape(text)
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
       3 
20 
     | 
    
         
             
            end
         
     | 
| 
       4 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
            dir = File.dirname(__FILE__)
         
     | 
| 
       5 
23 
     | 
    
         
             
            if ENV['NOTIFY']
         
     | 
| 
       6 
     | 
    
         
            -
               
     | 
| 
       7 
     | 
    
         
            -
                require File.join(__DIR__, "notify/#{ENV['NOTIFY']}")
         
     | 
| 
       8 
     | 
    
         
            -
              rescue LoadError
         
     | 
| 
       9 
     | 
    
         
            -
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
              require File.join(dir, "notify/#{ENV['NOTIFY']}")
         
     | 
| 
       10 
25 
     | 
    
         
             
            else
         
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  require filename
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              Dir[File.join(dir, "notify/*.rb")].each do |filename|
         
     | 
| 
      
 27 
     | 
    
         
            +
                break if Notify.methods.include?(:notify)
         
     | 
| 
      
 28 
     | 
    
         
            +
                require filename
         
     | 
| 
       16 
29 
     | 
    
         
             
              end
         
     | 
| 
       17 
30 
     | 
    
         
             
            end
         
     | 
| 
       18 
31 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
                def self.notify(title, message)
         
     | 
| 
      
 32 
     | 
    
         
            +
            module Notify
         
     | 
| 
      
 33 
     | 
    
         
            +
              unless methods.include?(:notify)
         
     | 
| 
      
 34 
     | 
    
         
            +
                def self.notify(title, message, options = {})
         
     | 
| 
       22 
35 
     | 
    
         
             
                  puts "#{title}: #{message}"
         
     | 
| 
       23 
36 
     | 
    
         
             
                end
         
     | 
| 
       24 
37 
     | 
    
         
             
              end
         
     | 
    
        data/lib/notify/growlnotify.rb
    CHANGED
    
    
    
        data/lib/notify/kdialog.rb
    CHANGED
    
    
    
        data/lib/notify/notify-send.rb
    CHANGED
    
    
    
        data/lib/notify/ruby-growl.rb
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
      
 1 
     | 
    
         
            +
            module Notify
         
     | 
| 
      
 2 
     | 
    
         
            +
              begin
         
     | 
| 
      
 3 
     | 
    
         
            +
                require 'ruby-growl'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
              module Notify
         
     | 
| 
       5 
5 
     | 
    
         
             
                @@growl = Growl.new 'localhost', 'ruby', ['notify']
         
     | 
| 
       6 
6 
     | 
    
         
             
                def self.notify(title, message, option = {})
         
     | 
| 
       7 
7 
     | 
    
         
             
                  @@growl.notify 'notify', title, message, option[:priority] || 0, option[:sticky] || false
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              rescue LoadError
         
     | 
| 
       9 
10 
     | 
    
         
             
              end
         
     | 
| 
       10 
     | 
    
         
            -
            rescue LoadError
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
    
        data/lib/notify/ruby_gntp.rb
    CHANGED
    
    | 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
      
 1 
     | 
    
         
            +
            module Notify
         
     | 
| 
      
 2 
     | 
    
         
            +
              begin
         
     | 
| 
      
 3 
     | 
    
         
            +
                require 'ruby_gntp'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
              module Notify
         
     | 
| 
       5 
5 
     | 
    
         
             
                def self.notify(title, message, option = {})
         
     | 
| 
       6 
6 
     | 
    
         
             
                  GNTP.notify :app_name => "ruby", :title => title, :text => message, :icon => option[:icon] || "", :sticky => option[:sticky] || false
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
              rescue LoadError
         
     | 
| 
       8 
9 
     | 
    
         
             
              end
         
     | 
| 
       9 
     | 
    
         
            -
            rescue LoadError
         
     | 
| 
       10 
10 
     | 
    
         
             
            end
         
     | 
    
        data/notify.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Generated by jeweler
         
     | 
| 
      
 2 
     | 
    
         
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         
     | 
| 
      
 3 
     | 
    
         
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         
     | 
| 
      
 4 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.name = "notify"
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.4.0"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.authors = ["jugyo"]
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = "2012-08-01"
         
     | 
| 
      
 13 
     | 
    
         
            +
              s.description = "The \"notify\" provides a function to notify on cross platform."
         
     | 
| 
      
 14 
     | 
    
         
            +
              s.email = "jugyo.org@gmail.com"
         
     | 
| 
      
 15 
     | 
    
         
            +
              s.executables = ["notify"]
         
     | 
| 
      
 16 
     | 
    
         
            +
              s.extra_rdoc_files = [
         
     | 
| 
      
 17 
     | 
    
         
            +
                "LICENSE",
         
     | 
| 
      
 18 
     | 
    
         
            +
                "README.md"
         
     | 
| 
      
 19 
     | 
    
         
            +
              ]
         
     | 
| 
      
 20 
     | 
    
         
            +
              s.files = [
         
     | 
| 
      
 21 
     | 
    
         
            +
                "LICENSE",
         
     | 
| 
      
 22 
     | 
    
         
            +
                "README.md",
         
     | 
| 
      
 23 
     | 
    
         
            +
                "Rakefile",
         
     | 
| 
      
 24 
     | 
    
         
            +
                "VERSION",
         
     | 
| 
      
 25 
     | 
    
         
            +
                "bin/notify",
         
     | 
| 
      
 26 
     | 
    
         
            +
                "lib/notify.rb",
         
     | 
| 
      
 27 
     | 
    
         
            +
                "lib/notify/growlnotify.rb",
         
     | 
| 
      
 28 
     | 
    
         
            +
                "lib/notify/kdialog.rb",
         
     | 
| 
      
 29 
     | 
    
         
            +
                "lib/notify/libnotify.rb",
         
     | 
| 
      
 30 
     | 
    
         
            +
                "lib/notify/notify-send.rb",
         
     | 
| 
      
 31 
     | 
    
         
            +
                "lib/notify/ruby-growl.rb",
         
     | 
| 
      
 32 
     | 
    
         
            +
                "lib/notify/ruby_gntp.rb",
         
     | 
| 
      
 33 
     | 
    
         
            +
                "lib/notify/terminal-notifier.rb",
         
     | 
| 
      
 34 
     | 
    
         
            +
                "notify.gemspec",
         
     | 
| 
      
 35 
     | 
    
         
            +
                "sample.rb"
         
     | 
| 
      
 36 
     | 
    
         
            +
              ]
         
     | 
| 
      
 37 
     | 
    
         
            +
              s.homepage = "http://github.com/jugyo/notify"
         
     | 
| 
      
 38 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 39 
     | 
    
         
            +
              s.rubygems_version = "1.8.23"
         
     | 
| 
      
 40 
     | 
    
         
            +
              s.summary = "A function to notify on cross platform."
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              if s.respond_to? :specification_version then
         
     | 
| 
      
 43 
     | 
    
         
            +
                s.specification_version = 3
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         
     | 
| 
      
 46 
     | 
    
         
            +
                else
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              else
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,33 +1,25 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification 
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: notify
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version 
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
       6 
     | 
    
         
            -
              - 0
         
     | 
| 
       7 
     | 
    
         
            -
              - 3
         
     | 
| 
       8 
     | 
    
         
            -
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              version: 0.3.0
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
       10 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
     | 
    
         
            -
            authors: 
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
       12 
8 
     | 
    
         
             
            - jugyo
         
     | 
| 
       13 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       14 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       15 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            date: 2010-09-29 00:00:00 +09:00
         
     | 
| 
       18 
     | 
    
         
            -
            default_executable: notify
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-08-01 00:00:00.000000000 Z
         
     | 
| 
       19 
13 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
14 
     | 
    
         
             
            description: The "notify" provides a function to notify on cross platform.
         
     | 
| 
       22 
15 
     | 
    
         
             
            email: jugyo.org@gmail.com
         
     | 
| 
       23 
     | 
    
         
            -
            executables: 
     | 
| 
      
 16 
     | 
    
         
            +
            executables:
         
     | 
| 
       24 
17 
     | 
    
         
             
            - notify
         
     | 
| 
       25 
18 
     | 
    
         
             
            extensions: []
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            extra_rdoc_files: 
         
     | 
| 
      
 19 
     | 
    
         
            +
            extra_rdoc_files:
         
     | 
| 
       28 
20 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       29 
21 
     | 
    
         
             
            - README.md
         
     | 
| 
       30 
     | 
    
         
            -
            files: 
     | 
| 
      
 22 
     | 
    
         
            +
            files:
         
     | 
| 
       31 
23 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       32 
24 
     | 
    
         
             
            - README.md
         
     | 
| 
       33 
25 
     | 
    
         
             
            - Rakefile
         
     | 
| 
         @@ -36,42 +28,35 @@ files: 
     | 
|
| 
       36 
28 
     | 
    
         
             
            - lib/notify.rb
         
     | 
| 
       37 
29 
     | 
    
         
             
            - lib/notify/growlnotify.rb
         
     | 
| 
       38 
30 
     | 
    
         
             
            - lib/notify/kdialog.rb
         
     | 
| 
       39 
     | 
    
         
            -
            - lib/notify/ 
     | 
| 
      
 31 
     | 
    
         
            +
            - lib/notify/libnotify.rb
         
     | 
| 
       40 
32 
     | 
    
         
             
            - lib/notify/notify-send.rb
         
     | 
| 
       41 
33 
     | 
    
         
             
            - lib/notify/ruby-growl.rb
         
     | 
| 
       42 
34 
     | 
    
         
             
            - lib/notify/ruby_gntp.rb
         
     | 
| 
      
 35 
     | 
    
         
            +
            - lib/notify/terminal-notifier.rb
         
     | 
| 
      
 36 
     | 
    
         
            +
            - notify.gemspec
         
     | 
| 
       43 
37 
     | 
    
         
             
            - sample.rb
         
     | 
| 
       44 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       45 
38 
     | 
    
         
             
            homepage: http://github.com/jugyo/notify
         
     | 
| 
       46 
39 
     | 
    
         
             
            licenses: []
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
40 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       49 
     | 
    
         
            -
            rdoc_options: 
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
      
 41 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 42 
     | 
    
         
            +
            require_paths:
         
     | 
| 
       52 
43 
     | 
    
         
             
            - lib
         
     | 
| 
       53 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement 
     | 
| 
      
 44 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       54 
45 
     | 
    
         
             
              none: false
         
     | 
| 
       55 
     | 
    
         
            -
              requirements: 
     | 
| 
       56 
     | 
    
         
            -
              - -  
     | 
| 
       57 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
       61 
     | 
    
         
            -
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 46 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 47 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 48 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 49 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 50 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       62 
51 
     | 
    
         
             
              none: false
         
     | 
| 
       63 
     | 
    
         
            -
              requirements: 
     | 
| 
       64 
     | 
    
         
            -
              - -  
     | 
| 
       65 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       66 
     | 
    
         
            -
                   
     | 
| 
       67 
     | 
    
         
            -
                  - 0
         
     | 
| 
       68 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
      
 52 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 53 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 54 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 55 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       69 
56 
     | 
    
         
             
            requirements: []
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
57 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       72 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 58 
     | 
    
         
            +
            rubygems_version: 1.8.23
         
     | 
| 
       73 
59 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       74 
60 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       75 
61 
     | 
    
         
             
            summary: A function to notify on cross platform.
         
     | 
| 
       76 
62 
     | 
    
         
             
            test_files: []
         
     | 
| 
       77 
     | 
    
         
            -
             
     |