xcknife 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 382b508c31ce85bef5f5e3b8c62c0123c99621c8
4
- data.tar.gz: 32d2d0f673e3249255b6411c4495728fd88f2ad4
3
+ metadata.gz: 8ed26dad507c5c0724cc106ed6a576107b89f115
4
+ data.tar.gz: 4f3bd509e3ae26553277f6a0acfc0c3399618d20
5
5
  SHA512:
6
- metadata.gz: 62db236867e7b9cce9cd898d801f85529f839dc1b92d5b90012477f5217f56162b8cac832b50c0018baab3cfe930e1457f6044cc0487dc91f68b4e046b3218bb
7
- data.tar.gz: f511bda1db99c3248cdec74fe82a297ca949e49f8dc12802364ee24fa413fe4c2a8c4f61ee45290278a6e5eb833490d997bba3d5ea5b607fa720065251134b5c
6
+ metadata.gz: 24198040c30930d5afd2f9acf6f0b70f78dd562e61d586208c211ca3672100c50d243732c8ee379c0107a261fc6f5eaf810ca1b392e23001b1fd5842eaffe116
7
+ data.tar.gz: 52227e2e60f654fae12b6b7ea03d3bf89993aec7770a7e62e6ec4272acc10df050fefb20d2fc296cff77b9b8e6ef10c58fb1b44e71042e9d0affa6973fbfe327
data/Rakefile CHANGED
@@ -14,4 +14,9 @@ task :build_test_dumper do
14
14
  FileUtils.copy_file("./testdumperbuild/Build/Products/Debug-iphonesimulator/TestDumper.framework/TestDumper", "./TestDumper.dylib")
15
15
  puts "TestDumper.dylib was created successfully"
16
16
  end
17
+ end
18
+
19
+ desc "Release wih test_dumper"
20
+ task :gem_release => [:build_test_dumper, :build] do
21
+ system 'gem push pkg/xcknife-*.gem'
17
22
  end
data/lib/xcknife.rb CHANGED
@@ -6,5 +6,5 @@ require 'xcknife/test_dumper'
6
6
  require 'xcknife/exceptions'
7
7
 
8
8
  module XCKnife
9
- VERSION = '0.6.0'
9
+ VERSION = '0.6.1'
10
10
  end
@@ -34,10 +34,10 @@ module XCKnife
34
34
  private
35
35
  def concat_to_file(test_specification, output_fd)
36
36
  file = test_specification.json_stream_file
37
- wait_test_dumper_completion(file)
38
- IO.readlines(file).each do |line|
37
+ IO.readlines(file).each do |line|
39
38
  event = OpenStruct.new(JSON.load(line))
40
39
  output_fd.write(line) unless should_test_event_be_ignored?(test_specification, event)
40
+ output_fd.flush
41
41
  end
42
42
  output_fd.flush
43
43
  end
@@ -47,31 +47,8 @@ module XCKnife
47
47
  return false unless event["test"] == "1"
48
48
  test_specification.skip_test_identifiers.include?(event["className"])
49
49
  end
50
-
51
- def wait_test_dumper_completion(file)
52
- retries_count = 0
53
- until has_test_dumper_terminated?(file) do
54
- retries_count += 1
55
- assert_has_not_timed_out(retries_count, file)
56
- sleep 0.1
57
- end
58
- end
59
-
60
- def assert_has_not_timed_out(retries_count, file)
61
- if retries_count == 100
62
- puts "Timeout error on: #{file}"
63
- exit 1
64
- end
65
- end
66
-
67
- def has_test_dumper_terminated?(file)
68
- return false unless File.exists?(file)
69
- last_line = `tail -n 1 "#{file}"`
70
- return /Completed Test Dumper/.match(last_line)
71
- end
72
50
  end
73
51
 
74
-
75
52
  class TestDumperHelper
76
53
  TestSpecification = Struct.new :json_stream_file, :skip_test_identifiers
77
54
 
@@ -95,10 +72,13 @@ module XCKnife
95
72
  xctestrun_as_json = `plutil -convert json -o - "#{xctestrun_file}"`
96
73
  FileUtils.mkdir_p(list_folder)
97
74
  JSON.load(xctestrun_as_json).map do |test_bundle_name, test_bundle|
98
- list_tests_wiht_simctl(list_folder, test_bundle, test_bundle_name)
75
+ test_specification = list_tests_wiht_simctl(list_folder, test_bundle, test_bundle_name)
76
+ wait_test_dumper_completion(test_specification.json_stream_file)
77
+ test_specification
99
78
  end
100
79
  end
101
80
 
81
+ private
102
82
  def list_tests_wiht_simctl(list_folder, test_bundle, test_bundle_name)
103
83
  env_variables = test_bundle["EnvironmentVariables"]
104
84
  testing_env_variables = test_bundle["TestingEnvironmentVariables"]
@@ -141,8 +121,6 @@ module XCKnife
141
121
  return TestSpecification.new outpath, discover_tests_to_skip(test_bundle)
142
122
  end
143
123
 
144
- private
145
-
146
124
  def discover_tests_to_skip(test_bundle)
147
125
  identifier_for_test_method = "/"
148
126
  skip_test_identifiers = test_bundle["SkipTestIdentifiers"] || []
@@ -177,6 +155,28 @@ module XCKnife
177
155
  end
178
156
  end
179
157
 
158
+ def wait_test_dumper_completion(file)
159
+ retries_count = 0
160
+ until has_test_dumper_terminated?(file) do
161
+ retries_count += 1
162
+ assert_has_not_timed_out(retries_count, file)
163
+ sleep 0.1
164
+ end
165
+ end
166
+
167
+ def assert_has_not_timed_out(retries_count, file)
168
+ if retries_count == 100
169
+ puts "Timeout error on: #{file}"
170
+ exit 1
171
+ end
172
+ end
173
+
174
+ def has_test_dumper_terminated?(file)
175
+ return false unless File.exists?(file)
176
+ last_line = `tail -n 1 "#{file}"`
177
+ return /Completed Test Dumper/.match(last_line)
178
+ end
179
+
180
180
  def run_apptest(env, test_host_bundle_identifier, test_bundle_path)
181
181
  call_simctl env, "launch #{@device_id} '#{test_host_bundle_identifier}' -XCTest All '#{test_bundle_path}'"
182
182
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcknife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Ribeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler