slather 0.0.233 → 0.0.234
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/slather +36 -8
- data/lib/slather/coverage_file.rb +6 -0
- data/lib/slather/coverage_service/coveralls.rb +22 -6
- data/lib/slather/project.rb +3 -2
- data/lib/slather/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c5ba01f7c2a9589c8c8e6bf2bf964d5e073faa5
|
4
|
+
data.tar.gz: 0018264bf4c9a9ec2744b1e8ca670c0fc5fa7862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f811984af1548b8068ca126419bd91f12306fec511a11539cb99e5f3bee18074d37fb4d78bbc2d1fee05352109b134079c78265bd7987d2b04121c40a8a1f08
|
7
|
+
data.tar.gz: 2a9d1b94116d9426317e8bcd2ce483acb3d1af6adbaf433ba0efdcb83f9c23d90de376b8b500413979fb2b0d16097906cf17ecfe219fbc455997b1f5ea232f33
|
data/bin/slather
CHANGED
@@ -12,6 +12,8 @@ Clamp do
|
|
12
12
|
|
13
13
|
option "--project, -p", "PROJECT", "Path to the xcodeproj", :attribute_name => :xcodeproj_path
|
14
14
|
|
15
|
+
option ["--travis", "-t"], :flag, "Indicate that the builds are running on Travis CI"
|
16
|
+
|
15
17
|
option ["--coveralls", "-c"], :flag, "Post coverage results to coveralls"
|
16
18
|
option ["--simple-output", "-s"], :flag, "Post coverage results to coveralls"
|
17
19
|
|
@@ -20,22 +22,48 @@ Clamp do
|
|
20
22
|
|
21
23
|
def execute
|
22
24
|
puts "Slathering..."
|
25
|
+
|
26
|
+
setup_service_name
|
27
|
+
setup_ignore_list
|
28
|
+
setup_build_directory
|
29
|
+
setup_coverage_service
|
23
30
|
|
24
|
-
|
31
|
+
post
|
25
32
|
|
26
|
-
|
33
|
+
puts "Done slathering!"
|
34
|
+
end
|
35
|
+
|
36
|
+
def setup_build_directory
|
37
|
+
project.build_directory = build_directory if build_directory
|
38
|
+
end
|
39
|
+
|
40
|
+
def setup_ignore_list
|
41
|
+
project.ignore_list = ignore_list if !ignore_list.empty?
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup_service_name
|
45
|
+
if travis?
|
46
|
+
project.ci_service = :travis_ci
|
47
|
+
end
|
48
|
+
end
|
27
49
|
|
50
|
+
def post
|
51
|
+
project.post
|
52
|
+
end
|
53
|
+
|
54
|
+
def project
|
55
|
+
@project ||= begin
|
56
|
+
xcodeproj_path_to_open = xcodeproj_path || Slather::Project.yml_file["xcodeproj"]
|
57
|
+
project = Slather::Project.open(xcodeproj_path_to_open)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def setup_coverage_service
|
28
62
|
if coveralls?
|
29
63
|
project.extend(Slather::CoverageService::Coveralls)
|
30
64
|
elsif simple_output?
|
31
65
|
project.extend(Slather::CoverageService::SimpleOutput)
|
32
66
|
end
|
33
|
-
|
34
|
-
project.ignore_list = ignore_list if !ignore_list.empty?
|
35
|
-
project.build_directory = build_directory if build_directory
|
36
|
-
project.post
|
37
|
-
|
38
|
-
puts "Done slathering!"
|
39
67
|
end
|
40
68
|
|
41
69
|
end
|
@@ -6,22 +6,38 @@ module Slather
|
|
6
6
|
Slather::CoverallsCoverageFile
|
7
7
|
end
|
8
8
|
|
9
|
+
def travis_job_id
|
10
|
+
ENV['TRAVIS_JOB_ID']
|
11
|
+
end
|
12
|
+
|
9
13
|
def coveralls_coverage_data
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
if ci_service == :travis_ci
|
15
|
+
if travis_job_id
|
16
|
+
{
|
17
|
+
:service_job_id => travis_job_id,
|
18
|
+
:service_name => "travis-ci",
|
19
|
+
:source_files => coverage_files.map(&:as_json)
|
20
|
+
}.to_json
|
21
|
+
else
|
22
|
+
raise StandardError, "Environment variable `TRAVIS_JOB_ID` not set. Is this running on a travis build?"
|
23
|
+
end
|
24
|
+
else
|
25
|
+
raise StandardError, "No support for ci named #{ci_service}"
|
26
|
+
end
|
15
27
|
end
|
16
28
|
private :coveralls_coverage_data
|
17
29
|
|
18
30
|
def post
|
19
31
|
f = File.open('coveralls_json_file', 'w+')
|
20
32
|
f.write(coveralls_coverage_data)
|
21
|
-
`curl -s --form json_file=@#{f.path}
|
33
|
+
`curl -s --form json_file=@#{f.path} #{coveralls_api_jobs_path}`
|
22
34
|
FileUtils.rm(f)
|
23
35
|
end
|
24
36
|
|
37
|
+
def coveralls_api_jobs_path
|
38
|
+
"https://coveralls.io/api/v1/jobs"
|
39
|
+
end
|
40
|
+
|
25
41
|
end
|
26
42
|
end
|
27
43
|
end
|
data/lib/slather/project.rb
CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
module Slather
|
7
7
|
class Project < Xcodeproj::Project
|
8
8
|
|
9
|
-
attr_accessor :build_directory, :ignore_list
|
9
|
+
attr_accessor :build_directory, :ignore_list, :ci_service
|
10
10
|
|
11
11
|
def self.open(xcodeproj)
|
12
12
|
proj = super
|
@@ -29,7 +29,7 @@ module Slather
|
|
29
29
|
coverage_file = coverage_file_class.new(file)
|
30
30
|
coverage_file.project = self
|
31
31
|
# If there's no source file for this gcno, it probably belongs to another project.
|
32
|
-
if coverage_file.source_file_pathname && !
|
32
|
+
if coverage_file.source_file_pathname && !coverage_file.ignored?
|
33
33
|
coverage_file
|
34
34
|
else
|
35
35
|
nil
|
@@ -58,6 +58,7 @@ module Slather
|
|
58
58
|
def configure_from_yml
|
59
59
|
self.build_directory = self.class.yml_file["build_directory"] if self.class.yml_file["build_directory"]
|
60
60
|
self.ignore_list = self.class.yml_file["ignore"] || []
|
61
|
+
self.ci_service = (self.class.yml_file["ci_service"] || :travis_ci).to_sym
|
61
62
|
|
62
63
|
coverage_service = self.class.yml_file["coverage_service"]
|
63
64
|
if coverage_service == "coveralls"
|
data/lib/slather/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.234
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|