xcknife 0.11.1 → 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,11 +29,18 @@ module XCKnife
25
29
  end
26
30
 
27
31
  # only-testing is available since Xcode 8
32
+ # rubocop:disable Metrics/CyclomaticComplexity
28
33
  def xcodebuild_only_arguments(single_partition, meta_partition = nil)
29
- only_targets = if meta_partition
30
- single_partition.keys.to_set & meta_partition.flat_map(&:keys).group_by(&:to_s).select{|_,v| v.size == 1 }.map(&:first).to_set
31
- else
32
- Set.new
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
33
44
  end
34
45
 
35
46
  only_target_arguments = only_targets.sort.map { |test_target| "-only-testing:#{test_target}" }
@@ -62,4 +73,5 @@ module XCKnife
62
73
  partition_set.map { |partition| xctool_only_arguments(partition) }
63
74
  end
64
75
  end
76
+ # rubocop:enable Metrics/CyclomaticComplexity
65
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,19 +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
- 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']
21
23
  s.bindir = 'bin'
22
- s.executables = ['xcknife', 'xcknife-min', 'xcknife-test-dumper']
24
+ s.executables = %w[xcknife xcknife-min xcknife-test-dumper]
23
25
  s.require_paths = ['lib']
24
26
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
25
27
 
26
- s.required_ruby_version = '>= 2.0.0'
28
+ s.required_ruby_version = '>= 2.6.0'
27
29
 
28
30
  s.add_development_dependency 'bundler', '~> 1.12'
29
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.11.1
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: 2020-06-12 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
@@ -39,8 +39,11 @@ extra_rdoc_files: []
39
39
  files:
40
40
  - ".gitignore"
41
41
  - ".rspec"
42
+ - ".rubocop.yml"
42
43
  - ".ruby-version"
43
44
  - ".travis.yml"
45
+ - ".vscode/configure.sh"
46
+ - ".vscode/vscode_ruby.json.template"
44
47
  - CONTRIBUTING.md
45
48
  - Gemfile
46
49
  - Gemfile.lock
@@ -78,7 +81,7 @@ homepage: https://github.com/square/xcknife
78
81
  licenses:
79
82
  - Apache-2.0
80
83
  metadata: {}
81
- post_install_message:
84
+ post_install_message:
82
85
  rdoc_options: []
83
86
  require_paths:
84
87
  - lib
@@ -86,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
89
  requirements:
87
90
  - - ">="
88
91
  - !ruby/object:Gem::Version
89
- version: 2.0.0
92
+ version: 2.6.0
90
93
  required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  requirements:
92
95
  - - ">="
@@ -94,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
97
  version: '0'
95
98
  requirements: []
96
99
  rubygems_version: 3.0.8
97
- signing_key:
100
+ signing_key:
98
101
  specification_version: 4
99
102
  summary: Simple tool for optimizing XCTest runs across machines
100
103
  test_files: []