pushover 1.0.1 → 1.0.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c82845fa7fc83d75b2de7531edd42cee14e97a36
4
- data.tar.gz: c9a78c165ff694607281d4e7186ebd5983d3d222
3
+ metadata.gz: 0e2a717fd5728c512f6c58a9fef3f1e40a8b3103
4
+ data.tar.gz: 020060276a59e65b83fc5a363dcfe7013f5e534e
5
5
  SHA512:
6
- metadata.gz: d101253f3fc643bf54208d7b20e2009523ab5047a273e019b31d3c8eb5a963e81ffd45cef49e3c23fd9736a3e3d6f7913388fdd7befb43598cf7829c2badc066
7
- data.tar.gz: c53ffd5bdcbb514e2a9863b668dd36605d8220447f7b0e9a4fd25b9981e464b88bd12b2c4c3634daa105d670205257feccaa139703dfd1fa958c57b73300a9de
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[:apikey]
47
- @current_app = find Bini::Options[:apikey]
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[:token]
49
- @current_user = find Bini::Options[:token]
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
@@ -1,4 +1,4 @@
1
1
  module Pushover
2
2
  # The current version of Pushover.
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
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"
@@ -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
- if !File.exist? CRED_FILE
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
- end
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[:apikey] = 'anapikey'
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[:apikey] = nil
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[:apikey] = 'somethingsilly'
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[:token] = 'atoken'
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[:token] = nil
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[:token] = 'somethingsilly'
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
- ## Unreleased
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.1
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-18 00:00:00.000000000 Z
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: