Skip to content

Commit

Permalink
Fix Coveralls wrapping git results in single quotes on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
philr committed Jan 9, 2021
1 parent d03f752 commit 7faf812
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,24 @@ end
desc 'Run tests using the refinement, then with the global install'
task :test => [:clean_coverage, 'test:refinement', 'test:global'] + (TEST_COVERAGE ? ['coveralls:push'] : []) do
end

# Coveralls expects an sh compatible shell when running git commands with Kernel#`
# On Windows, the results end up wrapped in single quotes.
# Patch Coveralls::Configuration to remove the quotes.
if RUBY_PLATFORM =~ /mingw/
module CoverallsFixConfigurationOnWindows
def self.included(base)
class << self
alias_method :git_without_windows_fix, :git

def git
git_without_windows_fix.tap do |hash|
hash[:head] = hash[:head].map {|h,v| [k, v =~ /\A'(.*)'\z/ ? $1 : v] }.to_h
end
end
end
end
end

Coveralls::Configuration.send(:include, CoverallsFixConfigurationOnWindows)
end

0 comments on commit 7faf812

Please sign in to comment.