test-prof 0.1.1 → 0.2.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: ec87793d9a80b7f23974e847523944bdfe148b67
4
- data.tar.gz: 2baef7b881fc96b8c48393c6ddc3dc0f0d967748
3
+ metadata.gz: 801b84df6d3f7ee580f2cdd0bb907a5d973d0f12
4
+ data.tar.gz: 7a1295fa606ba8fcbdb6d22867e0b6dfb5709519
5
5
  SHA512:
6
- metadata.gz: 5cf770c4cc7d47cdbab88e35edfd94eca9e87d81f1d1a2d9c12eeade108fee8a7e86b136cc446a3c11eb6cdc7499c68cc0455313c4156622bae1344f0cef9925
7
- data.tar.gz: 2e06a2110a04017da1ae8779c41a203a997b4a0644a6e5f26e14ae8a41e8cff0c7efb7b2d53fc3c031c75b28e6cde9b27dd74cef3f6263385725d6063ec1d9ce
6
+ metadata.gz: '078e932d7605e8399820ecdd3d7b4ee1098093c73d4f0f647c94ba095fad4b64531848304f86a3e1debce528bf815d2f78085b983c20ab906d0ca388d1874522'
7
+ data.tar.gz: '09c1d29d373158828d5d44d0a96a2413960934a60170b81a1f3974bc9c10e59fcdf4bcb20df2f842cd2985d82510c9e46ba024eca4f080d6008656e72a86a649'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.2.0
6
+
7
+ - Ensure output directory exists. ([@danielwestendorf][])
8
+
9
+ **Change default output dir** to "tmp/test_prof".
10
+
11
+ Rename `#artefact_path` to `#artifact_path` to be more US-like
12
+
13
+ Ensure output dir exists in `#artifact_path` method.
14
+
15
+ - FactoryDoctor: print success message when no bad examples found. ([@palkan][])
16
+
5
17
  ## 0.1.1
6
18
 
7
19
  - AnyFixture: clean tables in reverse order to not fail when foreign keys exist. ([@marshall-lee][])
@@ -12,3 +24,4 @@
12
24
 
13
25
  [@palkan]: https://github.com/palkan
14
26
  [@marshall-lee]: https://github.com/marshall-lee
27
+ [@danielwestendorf]: https://github.com/danielwestendorf
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Gem Version](https://badge.fury.io/rb/test-prof.svg)](https://rubygems.org/gems/test-prof) [![Build Status](https://travis-ci.org/palkan/test-prof.svg?branch=master)](https://travis-ci.org/palkan/test-prof) [![CircleCI](https://circleci.com/gh/palkan/test-prof.svg?style=svg)](https://circleci.com/gh/palkan/test-prof)
1
+ [![Gem Version](https://badge.fury.io/rb/test-prof.svg)](https://rubygems.org/gems/test-prof) [![Build Status](https://travis-ci.org/palkan/test-prof.svg?branch=master)](https://travis-ci.org/palkan/test-prof) [![CircleCI](https://circleci.com/gh/palkan/test-prof.svg?style=svg)](https://circleci.com/gh/palkan/test-prof) [![Code Triagers Badge](https://www.codetriage.com/palkan/test-prof/badges/users.svg)](https://www.codetriage.com/palkan/test-prof)
2
2
 
3
3
  # Ruby Tests Profiling Toolbox
4
4
 
@@ -85,7 +85,7 @@ TestProf global configuration is used by most of the profilers:
85
85
 
86
86
  ```ruby
87
87
  TestProf.configure do |config|
88
- # the directory to put artifacts (reports) in ("tmp" by default)
88
+ # the directory to put artifacts (reports) in ("tmp/test_prof" by default)
89
89
  config.output_dir = "tmp/test_prof"
90
90
 
91
91
  # use unique filenames for reports (by simply appending current timestamp)
@@ -30,7 +30,7 @@ And we want to test the `Task` model:
30
30
 
31
31
  ```ruby
32
32
  describe "PATCH #update" do
33
- let(:task( { create(:task) }
33
+ let(:task) { create(:task) }
34
34
 
35
35
  it "works" do
36
36
  patch :update, id: task.id, task: { completed: 't' }
data/lib/test_prof.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "fileutils"
3
4
  require "test_prof/version"
4
5
  require "test_prof/logging"
5
6
 
@@ -58,8 +59,10 @@ module TestProf
58
59
  ::File.expand_path(filename, ::File.join(::File.dirname(__FILE__), "..", "assets"))
59
60
  end
60
61
 
61
- # Return a path to store artefact
62
- def artefact_path(filename)
62
+ # Return a path to store artifact
63
+ def artifact_path(filename)
64
+ FileUtils.mkdir_p(config.output_dir)
65
+
63
66
  with_timestamps(
64
67
  ::File.join(
65
68
  config.output_dir,
@@ -91,7 +94,7 @@ module TestProf
91
94
  def initialize
92
95
  @output = $stdout
93
96
  @color = true
94
- @output_dir = "tmp"
97
+ @output_dir = "tmp/test_prof"
95
98
  @timestamps = false
96
99
  end
97
100
 
@@ -8,6 +8,8 @@ module TestProf
8
8
  include Logging
9
9
  using FloatDuration
10
10
 
11
+ SUCCESS_MESSAGE = 'FactoryDoctor says: "Looks good to me!"'
12
+
11
13
  NOTIFICATIONS = %i[
12
14
  example_started
13
15
  example_finished
@@ -42,7 +44,7 @@ module TestProf
42
44
  end
43
45
 
44
46
  def print
45
- return if @example_groups.empty?
47
+ return log(:info, SUCCESS_MESSAGE) if @example_groups.empty?
46
48
 
47
49
  msgs = []
48
50
 
@@ -61,7 +61,7 @@ module TestProf::FactoryProf
61
61
  template = File.read(TestProf.asset_path("flamegraph.template.html"))
62
62
  template.sub! '/**REPORT-DATA**/', data.to_json
63
63
 
64
- outpath = TestProf.artefact_path("factory-flame.html")
64
+ outpath = TestProf.artifact_path("factory-flame.html")
65
65
  File.write(outpath, template)
66
66
  outpath
67
67
  end
@@ -107,7 +107,7 @@ module TestProf
107
107
  private
108
108
 
109
109
  def build_path(name, printer)
110
- TestProf.artefact_path(
110
+ TestProf.artifact_path(
111
111
  "ruby-prof-report-#{printer}-#{config.mode}-#{name}.html"
112
112
  )
113
113
  end
@@ -98,7 +98,7 @@ module TestProf
98
98
  private
99
99
 
100
100
  def build_path(name)
101
- TestProf.artefact_path(
101
+ TestProf.artifact_path(
102
102
  "stack-prof-report-#{config.mode}#{config.raw ? '-raw' : ''}-#{name}.dump"
103
103
  )
104
104
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestProf
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler