notify 0.5.0 → 0.5.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 68eb2a31d3e0d10de76da6d551b7ef3a89e1763f
4
+ data.tar.gz: a2cb262f530f939b67a7bc207b17bab2ea8fd691
5
+ SHA512:
6
+ metadata.gz: 6f61149ba5f5f0dc36d98cb9bae429741769cd2a88d4a20a2695acb614f4353962bafaece786089f29904b6228c4ba1bd34375075691090d1806a90466e15c50
7
+ data.tar.gz: b4a1235fb101ccb106fcc4a5924aa148c8c7fe0da658afcdecb1dc9246c783eda4c8994b577e384226f79e430fa6e023ed9808b0b8a706318cdafa142649729a
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/README.md CHANGED
@@ -31,6 +31,11 @@ or
31
31
  require 'notify'
32
32
  Notify.notify "title", "message"
33
33
 
34
+ Notify also allows passing in an app name to replace the default "ruby":
35
+
36
+ require 'notify'
37
+ Notify.notify "title", "message", { app_name: "My App" }
38
+
34
39
  Command
35
40
  ---------
36
41
 
data/Rakefile CHANGED
@@ -1,17 +1,2 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "notify"
8
- gem.summary = %Q{A function to notify on cross platform.}
9
- gem.description = %Q{The "notify" provides a function to notify on cross platform.}
10
- gem.email = "jugyo.org@gmail.com"
11
- gem.homepage = "http://github.com/jugyo/notify"
12
- gem.authors = ["jugyo"]
13
- end
14
- Jeweler::GemcutterTasks.new
15
- rescue LoadError
16
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
- end
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -1,5 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'erb'
3
+ require 'notify/version'
3
4
 
4
5
  module Notify
5
6
  def self.which(prog, path=ENV['PATH'])
@@ -20,13 +21,18 @@ module Notify
20
21
  end
21
22
 
22
23
  dir = File.dirname(__FILE__)
23
- if ENV['NOTIFY']
24
- require File.join(dir, "notify/#{ENV['NOTIFY']}")
25
- else
26
- Dir[File.join(dir, "notify/*.rb")].each do |filename|
27
- break if Notify.methods.include?(:notify)
28
- require filename
24
+ begin
25
+ if ENV['NOTIFY']
26
+ require File.join(dir, "notify/#{ENV['NOTIFY']}")
27
+ else
28
+ Dir[File.join(dir, "notify/*.rb")].each do |filename|
29
+ break if Notify.methods.include?(:notify)
30
+ require filename
31
+ end
29
32
  end
33
+ rescue LoadError
34
+ # A safeguard against bad libraries or edge-case errors.
35
+ puts "Notify can't find the library specified."
30
36
  end
31
37
 
32
38
  module Notify
@@ -1,7 +1,8 @@
1
1
  module Notify
2
2
  if which('kdialog')
3
3
  def self.notify(title, message, option = {})
4
- system 'kdialog', '--passivepopup', message, '--title',title
4
+ iconargs = option.key?(:icon) ? ["--icon", option[:icon]] : ["",""]
5
+ system 'kdialog', '--passivepopup', message, '--title',title, iconargs[0], iconargs[1]
5
6
  end
6
7
  end
7
8
  end
@@ -1,7 +1,8 @@
1
1
  module Notify
2
2
  if which('notify-send')
3
3
  def self.notify(title, message, option = {})
4
- system 'notify-send', title, html_escape(message)
4
+ iconargs = option.key?(:icon) ? ["-i", option[:icon]] : ["",""]
5
+ system 'notify-send', title, html_escape(message), iconargs[0], iconargs[1]
5
6
  end
6
7
  end
7
8
  end
@@ -2,9 +2,9 @@ module Notify
2
2
  begin
3
3
  require 'ruby-growl'
4
4
 
5
- @@growl = Growl.new 'localhost', 'ruby'
6
- @@growl.add_notification 'notify'
7
5
  def self.notify(title, message, option = {})
6
+ @@growl = Growl.new 'localhost', option[:app_name] || "ruby"
7
+ @@growl.add_notification 'notify'
8
8
  @@growl.notify 'notify', title, message, option[:priority] || 0, option[:sticky] || false
9
9
  end
10
10
  rescue LoadError
@@ -3,7 +3,7 @@ module Notify
3
3
  require 'ruby_gntp'
4
4
 
5
5
  def self.notify(title, message, option = {})
6
- GNTP.notify :app_name => "ruby", :title => title, :text => message, :icon => option[:icon] || "", :sticky => option[:sticky] || false
6
+ GNTP.notify :app_name => option[:app_name] || "ruby", :title => title, :text => message, :icon => option[:icon] || "", :sticky => option[:sticky] || false
7
7
  end
8
8
  rescue LoadError
9
9
  end
@@ -0,0 +1,3 @@
1
+ module Notify
2
+ VERSION = '0.5.1'
3
+ end
@@ -1,51 +1,17 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/notify/version', __FILE__)
5
3
 
6
- Gem::Specification.new do |s|
7
- s.name = "notify"
8
- s.version = "0.5.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 = "2013-03-25"
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
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["jugyo"]
6
+ gem.email = ["jugyo.org@gmail.com"]
7
+ gem.description = %q{The "notify" provides a function to notify on cross platform.}
8
+ gem.summary = %q{A function to notify on cross platform.}
9
+ gem.homepage = "http://github.com/jugyo/notify"
51
10
 
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "notify"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Notify::VERSION
17
+ end
metadata CHANGED
@@ -1,29 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 0.5.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - jugyo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-25 00:00:00.000000000 Z
11
+ date: 2013-04-04 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: The "notify" provides a function to notify on cross platform.
15
- email: jugyo.org@gmail.com
14
+ email:
15
+ - jugyo.org@gmail.com
16
16
  executables:
17
17
  - notify
18
18
  extensions: []
19
- extra_rdoc_files:
20
- - LICENSE
21
- - README.md
19
+ extra_rdoc_files: []
22
20
  files:
21
+ - Gemfile
23
22
  - LICENSE
24
23
  - README.md
25
24
  - Rakefile
26
- - VERSION
27
25
  - bin/notify
28
26
  - lib/notify.rb
29
27
  - lib/notify/growlnotify.rb
@@ -33,30 +31,30 @@ files:
33
31
  - lib/notify/ruby-growl.rb
34
32
  - lib/notify/ruby_gntp.rb
35
33
  - lib/notify/terminal-notifier.rb
34
+ - lib/notify/version.rb
36
35
  - notify.gemspec
37
36
  - sample.rb
38
37
  homepage: http://github.com/jugyo/notify
39
38
  licenses: []
39
+ metadata: {}
40
40
  post_install_message:
41
41
  rdoc_options: []
42
42
  require_paths:
43
43
  - lib
44
44
  required_ruby_version: !ruby/object:Gem::Requirement
45
- none: false
46
45
  requirements:
47
- - - ! '>='
46
+ - - '>='
48
47
  - !ruby/object:Gem::Version
49
48
  version: '0'
50
49
  required_rubygems_version: !ruby/object:Gem::Requirement
51
- none: false
52
50
  requirements:
53
- - - ! '>='
51
+ - - '>='
54
52
  - !ruby/object:Gem::Version
55
53
  version: '0'
56
54
  requirements: []
57
55
  rubyforge_project:
58
- rubygems_version: 1.8.23
56
+ rubygems_version: 2.0.0
59
57
  signing_key:
60
- specification_version: 3
58
+ specification_version: 4
61
59
  summary: A function to notify on cross platform.
62
60
  test_files: []
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.0