guard-pushover 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in guard-pushover.gemspec
4
4
  gemspec
@@ -16,19 +16,24 @@ module Guard
16
16
  options = DEFAULTS.merge(options)
17
17
  @user_key = options.delete(:user_key)
18
18
  @api_key = options.delete(:api_key)
19
+ @default_message = options.delete(:message)
20
+ @ignore_changes = options.delete(:ignore_changes)
21
+ @ignore_removals = options.delete(:ignore_removals)
22
+ @ignore_additions = options.delete(:ignore_additions)
23
+
19
24
  super watchers, options
20
25
  end
21
26
 
22
27
  def run_on_changes(paths)
23
- send_notification "%s was changed.", paths.first unless options.delete(:ignore_changes)
28
+ send_notification "%s was changed.", paths.first unless @ignore_changes
24
29
  end
25
30
 
26
31
  def run_on_removals(paths)
27
- send_notification "%s was removed.", paths.first unless options.delete(:ignore_removals)
32
+ send_notification "%s was removed.", paths.first unless @ignore_removals
28
33
  end
29
34
 
30
35
  def run_on_additions(paths)
31
- send_notification "%s was added.", paths.first unless options.delete(:ignore_additions)
36
+ send_notification "%s was added.", paths.first unless @ignore_additions
32
37
  end
33
38
 
34
39
  private
@@ -39,7 +44,7 @@ module Guard
39
44
 
40
45
  def send_notification(msg, file)
41
46
  return unless api_keys_present?
42
- msg = (options.delete(:message) || msg) % file
47
+ msg = (@default_message || msg) % file
43
48
  @resp = client.notify(@user_key, msg, options)
44
49
  if @resp.ok?
45
50
  UI.info "Pushover: message sent"
@@ -61,4 +66,4 @@ module Guard
61
66
  UI.error "#{@resp[:errors].join()}#{append}"
62
67
  end
63
68
  end
64
- end
69
+ end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module PushoverVersion
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -30,28 +30,109 @@ describe Guard::Pushover do
30
30
 
31
31
  context "with options :ignore_additions => true" do
32
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)
33
+
34
+ describe "#run_on_additions" do
35
+ before :each do
36
+ client.should_not_receive(:notify)
37
+ Guard::UI.should_not_receive(:info)
38
+ end
39
+
40
+ it "does not send a notification" do
41
+ subject.run_on_additions(paths)
42
+ end
43
+
44
+ it "does not send a notification when called twice" do
45
+ subject.run_on_additions(paths)
46
+ subject.run_on_additions(paths)
47
+ end
48
+ end
49
+
50
+ describe "#run_on_changes" do
51
+ it "sends a notification" do
52
+ client.should_receive(:notify)
53
+ Guard::UI.should_receive(:info)
54
+ subject.run_on_changes(paths)
55
+ end
56
+ end
57
+
58
+ describe "#run_on_removals" do
59
+ it "sends a notification" do
60
+ client.should_receive(:notify)
61
+ Guard::UI.should_receive(:info)
62
+ subject.run_on_removals(paths)
63
+ end
37
64
  end
38
65
  end
39
66
 
40
67
  context "with options :ignore_removals => true" do
41
68
  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)
69
+
70
+ describe "#run_on_removals" do
71
+ before :each do
72
+ client.should_not_receive(:notify)
73
+ Guard::UI.should_not_receive(:info)
74
+ end
75
+
76
+ it "does not send a notification" do
77
+ subject.run_on_removals(paths)
78
+ end
79
+
80
+ it "does not send a notification when called twice" do
81
+ subject.run_on_removals(paths)
82
+ subject.run_on_removals(paths)
83
+ end
84
+ end
85
+
86
+ describe "#run_on_changes" do
87
+ it "sends a notification" do
88
+ client.should_receive(:notify)
89
+ Guard::UI.should_receive(:info)
90
+ subject.run_on_changes(paths)
91
+ end
92
+ end
93
+
94
+ describe "#run_on_additions" do
95
+ it "sends a notification" do
96
+ client.should_receive(:notify)
97
+ Guard::UI.should_receive(:info)
98
+ subject.run_on_additions(paths)
99
+ end
46
100
  end
47
101
  end
48
102
 
49
103
  context "with options :ignore_changes => true" do
50
104
  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)
105
+
106
+ describe "#run_on_changes" do
107
+ before :each do
108
+ client.should_not_receive(:notify)
109
+ Guard::UI.should_not_receive(:info)
110
+ end
111
+
112
+ it "does not send a notification" do
113
+ subject.run_on_changes(paths)
114
+ end
115
+
116
+ it "does not send a notification when called twice" do
117
+ subject.run_on_changes(paths)
118
+ subject.run_on_changes(paths)
119
+ end
120
+ end
121
+
122
+ describe "#run_on_removals" do
123
+ it "sends a notification" do
124
+ client.should_receive(:notify)
125
+ Guard::UI.should_receive(:info)
126
+ subject.run_on_removals(paths)
127
+ end
128
+ end
129
+
130
+ describe "#run_on_additions" do
131
+ it "sends a notification" do
132
+ client.should_receive(:notify)
133
+ Guard::UI.should_receive(:info)
134
+ subject.run_on_additions(paths)
135
+ end
55
136
  end
56
137
  end
57
138
 
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-pushover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jon Neverland
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-05 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rushover
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: guard
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: guard
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: guard-rspec
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rspec
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: coveralls
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -118,27 +131,29 @@ files:
118
131
  homepage: https://github.com/joenas/guard-pushover/
119
132
  licenses:
120
133
  - MIT
121
- metadata: {}
122
134
  post_install_message:
123
135
  rdoc_options: []
124
136
  require_paths:
125
137
  - lib
126
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
127
140
  requirements:
128
141
  - - ! '>='
129
142
  - !ruby/object:Gem::Version
130
143
  version: '0'
131
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
132
146
  requirements:
133
147
  - - ! '>='
134
148
  - !ruby/object:Gem::Version
135
149
  version: '0'
136
150
  requirements: []
137
151
  rubyforge_project:
138
- rubygems_version: 2.0.0
152
+ rubygems_version: 1.8.24
139
153
  signing_key:
140
- specification_version: 4
154
+ specification_version: 3
141
155
  summary: ''
142
156
  test_files:
143
157
  - spec/guard/pushover_spec.rb
144
158
  - spec/spec_helper.rb
159
+ has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZThmMTI0NzkxMDMwNzRjOTdiNDRiMzRhY2NjNmQ2OTU0NzIwZDY2OA==
5
- data.tar.gz: !binary |-
6
- NTBlOTYwMjAxYWI2YjBkMWUyOTIxMTYyMWQ4ZGFjNWNmZjM0OGU2ZQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NjI4OWE1NTM3NjJkMjAxNjE2Y2U0MDg2MmVhYjUyOTQ0OWZmYWMyYTRkNDI3
10
- ZTlkODk1ZDc2YjQ5YTZmN2FhYTkwNjkyOWU4YjRkZTEzMzRhN2M4NWJjZGU0
11
- YTYzOWM5ZGE1MmY3MGViYzRiNmIzYWVjNjlmYjZkNWM2ZmIxMzg=
12
- data.tar.gz: !binary |-
13
- Mzg5YWQzYmM1M2NhYjcwZmNhMDdmYzgzYzVlNWIwMjBmMTQwNzRiZGU5M2Nj
14
- ZWRkNGFkZTEwMmY4MTVkYTQ5M2YzMTAwZGVkYmRlMDQwOTNmMjA2MWZhYjZj
15
- MmY4YmRlNGY5MDg1Y2I0MWNhMzEzMzgwMDEzZjBkZWI1ZDZhNTE=