notify-push 0.1.2 → 0.1.3
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 +4 -4
- data/Gemfile +16 -0
- data/Gemfile.lock +10 -0
- data/README.md +2 -3
- data/VERSION +1 -1
- data/contrib/irssi/notify_push.pl +27 -0
- data/contrib/shell/notify-push-curl +26 -0
- data/lib/notify-push.rb +29 -21
- data/notify-push.gemspec +11 -3
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd0ab6b2b7e44edc715aa70fe7f88a00cb5abde7
|
4
|
+
data.tar.gz: 32e3095cbba0183ff1c2bdc7577152aca8fbbaae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ad5497e2be621ae61ba77e46bb7828d32746eddb23d2141806e0f5ef1fb3f1209a47f462b08e98c5046b4f3d592902dafdb86dbfc6a08239734bd11262190f8
|
7
|
+
data.tar.gz: f1f291e6bb25d4e8fe0ef0e18a9f1c14e49dcdba287fbacff1a34ce81426fde6edcd27274335b7ad52380483ad6c5de155252710ded1a831e9a7381a6d1bfc2c
|
data/Gemfile
CHANGED
@@ -3,12 +3,27 @@
|
|
3
3
|
# ================================================
|
4
4
|
source "http://rubygems.org"
|
5
5
|
|
6
|
+
# http://stackoverflow.com/questions/8420414/how-to-add-mac-specific-gems-to-bundle-on-mac-but-not-on-linux
|
7
|
+
def windows_only(require_as)
|
8
|
+
RbConfig::CONFIG['host_os'] =~ /mingw|mswin/i ? require_as : false
|
9
|
+
end
|
10
|
+
|
11
|
+
def linux_only(require_as)
|
12
|
+
RbConfig::CONFIG['host_os'] =~ /linux/ ? require_as : false
|
13
|
+
end
|
14
|
+
|
15
|
+
def darwin_only(require_as)
|
16
|
+
RbConfig::CONFIG['host_os'] =~ /darwin/ ? require_as : false
|
17
|
+
end
|
18
|
+
|
6
19
|
gem "pusher"
|
7
20
|
gem "pusher-client"
|
8
21
|
gem "activesupport"
|
9
22
|
gem "recursive-open-struct"
|
10
23
|
gem "pidfile"
|
11
24
|
gem "os"
|
25
|
+
#gem "terminal-notifier", require: darwin_only("terminal-notifier")
|
26
|
+
gem "notifier"
|
12
27
|
|
13
28
|
group :development do
|
14
29
|
gem "shoulda", ">= 0"
|
@@ -17,4 +32,5 @@ group :development do
|
|
17
32
|
gem "bundler", "~> 1.0"
|
18
33
|
gem "jeweler", "~> 2.0.1"
|
19
34
|
gem "simplecov", ">= 0"
|
35
|
+
gem "pry"
|
20
36
|
end
|
data/Gemfile.lock
CHANGED
@@ -9,6 +9,7 @@ GEM
|
|
9
9
|
tzinfo (~> 1.1)
|
10
10
|
addressable (2.3.8)
|
11
11
|
builder (3.2.2)
|
12
|
+
coderay (1.1.0)
|
12
13
|
descendants_tracker (0.0.4)
|
13
14
|
thread_safe (~> 0.3, >= 0.3.1)
|
14
15
|
docile (1.1.5)
|
@@ -38,6 +39,7 @@ GEM
|
|
38
39
|
rdoc
|
39
40
|
json (1.8.2)
|
40
41
|
jwt (1.5.0)
|
42
|
+
method_source (0.8.2)
|
41
43
|
mini_portile (0.6.2)
|
42
44
|
minitest (5.7.0)
|
43
45
|
multi_json (1.11.0)
|
@@ -45,6 +47,7 @@ GEM
|
|
45
47
|
multipart-post (2.0.0)
|
46
48
|
nokogiri (1.6.6.2)
|
47
49
|
mini_portile (~> 0.6.0)
|
50
|
+
notifier (0.5.1)
|
48
51
|
oauth2 (1.0.0)
|
49
52
|
faraday (>= 0.8, < 0.10)
|
50
53
|
jwt (~> 1.0)
|
@@ -53,6 +56,10 @@ GEM
|
|
53
56
|
rack (~> 1.2)
|
54
57
|
os (0.9.6)
|
55
58
|
pidfile (0.3.0)
|
59
|
+
pry (0.10.1)
|
60
|
+
coderay (~> 1.1.0)
|
61
|
+
method_source (~> 0.8.1)
|
62
|
+
slop (~> 3.4)
|
56
63
|
pusher (0.14.5)
|
57
64
|
httpclient (~> 2.5)
|
58
65
|
multi_json (~> 1.0)
|
@@ -77,6 +84,7 @@ GEM
|
|
77
84
|
json (~> 1.8)
|
78
85
|
simplecov-html (~> 0.10.0)
|
79
86
|
simplecov-html (0.10.0)
|
87
|
+
slop (3.6.0)
|
80
88
|
thread_safe (0.3.5)
|
81
89
|
tzinfo (1.2.2)
|
82
90
|
thread_safe (~> 0.1)
|
@@ -90,8 +98,10 @@ DEPENDENCIES
|
|
90
98
|
activesupport
|
91
99
|
bundler (~> 1.0)
|
92
100
|
jeweler (~> 2.0.1)
|
101
|
+
notifier
|
93
102
|
os
|
94
103
|
pidfile
|
104
|
+
pry
|
95
105
|
pusher
|
96
106
|
pusher-client
|
97
107
|
rdoc (~> 3.12)
|
data/README.md
CHANGED
@@ -4,12 +4,11 @@ A general purpose popup notifier sender/receiver for using WebSockets (via [Push
|
|
4
4
|
## Overview
|
5
5
|
`notify-push` employs a Receiver (*currently OS X only*) and Sender(s) to push messages from the Sender(s) to the Receiver.
|
6
6
|
|
7
|
-
|
8
|
-

|
9
|
-
|
10
7
|
**Example Use Case**:
|
11
8
|
You have `irssi` set up in a `screen` on a remote machine and you want to be notified on your laptop/desktop whenever your name gets highlighted.
|
12
9
|
|
10
|
+
<img src='images/doc/terminal-notifier.png' width='359' height='121' alt='IRC Example'/>
|
11
|
+
|
13
12
|
## Disclaimer
|
14
13
|
|
15
14
|

|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -0,0 +1,27 @@
|
|
1
|
+
use strict;
|
2
|
+
use vars qw($VERSION %IRSSI);
|
3
|
+
|
4
|
+
%IRSSI = (
|
5
|
+
authors => "Erik Nomitch",
|
6
|
+
contact => "erik\@nomitch.com",
|
7
|
+
name => "notify_push",
|
8
|
+
description => "An irssi plugin to activate notify-push",
|
9
|
+
license => "GPL-2",
|
10
|
+
url => "https://github.com/eriknomitch/notify-push",
|
11
|
+
);
|
12
|
+
|
13
|
+
use Irssi;
|
14
|
+
|
15
|
+
sub notify_push {
|
16
|
+
my ($server, $msg, $nick, $nick_addr, $target) = @_;
|
17
|
+
|
18
|
+
# WARNING: UNFINISHED - EDIT IN YOUR OWN CHANNELS
|
19
|
+
|
20
|
+
# FIX: User-defined channels.
|
21
|
+
# Only operate in these channels...
|
22
|
+
if ($target =~ m/#(?:foo|bar|baz)/) {
|
23
|
+
system "shell-notify-push", $msg, "IRC", "${nick} says..."
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
Irssi::signal_add_last("message public", "notify_push");
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# FIX: Unfinished
|
4
|
+
|
5
|
+
key=$PUSHER_KEY
|
6
|
+
secret=$PUSHER_SECRET
|
7
|
+
appID=$PUSHER_APP_ID
|
8
|
+
|
9
|
+
message=$1
|
10
|
+
title=$2
|
11
|
+
timestamp=$(date +%s)
|
12
|
+
|
13
|
+
data='{"name":"notification","channel":"notify-push","data":"{\"message\":\"'$message'\",\"title\":\"'$title'\"}"}'
|
14
|
+
|
15
|
+
# Be sure to use `printf %s` to prevent a trailing \n from being added to the data.
|
16
|
+
md5data=$(printf '%s' "$data" | md5sum | awk '{print $1}')
|
17
|
+
path="/apps/${appID}/events"
|
18
|
+
queryString="auth_key=${key}&auth_timestamp=${timestamp}&auth_version=1.0&body_md5=${md5data}"
|
19
|
+
|
20
|
+
# Be sure to use a multi-line, double quoted string that doesn't end in \n as
|
21
|
+
# input for the SHA-256 HMAC.
|
22
|
+
authSig=$(printf '%s' "POST
|
23
|
+
$path
|
24
|
+
$queryString" | openssl dgst -sha256 -hex -hmac "$secret")
|
25
|
+
curl -s -H "Content-Type:application/json" -d "$data" "http://api.pusherapp.com${path}?${queryString}&auth_signature=${authSig}" > /dev/null 2>&1 &
|
26
|
+
|
data/lib/notify-push.rb
CHANGED
@@ -3,15 +3,39 @@ require "shellwords"
|
|
3
3
|
require "yaml"
|
4
4
|
require "recursive-open-struct"
|
5
5
|
require "os"
|
6
|
+
require "notifier"
|
7
|
+
|
8
|
+
require "pry"
|
6
9
|
|
7
10
|
require "active_support/core_ext/hash/reverse_merge"
|
8
11
|
require "active_support/core_ext/module"
|
9
12
|
require "active_support/core_ext/object/blank"
|
10
13
|
|
14
|
+
# ------------------------------------------------
|
15
|
+
# ->CLASS->OS ------------------------------------
|
16
|
+
# ------------------------------------------------
|
17
|
+
class OS
|
18
|
+
def self.host_simple
|
19
|
+
# FIX: Add more.
|
20
|
+
%i(mac linux windows).each do |os|
|
21
|
+
return os if OS.send("#{os}?")
|
22
|
+
end or raise "Cannot detect OS."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
11
26
|
# ------------------------------------------------
|
12
27
|
# MODULE->NOTIFY-PUSH ----------------------------
|
13
28
|
# ------------------------------------------------
|
14
29
|
module NotifyPush
|
30
|
+
|
31
|
+
# ----------------------------------------------
|
32
|
+
# MODULE->UTILITY ------------------------------
|
33
|
+
# ----------------------------------------------
|
34
|
+
module Utility
|
35
|
+
def self.require_system_command_or_raise(command)
|
36
|
+
system "command -v #{command} >/dev/null 2>&1" or raise "The command '#{command}' cannot be found and is required."
|
37
|
+
end
|
38
|
+
end
|
15
39
|
|
16
40
|
# ----------------------------------------------
|
17
41
|
# ATTRIBUTES -----------------------------------
|
@@ -116,30 +140,17 @@ module NotifyPush
|
|
116
140
|
PidFile.new
|
117
141
|
end
|
118
142
|
|
119
|
-
# --------------------------------------------
|
120
|
-
# ENSURANCES ---------------------------------
|
121
|
-
# --------------------------------------------
|
122
|
-
def self.ensure_dependencies
|
123
|
-
system "command -v terminal-notifier >/dev/null 2>&1" or raise "'terminal-notifier' cannot be found."
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.ensure_compatibility
|
127
|
-
OS.mac? or "The notify-push receiver only supports OS X."
|
128
|
-
end
|
129
|
-
|
130
143
|
# --------------------------------------------
|
131
144
|
# NOTIFY -------------------------------------
|
132
145
|
# --------------------------------------------
|
133
146
|
def self.notify(title: "notify-push", subtitle: nil, message:)
|
134
147
|
|
135
|
-
|
136
|
-
"-message", message,
|
137
|
-
"-title", title
|
138
|
-
]
|
148
|
+
message = "#{subtitle} - #{message}" if subtitle
|
139
149
|
|
140
|
-
|
141
|
-
|
142
|
-
|
150
|
+
Notifier.notify({
|
151
|
+
title: title,
|
152
|
+
message: message
|
153
|
+
})
|
143
154
|
end
|
144
155
|
|
145
156
|
# --------------------------------------------
|
@@ -147,13 +158,10 @@ module NotifyPush
|
|
147
158
|
# --------------------------------------------
|
148
159
|
def self.start()
|
149
160
|
|
150
|
-
ensure_compatibility
|
151
|
-
ensure_dependencies
|
152
161
|
pid_lock
|
153
162
|
|
154
163
|
require "pusher-client"
|
155
164
|
|
156
|
-
|
157
165
|
socket = PusherClient::Socket.new configuration.pusher.key, {
|
158
166
|
secure: true
|
159
167
|
}
|
data/notify-push.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: notify-push 0.1.
|
5
|
+
# stub: notify-push 0.1.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "notify-push"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Erik Nomitch"]
|
14
|
-
s.date = "2015-06-
|
14
|
+
s.date = "2015-06-08"
|
15
15
|
s.description = "A general purpose popup notifier sender/receiver using WebSockets (via Pusher)"
|
16
16
|
s.email = "erik@nomitch.com"
|
17
17
|
s.executables = ["notify-push"]
|
@@ -28,6 +28,8 @@ Gem::Specification.new do |s|
|
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
30
|
"bin/notify-push",
|
31
|
+
"contrib/irssi/notify_push.pl",
|
32
|
+
"contrib/shell/notify-push-curl",
|
31
33
|
"images/doc/terminal-notifier.png",
|
32
34
|
"lib/notify-push.rb",
|
33
35
|
"notify-push.gemspec",
|
@@ -52,12 +54,14 @@ Gem::Specification.new do |s|
|
|
52
54
|
s.add_runtime_dependency(%q<recursive-open-struct>, [">= 0"])
|
53
55
|
s.add_runtime_dependency(%q<pidfile>, [">= 0"])
|
54
56
|
s.add_runtime_dependency(%q<os>, [">= 0"])
|
57
|
+
s.add_runtime_dependency(%q<notifier>, [">= 0"])
|
55
58
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
56
59
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
57
60
|
s.add_development_dependency(%q<yard>, ["~> 0.7"])
|
58
61
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
59
62
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
60
63
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
64
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
61
65
|
else
|
62
66
|
s.add_dependency(%q<pusher>, [">= 0"])
|
63
67
|
s.add_dependency(%q<pusher-client>, [">= 0"])
|
@@ -65,12 +69,14 @@ Gem::Specification.new do |s|
|
|
65
69
|
s.add_dependency(%q<recursive-open-struct>, [">= 0"])
|
66
70
|
s.add_dependency(%q<pidfile>, [">= 0"])
|
67
71
|
s.add_dependency(%q<os>, [">= 0"])
|
72
|
+
s.add_dependency(%q<notifier>, [">= 0"])
|
68
73
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
69
74
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
70
75
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
71
76
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
72
77
|
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
73
78
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
79
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
74
80
|
end
|
75
81
|
else
|
76
82
|
s.add_dependency(%q<pusher>, [">= 0"])
|
@@ -79,12 +85,14 @@ Gem::Specification.new do |s|
|
|
79
85
|
s.add_dependency(%q<recursive-open-struct>, [">= 0"])
|
80
86
|
s.add_dependency(%q<pidfile>, [">= 0"])
|
81
87
|
s.add_dependency(%q<os>, [">= 0"])
|
88
|
+
s.add_dependency(%q<notifier>, [">= 0"])
|
82
89
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
83
90
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
84
91
|
s.add_dependency(%q<yard>, ["~> 0.7"])
|
85
92
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
86
93
|
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
87
94
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
95
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
88
96
|
end
|
89
97
|
end
|
90
98
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notify-push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Nomitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pusher
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: notifier
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: shoulda
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +192,20 @@ dependencies:
|
|
178
192
|
- - ">="
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: pry
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
181
209
|
description: A general purpose popup notifier sender/receiver using WebSockets (via
|
182
210
|
Pusher)
|
183
211
|
email: erik@nomitch.com
|
@@ -196,6 +224,8 @@ files:
|
|
196
224
|
- Rakefile
|
197
225
|
- VERSION
|
198
226
|
- bin/notify-push
|
227
|
+
- contrib/irssi/notify_push.pl
|
228
|
+
- contrib/shell/notify-push-curl
|
199
229
|
- images/doc/terminal-notifier.png
|
200
230
|
- lib/notify-push.rb
|
201
231
|
- notify-push.gemspec
|