notifier 1.2.2 → 1.3.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
  SHA256:
3
- metadata.gz: 8372bdfe560b7af14829350fbf06a4eec6efa573f6b87fe992dab61cc1dd74cd
4
- data.tar.gz: bb4ebe4172bcea05940571909984b82d1e64eb146068ccffb00a6c028fe1313e
3
+ metadata.gz: 785cd994046d6e1654c06999c5909ab81b76056cd463c7b63cd72c58e096966e
4
+ data.tar.gz: a9db9eb14963b03a8ca59939a2a8afbf30994fa8b3fd1a8eea40689b72fcb298
5
5
  SHA512:
6
- metadata.gz: f37a5e1fe74a4308edc897948c6450c272a4498a4a2abcf378133e1d8741235274b589809f77286eccfa28f1afce555ff36a4b33d33b3083ea42eedb587c0667
7
- data.tar.gz: 8f67cf67140471f8621088032eda74d715150777482ad1afdfd5585949b473911e8a33c9ca87885576b4c05c910921832e2eced3bb371c25466eec1b260f846e
6
+ metadata.gz: f4b7c8f09062e9589abb6fa89c2266bf16c02d826ed428e3d04d139b651d370ca952ffc3ccaf53aa0f856f798ae5d7cabf14a34a29a217896a74f35973c104cb
7
+ data.tar.gz: 12c3ad81bd54842c608b84e3b4de1393e457e32f42e25c391ddae3952ebb7128419eb8009e26be14bc1cc656ad5a7d09d964755a2d40698cfd37a7215aee11a1
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
  rubocop-fnando: .rubocop.yml
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 2.7
6
+ TargetRubyVersion: 3.4
7
7
  NewCops: enable
8
8
  Exclude:
9
9
  - vendor/**/*
data/README.md CHANGED
@@ -7,6 +7,7 @@ Send system notifications on several platforms with a simple and unified API.
7
7
  Currently supports:
8
8
 
9
9
  - terminal-notifier (Notification Center wrapper for Mac OS X)
10
+ - [HUD](https://fnando.gumroad.com/l/hud-macos)
10
11
  - Kdialog (Linux/KDE)
11
12
  - Knotify (Linux/KDE)
12
13
  - OSD Cat (Linux)
@@ -30,19 +31,23 @@ terminal-notifier also supports two additional flags:
30
31
 
31
32
  See terminal-notifier's help for additional information.
32
33
 
34
+ #### hud
35
+
36
+ - Install HUD - https://fnando.gumroad.com/l/hud-macos
37
+
33
38
  ### Linux
34
39
 
35
- If you're a linux guy, you can choose one of these methods:
40
+ If you're a linux user, you can choose one of these methods:
36
41
 
37
42
  - Install libnotify-bin and its dependencies:
38
43
  `sudo aptitude install libnotify-bin`
39
44
  - Install xosd-bin: `sudo aptitude install xosd-bin`
40
- - KDE users don't need to install anything: Test Notifier will use +knotify+ or
41
- +kdialog+.
45
+ - KDE users don't need to install anything: Test Notifier will use `knotify` or
46
+ `kdialog`.
42
47
 
43
48
  ### Windows
44
49
 
45
- - Install Snarl: download from http://www.fullphat.net
50
+ - Install Snarl: download from https://github.com/fullphat/snarl
46
51
  - Install ruby-snarl: `gem install ruby-snarl`
47
52
 
48
53
  ## Usage
data/lib/notifier/hud.rb CHANGED
@@ -11,19 +11,18 @@ module Notifier
11
11
  def hud_bin
12
12
  @hud_bin ||= [
13
13
  "/Applications/hud.app/Contents/MacOS/cli",
14
- "~/Applications/hud.app/Contents/MacOS/cli"
15
- ].first {|path| File.expand_path(path) }
14
+ File.expand_path("~/Applications/hud.app/Contents/MacOS/cli")
15
+ ].find {|path| File.file?(path) }
16
16
  end
17
17
 
18
18
  def notify(options)
19
+ options[:image] ||= "apple.terminal"
20
+
19
21
  command = [
20
22
  hud_bin,
21
- "--title",
22
- options[:title].to_s,
23
- "--message",
24
- options[:message].to_s,
25
- "--symbol-name",
26
- options[:image].to_s
23
+ "--title", options[:title].to_s,
24
+ "--message", options[:message].to_s,
25
+ "--symbol-name", options[:image].to_s
27
26
  ]
28
27
 
29
28
  Thread.new { system(*command) }.join
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Notifier
4
- module Placebo
4
+ module Noop
5
5
  extend self
6
6
 
7
7
  def supported?
@@ -11,9 +11,9 @@ module Notifier
11
11
  def notify(options)
12
12
  command = [
13
13
  "terminal-notifier",
14
+ "-ignoreDnD",
14
15
  "-group", "notifier-rubygems",
15
16
  "-title", options[:title].to_s,
16
- "-appIcon", options.fetch(:image, "").to_s,
17
17
  "-message", options[:message].to_s,
18
18
  "-subtitle", options.fetch(:subtitle, "").to_s
19
19
  ]
@@ -21,16 +21,17 @@ module Notifier
21
21
  # -sound with an empty string (e.g., "") will trigger the
22
22
  # default sound so we need to check for it.
23
23
  if options[:sound]
24
- command.concat([
25
- "-sound",
26
- options.fetch(:sound, "default").to_s
27
- ])
24
+ command.push("-sound", options.fetch(:sound, "default").to_s)
28
25
  end
29
26
 
30
27
  Thread.new do
31
28
  Open3.popen3(*command) do |_stdin, _stdout, _stderr|
32
29
  # noop
33
30
  end
31
+
32
+ sleep 5
33
+
34
+ Open3.popen3("terminal-notifier", "-remove", "notifier-rubygems")
34
35
  end.join
35
36
  end
36
37
  end
@@ -3,8 +3,8 @@
3
3
  module Notifier
4
4
  module Version
5
5
  MAJOR = 1
6
- MINOR = 2
7
- PATCH = 2
8
- STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
+ MINOR = 3
7
+ PATCH = 0
8
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}".freeze
9
9
  end
10
10
  end
data/lib/notifier.rb CHANGED
@@ -15,7 +15,7 @@ module Notifier
15
15
  require "notifier/knotify"
16
16
  require "notifier/kdialog"
17
17
  require "notifier/notify_send"
18
- require "notifier/placebo"
18
+ require "notifier/noop"
19
19
  require "notifier/terminal_notifier"
20
20
  require "notifier/version"
21
21
 
@@ -26,7 +26,7 @@ module Notifier
26
26
  end
27
27
 
28
28
  def skip_constants
29
- @skip_constants ||= %w[Placebo Adapters Version]
29
+ @skip_constants ||= %w[Noop Adapters Version]
30
30
  end
31
31
 
32
32
  def notifier
@@ -43,7 +43,7 @@ module Notifier
43
43
  const_get(name) unless skip_constants.include?(name.to_s)
44
44
  end
45
45
 
46
- notifiers.sort_by(&:name) + [Placebo]
46
+ notifiers.sort_by(&:name) + [Noop]
47
47
  end
48
48
 
49
49
  def supported_notifiers
data/notifier.gemspec CHANGED
@@ -11,20 +11,19 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://rubygems.org/gems/notifier"
12
12
  s.summary = "Send system notifications on several platforms with a " \
13
13
  "simple and unified API. Currently supports Libnotify, " \
14
- "OSD, KDE (Knotify and Kdialog) and Snarl"
14
+ "OSD, HUD, KDE (Knotify and Kdialog) and Snarl"
15
15
  s.description = s.summary
16
- s.required_ruby_version = ">= 2.7"
16
+ s.required_ruby_version = ">= 3.4"
17
17
  s.metadata["rubygems_mfa_required"] = "true"
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
20
  s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
22
21
  File.basename(f)
23
22
  end
24
23
  s.require_paths = ["lib"]
25
24
 
26
- s.requirements << "terminal-notifier, Libnotify, OSD, KDE (Knotify and " \
27
- "Kdialog) or Snarl"
25
+ s.requirements << "terminal-notifier, HUD, Libnotify, OSD, " \
26
+ "KDE (Knotify and Kdialog) or Snarl"
28
27
 
29
28
  s.add_development_dependency "minitest-utils"
30
29
  s.add_development_dependency "mocha"
@@ -5,7 +5,7 @@ require "test_helper"
5
5
  class NotifierTest < Minitest::Test
6
6
  setup do
7
7
  Notifier.notifiers.each do |notifier|
8
- unless notifier == Notifier::Placebo
8
+ unless notifier == Notifier::Noop
9
9
  notifier.stubs(:supported?).returns(false)
10
10
  end
11
11
  end
@@ -14,10 +14,6 @@ class NotifierTest < Minitest::Test
14
14
  ENV.delete("NOTIFIER")
15
15
  end
16
16
 
17
- teardown do
18
- Notifier.default_notifier = :hud
19
- end
20
-
21
17
  test "retrieves list of supported notifiers" do
22
18
  Notifier::Snarl.stubs(:supported?).returns(true)
23
19
  Notifier::Knotify.stubs(:supported?).returns(true)
@@ -70,8 +66,8 @@ class NotifierTest < Minitest::Test
70
66
  assert_equal 8, Notifier.notifiers.size
71
67
  end
72
68
 
73
- test "considers Placebo as fallback notifier" do
74
- assert_equal Notifier::Placebo, Notifier.supported_notifiers.last
69
+ test "considers Noop as fallback notifier" do
70
+ assert_equal Notifier::Noop, Notifier.supported_notifiers.last
75
71
  end
76
72
 
77
73
  test "returns notifier by its name" do
@@ -82,6 +78,7 @@ class NotifierTest < Minitest::Test
82
78
 
83
79
  test "returns notifier by its name when supported" do
84
80
  Notifier::Snarl.expects(:supported?).returns(true)
81
+
85
82
  assert_equal Notifier::Snarl, Notifier.supported_notifier_from_name(:snarl)
86
83
  end
87
84
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-02-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest-utils
@@ -109,7 +108,7 @@ dependencies:
109
108
  - !ruby/object:Gem::Version
110
109
  version: '0'
111
110
  description: Send system notifications on several platforms with a simple and unified
112
- API. Currently supports Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
111
+ API. Currently supports Libnotify, OSD, HUD, KDE (Knotify and Kdialog) and Snarl
113
112
  email:
114
113
  - me@fnando.com
115
114
  executables: []
@@ -126,9 +125,9 @@ files:
126
125
  - lib/notifier/hud.rb
127
126
  - lib/notifier/kdialog.rb
128
127
  - lib/notifier/knotify.rb
128
+ - lib/notifier/noop.rb
129
129
  - lib/notifier/notify_send.rb
130
130
  - lib/notifier/osd_cat.rb
131
- - lib/notifier/placebo.rb
132
131
  - lib/notifier/snarl.rb
133
132
  - lib/notifier/terminal_notifier.rb
134
133
  - lib/notifier/version.rb
@@ -140,7 +139,6 @@ homepage: http://rubygems.org/gems/notifier
140
139
  licenses: []
141
140
  metadata:
142
141
  rubygems_mfa_required: 'true'
143
- post_install_message:
144
142
  rdoc_options: []
145
143
  require_paths:
146
144
  - lib
@@ -148,20 +146,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
146
  requirements:
149
147
  - - ">="
150
148
  - !ruby/object:Gem::Version
151
- version: '2.7'
149
+ version: '3.4'
152
150
  required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  requirements:
154
152
  - - ">="
155
153
  - !ruby/object:Gem::Version
156
154
  version: '0'
157
155
  requirements:
158
- - terminal-notifier, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl
159
- rubygems_version: 3.3.7
160
- signing_key:
156
+ - terminal-notifier, HUD, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl
157
+ rubygems_version: 4.0.3
161
158
  specification_version: 4
162
159
  summary: Send system notifications on several platforms with a simple and unified
163
- API. Currently supports Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
164
- test_files:
165
- - test/notifier/snarl_test.rb
166
- - test/notifier_test.rb
167
- - test/test_helper.rb
160
+ API. Currently supports Libnotify, OSD, HUD, KDE (Knotify and Kdialog) and Snarl
161
+ test_files: []