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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2ZjZGMyODUzOWEwZDllMDc3MjE4NjNlMWY5ZThjNDJmZjQ5MjBlNg==
4
+ ZThmMTI0NzkxMDMwNzRjOTdiNDRiMzRhY2NjNmQ2OTU0NzIwZDY2OA==
5
5
  data.tar.gz: !binary |-
6
- ZDAzYzViNTI1YmJmMDA4MmZlZTczMmU4NmRmZDU5MmFiMjNlYTE1Ng==
6
+ NTBlOTYwMjAxYWI2YjBkMWUyOTIxMTYyMWQ4ZGFjNWNmZjM0OGU2ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YTA5ODYzZTk5Y2ZkZWIzOWU5MzBjN2M5ZGYzOTY0MjA4Mzg3N2YyYTY1YmVm
10
- MWFlNGUwNTBiOTE3Njk3M2FmNzc1NGZkYTQ0NGIxYjYxNTZlODEwMzZkNDUy
11
- M2ZkNzgyYjFiMDg2ZjQzMGI5NmQ3NWRhMDVhMWVhZWQ4MmEwODQ=
9
+ NjI4OWE1NTM3NjJkMjAxNjE2Y2U0MDg2MmVhYjUyOTQ0OWZmYWMyYTRkNDI3
10
+ ZTlkODk1ZDc2YjQ5YTZmN2FhYTkwNjkyOWU4YjRkZTEzMzRhN2M4NWJjZGU0
11
+ YTYzOWM5ZGE1MmY3MGViYzRiNmIzYWVjNjlmYjZkNWM2ZmIxMzg=
12
12
  data.tar.gz: !binary |-
13
- MjFlMGZlMTI4ZjY2NGU3NmQ2ZDhhOWM1NDM4NzAyZTNmMmZlNGYwZDY3OGFj
14
- M2FmYWZjNWM3ZTFiYjJlZDMxNzc3OGFmNmFjNjkyOTZkYzU1MTQ4Y2MyYmVj
15
- MmVlNDY4YmU3ZjdhNjI0Y2RmMDVjMzE1M2RkZWM0MTQ1YTZkNDg=
13
+ Mzg5YWQzYmM1M2NhYjcwZmNhMDdmYzgzYzVlNWIwMjBmMTQwNzRiZGU5M2Nj
14
+ ZWRkNGFkZTEwMmY4MTVkYTQ5M2YzMTAwZGVkYmRlMDQwOTNmMjA2MWZhYjZj
15
+ MmY4YmRlNGY5MDg1Y2I0MWNhMzEzMzgwMDEzZjBkZWI1ZDZhNTE=
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in guard-pushover.gemspec
4
4
  gemspec
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).
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module PushoverVersion
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ describe Guard::Pushover do
20
20
  subject.run_on_removals(paths)
21
21
  end
22
22
 
23
- it "#run_on_additions_sends a notification to client with correct parameters" do
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 'user identifier is invalid'" do
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'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-pushover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Neverland