Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 383caac

Browse files
committed
Merge pull request #66 from jv-dan/master
added support for changing the location of the .git root
2 parents f31c043 + f67cf54 commit 383caac

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ end
4646
CodeClimate::TestReporter.start
4747
```
4848

49+
Another example for when your Rails application root is not at the root of the git repository root
50+
51+
```ruby
52+
CodeClimate::TestReporter.configure do |config|
53+
config.path_prefix = "app_root" #the root of your Rails application relative to the repository root
54+
config.git_dir = "../" #the relative or absolute location of your git root compared to where your tests are run
55+
end
56+
57+
CodeClimate::TestReporter.start
58+
```
59+
4960
## Extending Simplecov with other formatters
5061

5162
Since ruby-test-reporter 0.4.0 you can use `CodeClimate::TestReporter::Formatter` as a Simplecov formatter directly. Just add the formatter to your Simplecov formatter in addition to the rest of your configuration:

lib/code_climate/test_reporter/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def self.configuration
1919
end
2020

2121
class Configuration
22-
attr_accessor :branch, :logger, :profile, :path_prefix, :gzip_request
22+
attr_accessor :branch, :logger, :profile, :path_prefix, :gzip_request, :git_dir
2323

2424
def initialize
2525
@gzip_request = true

lib/code_climate/test_reporter/git.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def git(command)
4949
end
5050

5151
def git_dir
52+
return CodeClimate::TestReporter.configuration.git_dir unless CodeClimate::TestReporter.configuration.git_dir.nil?
53+
5254
root = "."
5355

5456
if defined?(Rails) && File.directory?(File.expand_path(".git", Rails.root))

0 commit comments

Comments
 (0)