Skip to content

Commit

Permalink
improved coveralls to only look for .m files
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Oct 1, 2013
1 parent 55144b9 commit e779026
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -9,4 +9,4 @@ script:
- xctool project DTCoreText.xcodeproj -scheme "Mac Framework" test -arch x86_64 ONLY_ACTIVE_ARCH=NO - xctool project DTCoreText.xcodeproj -scheme "Mac Framework" test -arch x86_64 ONLY_ACTIVE_ARCH=NO


after_success: after_success:
- ./coveralls.rb --exclude-folder Demo --exclude-folder Test --exclude-folder Externals --exclude-headers - ./coveralls.rb --extension m --exclude-folder Demo --exclude-folder Test --exclude-folder Externals
2 changes: 1 addition & 1 deletion Externals/DTFoundation
Submodule DTFoundation updated 2 files
+1 −1 .travis.yml
+19 −2 coveralls.rb
21 changes: 19 additions & 2 deletions coveralls.rb
Expand Up @@ -7,6 +7,7 @@


# arraw of source subfolders to exclude # arraw of source subfolders to exclude
excludedFolders = [] excludedFolders = []
extensionsToProcess = []
coveralls_cmd = "coveralls" coveralls_cmd = "coveralls"


excludeHeaders = false excludeHeaders = false
Expand All @@ -24,6 +25,11 @@
excludeHeaders = true excludeHeaders = true
end end


opts.on('-x', '--extension EXT', 'Source file extension to process') do |v|
extensionsToProcess << v
coveralls_cmd.concat(" -x #{v}")
end

opts.on_tail("-?", "--help", "Show this message") do opts.on_tail("-?", "--help", "Show this message") do
puts opts puts opts
exit exit
Expand Down Expand Up @@ -71,14 +77,20 @@
match = GCOV_SOURCE_PATTERN.match(firstLine) match = GCOV_SOURCE_PATTERN.match(firstLine)


if (match) if (match)

source_path = match[1] source_path = match[1]


puts "source: #{source_path} - #{workingDir}"

if (source_path.start_with? workingDir) if (source_path.start_with? workingDir)


# cut off absolute working dir to get relative source path # cut off absolute working dir to get relative source path
relative_path = source_path.slice(workingDir.length+1, source_path.length) relative_path = source_path.slice(workingDir.length+1, source_path.length)


extension = File.extname(relative_path) extension = File.extname(relative_path)
extension = extension.slice(1, extension.length-1)

puts "#{extension}"


# get the path components # get the path components
path_comps = relative_path.split(File::SEPARATOR) path_comps = relative_path.split(File::SEPARATOR)
Expand All @@ -89,10 +101,15 @@
if (excludedFolders.include?(path_comps[0])) if (excludedFolders.include?(path_comps[0]))
exclusionMsg = "excluded via option" exclusionMsg = "excluded via option"
else else
if (excludeHeaders && extension == '.h') if (excludeHeaders == true && extension == 'h')
exclusionMsg = "excluded header" exclusionMsg = "excluded header"
else else
shouldProcess = true if (extensionsToProcess.count == 0 || extensionsToProcess.include?(extension))
shouldProcess = true
else
exclusionMsg = "excluded extension"
shouldProcess = false
end
end end
end end


Expand Down

0 comments on commit e779026

Please sign in to comment.