guard-pushover 0.2.0 → 0.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 +8 -8
- data/Gemfile +1 -1
- data/README.md +5 -0
- data/lib/guard/pushover.rb +3 -3
- data/lib/guard/pushover/version.rb +1 -1
- data/spec/guard/pushover_spec.rb +29 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZThmMTI0NzkxMDMwNzRjOTdiNDRiMzRhY2NjNmQ2OTU0NzIwZDY2OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTBlOTYwMjAxYWI2YjBkMWUyOTIxMTYyMWQ4ZGFjNWNmZjM0OGU2ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjI4OWE1NTM3NjJkMjAxNjE2Y2U0MDg2MmVhYjUyOTQ0OWZmYWMyYTRkNDI3
|
10
|
+
ZTlkODk1ZDc2YjQ5YTZmN2FhYTkwNjkyOWU4YjRkZTEzMzRhN2M4NWJjZGU0
|
11
|
+
YTYzOWM5ZGE1MmY3MGViYzRiNmIzYWVjNjlmYjZkNWM2ZmIxMzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mzg5YWQzYmM1M2NhYjcwZmNhMDdmYzgzYzVlNWIwMjBmMTQwNzRiZGU5M2Nj
|
14
|
+
ZWRkNGFkZTEwMmY4MTVkYTQ5M2YzMTAwZGVkYmRlMDQwOTNmMjA2MWZhYjZj
|
15
|
+
MmY4YmRlNGY5MDg1Y2I0MWNhMzEzMzgwMDEzZjBkZWI1ZDZhNTE=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -40,6 +40,11 @@ end
|
|
40
40
|
``` ruby
|
41
41
|
:title => 'Title' # Custom title, default is 'Guard'
|
42
42
|
:priority => 1 # Priority, default is 0
|
43
|
+
:message => "Filename: %s" # Custom message, using sprintf.
|
44
|
+
:ignore_additions => true # Ignores added files
|
45
|
+
:ignore_changes => true # Ignores changed files
|
46
|
+
:ignore_removals => true # Ignores removed files
|
47
|
+
|
43
48
|
```
|
44
49
|
|
45
50
|
Read more on [Pushover API](https://pushover.net/api).
|
data/lib/guard/pushover.rb
CHANGED
@@ -20,15 +20,15 @@ module Guard
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def run_on_changes(paths)
|
23
|
-
send_notification "%s was changed.", paths.first
|
23
|
+
send_notification "%s was changed.", paths.first unless options.delete(:ignore_changes)
|
24
24
|
end
|
25
25
|
|
26
26
|
def run_on_removals(paths)
|
27
|
-
send_notification "%s was removed.", paths.first
|
27
|
+
send_notification "%s was removed.", paths.first unless options.delete(:ignore_removals)
|
28
28
|
end
|
29
29
|
|
30
30
|
def run_on_additions(paths)
|
31
|
-
send_notification "%s was added.", paths.first
|
31
|
+
send_notification "%s was added.", paths.first unless options.delete(:ignore_additions)
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
data/spec/guard/pushover_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe Guard::Pushover do
|
|
20
20
|
subject.run_on_removals(paths)
|
21
21
|
end
|
22
22
|
|
23
|
-
it "#
|
23
|
+
it "#run_on_additions sends a notification to client with correct parameters" do
|
24
24
|
message = "#{paths.first} was added."
|
25
25
|
client.should_receive(:notify).with(user_key, message, expected_options)
|
26
26
|
Guard::UI.should_receive(:info).with(/Pushover: message sent/)
|
@@ -28,6 +28,33 @@ describe Guard::Pushover do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
context "with options :ignore_additions => true" do
|
32
|
+
let(:options) { {:user_key => user_key, :api_key => api_key, :client => client, :ignore_additions => true} }
|
33
|
+
it "#run_on_additions does not send a notification" do
|
34
|
+
client.should_not_receive(:notify)
|
35
|
+
Guard::UI.should_not_receive(:info)
|
36
|
+
subject.run_on_additions(paths)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "with options :ignore_removals => true" do
|
41
|
+
let(:options) { {:user_key => user_key, :api_key => api_key, :client => client, :ignore_removals => true} }
|
42
|
+
it "#run_on_additions does not send a notification" do
|
43
|
+
client.should_not_receive(:notify)
|
44
|
+
Guard::UI.should_not_receive(:info)
|
45
|
+
subject.run_on_removals(paths)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "with options :ignore_changes => true" do
|
50
|
+
let(:options) { {:user_key => user_key, :api_key => api_key, :client => client, :ignore_changes => true} }
|
51
|
+
it "#run_on_additions does not send a notification" do
|
52
|
+
client.should_not_receive(:notify)
|
53
|
+
Guard::UI.should_not_receive(:info)
|
54
|
+
subject.run_on_changes(paths)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
31
58
|
describe "#run_on_changes" do
|
32
59
|
let(:run_on_changes){subject.run_on_changes(paths)}
|
33
60
|
|
@@ -110,7 +137,7 @@ describe Guard::Pushover do
|
|
110
137
|
end
|
111
138
|
|
112
139
|
context "for 'token' key" do
|
113
|
-
it "shows error message '
|
140
|
+
it "shows error message 'application token is invalid'" do
|
114
141
|
response.stub(:[]).with(:user).and_return(true)
|
115
142
|
response.stub(:[]).with(:token).and_return('invalid')
|
116
143
|
response.stub(:[]).with(:errors).and_return(['application token is invalid'])
|