cocoapods-testing 0.0.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 +7 -0
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +11 -0
- data/Rakefile +1 -0
- data/TODO.md +3 -0
- data/cocoapods_testing.gemspec +25 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/cocoapods_testing.rb +3 -0
- data/lib/pod/command/lib/testing.rb +106 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 719cfa06507004c821138b8b791f3898019abd7b
|
4
|
+
data.tar.gz: 45a398bc4932365fddb16be9b945b8408d899cc5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d5a73cfa8c43560c151367e929500189161859ba6ec7e3f5e143dfa19707ec4e8dddd3e50c52626c8fe8d0b330098f679cd3d156b5d540d3f2f2e492f11a682
|
7
|
+
data.tar.gz: 7e09a626f624b3beac2bd26ae3a45f1bd8da4ab70b71390050c7db8c97902c524c5f832a0cc3582ac457b11ce7c8d6771005a4b4cc5c19b365f6bf85399a79eb
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Boris Bügling <boris@icculus.org>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/TODO.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_testing.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cocoapods-testing"
|
8
|
+
spec.version = CocoapodsTesting::VERSION
|
9
|
+
spec.authors = ["Boris Bügling"]
|
10
|
+
spec.email = ["boris@icculus.org"]
|
11
|
+
spec.description = %q{Run tests for any pod from the command line without any prior knowledge.}
|
12
|
+
spec.summary = %q{Run tests for any pod from the command line without any prior knowledge.}
|
13
|
+
spec.homepage = "https://github.com/neonichu/cocoapods-testing"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'xctasks'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pod/command/lib/testing'
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'xcodeproj'
|
2
|
+
require 'xctasks/test_task'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Lib
|
7
|
+
|
8
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
9
|
+
# in the `plugins.json` file, once your plugin is released.
|
10
|
+
|
11
|
+
class Testing < Lib
|
12
|
+
self.summary = 'Run tests for any pod from the command line without any prior knowledge.'
|
13
|
+
|
14
|
+
def handle_workspace(workspace, workspace_location)
|
15
|
+
workspace.file_references.each do |ref|
|
16
|
+
if ref.path.end_with?('.xcodeproj')
|
17
|
+
project = Xcodeproj::Project.open(ref.path)
|
18
|
+
|
19
|
+
schemes = Dir[Xcodeproj::XCScheme.shared_data_dir(ref.path).to_s + '/*']
|
20
|
+
schemes += Dir[Xcodeproj::XCScheme.user_data_dir(ref.path).to_s + '/*']
|
21
|
+
|
22
|
+
scheme_map = Hash.new
|
23
|
+
schemes.each do |path|
|
24
|
+
doc = REXML::Document.new(File.new(path))
|
25
|
+
REXML::XPath.each(doc, '//TestAction') do |action|
|
26
|
+
blueprint_name = REXML::XPath.first(action,
|
27
|
+
'//BuildableReference/@BlueprintName').value
|
28
|
+
scheme_name = File.basename(path, '.xcscheme')
|
29
|
+
scheme_map[blueprint_name] = scheme_name
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
project.targets.each do |target|
|
34
|
+
product_type = nil
|
35
|
+
|
36
|
+
begin
|
37
|
+
product_type = target.product_type.to_s
|
38
|
+
rescue
|
39
|
+
next
|
40
|
+
end
|
41
|
+
|
42
|
+
if product_type.end_with?('bundle.unit-test')
|
43
|
+
puts scheme_map
|
44
|
+
|
45
|
+
scheme = scheme_map[target.name]
|
46
|
+
run_tests(workspace_location, target.name, scheme)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def podspecs_to_check
|
54
|
+
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}')
|
55
|
+
msg = 'Unable to find a podspec in the working directory'
|
56
|
+
fail Informative, msg if podspecs.count.zero?
|
57
|
+
podspecs
|
58
|
+
end
|
59
|
+
|
60
|
+
def run_tests(workspace, target_name, scheme_name)
|
61
|
+
# TODO: Figure out what this was supposed to do:
|
62
|
+
# new(test: 'server:autostart')
|
63
|
+
XCTasks::TestTask.new do |t|
|
64
|
+
#t.runner = :xcodebuild
|
65
|
+
t.runner = :xcpretty
|
66
|
+
t.workspace = workspace
|
67
|
+
|
68
|
+
t.subtask(unit: scheme_name) do |s|
|
69
|
+
# TODO: version should be configurable
|
70
|
+
s.ios_versions = %w(7.1)
|
71
|
+
s.destination('name=iPhone Retina (4-inch)')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
UI.puts 'Running tests for ' + target_name
|
76
|
+
# puts Rake.application.tasks
|
77
|
+
Rake::Task['test:unit'].invoke
|
78
|
+
end
|
79
|
+
|
80
|
+
def workspaces_in_dir(dir)
|
81
|
+
glob_match = Dir.glob("#{dir}/**/*.xc{odeproj,workspace}")
|
82
|
+
glob_match = glob_match.reject do |p|
|
83
|
+
next true if p.include?('Pods.xcodeproj')
|
84
|
+
next true if p.end_with?('.xcodeproj/project.xcworkspace')
|
85
|
+
sister_workspace = p.chomp(File.extname(p.to_s)) + '.xcworkspace'
|
86
|
+
p.end_with?('.xcodeproj') && glob_match.include?(sister_workspace)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def run
|
91
|
+
podspecs_to_check.each do # |path|
|
92
|
+
# TODO: How to link specs to projects/workspaces?
|
93
|
+
# spec = Specification.from_file(path)
|
94
|
+
|
95
|
+
workspaces_in_dir(Pathname.pwd).each do |workspace|
|
96
|
+
next if workspace.end_with?('.xcodeproj')
|
97
|
+
|
98
|
+
wrkspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace)
|
99
|
+
handle_workspace(wrkspace, workspace)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-testing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Boris Bügling
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: xctasks
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Run tests for any pod from the command line without any prior knowledge.
|
56
|
+
email:
|
57
|
+
- boris@icculus.org
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- TODO.md
|
68
|
+
- cocoapods_testing.gemspec
|
69
|
+
- lib/cocoapods_plugin.rb
|
70
|
+
- lib/cocoapods_testing.rb
|
71
|
+
- lib/pod/command/lib/testing.rb
|
72
|
+
homepage: https://github.com/neonichu/cocoapods-testing
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.0.14
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Run tests for any pod from the command line without any prior knowledge.
|
96
|
+
test_files: []
|