knapsack_pro 0.34.0 → 0.35.0

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: 3e582f3bb77bbb31b75f5af3dafaf64640cc5422
4
- data.tar.gz: 3c63bb3184ad83294ea4e56228a0f6162339a06d
3
+ metadata.gz: '094b839e2b6fef614a4c91b10579d484ee7aef37'
4
+ data.tar.gz: 1270f9dd4023504fa6fb4ab929ffeaccc605d529
5
5
  SHA512:
6
- metadata.gz: 967fc7bf640046172006cf18cd7f29b83875755cec5f008f5a0abe63578fbb3d0eb16958800155acc3b6f3a395b628c510414eec26251acde8d08dd7d3b939ea
7
- data.tar.gz: 74dcb5541c52a0f4bd3bd83b31a3553946b77f9ebe06a61f8b6d2595a2732b9564201e071694b0b85f64aa7019c6d7af07e11f71742d69fb047b2bf9ca83b684
6
+ metadata.gz: c8266d9534aa7f0f93dfbce4e7a3699a9363f2a256a8c22e7dd3410d0ba50c27a73dd29cbdfa3fd53159520dca455257a1925b33f7904812f4f4cbe6f19e46a0
7
+ data.tar.gz: ad0ce91e958078a3884913aab721a9d08be79a0c22bbeaa387d1c16ff2a18a83f647d914e2d230a6b9aaf6627aa5e3bc173bc721ad0cb4ad6626d9e716a31dfa
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.35.0
6
+
7
+ * Add `RSpecQueueProfileFormatterExtension` to show profile summary only once at the very end of RSpec Queue Mode output.
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.34.0...v0.35.0
10
+
5
11
  ### 0.34.0
6
12
 
7
13
  * Fix command visible at the end of RSpec Queue Mode output to be able retry test files with spaces in name.
@@ -0,0 +1,56 @@
1
+ RSpec::Support.require_rspec_core('formatters/profile_formatter')
2
+
3
+ module KnapsackPro
4
+ module Formatters
5
+ module RSpecQueueProfileFormatterExtension
6
+ def self.print_summary
7
+ return unless KnapsackPro::Config::Env.modify_default_rspec_formatters?
8
+ RSpec::Core::Formatters::ProfileFormatter.print_profile_summary
9
+ end
10
+
11
+ def initialize(output)
12
+ @output = output
13
+ self.class.registered_output = output
14
+ end
15
+
16
+ def dump_profile(profile)
17
+ self.class.most_recent_profile = profile
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ if KnapsackPro::Config::Env.modify_default_rspec_formatters?
24
+ class RSpec::Core::Formatters::ProfileFormatter
25
+ prepend KnapsackPro::Formatters::RSpecQueueProfileFormatterExtension
26
+
27
+ def self.registered_output=(output)
28
+ @registered_output = {
29
+ ENV['KNAPSACK_PRO_QUEUE_ID'] => output
30
+ }
31
+ end
32
+
33
+ def self.registered_output
34
+ @registered_output ||= {}
35
+ @registered_output[ENV['KNAPSACK_PRO_QUEUE_ID']]
36
+ end
37
+
38
+ def self.most_recent_profile=(profile)
39
+ @most_recent_profile = {
40
+ ENV['KNAPSACK_PRO_QUEUE_ID'] => profile
41
+ }
42
+ end
43
+
44
+ def self.most_recent_profile
45
+ @most_recent_profile ||= {}
46
+ @most_recent_profile[ENV['KNAPSACK_PRO_QUEUE_ID']] || []
47
+ end
48
+
49
+ def self.print_profile_summary
50
+ return unless registered_output
51
+ profile_formatter = new(registered_output)
52
+ profile_formatter.send(:dump_profile_slowest_examples, most_recent_profile)
53
+ profile_formatter.send(:dump_profile_slowest_example_groups, most_recent_profile)
54
+ end
55
+ end
56
+ end
@@ -5,6 +5,7 @@ module KnapsackPro
5
5
  def self.run(args)
6
6
  require 'rspec/core'
7
7
  require_relative '../../formatters/rspec_queue_summary_formatter'
8
+ require_relative '../../formatters/rspec_queue_profile_formatter_extension'
8
9
 
9
10
  ENV['KNAPSACK_PRO_TEST_SUITE_TOKEN'] = KnapsackPro::Config::Env.test_suite_token_rspec
10
11
  ENV['KNAPSACK_PRO_QUEUE_RECORDING_ENABLED'] = 'true'
@@ -29,6 +30,7 @@ module KnapsackPro
29
30
  if test_file_paths.empty?
30
31
  unless all_test_file_paths.empty?
31
32
  KnapsackPro::Formatters::RSpecQueueSummaryFormatter.print_summary
33
+ KnapsackPro::Formatters::RSpecQueueProfileFormatterExtension.print_summary
32
34
 
33
35
  log_rspec_command(args, all_test_file_paths, :end_of_queue)
34
36
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.34.0'
2
+ VERSION = '0.35.0'
3
3
  end
@@ -6,6 +6,7 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
6
6
  stub_const('ENV', { 'KNAPSACK_PRO_MODIFY_DEFAULT_RSPEC_FORMATTERS' => false })
7
7
 
8
8
  require KnapsackPro.root + '/lib/knapsack_pro/formatters/rspec_queue_summary_formatter'
9
+ require KnapsackPro.root + '/lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension'
9
10
  end
10
11
 
11
12
  describe '.run' do
@@ -108,6 +109,7 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
108
109
 
109
110
  it do
110
111
  expect(KnapsackPro::Formatters::RSpecQueueSummaryFormatter).to receive(:print_summary)
112
+ expect(KnapsackPro::Formatters::RSpecQueueProfileFormatterExtension).to receive(:print_summary)
111
113
  expect(KnapsackPro::Report).to receive(:save_node_queue_to_api)
112
114
  expect(described_class).to receive(:exit).with(exitstatus)
113
115
 
@@ -120,6 +122,7 @@ describe KnapsackPro::Runners::Queue::RSpecRunner do
120
122
 
121
123
  it do
122
124
  expect(KnapsackPro::Formatters::RSpecQueueSummaryFormatter).to receive(:print_summary)
125
+ expect(KnapsackPro::Formatters::RSpecQueueProfileFormatterExtension).to receive(:print_summary)
123
126
  expect(KnapsackPro::Report).to receive(:save_node_queue_to_api)
124
127
  expect(described_class).to receive(:exit).with(exit_code)
125
128
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.0
4
+ version: 0.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-29 00:00:00.000000000 Z
11
+ date: 2017-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -244,6 +244,7 @@ files:
244
244
  - lib/knapsack_pro/crypto/decryptor.rb
245
245
  - lib/knapsack_pro/crypto/digestor.rb
246
246
  - lib/knapsack_pro/crypto/encryptor.rb
247
+ - lib/knapsack_pro/formatters/rspec_queue_profile_formatter_extension.rb
247
248
  - lib/knapsack_pro/formatters/rspec_queue_summary_formatter.rb
248
249
  - lib/knapsack_pro/logger_wrapper.rb
249
250
  - lib/knapsack_pro/presenter.rb