rscout 0.0.7 → 0.0.8

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: f99db4dc314b86a999f18358e0b0b00443d72fed
4
- data.tar.gz: a48d9e65ffa1138de4233062f246c560691d5e74
3
+ metadata.gz: 2b4e0f84ccdddbea2fb2e27d4017f6ae4d3d95f2
4
+ data.tar.gz: ae5c5d7608094e91b5753f1156aab2cd46571916
5
5
  SHA512:
6
- metadata.gz: 5f865c5c520d4981b433226734e80fad990525a521f013cfd6bfc65b1a91dfbdd6f96deceb90b916a230da576b4a25d931a7155a57c7aa1e785e2f2fd54f065a
7
- data.tar.gz: 7065eb96ad0b9403c6b9158b8c79e3b4e6ae4691bf94f7e891ea058540134bf1960b9b526e2db3d2cb9e8c6e1f7a6b9a631baea5f3979c0d4dba4a5fa32399da
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 SMTP ENV keys if applicable.
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
@@ -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
- send_failure_notifications config, env, output
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 send_failure_notifications(config, env, output)
107
- email_body = [output.txt.string, output.error.backtrace.join("\n")].join("\n")
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 emails alert to #{config.email}"
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 "RScout Alert: Tests failing on #{config.name.to_s.humanize.titleize} (#{env})"
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
- header["X-Priority"] = "1 (Highest)"
118
- header["X-MSMail-Priority"] = "High"
119
- header["Importance"] = "High"
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$/)
@@ -1,3 +1,3 @@
1
1
  module Rscout
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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.7
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-05-28 00:00:00.000000000 Z
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: {}