xcknife 0.6.5 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rexml/document'
2
4
 
3
5
  module XCKnife
@@ -8,20 +10,18 @@ module XCKnife
8
10
  ret = {}
9
11
  xml_root = REXML::Document.new(xscheme_data).root
10
12
 
11
-
12
- action = xml_root.elements["//TestAction"]
13
+ action = xml_root.elements['//TestAction']
13
14
  return ret if action.nil?
14
- if action.attributes['shouldUseLaunchSchemeArgsEnv'] == "YES"
15
- action = xml_root.elements["//LaunchAction"]
16
- end
15
+
16
+ action = xml_root.elements['//LaunchAction'] if action.attributes['shouldUseLaunchSchemeArgsEnv'] == 'YES'
17
17
  return ret if action.nil?
18
- env_elements = action.elements[".//EnvironmentVariables"]
18
+
19
+ env_elements = action.elements['.//EnvironmentVariables']
19
20
  return ret if env_elements.nil?
21
+
20
22
  env_elements.elements.each do |e|
21
23
  attrs = e.attributes
22
- if attrs["isEnabled"] == "YES"
23
- ret[attrs["key"]] = attrs["value"]
24
- end
24
+ ret[attrs['key']] = attrs['value'] if attrs['isEnabled'] == 'YES'
25
25
  end
26
26
  ret
27
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
5
  module XCKnife
@@ -5,12 +7,14 @@ module XCKnife
5
7
  def only_arguments_for_a_partition_set(output_type, partition_set)
6
8
  method = "#{output_type}_only_arguments_for_a_partition_set"
7
9
  raise "Unknown output_type: #{output_type}" unless respond_to?(method)
10
+
8
11
  __send__(method, partition_set)
9
12
  end
10
13
 
11
14
  def only_arguments(output_type, partition)
12
15
  method = "#{output_type}_only_arguments"
13
16
  raise "Unknown output_type: #{output_type}" unless respond_to?(method)
17
+
14
18
  __send__(method, partition)
15
19
  end
16
20
 
@@ -25,12 +29,31 @@ module XCKnife
25
29
  end
26
30
 
27
31
  # only-testing is available since Xcode 8
28
- def xcodebuild_only_arguments(single_partition)
29
- single_partition.flat_map do |test_target, classes|
32
+ # rubocop:disable Metrics/CyclomaticComplexity
33
+ def xcodebuild_only_arguments(single_partition, meta_partition = nil)
34
+ only_targets = Set.new
35
+
36
+ if meta_partition
37
+ filtered = meta_partition.flat_map(&:keys)
38
+ .group_by(&:to_s)
39
+ .select { |_, v| v.size == 1 }
40
+ .map(&:first)
41
+ .to_set
42
+
43
+ only_targets = single_partition.keys.to_set & filtered
44
+ end
45
+
46
+ only_target_arguments = only_targets.sort.map { |test_target| "-only-testing:#{test_target}" }
47
+
48
+ only_class_arguments = single_partition.flat_map do |test_target, classes|
49
+ next [] if only_targets.include?(test_target)
50
+
30
51
  classes.sort.map do |clazz|
31
52
  "-only-testing:#{test_target}/#{clazz}"
32
53
  end
33
- end
54
+ end.sort
55
+
56
+ only_target_arguments + only_class_arguments
34
57
  end
35
58
 
36
59
  # skip-testing is available since Xcode 8
@@ -50,4 +73,5 @@ module XCKnife
50
73
  partition_set.map { |partition| xctool_only_arguments(partition) }
51
74
  end
52
75
  end
53
- end
76
+ # rubocop:enable Metrics/CyclomaticComplexity
77
+ end
@@ -1,6 +1,8 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
4
6
  require 'xcknife'
5
7
 
6
8
  Gem::Specification.new do |s|
@@ -11,22 +13,19 @@ Gem::Specification.new do |s|
11
13
  s.homepage = 'https://github.com/square/xcknife'
12
14
  s.licenses = ['Apache-2.0']
13
15
 
14
- s.summary = %q{Simple tool for optimizing XCTest runs across machines}
16
+ s.summary = 'Simple tool for optimizing XCTest runs across machines'
15
17
  s.description = <<-DESCRIPTION
16
18
  Simple tool for optimizing XCTest runs across machines.
17
19
  Works by leveraging xctool's json-streams timing and test data.
18
20
  DESCRIPTION
19
21
 
20
- # Only allow gem to be pushed to https://rubygems.org
21
- s.metadata["allowed_push_host"] = 'https://rubygems.org'
22
-
23
- s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).reject { |f| f =~ /^spec/} + ["TestDumper/TestDumper.dylib"]
22
+ s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).reject { |f| f =~ /^spec/ } + ['TestDumper/TestDumper.dylib']
24
23
  s.bindir = 'bin'
25
- s.executables = ['xcknife', 'xcknife-min', 'xcknife-test-dumper']
24
+ s.executables = %w[xcknife xcknife-min xcknife-test-dumper]
26
25
  s.require_paths = ['lib']
27
26
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
28
27
 
29
- s.required_ruby_version = '>= 2.0.0'
28
+ s.required_ruby_version = '>= 2.6.0'
30
29
 
31
30
  s.add_development_dependency 'bundler', '~> 1.12'
32
31
  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.5
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Ribeiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-06 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,18 +38,23 @@ extensions: []
38
38
  extra_rdoc_files: []
39
39
  files:
40
40
  - ".gitignore"
41
- - ".gitmodules"
42
41
  - ".rspec"
42
+ - ".rubocop.yml"
43
43
  - ".ruby-version"
44
44
  - ".travis.yml"
45
+ - ".vscode/configure.sh"
46
+ - ".vscode/vscode_ruby.json.template"
45
47
  - CONTRIBUTING.md
46
48
  - Gemfile
49
+ - Gemfile.lock
47
50
  - LICENSE
51
+ - OWNERS.yml
48
52
  - README.md
49
53
  - Rakefile
50
54
  - TestDumper/README.md
51
55
  - TestDumper/TestDumper.dylib
52
56
  - TestDumper/TestDumper.xcodeproj/project.pbxproj
57
+ - TestDumper/TestDumper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
53
58
  - TestDumper/TestDumper.xcodeproj/xcshareddata/xcschemes/TestDumper.xcscheme
54
59
  - TestDumper/TestDumper/Info.plist
55
60
  - TestDumper/TestDumper/Initialize.m
@@ -75,9 +80,8 @@ files:
75
80
  homepage: https://github.com/square/xcknife
76
81
  licenses:
77
82
  - Apache-2.0
78
- metadata:
79
- allowed_push_host: https://rubygems.org
80
- post_install_message:
83
+ metadata: {}
84
+ post_install_message:
81
85
  rdoc_options: []
82
86
  require_paths:
83
87
  - lib
@@ -85,16 +89,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
89
  requirements:
86
90
  - - ">="
87
91
  - !ruby/object:Gem::Version
88
- version: 2.0.0
92
+ version: 2.6.0
89
93
  required_rubygems_version: !ruby/object:Gem::Requirement
90
94
  requirements:
91
95
  - - ">="
92
96
  - !ruby/object:Gem::Version
93
97
  version: '0'
94
98
  requirements: []
95
- rubyforge_project:
96
- rubygems_version: 2.4.5.1
97
- signing_key:
99
+ rubygems_version: 3.0.8
100
+ signing_key:
98
101
  specification_version: 4
99
102
  summary: Simple tool for optimizing XCTest runs across machines
100
103
  test_files: []
@@ -1,3 +0,0 @@
1
- [submodule "spec/xcknife-exemplar"]
2
- path = spec/xcknife-exemplar
3
- url = https://github.com/danielribeiro/xcknife-exemplar.git