rscout 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -2
- data/bin/rscout +2 -0
- data/lib/rscout.rb +23 -15
- data/lib/rscout/version.rb +1 -1
- data/rscout.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b4e0f84ccdddbea2fb2e27d4017f6ae4d3d95f2
|
4
|
+
data.tar.gz: ae5c5d7608094e91b5753f1156aab2cd46571916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0baee0226aceb46c71edb2697ba40f8679b5a8ce547e3e3328a06c720124f7816636597d977abd44b4459482e81dc748bdd27df29c6d6e0bb13ecbfbbc59e871
|
7
|
+
data.tar.gz: 6a6ec2e4968aae8cf02797014c4c7d089b01966f8ef7f80ba9de7153d5fca7b93ac2b31f59990cef858bee179fb094c9dc41fb24ce05df522c124706cd5cce08
|
data/README.md
CHANGED
@@ -69,9 +69,21 @@ Note: For PagerDuty configurations, you should use their REST API to determine t
|
|
69
69
|
The `rscout` command should be run from the directory where you keep your RScout test Gemfile. See Configuration section above.
|
70
70
|
|
71
71
|
$ cd myproject
|
72
|
-
$ SMTP_ADDRESS=localhost SMTP_PORT=1025 bundle exec rscout test --env production`
|
72
|
+
$ RSCOUT_LOG=/path/to/rscout.log RSCOUT_EMAIL=rscout_from@example.com SMTP_ADDRESS=localhost SMTP_PORT=1025 bundle exec rscout test --env production`
|
73
73
|
|
74
|
-
Supply the rscout command with the necessary
|
74
|
+
Supply the rscout command with the necessary ENV keys if applicable.
|
75
|
+
|
76
|
+
For documentation, run `rscout --help`, which outputs:
|
77
|
+
|
78
|
+
```
|
79
|
+
Usage:
|
80
|
+
rscout test e, --env=ENV
|
81
|
+
|
82
|
+
Options:
|
83
|
+
e, --env=ENV # The environment to run the test suite on.
|
84
|
+
s, [--send-success], [--no-send-success] # Send notifications even without any test failures.
|
85
|
+
v, [--verbose], [--no-verbose] # Show verbose messaging.
|
86
|
+
```
|
75
87
|
|
76
88
|
## TODO
|
77
89
|
|
data/bin/rscout
CHANGED
@@ -12,6 +12,7 @@ Dotenv.load
|
|
12
12
|
class RscoutCommand < Thor
|
13
13
|
desc 'test', 'Run tests'
|
14
14
|
method_option :env, required: :true, type: :string, aliases: [:e], desc: 'The environment to run the test suite on.'
|
15
|
+
method_option :send_success, type: :boolean, aliases: [:s], default: false, lazy_default: true, desc: 'Send notifications even without any test failures.'
|
15
16
|
method_option :verbose, type: :boolean, aliases: [:v], default: false, lazy_default: true, desc: 'Show verbose messaging.'
|
16
17
|
def test
|
17
18
|
Mail.defaults do
|
@@ -32,6 +33,7 @@ class RscoutCommand < Thor
|
|
32
33
|
RScout.options[:env] = options.env
|
33
34
|
RScout.options[:verbose] = options.verbose
|
34
35
|
RScout.options[:from_email] = ENV['RSCOUT_EMAIL'] if ENV['RSCOUT_EMAIL']
|
36
|
+
RScout.options[:send_success] = options.send_success
|
35
37
|
|
36
38
|
RScout.run_suite Dir.pwd
|
37
39
|
end
|
data/lib/rscout.rb
CHANGED
@@ -18,7 +18,8 @@ module RScout
|
|
18
18
|
logger: DEFAULT_LOGGER,
|
19
19
|
verbose: false,
|
20
20
|
env: 'development',
|
21
|
-
from_email: 'rscout@localhost'
|
21
|
+
from_email: 'rscout@localhost',
|
22
|
+
send_success: false
|
22
23
|
}
|
23
24
|
|
24
25
|
class << self
|
@@ -93,9 +94,9 @@ module RScout
|
|
93
94
|
output.json.close unless output.json.closed?
|
94
95
|
end
|
95
96
|
|
96
|
-
if failed
|
97
|
-
logger.info "Tests failed."
|
98
|
-
|
97
|
+
if failed || options[:send_success]
|
98
|
+
logger.info (failed ? "Tests failed." : "Tests passed.")
|
99
|
+
send_notifications config, env, output, failed
|
99
100
|
end
|
100
101
|
|
101
102
|
failed
|
@@ -103,24 +104,31 @@ module RScout
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
106
|
-
def
|
107
|
-
|
107
|
+
def send_notifications(config, env, output, failed=false)
|
108
|
+
email_body_parts = []
|
109
|
+
email_body_parts << output.txt.string if output.txt && output.txt.respond_to?(:string)
|
110
|
+
email_body_parts << output.error.backtrace.join("\n") if output.error.backtrace
|
111
|
+
email_body = email_body_parts.join("\n\n")
|
112
|
+
|
108
113
|
if config.email_enabled && config.email
|
109
|
-
logger.info "Sending
|
114
|
+
logger.info "Sending email alert to #{config.email}"
|
115
|
+
|
116
|
+
status_text = failed ? "RSout Alert: Tests failing" : "RScout: All tests passing"
|
117
|
+
|
110
118
|
begin
|
111
119
|
mail = Mail.new do
|
112
120
|
from RScout.options[:from_email]
|
113
121
|
to config.email
|
114
|
-
subject "
|
122
|
+
subject "#{status_text} on #{config.name.to_s.humanize.titleize} (#{env})"
|
115
123
|
add_file filename: 'results.html', content: output.html.string
|
116
124
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
text_part do
|
122
|
-
body email_body
|
125
|
+
if failed
|
126
|
+
header["X-Priority"] = "1 (Highest)"
|
127
|
+
header["X-MSMail-Priority"] = "High"
|
128
|
+
header["Importance"] = "High"
|
123
129
|
end
|
130
|
+
|
131
|
+
body email_body
|
124
132
|
end
|
125
133
|
|
126
134
|
mail.deliver!
|
@@ -130,7 +138,7 @@ module RScout
|
|
130
138
|
end
|
131
139
|
end
|
132
140
|
|
133
|
-
if config.pagerduty_enabled && config.pagerduty_service_key
|
141
|
+
if failed && config.pagerduty_enabled && config.pagerduty_service_key
|
134
142
|
logger.info "Triggering PagerDuty incident to #{config.pagerduty_service_key}"
|
135
143
|
begin
|
136
144
|
if config.pagerduty_service_key.match(/@(.*)pagerduty.com$/)
|
data/lib/rscout/version.rb
CHANGED
data/rscout.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["andrew@tremorlab.com"]
|
11
11
|
spec.description = %q{Integration tests with Rspec}
|
12
12
|
spec.summary = %q{Integration tests with Rspec}
|
13
|
-
spec.homepage = "https://github.com/andrhamm"
|
13
|
+
spec.homepage = "https://github.com/andrhamm/rscout"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rscout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hammond (@andrhamm)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -215,7 +215,7 @@ files:
|
|
215
215
|
- lib/rscout.rb
|
216
216
|
- lib/rscout/version.rb
|
217
217
|
- rscout.gemspec
|
218
|
-
homepage: https://github.com/andrhamm
|
218
|
+
homepage: https://github.com/andrhamm/rscout
|
219
219
|
licenses:
|
220
220
|
- MIT
|
221
221
|
metadata: {}
|