xctest-runner 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e20d4737c7d79a3473f752177015b7ef9913c2f7
4
- data.tar.gz: 17e3a16a2f66e2cc67664a5e87be769b9b8f8a03
3
+ metadata.gz: a00f0e993f2d26eb625fce6c23898256d53168b4
4
+ data.tar.gz: d6bfe7c84e27ca2522b7ecadaa50fc94206861f0
5
5
  SHA512:
6
- metadata.gz: d3e0900e1c8954cdac3c01a5e4289de2fe21150aef4f67f17be311d45bba33a3d34467af994cae667db71684a1af2acbae8f7e3555daa543e0b5d1ca1f795c02
7
- data.tar.gz: 0ed3bf2be0e336b2528ac90a93bdfa53a048072941586a1cb38e99df443a86794840079f31f50afdf7ee2097d925260ca2655040b472cfdaad1623bd6a89da64
6
+ metadata.gz: a7d2b6ac60cb0801181f4356f79e2920b020d9c8ad6c17d12d37cc26247b309111fecfc837a663c69e849e89e207dc99021767f9b78e493e0b5de6caa4922eb2
7
+ data.tar.gz: 29ecedeb967476d3504a414f97af5976433125ca48cae622a21b1ac2cb4ec313666480b6e380abb014ead8c52b6f291537d74b171ba96b08a2a2c7be6b4a8021
data/Gemfile CHANGED
@@ -1,7 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'systemu'
4
-
5
3
  group :development do
6
4
  gem 'rspec'
7
5
  gem 'rdoc'
data/README.md CHANGED
@@ -12,10 +12,24 @@ $ gem install xctest-runner
12
12
 
13
13
  ## Usage
14
14
 
15
+ ### Simple usage
16
+
17
+ ```shell
18
+ $ xctest-runner
19
+ ```
20
+
21
+ xctest-runner may be able to find the appropriate Target automatically.
22
+
15
23
  ### If you would like to run a specific test case
16
24
 
17
25
  ```shell
18
- $ xctest-runner -target YourTestsTarget -test SampleTests/testSample
26
+ $ xctest-runner -test SampleTests/testSample
27
+ ```
28
+
29
+ ### If you specify a target
30
+
31
+ ```shell
32
+ $ xctest-runner -target YourTestsTarget
19
33
  ```
20
34
 
21
35
  ### If you specify a scheme
@@ -27,13 +41,13 @@ $ xctest-runner -scheme YourScheme
27
41
  ### If you specify a workspace
28
42
 
29
43
  ```shell
30
- $ xctest-runner -workspace Sample.xcworkspace -target YourTestsTarget
44
+ $ xctest-runner -workspace Sample.xcworkspace
31
45
  ```
32
46
 
33
47
  ### If you specify a project
34
48
 
35
49
  ```shell
36
- $ xctest-runner -workspace Sample.xcodeproj -target YourTestsTarget
50
+ $ xctest-runner -project Sample.xcodeproj
37
51
  ```
38
52
 
39
53
  ## Advanced Usage
@@ -41,13 +55,13 @@ $ xctest-runner -workspace Sample.xcodeproj -target YourTestsTarget
41
55
  ### If you would like to use [xcpretty](https://github.com/mneorr/XCPretty)
42
56
 
43
57
  ```shell
44
- $ xctest-runner -target YourTestsTarget | xcpretty -c
58
+ $ xctest-runner 2>&1 | xcpretty -c
45
59
  ```
46
60
 
47
61
  ### If you would like add your build options
48
62
 
49
63
  ```shell
50
- $ xctest-runner -target YourTestsTarget -suffix "OBJROOT=."
64
+ $ xctest-runner -suffix "OBJROOT=."
51
65
  ```
52
66
 
53
67
  ## Copyright
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -27,4 +27,24 @@ module BuildEnvironment
27
27
  ENV['DYLD_ROOT_PATH'] = ENV['SDK_DIR']
28
28
  end
29
29
 
30
+ def xcodebuild_list
31
+ execute_command("xcodebuild -list")
32
+ end
33
+
34
+ def default_target
35
+ target = nil
36
+ is_target = false
37
+
38
+ output = xcodebuild_list
39
+ output.each_line do |line|
40
+ line = line.strip
41
+ if line =~ /\w+:/
42
+ is_target = ('Targets:' == line)
43
+ elsif is_target
44
+ target = line if target.nil? || line.end_with?('Tests')
45
+ end
46
+ end
47
+ target ? target : 'Tests'
48
+ end
49
+
30
50
  end
@@ -1,17 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require 'systemu'
4
-
5
3
  module Shell
6
4
 
7
5
  def execute_command(command, need_puts = false)
8
- status, stdout, stderr = systemu command
9
6
  if need_puts
10
- puts "$ #{command}\n\n"
11
- puts stdout
7
+ puts "$ #{command}\n\n" if need_puts
8
+ system command
9
+ else
10
+ `#{command}`
12
11
  end
13
- puts stderr
14
- stdout
15
12
  end
16
13
 
17
14
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  class XCTestRunner
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/xctest-runner.rb CHANGED
@@ -54,6 +54,7 @@ class XCTestRunner
54
54
  (@workspace ? "-workspace #{@workspace} " : '') +
55
55
  (@project ? "-project #{@project} " : '') +
56
56
  (@target ? "-target #{@target} " : '') +
57
+ (@scheme.nil? && @target.nil? ? "-target #{default_target} " : '') +
57
58
  "-sdk #{@sdk} -arch #{@arch} -configuration #{@configuration}"
58
59
  end
59
60
 
@@ -8,6 +8,8 @@ describe XCTestRunner do
8
8
  @last_command = command
9
9
  if command.include?('-showBuildSettings')
10
10
  build_settings
11
+ elsif command.include?('-list')
12
+ xcodebuild_list
11
13
  end
12
14
  end
13
15
 
@@ -20,6 +22,24 @@ describe XCTestRunner do
20
22
  HOGE = "huga"
21
23
  EOS
22
24
  end
25
+
26
+ def xcodebuild_list
27
+ <<-EOS
28
+ Information about project "PodSample":
29
+ Targets:
30
+ PodSample
31
+ PodSampleTests
32
+
33
+ Build Configurations:
34
+ Debug
35
+ Release
36
+
37
+ If no build configuration is specified and -scheme is not passed then "Release" is used.
38
+
39
+ Schemes:
40
+ PodSample
41
+ EOS
42
+ end
23
43
  end
24
44
 
25
45
  let(:opts) {
@@ -37,10 +57,11 @@ describe XCTestRunner do
37
57
  end
38
58
 
39
59
  it 'runs xcodebuild with default options' do
40
- expect(opts.count).to eq 3
60
+ expect(opts.count).to eq 4
41
61
  expect(opts['-sdk']).to eq 'iphonesimulator'
42
62
  expect(opts['-arch']).to eq 'x86_64'
43
63
  expect(opts['-configuration']).to eq 'Debug'
64
+ expect(opts['-target']).to eq 'PodSampleTests'
44
65
  end
45
66
 
46
67
  it 'doese not run clean command' do
@@ -68,7 +89,7 @@ describe XCTestRunner do
68
89
  end
69
90
 
70
91
  it 'has some build arguments' do
71
- expect(opts.count).to eq 4
92
+ expect(opts.count).to eq 5
72
93
  expect(opts['-workspace']).to eq 'Sample'
73
94
  end
74
95
  end
@@ -79,7 +100,7 @@ describe XCTestRunner do
79
100
  end
80
101
 
81
102
  it 'has some build arguments' do
82
- expect(opts.count).to eq 4
103
+ expect(opts.count).to eq 5
83
104
  expect(opts['-project']).to eq 'Sample'
84
105
  end
85
106
  end
@@ -101,7 +122,7 @@ describe XCTestRunner do
101
122
  end
102
123
 
103
124
  it 'has some build arguments' do
104
- expect(opts.count).to eq 3
125
+ expect(opts.count).to eq 4
105
126
  expect(opts['-sdk']).to eq 'iphoneos'
106
127
  end
107
128
  end
@@ -112,7 +133,7 @@ describe XCTestRunner do
112
133
  end
113
134
 
114
135
  it 'has some build arguments' do
115
- expect(opts.count).to eq 3
136
+ expect(opts.count).to eq 4
116
137
  expect(opts['-arch']).to eq 'armv7'
117
138
  end
118
139
  end
@@ -123,7 +144,7 @@ describe XCTestRunner do
123
144
  end
124
145
 
125
146
  it 'has some build arguments' do
126
- expect(opts.count).to eq 3
147
+ expect(opts.count).to eq 4
127
148
  expect(opts['-configuration']).to eq 'Release'
128
149
  end
129
150
  end
@@ -134,7 +155,7 @@ describe XCTestRunner do
134
155
  end
135
156
 
136
157
  it 'has some build arguments' do
137
- expect(opts.count).to eq 3
158
+ expect(opts.count).to eq 4
138
159
  end
139
160
 
140
161
  it 'run test command with the specific test case' do
@@ -149,7 +170,7 @@ describe XCTestRunner do
149
170
  end
150
171
 
151
172
  it 'has some build arguments' do
152
- expect(opts.count).to eq 3
173
+ expect(opts.count).to eq 4
153
174
  end
154
175
 
155
176
  it 'run clean command' do
@@ -166,7 +187,7 @@ describe XCTestRunner do
166
187
  end
167
188
 
168
189
  it 'has some build arguments' do
169
- expect(opts.count).to eq 3
190
+ expect(opts.count).to eq 4
170
191
  end
171
192
 
172
193
  it 'run test command with the suffix' do
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "xctest-runner"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tokorom"]
@@ -45,14 +45,12 @@ Gem::Specification.new do |s|
45
45
  s.specification_version = 4
46
46
 
47
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
- s.add_runtime_dependency(%q<systemu>, [">= 0"])
49
48
  s.add_development_dependency(%q<rspec>, [">= 0"])
50
49
  s.add_development_dependency(%q<rdoc>, [">= 0"])
51
50
  s.add_development_dependency(%q<bundler>, [">= 0"])
52
51
  s.add_development_dependency(%q<jeweler>, [">= 0"])
53
52
  s.add_development_dependency(%q<simplecov>, [">= 0"])
54
53
  else
55
- s.add_dependency(%q<systemu>, [">= 0"])
56
54
  s.add_dependency(%q<rspec>, [">= 0"])
57
55
  s.add_dependency(%q<rdoc>, [">= 0"])
58
56
  s.add_dependency(%q<bundler>, [">= 0"])
@@ -60,7 +58,6 @@ Gem::Specification.new do |s|
60
58
  s.add_dependency(%q<simplecov>, [">= 0"])
61
59
  end
62
60
  else
63
- s.add_dependency(%q<systemu>, [">= 0"])
64
61
  s.add_dependency(%q<rspec>, [">= 0"])
65
62
  s.add_dependency(%q<rdoc>, [">= 0"])
66
63
  s.add_dependency(%q<bundler>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xctest-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tokorom
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: systemu
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
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement