New Upstream Snapshot - ruby-rspec-profiling

Ready changes

Summary

Merged new upstream version: 0.0.5+git20201006.1.a69a4d6 (was: 0.0.5).

Resulting package

Built on 2022-12-29T15:19 (took 7m36s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots ruby-rspec-profiling

Lintian Result

Diff

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index d87d4be..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-*.gem
-*.rbc
-.bundle
-.config
-.yardoc
-Gemfile.lock
-InstalledFiles
-_yardoc
-coverage
-doc/
-lib/bundler/man
-pkg
-rdoc
-spec/reports
-test/tmp
-test/version_tmp
-tmp
diff --git a/.ruby-version b/.ruby-version
index 58f65ad..bff6ce5 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-ruby-2.2.1
+ruby-2.7.1
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..4dce0a0
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,7 @@
+## 0.0.6
+
+* Create indexes for DB collectors [#26]
+* Use ActiveRecord v5 data_source_exists? if in use [#25]
+* Strip newlines and other whitespace in Git output [#24]
+
+## 0.0.5
diff --git a/README.md b/README.md
index 82f7a38..b7652ed 100644
--- a/README.md
+++ b/README.md
@@ -169,7 +169,7 @@ require 'rspec_profiling'
 require 'rspec_profiling/console'
 ```
 
-Then `results` will be available as a variable to the script. 
+Then `results` will be available as a variable to the script.
 
 ## Uninstalling
 
@@ -183,10 +183,10 @@ To remove the results database, run `bundle exec rake rspec_profiling:uninstall`
 4. Push to the branch (`git push origin my-new-feature`)
 5. Create new Pull Request
 
-## About Foraker Labs
+## About Breakwater
 
-![Foraker Logo](http://assets.foraker.com/attribution_logo.png)
+![Breakwater Logo](https://images.squarespace-cdn.com/content/5d084fe43b0b620001239437/1565926359217-2LQ1BOFAO5846OAYAGZV/breakwater.png?content-type=image%2Fpng)
 
-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).
+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).
 
-This project is maintained by Foraker Labs. The names and logos of Foraker Labs are fully owned and copyright Foraker Design, LLC.
+This project is maintained by Breakwater. The names and logos of Breakwater are fully owned and copyright Breakwater Limited.
diff --git a/debian/changelog b/debian/changelog
index 687bc21..944c0bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,11 @@
-ruby-rspec-profiling (0.0.5-3) UNRELEASED; urgency=low
+ruby-rspec-profiling (0.0.5+git20201006.1.a69a4d6-1) UNRELEASED; urgency=low
 
   * Set field Upstream-Contact in debian/copyright.
   * Remove obsolete fields Contact, Name from debian/upstream/metadata (already
     present in machine-readable debian/copyright).
+  * New upstream snapshot.
 
- -- Debian Janitor <janitor@jelmer.uk>  Fri, 04 Sep 2020 04:52:14 -0000
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 29 Dec 2022 15:14:28 -0000
 
 ruby-rspec-profiling (0.0.5-2) unstable; urgency=medium
 
diff --git a/lib/rspec_profiling/collectors/csv.rb b/lib/rspec_profiling/collectors/csv.rb
index 52f164d..ca7cc95 100644
--- a/lib/rspec_profiling/collectors/csv.rb
+++ b/lib/rspec_profiling/collectors/csv.rb
@@ -5,7 +5,7 @@ module RspecProfiling
     class CSV
       HEADERS = %w{
         branch
-        commit
+        commit_hash
         date
         file
         line_number
diff --git a/lib/rspec_profiling/collectors/psql.rb b/lib/rspec_profiling/collectors/psql.rb
index 73687d2..9509746 100644
--- a/lib/rspec_profiling/collectors/psql.rb
+++ b/lib/rspec_profiling/collectors/psql.rb
@@ -25,19 +25,19 @@ module RspecProfiling
         return if prepared?
 
         connection.create_table(table) do |t|
-          t.string    :branch
-          t.string    :commit
-          t.datetime  :date
-          t.text      :file
-          t.integer   :line_number
+          t.string    :branch, index: true
+          t.string    :commit_hash, index: true
+          t.datetime  :date, index: true
+          t.text      :file, index: true
+          t.integer   :line_number, index: true
           t.text      :description
-          t.decimal   :time
-          t.string    :status
+          t.decimal   :time, index: true
+          t.string    :status, index: true
           t.text      :exception
-          t.integer   :query_count
-          t.decimal   :query_time
-          t.integer   :request_count
-          t.decimal   :request_time
+          t.integer   :query_count, index: true
+          t.decimal   :query_time, index:true
+          t.integer   :request_count, index: true
+          t.decimal   :request_time, index: true
           t.timestamps null: true
         end
       end
@@ -63,7 +63,15 @@ module RspecProfiling
       private
 
       def prepared?
-        connection.table_exists?(table)
+        if active_record5_or_up?
+          connection.data_source_exists?(table)
+        else
+          connection.table_exists?(table)
+        end
+      end
+
+      def active_record5_or_up?
+        ActiveRecord::VERSION::STRING[0].to_i >= 5
       end
 
       def connection
diff --git a/lib/rspec_profiling/collectors/sql.rb b/lib/rspec_profiling/collectors/sql.rb
index 26ffa4b..c35e57f 100644
--- a/lib/rspec_profiling/collectors/sql.rb
+++ b/lib/rspec_profiling/collectors/sql.rb
@@ -25,19 +25,19 @@ module RspecProfiling
         return if prepared?
 
         connection.create_table(table) do |t|
-          t.string    :branch
-          t.string    :commit
-          t.datetime  :date
-          t.text      :file
-          t.integer   :line_number
+          t.string    :branch, index: true
+          t.string    :commit_hash, index: true
+          t.datetime  :date, index: true
+          t.text      :file, index: true
+          t.integer   :line_number, index: true
           t.text      :description
-          t.decimal   :time
-          t.string    :status
+          t.decimal   :time, index: true
+          t.string    :status, index: true
           t.text      :exception
-          t.integer   :query_count
-          t.decimal   :query_time
-          t.integer   :request_count
-          t.decimal   :request_time
+          t.integer   :query_count, index: true
+          t.decimal   :query_time, index:true
+          t.integer   :request_count, index: true
+          t.decimal   :request_time, index: true
           t.timestamps null: true
         end
       end
diff --git a/lib/rspec_profiling/run.rb b/lib/rspec_profiling/run.rb
index c8e9fa8..5814a0c 100644
--- a/lib/rspec_profiling/run.rb
+++ b/lib/rspec_profiling/run.rb
@@ -28,7 +28,7 @@ module RspecProfiling
     def example_finished(*args)
       collector.insert({
         branch:        vcs.branch,
-        commit:        vcs.sha,
+        commit_hash:   vcs.sha,
         date:          vcs.time,
         file:          @current_example.file,
         line_number:   @current_example.line_number,
diff --git a/lib/rspec_profiling/vcs/git.rb b/lib/rspec_profiling/vcs/git.rb
index 946e90a..f608c82 100644
--- a/lib/rspec_profiling/vcs/git.rb
+++ b/lib/rspec_profiling/vcs/git.rb
@@ -4,11 +4,11 @@ module RspecProfiling
   module VCS
     class Git
       def branch
-        `git rev-parse --abbrev-ref HEAD`
+        `git rev-parse --abbrev-ref HEAD`.chomp
       end
 
       def sha
-        `git rev-parse HEAD`
+        `git rev-parse HEAD`.chomp
       end
 
       def time
diff --git a/lib/rspec_profiling/version.rb b/lib/rspec_profiling/version.rb
index 5ee1b0f..c08fc41 100644
--- a/lib/rspec_profiling/version.rb
+++ b/lib/rspec_profiling/version.rb
@@ -1,3 +1,3 @@
 module RspecProfiling
-  VERSION = "0.0.5"
+  VERSION = "0.0.6"
 end
diff --git a/rspec_profiling b/rspec_profiling
old mode 100755
new mode 100644
index d63c7f7..d71e819
Binary files a/rspec_profiling and b/rspec_profiling differ
diff --git a/rspec_profiling.gemspec b/rspec_profiling.gemspec
index 98ce676..3789e3d 100644
--- a/rspec_profiling.gemspec
+++ b/rspec_profiling.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
   spec.add_dependency "pg"
   spec.add_dependency "rails"
 
-  spec.add_development_dependency "bundler", "~> 1.3"
+  spec.add_development_dependency "bundler", "> 1.3"
   spec.add_development_dependency "rake"
   spec.add_development_dependency "rspec"
 end
diff --git a/spec/collectors/psql_spec.rb b/spec/collectors/psql_spec.rb
index 4e2f64d..0f5d107 100644
--- a/spec/collectors/psql_spec.rb
+++ b/spec/collectors/psql_spec.rb
@@ -14,7 +14,7 @@ module RspecProfiling
         before do
           collector.insert({
             branch: "master",
-            commit: "ABC123",
+            commit_hash: "ABC123",
             date: "Thu Dec 18 12:00:00 2012",
             file: "/some/file.rb",
             line_number: 10,
@@ -37,11 +37,11 @@ module RspecProfiling
           expect(result.branch).to eq "master"
         end
 
-        it "records the commit SHA" do
-          expect(result.commit).to eq "ABC123"
+        it "records the commit_hash SHA" do
+          expect(result.commit_hash).to eq "ABC123"
         end
 
-        it "records the commit date" do
+        it "records the commit_hash date" do
           expect(result.date).to eq Time.utc(2012, 12, 18, 12)
         end
 
diff --git a/spec/collectors/sql_spec.rb b/spec/collectors/sql_spec.rb
index 3507872..1924b2f 100644
--- a/spec/collectors/sql_spec.rb
+++ b/spec/collectors/sql_spec.rb
@@ -14,7 +14,7 @@ module RspecProfiling
         before do
           collector.insert({
             branch: "master",
-            commit: "ABC123",
+            commit_hash: "ABC123",
             date: "Thu Dec 18 12:00:00 2012",
             file: "/some/file.rb",
             line_number: 10,
@@ -37,11 +37,11 @@ module RspecProfiling
           expect(result.branch).to eq "master"
         end
 
-        it "records the commit SHA" do
-          expect(result.commit).to eq "ABC123"
+        it "records the commit_hash SHA" do
+          expect(result.commit_hash).to eq "ABC123"
         end
 
-        it "records the commit date" do
+        it "records the commit_hash date" do
           expect(result.date).to eq Time.utc(2012, 12, 18, 12)
         end
 
diff --git a/spec/run_spec.rb b/spec/run_spec.rb
index 9f5d785..94ee6ea 100644
--- a/spec/run_spec.rb
+++ b/spec/run_spec.rb
@@ -52,8 +52,8 @@ module RspecProfiling
         expect(result.branch).to eq "master"
       end
 
-      it "records the commit SHA" do
-        expect(result.commit).to eq "abc123"
+      it "records the commit_hash SHA" do
+        expect(result.commit_hash).to eq "abc123"
       end
 
       it "counts two queries" do
diff --git a/spec/vcs/git_spec.rb b/spec/vcs/git_spec.rb
index 2084cd5..f0d535b 100644
--- a/spec/vcs/git_spec.rb
+++ b/spec/vcs/git_spec.rb
@@ -4,22 +4,22 @@ module RspecProfiling
   describe VCS::Git do
     describe "#branch" do
       it "calls Git to get the current branch" do
-        expect(subject).to receive(:`).with("git rev-parse --abbrev-ref HEAD").and_return("master")
+        expect(subject).to receive(:`).with("git rev-parse --abbrev-ref HEAD").and_return("master\n")
         expect(subject.branch).to eq "master"
       end
     end
 
     describe "#sha" do
       it "calls Git to get the current commit's SHA" do
-        expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123")
+        expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123\n")
         expect(subject.sha).to eq "abc123"
       end
     end
 
     describe "#time" do
       it "calls Git to get the current commit's datetime" do
-        expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123")
-        expect(subject).to receive(:`).with("git show -s --format=%ci abc123").and_return("2017-01-31")
+        expect(subject).to receive(:`).with("git rev-parse HEAD").and_return("abc123\n")
+        expect(subject).to receive(:`).with("git show -s --format=%ci abc123").and_return("2017-01-31\n")
         expect(subject.time).to eq Time.parse("2017-01-31")
       end
     end

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/share/doc/ruby-rspec-profiling/changelog.gz
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/collectors/csv.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/collectors/psql.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/collectors/sql.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/config.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/console.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/example.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/rspec.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/run.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/vcs/git.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/vcs/git_svn.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/vcs/svn.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/rspec_profiling/version.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.6/lib/tasks/rspec_profiling.rake
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/specifications/rspec_profiling-0.0.6.gemspec

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/collectors/csv.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/collectors/psql.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/collectors/sql.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/config.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/console.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/example.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/rspec.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/run.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/vcs/git.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/vcs/git_svn.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/vcs/svn.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/rspec_profiling/version.rb
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/gems/rspec_profiling-0.0.5/lib/tasks/rspec_profiling.rake
-rw-r--r--  root/root   /usr/share/rubygems-integration/all/specifications/rspec_profiling-0.0.5.gemspec

No differences were encountered in the control files

More details

Full run details