cocoapods-testing 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -2
- data/README.md +1 -1
- data/cocoapods_testing.gemspec +1 -1
- data/lib/cocoapods_testing.rb +1 -1
- data/lib/pod/command/lib/testing.rb +84 -46
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60978cc8a272b1bce1fec928fd77045b608b8b50
|
4
|
+
data.tar.gz: 3e5c75046d96388c3e30fa60b43cc31b505423a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4508ba8cad21997b30c53ffeb199b777dbdc02e88fa5b98370360d33ace2bc14c894af3eb1e2d92325cefe3e3d85f7e9111e99f3093e529120dbd7693f37482b
|
7
|
+
data.tar.gz: 13b949c608595a767a6ac88046e978270386bc867a16aa82cf1055b709cda01f5a5d6cb4170f040fdf135b97daf0202d7d575ab0b62bea9b2536f28006a43f44
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
cocoapods-testing (0.0.6)
|
5
|
-
xctasks
|
5
|
+
xctasks (>= 0.5.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
nokogiri (1.6.3.1)
|
12
12
|
mini_portile (= 0.6.0)
|
13
13
|
rake (10.3.2)
|
14
|
-
xctasks (0.
|
14
|
+
xctasks (0.5.0)
|
15
15
|
nokogiri (~> 1.6, >= 1.6.3.1)
|
16
16
|
rake (~> 10.0, >= 10.0.0)
|
17
17
|
|
@@ -21,4 +21,5 @@ PLATFORMS
|
|
21
21
|
DEPENDENCIES
|
22
22
|
bundler (~> 1.3)
|
23
23
|
cocoapods-testing!
|
24
|
+
nokogiri (= 1.6.3.1)
|
24
25
|
rake
|
data/README.md
CHANGED
data/cocoapods_testing.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'xctasks'
|
21
|
+
spec.add_dependency 'xctasks', '>= 0.5.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
24
|
spec.add_development_dependency "rake"
|
data/lib/cocoapods_testing.rb
CHANGED
@@ -13,27 +13,89 @@ module Pod
|
|
13
13
|
|
14
14
|
def self.options
|
15
15
|
[
|
16
|
+
['--dry-run', 'Show which tests would be executed.'],
|
16
17
|
['--verbose', 'Show full xcodebuild output.']
|
17
18
|
]
|
18
19
|
end
|
19
20
|
|
20
21
|
def initialize(argv)
|
22
|
+
@@dry_run = argv.flag?('dry-run')
|
21
23
|
@@verbose = argv.flag?('verbose')
|
22
24
|
@@args = argv.arguments!
|
25
|
+
|
26
|
+
@@found_projects = []
|
27
|
+
@@found_tests = false
|
23
28
|
super
|
24
29
|
end
|
25
30
|
|
31
|
+
def self.handle_projects_in_dir(dir)
|
32
|
+
workspaces_in_dir(dir).each do |workspace_path|
|
33
|
+
next if workspace_path.end_with?('.xcworkspace')
|
34
|
+
|
35
|
+
project = Xcodeproj::Project.open(Pathname.new(workspace_path))
|
36
|
+
yield project, workspace_path
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
26
40
|
def self.handle_workspaces_in_dir(dir)
|
27
41
|
workspaces_in_dir(dir).each do |workspace_path|
|
28
|
-
|
42
|
+
next if workspace_path.end_with?('.xcodeproj')
|
29
43
|
|
30
|
-
|
31
|
-
|
32
|
-
|
44
|
+
workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
|
45
|
+
yield workspace, workspace_path
|
46
|
+
end
|
33
47
|
end
|
34
48
|
|
35
49
|
:private
|
36
50
|
|
51
|
+
def handle_xcode_artifacts_in_dir(dir)
|
52
|
+
self.class.handle_workspaces_in_dir(dir) do |workspace, workspace_path|
|
53
|
+
handle_workspace(workspace, workspace_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
self.class.handle_projects_in_dir(dir) do |project, project_path|
|
57
|
+
handle_project(project, project_path)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def handle_project(project, project_location, workspace_location = nil)
|
62
|
+
return if @@found_projects.include?(project_location)
|
63
|
+
|
64
|
+
schemes = Dir[Xcodeproj::XCScheme.shared_data_dir(project_location).to_s + '/*']
|
65
|
+
schemes += Dir[Xcodeproj::XCScheme.user_data_dir(project_location).to_s + '/*']
|
66
|
+
|
67
|
+
scheme_map = Hash.new
|
68
|
+
schemes.each do |path|
|
69
|
+
next if File.directory?(path)
|
70
|
+
doc = REXML::Document.new(File.new(path))
|
71
|
+
REXML::XPath.each(doc, '//TestAction') do |action|
|
72
|
+
blueprint_name = REXML::XPath.first(action,
|
73
|
+
'//BuildableReference/@BlueprintName').value
|
74
|
+
scheme_name = File.basename(path, '.xcscheme')
|
75
|
+
scheme_map[blueprint_name] = scheme_name
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
project.targets.each do |target|
|
80
|
+
product_type = nil
|
81
|
+
|
82
|
+
begin
|
83
|
+
product_type = target.product_type.to_s
|
84
|
+
rescue
|
85
|
+
next
|
86
|
+
end
|
87
|
+
|
88
|
+
if product_type.end_with?('bundle.unit-test')
|
89
|
+
scheme = scheme_map[target.name]
|
90
|
+
# Fallback to first scheme if none is found for this target
|
91
|
+
next if not scheme_map.first
|
92
|
+
scheme = scheme_map.first[1] unless scheme && scheme.length > 0
|
93
|
+
@@found_projects << project_location
|
94
|
+
run_tests(workspace_location || project_location, target.name, scheme)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
37
99
|
def handle_workspace(workspace, workspace_location)
|
38
100
|
workspace.file_references.each do |ref|
|
39
101
|
if ref.path.end_with?('.xcodeproj')
|
@@ -41,37 +103,7 @@ module Pod
|
|
41
103
|
next
|
42
104
|
end
|
43
105
|
project = Xcodeproj::Project.open(ref.path)
|
44
|
-
|
45
|
-
schemes = Dir[Xcodeproj::XCScheme.shared_data_dir(ref.path).to_s + '/*']
|
46
|
-
schemes += Dir[Xcodeproj::XCScheme.user_data_dir(ref.path).to_s + '/*']
|
47
|
-
|
48
|
-
scheme_map = Hash.new
|
49
|
-
schemes.each do |path|
|
50
|
-
doc = REXML::Document.new(File.new(path))
|
51
|
-
REXML::XPath.each(doc, '//TestAction') do |action|
|
52
|
-
blueprint_name = REXML::XPath.first(action,
|
53
|
-
'//BuildableReference/@BlueprintName').value
|
54
|
-
scheme_name = File.basename(path, '.xcscheme')
|
55
|
-
scheme_map[blueprint_name] = scheme_name
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
project.targets.each do |target|
|
60
|
-
product_type = nil
|
61
|
-
|
62
|
-
begin
|
63
|
-
product_type = target.product_type.to_s
|
64
|
-
rescue
|
65
|
-
next
|
66
|
-
end
|
67
|
-
|
68
|
-
if product_type.end_with?('bundle.unit-test')
|
69
|
-
scheme = scheme_map[target.name]
|
70
|
-
# Fallback to first scheme if none is found for this target
|
71
|
-
scheme = scheme_map.first[1] unless scheme && scheme.length > 0
|
72
|
-
run_tests(workspace_location, target.name, scheme)
|
73
|
-
end
|
74
|
-
end
|
106
|
+
handle_project(project, ref.path, workspace_location)
|
75
107
|
end
|
76
108
|
end
|
77
109
|
end
|
@@ -84,12 +116,17 @@ module Pod
|
|
84
116
|
end
|
85
117
|
|
86
118
|
def run_tests(workspace, target_name, scheme_name)
|
87
|
-
|
88
|
-
|
119
|
+
@@found_tests = true
|
120
|
+
|
89
121
|
XCTasks::TestTask.new do |t|
|
90
122
|
t.actions = %w(clean build test)
|
91
123
|
t.runner = @@verbose ? :xcodebuild : :xcpretty
|
92
|
-
|
124
|
+
|
125
|
+
if workspace.end_with? 'workspace'
|
126
|
+
t.workspace = workspace
|
127
|
+
else
|
128
|
+
t.project = workspace
|
129
|
+
end
|
93
130
|
|
94
131
|
t.actions << @@args unless @@args.nil?
|
95
132
|
|
@@ -107,10 +144,10 @@ module Pod
|
|
107
144
|
end
|
108
145
|
|
109
146
|
UI.puts 'Running tests for ' + target_name
|
110
|
-
|
111
|
-
Rake::Task['test:unit'].invoke
|
147
|
+
Rake::Task['test:unit'].invoke unless @@dry_run
|
112
148
|
end
|
113
149
|
|
150
|
+
# TODO: Refactor to remove all projects which are part of a workspace
|
114
151
|
def self.workspaces_in_dir(dir)
|
115
152
|
glob_match = Dir.glob("#{dir}/**/*.xc{odeproj,workspace}")
|
116
153
|
glob_match = glob_match.reject do |p|
|
@@ -138,21 +175,22 @@ module Pod
|
|
138
175
|
# TODO: How to link specs to projects/workspaces?
|
139
176
|
# spec = Specification.from_file(path)
|
140
177
|
|
141
|
-
|
142
|
-
handle_workspace(workspace, workspace_path)
|
143
|
-
end
|
178
|
+
handle_xcode_artifacts_in_dir(Pathname.pwd)
|
144
179
|
|
145
180
|
Dir['*'].each do |dir|
|
146
181
|
next if !File.directory?(dir)
|
147
182
|
original_dir = Pathname.pwd
|
148
183
|
Dir.chdir(dir)
|
149
184
|
|
150
|
-
|
151
|
-
handle_workspace(workspace, workspace_path)
|
152
|
-
end
|
185
|
+
handle_xcode_artifacts_in_dir(Pathname.pwd)
|
153
186
|
|
154
187
|
Dir.chdir(original_dir)
|
155
188
|
end
|
189
|
+
|
190
|
+
if not @@found_tests
|
191
|
+
puts('No suitable test targets found.'.yellow)
|
192
|
+
exit(1)
|
193
|
+
end
|
156
194
|
end
|
157
195
|
end
|
158
196
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Bügling
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xctasks
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Run tests for any pod from the command line without any prior knowledge.
|
@@ -59,7 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
-
|
62
|
+
- .gitignore
|
63
63
|
- Gemfile
|
64
64
|
- Gemfile.lock
|
65
65
|
- LICENSE.txt
|
@@ -80,12 +80,12 @@ require_paths:
|
|
80
80
|
- lib
|
81
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|