pushover 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pushover +2 -1
- data/lib/pushover/app.rb +2 -2
- data/lib/pushover/user.rb +2 -2
- data/lib/pushover/version.rb +1 -1
- data/pushover.gemspec +1 -0
- data/spec/bin/pushover_spec.rb +14 -5
- data/spec/lib/pushover/app_spec.rb +3 -3
- data/spec/lib/pushover/user_spec.rb +3 -3
- data/whatsnew.md +10 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e2a717fd5728c512f6c58a9fef3f1e40a8b3103
|
4
|
+
data.tar.gz: 020060276a59e65b83fc5a363dcfe7013f5e534e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd7f18dfbd1b3584b5ef27c45a6f011c02f9465cdcda9258ee343bffe465c79b57c3bccefa0a405a8989cbbd53410193111c9ae79bf5a06aaad01e7554d0e70d
|
7
|
+
data.tar.gz: 6941590b5140b4c38bd173e21d090b7c3f026ed8a8dd023668cf83aaf30af9e37bb9121fdbdc2e357c785800bb8b5f4f88353964419d50be4c4f04911a24c7dd
|
data/bin/pushover
CHANGED
@@ -27,7 +27,7 @@ bail = false
|
|
27
27
|
|
28
28
|
# Order is important.
|
29
29
|
if Options[:config_file]
|
30
|
-
Bini::Config.file = Options[:config_file]
|
30
|
+
Bini::Config.options[:file] = Options[:config_file]
|
31
31
|
puts "Selected config file: #{Options[:config_file]}"
|
32
32
|
end
|
33
33
|
|
@@ -126,6 +126,7 @@ exit if bail
|
|
126
126
|
options = Options[].select { |k,v| v}
|
127
127
|
options[:token] = Pushover::App.current_app
|
128
128
|
options[:user] = Pushover::User.current_user
|
129
|
+
|
129
130
|
options.delete :config_file
|
130
131
|
options.merge! message:message
|
131
132
|
|
data/lib/pushover/app.rb
CHANGED
@@ -43,8 +43,8 @@ module Pushover
|
|
43
43
|
# Return the current app selected, or the first one saved.
|
44
44
|
def current_app
|
45
45
|
# did something get supplied on the cli? try to find it.
|
46
|
-
if Bini::Options[:
|
47
|
-
@current_app = find Bini::Options[:
|
46
|
+
if Bini::Options[:token]
|
47
|
+
@current_app = find Bini::Options[:token]
|
48
48
|
else
|
49
49
|
@current_app = find Bini::Config[:applications].values.first if Bini::Config[:applications]
|
50
50
|
end
|
data/lib/pushover/user.rb
CHANGED
@@ -45,8 +45,8 @@ module Pushover
|
|
45
45
|
# Return the current user selected, or the first one saved.
|
46
46
|
def current_user
|
47
47
|
# did something get supplied on the cli? try to find it.
|
48
|
-
if Bini::Options[:
|
49
|
-
@current_user =
|
48
|
+
if Bini::Options[:user]
|
49
|
+
@current_user = Bini::Options[:user]
|
50
50
|
elsif !@current_user
|
51
51
|
@current_user = find Bini::Config[:users].values.first if Bini::Config[:users]
|
52
52
|
end
|
data/lib/pushover/version.rb
CHANGED
data/pushover.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.date = Time.now.strftime('%Y-%m-%d')
|
9
9
|
gem.version = Pushover::VERSION
|
10
10
|
gem.platform = Gem::Platform::RUBY
|
11
|
+
gem.license = "Beerware v42"
|
11
12
|
|
12
13
|
# descriptions
|
13
14
|
gem.description = "Api (and CLI) to interface with pushover.net"
|
data/spec/bin/pushover_spec.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# If you want to run these tests, add ENV["TEST_CLI"]
|
4
4
|
# If you have a credentials file already, you might find it beeps you.
|
5
5
|
|
6
|
+
# this should be a working cred file that can send messages for proper end to end testing.
|
6
7
|
CRED_FILE = "#{Dir.home}/.config/pushover/credentials.yaml"
|
7
8
|
FAKE_CRED_FILE = 'tmp/fake_credentials.yaml'
|
8
9
|
CMD = 'bundle exec bin/pushover'
|
@@ -22,14 +23,22 @@ if ENV["TEST_CLI"] =~ /^t/
|
|
22
23
|
end
|
23
24
|
|
24
25
|
describe "send" do
|
25
|
-
|
26
|
-
it "sends messages (no credentials file)"
|
27
|
-
else
|
28
|
-
it "sends messages" do
|
26
|
+
it "sends messages" do
|
29
27
|
p = CLIProcess.new "#{CMD} --config_file #{CRED_FILE} a message", 3, 3
|
30
28
|
p.run!
|
31
29
|
p.stdout.should include("success"), "#{p.stderr}"
|
32
|
-
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sends messages (no credentials file)" do
|
33
|
+
# for this trick, lets extract our creds from the cred file manually.
|
34
|
+
# store them locally,then pass them back as app/user arguments.
|
35
|
+
creds = YAML.load open(CRED_FILE).read
|
36
|
+
|
37
|
+
app = creds[:applications].first.values.first
|
38
|
+
user = creds[:users].first.values.first
|
39
|
+
p = CLIProcess.new "#{CMD} -a #{app} -u #{user} a message", 3, 3
|
40
|
+
p.run!
|
41
|
+
p.stdout.should include("success"), "#{p.stderr}"
|
33
42
|
end
|
34
43
|
|
35
44
|
it "lets me know when a message fails" do
|
@@ -30,20 +30,20 @@ describe "application" do
|
|
30
30
|
|
31
31
|
describe "#current_app" do
|
32
32
|
it "will look on the cli first" do
|
33
|
-
Bini::Options[:
|
33
|
+
Bini::Options[:token] = 'anapikey'
|
34
34
|
App.current_app.should eq "anapikey"
|
35
35
|
end
|
36
36
|
it "will grab the first app in the config as a last resort" do
|
37
37
|
App.add "foo", "bar2"
|
38
38
|
Bini::Config.save
|
39
|
-
Bini::Options[:
|
39
|
+
Bini::Options[:token] = nil
|
40
40
|
App.current_app.should eq "bar2"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "#current_app?" do
|
45
45
|
it "Will return true if we have a current_app" do
|
46
|
-
Bini::Options[:
|
46
|
+
Bini::Options[:token] = 'somethingsilly'
|
47
47
|
App.current_app.should eq 'somethingsilly'
|
48
48
|
end
|
49
49
|
it "Will return nil otherwise" do
|
@@ -30,20 +30,20 @@ describe "user" do
|
|
30
30
|
|
31
31
|
describe "#current_user" do
|
32
32
|
it "will look on the cli first" do
|
33
|
-
Bini::Options[:
|
33
|
+
Bini::Options[:user] = 'atoken'
|
34
34
|
User.current_user.should eq "atoken"
|
35
35
|
end
|
36
36
|
it "will grab the first user in the config as a last resort" do
|
37
37
|
User.add "foo", "bar2"
|
38
38
|
Bini::Config.save
|
39
|
-
Bini::Options[:
|
39
|
+
Bini::Options[:user] = nil
|
40
40
|
User.current_user.should eq "bar2"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "#current_user?" do
|
45
45
|
it "Will return true if we have a current_user" do
|
46
|
-
Bini::Options[:
|
46
|
+
Bini::Options[:user] = 'somethingsilly'
|
47
47
|
User.current_user?.should be_true
|
48
48
|
end
|
49
49
|
it "Will return nil otherwise" do
|
data/whatsnew.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
##
|
1
|
+
## 1.0.2
|
2
|
+
* hotfixes
|
3
|
+
* #13 added license to the gemspec
|
4
|
+
* #15 fixed the configfile not being configurable on the cli (and testing now)
|
5
|
+
* #16 fix for the --user option reading the app key (and tests).
|
6
|
+
|
7
|
+
## 1.0.1
|
8
|
+
* hot fix (merge from @cptobvious) for optional notification parameters.
|
9
|
+
|
10
|
+
## 1.0.0
|
2
11
|
* Sounds.
|
3
12
|
* Emergency notifications.
|
4
13
|
* Will properly trap 500 (server errors) being returned from the server.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Brodeur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yajl-ruby
|
@@ -85,7 +85,8 @@ files:
|
|
85
85
|
- spec/spec_helper.rb
|
86
86
|
- whatsnew.md
|
87
87
|
homepage: https://github.com/erniebrodeur/pushover
|
88
|
-
licenses:
|
88
|
+
licenses:
|
89
|
+
- Beerware v42
|
89
90
|
metadata: {}
|
90
91
|
post_install_message:
|
91
92
|
rdoc_options:
|