capistrano-stats 1.0.3 → 1.1.1
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/capistrano-stats/metric-collector.rb +30 -10
- data/lib/capistrano-stats/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52515a16e3df21ab213463d1840931b39d946a50
|
4
|
+
data.tar.gz: 7ca3fe990c9b274507d3d0dcc0edc5d0f926399c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd70b66c4971c2fba9647bbdd5a0f24dd979bbe44d616933b36545be05cd5579ccf42775429f1342fef097f0eaba8af438a943cb49fdf8709640e1f5211c9f77
|
7
|
+
data.tar.gz: bc24902af73f05881c60fc5a5a979625a0fbc9d35baf35f32af91497a16c3a2f9f6fb11d4a090301f6f0b87878284d1a5f67b7e8dec47a96f7017e66c78f69a9
|
@@ -12,16 +12,31 @@ module Capistrano
|
|
12
12
|
@pwd = Pathname.new(pwd)
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def user_preference
|
16
16
|
ask_to_enable unless File.exists?(sentry_file)
|
17
|
-
File.read(sentry_file)
|
17
|
+
pref = File.read(sentry_file)
|
18
|
+
if pref.chomp == "true"
|
19
|
+
:full
|
20
|
+
elsif pref.chomp == "false"
|
21
|
+
:ping
|
22
|
+
else
|
23
|
+
pref && pref.to_sym
|
24
|
+
end
|
18
25
|
end
|
19
26
|
|
20
27
|
def collect
|
28
|
+
return if user_preference == :none
|
21
29
|
socket = UDPSocket.new
|
22
|
-
message.anonymize! unless
|
30
|
+
message.anonymize! unless user_preference == :full
|
23
31
|
socket.send(message.to_s, 0, *destination)
|
24
|
-
rescue SocketError
|
32
|
+
rescue SocketError, Errno::EACCES, Errno::EADDRINUSE, Errno::EADDRNOTAVAIL,
|
33
|
+
Errno::EAFNOSUPPORT, Errno::EALREADY, Errno::EBADF, Errno::ECONNREFUSED,
|
34
|
+
Errno::ECONNRESET, Errno::EFAULT, Errno::EHOSTUNREACH, Errno::EINPROGRESS,
|
35
|
+
Errno::EINTR, Errno::EINVAL, Errno::EIO, Errno::EISCONN, Errno::ELOOP,
|
36
|
+
Errno::ENAMETOOLONG, Errno::ENETDOWN,
|
37
|
+
Errno::ENETUNREACH, Errno::ENOBUFS, Errno::ENOENT, Errno::ENOSR,
|
38
|
+
Errno::ENOTDIR, Errno::ENOTSOCK, Errno::EOPNOTSUPP, Errno::EPROTOTYPE,
|
39
|
+
Errno::ETIMEDOUT, Errno::EWOULDBLOCK
|
25
40
|
warn "There was a problem tracking statistics, please report to https://github.com/capistrano/stats"
|
26
41
|
end
|
27
42
|
|
@@ -52,7 +67,12 @@ module Capistrano
|
|
52
67
|
def ask_to_enable
|
53
68
|
return false unless $stdin.tty?
|
54
69
|
show_prompt
|
55
|
-
result = ask_to_confirm("Do you want to enable statistics? (y/N): ")
|
70
|
+
result = ask_to_confirm("Do you want to enable statistics? (y/N): ") ? :full : :ping
|
71
|
+
if result != :full
|
72
|
+
if ask_to_confirm("Do you also want to disable the UDP ping to the metrics server? (y/N): ")
|
73
|
+
result = :none
|
74
|
+
end
|
75
|
+
end
|
56
76
|
show_thank_you_note(result)
|
57
77
|
write_setting(result)
|
58
78
|
end
|
@@ -62,15 +82,15 @@ module Capistrano
|
|
62
82
|
Would you like to enable statistics? Here is an example message we would
|
63
83
|
send:
|
64
84
|
|
65
|
-
|
85
|
+
#{message}
|
66
86
|
|
67
87
|
EOF
|
68
88
|
end
|
69
89
|
|
70
90
|
def show_thank_you_note(result)
|
71
|
-
puts(result
|
72
|
-
|
73
|
-
|
91
|
+
puts(result == :full ?
|
92
|
+
"Thank you, you may wish to add .capistrano/ to your source control database to avoid future prompts" :
|
93
|
+
"Your preferences have been saved.")
|
74
94
|
end
|
75
95
|
|
76
96
|
def message
|
@@ -95,7 +115,7 @@ module Capistrano
|
|
95
115
|
def write_setting(value)
|
96
116
|
Dir.mkdir(sentry_file.dirname) rescue nil
|
97
117
|
File.open(sentry_file, "wb") do |f|
|
98
|
-
f.write(value)
|
118
|
+
f.write(value.to_sym)
|
99
119
|
end
|
100
120
|
end
|
101
121
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Hambley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Collects anonymous usage statistics about Capistrano to aid with platform
|
14
14
|
support and ruby version targeting.
|