rspec_profiling 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fc2c3039e171c0935a2c938945e538e5ca46f1c2
4
- data.tar.gz: bf4e57b9289fe5a396084b0e80a836586259ad2c
2
+ SHA256:
3
+ metadata.gz: 24110d7ae61d04956ff76ff9e13c088c238a5fe66218d9e1aa4ef8a62bdbd9c6
4
+ data.tar.gz: 44d1a03208cba2c4249cbc81b27657dc535157d8fbe7ae302e618645732aebb5
5
5
  SHA512:
6
- metadata.gz: 526049fc2f4db27873427c16cde7da2ab1a1abc87f513fac462fdef5c96aad5f214cb2a59658a4d04ee9fe0faf1c9ecaf577b76829cbefab2f914d54fd3ecea1
7
- data.tar.gz: ba80e7353e2b5f1b2187a08172a2b4bc280b16aaee9a79de1c99ac1db7f3f306e2b8de10a09b0c2ba9910e5e0f5f2d1b0380df16bbb66725f994e964a9884d1b
6
+ metadata.gz: 3ad4f846af0ec602a4f8211f7f53f4358764e8aeed1e558dd46a3e8b8f70db66e02d53aa1242fb0715eb596c08c302d0d9cf23c499cf45246ae55f9f37e38c63
7
+ data.tar.gz: f9b030d41c7a68b511254bcdeb153a0b2dfd047928e9b38f1ffba123423dbd908d10badf0d461934c5f8e5bfc9944f0260e80558fbd8b57f51d800ef9e986506
@@ -1 +1 @@
1
- ruby-2.2.1
1
+ ruby-2.7.1
@@ -0,0 +1,7 @@
1
+ ## 0.0.6
2
+
3
+ * Create indexes for DB collectors [#26]
4
+ * Use ActiveRecord v5 data_source_exists? if in use [#25]
5
+ * Strip newlines and other whitespace in Git output [#24]
6
+
7
+ ## 0.0.5
data/README.md CHANGED
@@ -169,7 +169,7 @@ require 'rspec_profiling'
169
169
  require 'rspec_profiling/console'
170
170
  ```
171
171
 
172
- Then `results` will be available as a variable to the script.
172
+ Then `results` will be available as a variable to the script.
173
173
 
174
174
  ## Uninstalling
175
175
 
@@ -183,10 +183,10 @@ To remove the results database, run `bundle exec rake rspec_profiling:uninstall`
183
183
  4. Push to the branch (`git push origin my-new-feature`)
184
184
  5. Create new Pull Request
185
185
 
186
- ## About Foraker Labs
186
+ ## About Breakwater
187
187
 
188
- ![Foraker Logo](http://assets.foraker.com/attribution_logo.png)
188
+ ![Breakwater Logo](https://images.squarespace-cdn.com/content/5d084fe43b0b620001239437/1565926359217-2LQ1BOFAO5846OAYAGZV/breakwater.png?content-type=image%2Fpng)
189
189
 
190
- Foraker Labs builds exciting web and mobile apps in Boulder, CO. Our work powers a wide variety of businesses with many different needs. We love open source software, and we're proud to contribute where we can. Interested to learn more? [Contact us today](https://www.foraker.com/contact-us).
190
+ Breakwater builds exciting web and mobile apps in Louisville, CO. Our work powers a wide variety of businesses with many different needs. We love open source software, and we're proud to contribute where we can. Interested to learn more? [Contact us today](https://www.breakwaterltd.com/contact).
191
191
 
192
- This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC.
192
+ This project is maintained by Breakwater. The names and logos of Breakwater are fully owned and copyright Breakwater Limited.
@@ -5,7 +5,7 @@ module RspecProfiling
5
5
  class CSV
6
6
  HEADERS = %w{
7
7
  branch
8
- commit
8
+ commit_hash
9
9
  date
10
10
  file
11
11
  line_number
@@ -25,19 +25,19 @@ module RspecProfiling
25
25
  return if prepared?
26
26
 
27
27
  connection.create_table(table) do |t|
28
- t.string :branch
29
- t.string :commit
30
- t.datetime :date
31
- t.text :file
32
- t.integer :line_number
28
+ t.string :branch, index: true
29
+ t.string :commit_hash, index: true
30
+ t.datetime :date, index: true
31
+ t.text :file, index: true
32
+ t.integer :line_number, index: true
33
33
  t.text :description
34
- t.decimal :time
35
- t.string :status
34
+ t.decimal :time, index: true
35
+ t.string :status, index: true
36
36
  t.text :exception
37
- t.integer :query_count
38
- t.decimal :query_time
39
- t.integer :request_count
40
- t.decimal :request_time
37
+ t.integer :query_count, index: true
38
+ t.decimal :query_time, index:true
39
+ t.integer :request_count, index: true
40
+ t.decimal :request_time, index: true
41
41
  t.timestamps null: true
42
42
  end
43
43
  end
@@ -63,7 +63,15 @@ module RspecProfiling
63
63
  private
64
64
 
65
65
  def prepared?
66
- connection.table_exists?(table)
66
+ if active_record5_or_up?
67
+ connection.data_source_exists?(table)
68
+ else
69
+ connection.table_exists?(table)
70
+ end
71
+ end
72
+
73
+ def active_record5_or_up?
74
+ ActiveRecord::VERSION::STRING[0].to_i >= 5
67
75
  end
68
76
 
69
77
  def connection
@@ -25,19 +25,19 @@ module RspecProfiling
25
25
  return if prepared?
26
26
 
27
27
  connection.create_table(table) do |t|
28
- t.string :branch
29
- t.string :commit
30
- t.datetime :date
31
- t.text :file
32
- t.integer :line_number
28
+ t.string :branch, index: true
29
+ t.string :commit_hash, index: true
30
+ t.datetime :date, index: true
31
+ t.text :file, index: true
32
+ t.integer :line_number, index: true
33
33
  t.text :description
34
- t.decimal :time
35
- t.string :status
34
+ t.decimal :time, index: true
35
+ t.string :status, index: true
36
36
  t.text :exception
37
- t.integer :query_count
38
- t.decimal :query_time
39
- t.integer :request_count
40
- t.decimal :request_time
37
+ t.integer :query_count, index: true
38
+ t.decimal :query_time, index:true
39
+ t.integer :request_count, index: true
40
+ t.decimal :request_time, index: true
41
41
  t.timestamps null: true
42
42
  end
43
43
  end
@@ -28,7 +28,7 @@ module RspecProfiling
28
28
  def example_finished(*args)
29
29
  collector.insert({
30
30
  branch: vcs.branch,
31
- commit: vcs.sha,
31
+ commit_hash: vcs.sha,
32
32
  date: vcs.time,
33
33
  file: @current_example.file,
34
34
  line_number: @current_example.line_number,
@@ -4,11 +4,11 @@ module RspecProfiling
4
4
  module VCS
5
5
  class Git
6
6
  def branch
7
- `git rev-parse --abbrev-ref HEAD`
7
+ `git rev-parse --abbrev-ref HEAD`.chomp
8
8
  end
9
9
 
10
10
  def sha
11
- `git rev-parse HEAD`
11
+ `git rev-parse HEAD`.chomp
12
12
  end
13
13
 
14
14
  def time
@@ -1,3 +1,3 @@
1
1
  module RspecProfiling
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
Binary file
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "pg"
24
24
  spec.add_dependency "rails"
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "bundler", "> 1.3"
27
27
  spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency "rspec"
29
29
  end
@@ -14,7 +14,7 @@ module RspecProfiling
14
14
  before do
15
15
  collector.insert({
16
16
  branch: "master",
17
- commit: "ABC123",
17
+ commit_hash: "ABC123",
18
18
  date: "Thu Dec 18 12:00:00 2012",
19
19
  file: "/some/file.rb",
20
20
  line_number: 10,
@@ -37,11 +37,11 @@ module RspecProfiling
37
37
  expect(result.branch).to eq "master"
38
38
  end
39
39
 
40
- it "records the commit SHA" do
41
- expect(result.commit).to eq "ABC123"
40
+ it "records the commit_hash SHA" do
41
+ expect(result.commit_hash).to eq "ABC123"
42
42
  end
43
43
 
44
- it "records the commit date" do
44
+ it "records the commit_hash date" do
45
45
  expect(result.date).to eq Time.utc(2012, 12, 18, 12)
46
46
  end
47
47
 
@@ -14,7 +14,7 @@ module RspecProfiling
14
14
  before do
15
15
  collector.insert({
16
16
  branch: "master",
17
- commit: "ABC123",
17
+ commit_hash: "ABC123",
18
18
  date: "Thu Dec 18 12:00:00 2012",
19
19
  file: "/some/file.rb",
20
20
  line_number: 10,
@@ -37,11 +37,11 @@ module RspecProfiling
37
37
  expect(result.branch).to eq "master"
38
38
  end
39
39
 
40
- it "records the commit SHA" do
41
- expect(result.commit).to eq "ABC123"
40
+ it "records the commit_hash SHA" do
41
+ expect(result.commit_hash).to eq "ABC123"
42
42
  end
43
43
 
44
- it "records the commit date" do
44
+ it "records the commit_hash date" do
45
45
  expect(result.date).to eq Time.utc(2012, 12, 18, 12)
46
46
  end
47
47
 
@@ -52,8 +52,8 @@ module RspecProfiling
52
52
  expect(result.branch).to eq "master"
53
53
  end
54
54
 
55
- it "records the commit SHA" do
56
- expect(result.commit).to eq "abc123"
55
+ it "records the commit_hash SHA" do
56
+ expect(result.commit_hash).to eq "abc123"
57
57
  end
58
58
 
59
59
  it "counts two queries" do
@@ -4,22 +4,22 @@ module RspecProfiling
4
4
  describe VCS::Git do
5
5
  describe "#branch" do
6
6
  it "calls Git to get the current branch" do
7
- expect(subject).to receive(:`).with("git rev-parse --abbrev-ref HEAD").and_return("master")
7
+ expect(subject).to receive(:`).with("git rev-parse --abbrev-ref HEAD").and_return("master\n")
8
8
  expect(subject.branch).to eq "master"
9
9
  end
10
10
  end
11
11
 
12
12
  describe "#sha" do
13
13
  it "calls Git to get the current commit's SHA" do
14
- expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123")
14
+ expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123\n")
15
15
  expect(subject.sha).to eq "abc123"
16
16
  end
17
17
  end
18
18
 
19
19
  describe "#time" do
20
20
  it "calls Git to get the current commit's datetime" do
21
- expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123")
22
- expect(subject).to receive(:`).with("git show -s --format=%ci abc123").and_return("2017-01-31")
21
+ expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123\n")
22
+ expect(subject).to receive(:`).with("git show -s --format=%ci abc123").and_return("2017-01-31\n")
23
23
  expect(subject.time).to eq Time.parse("2017-01-31")
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_profiling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eddy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
@@ -118,6 +118,7 @@ files:
118
118
  - ".gitignore"
119
119
  - ".ruby-gemset"
120
120
  - ".ruby-version"
121
+ - CHANGELOG.md
121
122
  - Gemfile
122
123
  - LICENSE.txt
123
124
  - README.md
@@ -162,8 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  - !ruby/object:Gem::Version
163
164
  version: '0'
164
165
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.4.8
166
+ rubygems_version: 3.1.2
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: Profile RSpec test suites