phonehome 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phonehome/gem/version.rb +1 -1
- data/lib/phonehome.rb +7 -12
- 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: 5cd5c2086cd234c4391bb81093686ceae9558443
|
4
|
+
data.tar.gz: 55f5929b7b4c2cb51d9b15ca7d6852de9441cc69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23dd0d7d8ae38e67cd4e9d8c1340c1d849ddd62507226c04c66005f8773165e24a71ea728bc19c8d1d0e80dccd7d834edf229d94ae1e165d64c63a07d2900b70
|
7
|
+
data.tar.gz: b205ea056c5a81e8cc52f934edd6f3eda820e641f8fe48db978ab8775c960cc779de9fd4f7cdba6081ef16bb1291a7294b806c295bcd33a68db2add77f7b192d
|
data/lib/phonehome.rb
CHANGED
@@ -16,22 +16,15 @@ module Phonehome
|
|
16
16
|
p 'Something goes wrong. Server not responding'
|
17
17
|
return false
|
18
18
|
end
|
19
|
-
check_secret_key(secret_key)
|
19
|
+
check_secret_key(secret_key){yield}
|
20
20
|
user_events = get_user_events(secret_key).split
|
21
|
-
status =
|
22
|
-
|
23
|
-
if id.to_i != val.to_i
|
24
|
-
status += 1 # make +1 for status var if event IT not him
|
25
|
-
else
|
26
|
-
status = 0 # if find correct id break this
|
27
|
-
break
|
28
|
-
end
|
29
|
-
end
|
30
|
-
if status > 0
|
21
|
+
status = user_events.include?(id.to_s) ? true : false
|
22
|
+
if status == false
|
31
23
|
p 'You try to run not your event!' # Write error to console
|
24
|
+
yield
|
32
25
|
exit
|
33
26
|
end
|
34
|
-
start(secret_key, id) # id - from job, Event
|
27
|
+
start(secret_key, id){yield} # id - from job, Event
|
35
28
|
yield
|
36
29
|
stop(@id) # @id - from API, CurrentEvent
|
37
30
|
rescue => e
|
@@ -49,6 +42,7 @@ module Phonehome
|
|
49
42
|
response = Excon.post("http://#{@@phonehomeURL}/query/#{secret_key}/#{get_status(1)}/#{id}", :headers => { "Content-Type" => "application/json" })
|
50
43
|
if JSON.parse(response.body)['status'] == 'All events are completed'
|
51
44
|
p "#{id}: All events are completed"
|
45
|
+
yield
|
52
46
|
raise "#{id}: All events are completed"
|
53
47
|
end
|
54
48
|
@id = JSON.parse(response.body)['id']
|
@@ -85,6 +79,7 @@ module Phonehome
|
|
85
79
|
response = Excon.post("http://#{@@phonehomeURL}/check_secret_key/#{secret_key}")
|
86
80
|
if response.data[:body] != 'true'
|
87
81
|
p 'Your secret key is invalid!'
|
82
|
+
yield
|
88
83
|
exit
|
89
84
|
end
|
90
85
|
end
|