vagrant-pushbullet 0.0.1 → 0.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 +4 -4
- data/lib/vagrant-pushbullet/action.rb +9 -4
- data/lib/vagrant-pushbullet/command.rb +25 -3
- data/lib/vagrant-pushbullet/version.rb +1 -1
- data/lib/vagrant-pushbullet.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4d393525735d38ac184cb042021596e7cd85a8
|
4
|
+
data.tar.gz: 5b09f487377d9fd30fdbc0aff454ed767e6eb366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6f790325aa3add30115059781fb95a141231e35c2803aa6f3c743c3d6730480494490f1b0c9d3199e1d81551ab86e4b02731cbb6e7a2da1cb9886fe3ea15701
|
7
|
+
data.tar.gz: c1d345ec30331b2ddee6f387ab4a7cf26d42d42d9a861c5507caa90dd242170f0b28088af2ca2d6a81944bad490479a628c278ba8c8d3b0dde9a82344ac80e8e
|
@@ -31,7 +31,6 @@ module VagrantPlugins
|
|
31
31
|
env[:ui].error("Pushbullet plugin configuration has not yet been set up. \nPlease replace required values in config file: #{config_file} ")
|
32
32
|
end
|
33
33
|
|
34
|
-
@machinfo = env[:machine]
|
35
34
|
case action
|
36
35
|
when :up
|
37
36
|
notification(config, config_file) if state != :running && provision && config.is_config_valid
|
@@ -48,9 +47,15 @@ module VagrantPlugins
|
|
48
47
|
devices = PushbulletConfig::DEVICES
|
49
48
|
token = PushbulletConfig::TOKEN
|
50
49
|
client = Washbullet::Client.new(token)
|
51
|
-
devices.
|
52
|
-
|
53
|
-
|
50
|
+
if(devices.length > 0)
|
51
|
+
devices.each {|iden|
|
52
|
+
client.push_note(iden, "Vagrant Finished: #{@machine}", '')
|
53
|
+
}
|
54
|
+
else
|
55
|
+
#push to all
|
56
|
+
client.push_note('', "Vagrant Finished: #{@machine}", '')
|
57
|
+
end
|
58
|
+
|
54
59
|
end
|
55
60
|
end
|
56
61
|
end
|
@@ -25,12 +25,14 @@ To notify all devices:
|
|
25
25
|
- Leave the DEVICES variable empty in your config file.
|
26
26
|
INFO
|
27
27
|
@env.ui.info(guide)
|
28
|
-
|
29
|
-
client = Washbullet::Client.new('v1zUVfPeLEveoY8suYABuu9WmuZUDhItndujC7jkt9OgK')
|
30
28
|
require config_file
|
29
|
+
|
30
|
+
wb_client = get_washbullet_client(PushbulletConfig::TOKEN,config_file)
|
31
|
+
return if wb_client == nil
|
32
|
+
|
31
33
|
enabled_devices = PushbulletConfig::DEVICES
|
32
34
|
|
33
|
-
devices =
|
35
|
+
devices = wb_client.devices.body["devices"]
|
34
36
|
msg = []
|
35
37
|
devices.each { |device|
|
36
38
|
if device["active"]
|
@@ -49,6 +51,26 @@ INFO
|
|
49
51
|
@env.ui.error("Please put your pushbullet token from http://pushbullet.com/account into this file: #{config_file}.
|
50
52
|
\n ---- Then run this command again to limit pushes to specific devices-----")
|
51
53
|
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def get_washbullet_client(api_token,config_file)
|
59
|
+
if (api_token.nil? || api_token.empty?)
|
60
|
+
@env.ui.error("Your API Token is not set. \nYou can find it here: http://pushbullet.com/account \nAnd enter it here: #{config_file}")
|
61
|
+
return nil
|
62
|
+
end
|
63
|
+
|
64
|
+
begin
|
65
|
+
client = Washbullet::Client.new(api_token)
|
66
|
+
rescue Washbullet::Unauthorized
|
67
|
+
@env.ui.error("Pushbullet API Authentication failed. Please compare your API Token: http://pushbullet.com/account with: #{config_file}")
|
68
|
+
return nil
|
69
|
+
rescue Exception => e
|
70
|
+
@env.ui.error("There was an unknown exception with the Pushbullet plugin. \n Please report this to https://github.com/brettswift/vagrant-pushbullet")
|
71
|
+
raise e
|
72
|
+
end
|
73
|
+
|
52
74
|
end
|
53
75
|
end
|
54
76
|
end
|
data/lib/vagrant-pushbullet.rb
CHANGED