slather 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/bin/slather +3 -3
- data/lib/slather/coverage_file.rb +11 -5
- data/lib/slather/coverage_service/coveralls.rb +6 -15
- data/lib/slather/project.rb +1 -6
- data/lib/slather/version.rb +1 -1
- data/spec/slather/coverage_service/coveralls_spec.rb +0 -15
- data/spec/slather/project_spec.rb +0 -8
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmQ4NmM0NmNjYWQ3Yjc0NjgzN2Q5ODA0NzVhYmM2M2QxMTMzZGQ1ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTQwNTNlMTM3MjFhMjBiMzI3ZDQxZjUyODRiYWM4ZDU3MGVjMTBjYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjRhYzYyNGVkMDgwMDliYmJhMDVlNWEyNTUyYTg5YWQ0OTFiMTA2OGJiMDQ1
|
10
|
+
YzYxYmMyODE1MDEyNGQ0MzY1ZGUzOTdjNWU0NjQ1MTM5OTBiZThmODg2MjVi
|
11
|
+
MzU3M2JlZTQ1M2Y4NTFhYmQ5MGI0MGU1NWM0YTg0YjYxMjViN2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDRlMGE4ZWM2YjZkNWE3YzBkMGZlZWMxMmE4OTAyN2E4MTE2NTE1YjQyMTVh
|
14
|
+
NTRmZmNmMWFiNWRmZmVjMDY3NTQ3NmNjZjc3OTU2NmVhZWY1NThhYjYzMTc4
|
15
|
+
NDY2ZDM2MWFiMWFhYTQ0M2E3YzE3ZWU4MzFkMzQzNmZmMzg1ZWI=
|
data/bin/slather
CHANGED
@@ -7,14 +7,14 @@ Clamp do
|
|
7
7
|
|
8
8
|
self.default_subcommand = "coverage"
|
9
9
|
|
10
|
-
subcommand "coverage", "Computes coverage for the
|
10
|
+
subcommand "coverage", "Computes coverage for the supplied project" do
|
11
11
|
|
12
12
|
parameter "[xcodeproj]", "Path to the xcodeproj", :attribute_name => :xcodeproj_path
|
13
13
|
|
14
14
|
option ["--travis", "-t"], :flag, "Indicate that the builds are running on Travis CI"
|
15
15
|
|
16
16
|
option ["--coveralls", "-c"], :flag, "Post coverage results to coveralls"
|
17
|
-
option ["--simple-output", "-s"], :flag, "
|
17
|
+
option ["--simple-output", "-s"], :flag, "Output coverage results to the terminal"
|
18
18
|
|
19
19
|
option ["--build-directory", "-b"], "BUILD_DIRECTORY", "The directory where gcno files will be written to. Defaults to derived data."
|
20
20
|
option ["--source-directory"], "SOURCE_DIRECTORY", "The directory where your source files are located."
|
@@ -88,4 +88,4 @@ Clamp do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
91
|
-
end
|
91
|
+
end
|
@@ -42,8 +42,10 @@ module Slather
|
|
42
42
|
# Sometimes gcov makes gcov files for Cocoa Touch classes, like NSRange. Ignore and delete later.
|
43
43
|
gcov_files_created = gcov_output.scan(/creating '(.+\..+\.gcov)'/)
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
gcov_file_name = "./#{source_file_pathname.basename}.gcov"
|
46
|
+
if File.exists?(gcov_file_name)
|
47
|
+
gcov_data = File.new(gcov_file_name).read
|
48
|
+
end
|
47
49
|
|
48
50
|
gcov_files_created.each { |file| FileUtils.rm(file) }
|
49
51
|
|
@@ -52,10 +54,14 @@ module Slather
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def coverage_data
|
55
|
-
|
57
|
+
if gcov_data
|
58
|
+
first_line_start = gcov_data =~ /^\s+(-|#+|[0-9+]):\s+1:/
|
56
59
|
|
57
|
-
|
58
|
-
|
60
|
+
gcov_data[first_line_start..-1].split("\n").map do |line|
|
61
|
+
coverage_for_line(line)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
[]
|
59
65
|
end
|
60
66
|
end
|
61
67
|
|
@@ -13,22 +13,13 @@ module Slather
|
|
13
13
|
private :travis_job_id
|
14
14
|
|
15
15
|
def coveralls_coverage_data
|
16
|
-
if ci_service == :travis_ci
|
16
|
+
if ci_service == :travis_ci
|
17
17
|
if travis_job_id
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}.to_json
|
24
|
-
elsif ci_service == :travis_pro
|
25
|
-
{
|
26
|
-
:service_job_id => travis_job_id,
|
27
|
-
:service_name => "travis-pro",
|
28
|
-
:repo_token => ci_access_token,
|
29
|
-
:source_files => coverage_files.map(&:as_json)
|
30
|
-
}.to_json
|
31
|
-
end
|
18
|
+
{
|
19
|
+
:service_job_id => travis_job_id,
|
20
|
+
:service_name => "travis-ci",
|
21
|
+
:source_files => coverage_files.map(&:as_json)
|
22
|
+
}.to_json
|
32
23
|
else
|
33
24
|
raise StandardError, "Environment variable `TRAVIS_JOB_ID` not set. Is this running on a travis build?"
|
34
25
|
end
|
data/lib/slather/project.rb
CHANGED
@@ -19,7 +19,7 @@ end
|
|
19
19
|
module Slather
|
20
20
|
class Project < Xcodeproj::Project
|
21
21
|
|
22
|
-
attr_accessor :build_directory, :ignore_list, :ci_service, :coverage_service, :
|
22
|
+
attr_accessor :build_directory, :ignore_list, :ci_service, :coverage_service, :source_directory
|
23
23
|
|
24
24
|
alias_method :setup_for_coverage, :slather_setup_for_coverage
|
25
25
|
|
@@ -70,7 +70,6 @@ module Slather
|
|
70
70
|
configure_build_directory_from_yml
|
71
71
|
configure_ignore_list_from_yml
|
72
72
|
configure_ci_service_from_yml
|
73
|
-
configure_ci_access_token_from_yml
|
74
73
|
configure_coverage_service_from_yml
|
75
74
|
configure_source_directory_from_yml
|
76
75
|
end
|
@@ -99,10 +98,6 @@ module Slather
|
|
99
98
|
self.coverage_service ||= (self.class.yml["coverage_service"] || :terminal)
|
100
99
|
end
|
101
100
|
|
102
|
-
def configure_ci_access_token_from_yml
|
103
|
-
self.ci_access_token ||= (self.class.yml["ci_access_token"] || "")
|
104
|
-
end
|
105
|
-
|
106
101
|
def coverage_service=(service)
|
107
102
|
service = service && service.to_sym
|
108
103
|
if service == :coveralls
|
data/lib/slather/version.rb
CHANGED
@@ -36,21 +36,6 @@ describe Slather::CoverageService::Coveralls do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
context "coverage_service is :travis_pro" do
|
40
|
-
before(:each) { fixtures_project.ci_service = :travis_pro }
|
41
|
-
|
42
|
-
it "should return valid json for coveralls coverage data" do
|
43
|
-
fixtures_project.stub(:travis_job_id).and_return("9182")
|
44
|
-
fixtures_project.stub(:ci_access_token).and_return("abc123")
|
45
|
-
expect(fixtures_project.send(:coveralls_coverage_data)).to eq("{\"service_job_id\":\"9182\",\"service_name\":\"travis-pro\",\"repo_token\":\"abc123\",\"source_files\":[{\"name\":\"spec/fixtures/fixtures/fixtures.m\",\"source\":\"//\\n// fixtures.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/24/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import \\\"fixtures.h\\\"\\n\\n@implementation fixtures\\n\\n- (void)testedMethod\\n{\\n NSLog(@\\\"tested\\\");\\n}\\n\\n- (void)untestedMethod\\n{\\n NSLog(@\\\"untested\\\");\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,1,null,null,null,0,0,null,null]},{\"name\":\"spec/fixtures/fixtures/more_files/peekaview.m\",\"source\":\"//\\n// peekaview.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/25/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import \\\"peekaview.h\\\"\\n\\n@implementation peekaview\\n\\n- (id)initWithFrame:(CGRect)frame\\n{\\n self = [super initWithFrame:frame];\\n if (self) {\\n // Initialization code\\n }\\n return self;\\n}\\n\\n/*\\n// Only override drawRect: if you perform custom drawing.\\n// An empty implementation adversely affects performance during animation.\\n- (void)drawRect:(CGRect)rect\\n{\\n // Drawing code\\n}\\n*/\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,0,null,0,0,null,0,0,0,null,null,null,null,null,null,null,null,null,null,null]},{\"name\":\"spec/fixtures/fixturesTests/fixturesTests.m\",\"source\":\"//\\n// fixturesTests.m\\n// fixturesTests\\n//\\n// Created by Mark Larsen on 6/24/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import <XCTest/XCTest.h>\\n#import \\\"fixtures.h\\\"\\n\\n@interface fixturesTests : XCTestCase\\n\\n@end\\n\\n@implementation fixturesTests\\n\\n- (void)setUp\\n{\\n [super setUp];\\n // Put setup code here. This method is called before the invocation of each test method in the class.\\n}\\n\\n- (void)tearDown\\n{\\n // Put teardown code here. This method is called after the invocation of each test method in the class.\\n [super tearDown];\\n}\\n\\n- (void)testExample\\n{\\n fixtures *f = [[fixtures alloc] init];\\n [f testedMethod];\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,1,null,null,null,null,1,1,null,null,null,1,1,1,null,null]},{\"name\":\"spec/fixtures/fixturesTests/peekaviewTests.m\",\"source\":\"//\\n// peekaviewTests.m\\n// fixtures\\n//\\n// Created by Mark Larsen on 6/25/14.\\n// Copyright (c) 2014 marklarr. All rights reserved.\\n//\\n\\n#import <XCTest/XCTest.h>\\n\\n@interface peekaviewTests : XCTestCase\\n\\n@end\\n\\n@implementation peekaviewTests\\n\\n- (void)setUp\\n{\\n [super setUp];\\n // Put setup code here. This method is called before the invocation of each test method in the class.\\n}\\n\\n- (void)tearDown\\n{\\n // Put teardown code here. This method is called after the invocation of each test method in the class.\\n [super tearDown];\\n}\\n\\n- (void)testExample\\n{\\n XCTAssert(YES, @\\\"woot\\\");\\n}\\n\\n@end\\n\",\"coverage\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,1,null,null,null,null,1,1,null,null,null,2,1,null,null]}]}")
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should raise an error if there is no TRAVIS_JOB_ID" do
|
49
|
-
fixtures_project.stub(:travis_job_id).and_return(nil)
|
50
|
-
expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
39
|
it "should raise an error if it does not recognize the ci_service" do
|
55
40
|
fixtures_project.ci_service = :jenkins_ci
|
56
41
|
expect { fixtures_project.send(:coveralls_coverage_data) }.to raise_error(StandardError)
|
@@ -228,14 +228,6 @@ describe Slather::Project do
|
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
231
|
-
describe "#configure_ci_access_token_from_yml" do
|
232
|
-
it "should set the ci_access_token if it has been provided by the yml" do
|
233
|
-
Slather::Project.stub(:yml).and_return({"ci_access_token" => "abc123"})
|
234
|
-
expect(fixtures_project).to receive(:ci_access_token=).with("abc123")
|
235
|
-
fixtures_project.configure_ci_access_token_from_yml
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
231
|
describe "#coverage_service=" do
|
240
232
|
it "should extend Slather::CoverageService::Coveralls and set coverage_service = :coveralls if given coveralls" do
|
241
233
|
expect(fixtures_project).to receive(:extend).with(Slather::CoverageService::Coveralls)
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
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-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -196,4 +196,3 @@ test_files:
|
|
196
196
|
- spec/slather/project_spec.rb
|
197
197
|
- spec/slather/slather_spec.rb
|
198
198
|
- spec/spec_helper.rb
|
199
|
-
has_rdoc:
|