xcodeproj 1.1.0 → 1.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: d0259d3fcd165b76b23b22fbd8a6e75b0aee2d21
4
- data.tar.gz: acdb6e1ad6df583dc8a5eca2b810ed7341f246a4
3
+ metadata.gz: 3ca60747e446e5e585d290d9a504f06e4fee6019
4
+ data.tar.gz: 727648b30f7b1a64960aad8729a652bb1e533e54
5
5
  SHA512:
6
- metadata.gz: ad150ebf0f6b9fd198a443d590d70ff2ea5ba08b0df075cf1197d56ce4eb31334803ec130db4a53c1e86288fd136ce721bc3eefc2714d4f1c174fdc6c8915c10
7
- data.tar.gz: 9ceb7e7978abad793e43b33843ffe7b9fa6f81dbdcfbf062521948738c8e4e011ea33e73681780ae912f1c0ef09b6802283664c0087ecfd0973653be5c578fc3
6
+ metadata.gz: 3ff953b6a376b57e49c109720f1c48310647081d8cdebac8df33508a9cf0145b4888aae9c9357df1fbd61ecd367fa25ad3795f2e274461326736123a881a64ca
7
+ data.tar.gz: 2d0918aaa5872e7b963509f06bed07d886cff04c493247c427e7eca691df2a59345791cc828492d5ad1755c40afac24c42adc1ff5af1701c82eac47dab2d1509
data/README.md CHANGED
@@ -6,12 +6,13 @@
6
6
 
7
7
  Xcodeproj lets you create and modify Xcode projects from [Ruby][ruby].
8
8
  Script boring management tasks or build Xcode-friendly libraries. Also includes
9
- support for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
9
+ support for Xcode workspaces (`.xcworkspace`), configuration files (`.xcconfig`) and
10
+ Xcode Scheme files (`.xcscheme`).
10
11
 
11
12
  It is used in [CocoaPods](https://github.com/CocoaPods/CocoaPods) to create a
12
- static library from scratch, for both iOS and OSX.
13
+ a collection of supplemental libraries or frameworks, for all platforms Xcode supports.
13
14
 
14
- The documentation can be found [here](http://docs.cocoapods.org/xcodeproj/index.html).
15
+ The API reference can be found [here](http://www.rubydoc.info/gems/xcodeproj).
15
16
 
16
17
  ## Installing Xcodeproj
17
18
 
@@ -20,6 +21,58 @@ by performing the following command:
20
21
 
21
22
  $ [sudo] gem install xcodeproj
22
23
 
24
+ ## Quickstart
25
+
26
+ To begin editing an xcodeproj file start by opening it as an Xcodeproj with:
27
+
28
+ ```ruby
29
+ require 'xcodeproj'
30
+ project_path = '/your_path/your_project.xcodeproj'
31
+ project = Xcodeproj::Project.open(project_path)
32
+ ```
33
+
34
+ #### Some Small Examples To Get You Started
35
+
36
+ > Look through all targets
37
+
38
+ ```ruby
39
+ project.targets.each do |target|
40
+ puts target.name
41
+ end
42
+ ```
43
+
44
+ > Get all source files for a target
45
+
46
+ ```ruby
47
+ target = project.targets.first
48
+ files = target.source_build_phase.files.to_a.map do |pbx_build_file|
49
+ pbx_build_file.file_ref.real_path.to_s
50
+
51
+ end.select do |path|
52
+ path.end_with?(".m", ".mm", ".swift")
53
+
54
+ end.select do |path|
55
+ File.exists?(path)
56
+ end
57
+ ```
58
+
59
+ > Set a specific build configuration to all targets
60
+
61
+ ```ruby
62
+ project.targets.each do |target|
63
+ target.build_configurations.each do |config|
64
+ config.build_settings['MY_CUSTOM_FLAG'] ||= 'TRUE'
65
+ end
66
+ end
67
+ ```
68
+
69
+ ## Command Line Tool
70
+
71
+ Installing the Xcodeproj gem will also install a command-line tool `xcodeproj` which you can
72
+ use to generate project diffs, target diffs, output all configurations and show a YAML representation.
73
+
74
+ For more information consult `xcodeproj --help`.
75
+
23
76
  ## Collaborate
24
77
 
25
78
  All Xcodeproj development happens on [GitHub][xcodeproj]. Contributing patches
@@ -106,21 +106,23 @@ module Xcodeproj
106
106
  # @return [Hash] The uniform type identifier of various product types.
107
107
  #
108
108
  PRODUCT_TYPE_UTI = {
109
- :application => 'com.apple.product-type.application',
110
- :framework => 'com.apple.product-type.framework',
111
- :dynamic_library => 'com.apple.product-type.library.dynamic',
112
- :static_library => 'com.apple.product-type.library.static',
113
- :bundle => 'com.apple.product-type.bundle',
114
- :octest_bundle => 'com.apple.product-type.bundle',
115
- :unit_test_bundle => 'com.apple.product-type.bundle.unit-test',
116
- :ui_test_bundle => 'com.apple.product-type.bundle.ui-testing',
117
- :app_extension => 'com.apple.product-type.app-extension',
118
- :command_line_tool => 'com.apple.product-type.tool',
119
- :watch_app => 'com.apple.product-type.application.watchapp',
120
- :watch2_app => 'com.apple.product-type.application.watchapp2',
121
- :watch_extension => 'com.apple.product-type.watchkit-extension',
122
- :watch2_extension => 'com.apple.product-type.watchkit2-extension',
123
- :tv_extension => 'com.apple.product-type.tv-app-extension',
109
+ :application => 'com.apple.product-type.application',
110
+ :framework => 'com.apple.product-type.framework',
111
+ :dynamic_library => 'com.apple.product-type.library.dynamic',
112
+ :static_library => 'com.apple.product-type.library.static',
113
+ :bundle => 'com.apple.product-type.bundle',
114
+ :octest_bundle => 'com.apple.product-type.bundle',
115
+ :unit_test_bundle => 'com.apple.product-type.bundle.unit-test',
116
+ :ui_test_bundle => 'com.apple.product-type.bundle.ui-testing',
117
+ :app_extension => 'com.apple.product-type.app-extension',
118
+ :command_line_tool => 'com.apple.product-type.tool',
119
+ :watch_app => 'com.apple.product-type.application.watchapp',
120
+ :watch2_app => 'com.apple.product-type.application.watchapp2',
121
+ :watch_extension => 'com.apple.product-type.watchkit-extension',
122
+ :watch2_extension => 'com.apple.product-type.watchkit2-extension',
123
+ :tv_extension => 'com.apple.product-type.tv-app-extension',
124
+ :messages_extension => 'com.apple.product-type.app-extension.messages',
125
+ :sticker_pack => 'com.apple.product-type.app-extension.messages-sticker-pack',
124
126
  }.freeze
125
127
 
126
128
  # @return [Hash] The extensions or the various product UTIs.
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '1.1.0'.freeze unless defined? Xcodeproj::VERSION
4
+ VERSION = '1.2.0'.freeze unless defined? Xcodeproj::VERSION
5
5
  end
@@ -60,6 +60,7 @@ module Xcodeproj
60
60
  end
61
61
 
62
62
  XCODE_PATH = Pathname.new(`xcrun xcode-select --print-path`.strip).dirname
63
+ XCODE_VERSION = Gem::Version.new(`xcodebuild -version`.split(' ')[1])
63
64
 
64
65
  def self.load_xcode_framework(framework)
65
66
  Fiddle.dlopen(XCODE_PATH.join(framework).to_s)
@@ -70,14 +71,22 @@ module Xcodeproj
70
71
  # @note The IB frameworks only seem to be necessary on Xcode 7+
71
72
  #
72
73
  def self.load_xcode_frameworks
74
+ is_80_or_later = XCODE_VERSION >= Gem::Version.new('8.0')
75
+
73
76
  DevToolsCore.silence_stderr do
74
77
  load_xcode_framework('SharedFrameworks/DVTFoundation.framework/DVTFoundation')
75
78
  load_xcode_framework('SharedFrameworks/DVTServices.framework/DVTServices')
76
79
  load_xcode_framework('SharedFrameworks/DVTPortal.framework/DVTPortal')
77
80
  load_xcode_framework('SharedFrameworks/DVTSourceControl.framework/DVTSourceControl')
78
- load_xcode_framework('SharedFrameworks/CSServiceClient.framework/CSServiceClient')
81
+ load_xcode_framework('SharedFrameworks/CSServiceClient.framework/CSServiceClient') unless is_80_or_later
79
82
  load_xcode_framework('Frameworks/IBFoundation.framework/IBFoundation')
80
83
  load_xcode_framework('Frameworks/IBAutolayoutFoundation.framework/IBAutolayoutFoundation')
84
+ if is_80_or_later
85
+ load_xcode_framework('SharedFrameworks/DVTAnalyticsClient.framework/DVTAnalyticsClient')
86
+ load_xcode_framework('SharedFrameworks/DVTAnalytics.framework/DVTAnalytics')
87
+ load_xcode_framework('SharedFrameworks/DVTDocumentation.framework/DVTDocumentation')
88
+ load_xcode_framework('SharedFrameworks/SourceKit.framework/SourceKit')
89
+ end
81
90
  load_xcode_framework('Frameworks/IDEFoundation.framework/IDEFoundation')
82
91
  load_xcode_framework('PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core')
83
92
  end
@@ -526,6 +526,40 @@ module Xcodeproj
526
526
  root_object.targets.grep(PBXNativeTarget)
527
527
  end
528
528
 
529
+ # Checks the native target for any targets in the project
530
+ # that are dependent on the native target and would be
531
+ # embedded in it at build time
532
+ #
533
+ # @param [PBXNativeTarget] native target to check for
534
+ # embedded targets
535
+ #
536
+ #
537
+ # @return [Array<PBXNativeTarget>] A list of all targets that
538
+ # are embedded in the passed in target
539
+ #
540
+ def embedded_targets_in_native_target(native_target)
541
+ native_targets.select do |target|
542
+ host_targets_for_embedded_target(target).map(&:uuid).include? native_target.uuid
543
+ end
544
+ end
545
+
546
+ # Returns the native targets, in which the embedded target is
547
+ # embedded. This works by traversing the targets to find those
548
+ # where the target is a dependency.
549
+ #
550
+ # @param [PBXNativeTarget] native target that might be embedded
551
+ # in another target
552
+ #
553
+ # @return [Array<PBXNativeTarget>] the native targets that host the
554
+ # embedded target
555
+ #
556
+ def host_targets_for_embedded_target(embedded_target)
557
+ native_targets.select do |native_target|
558
+ ((embedded_target.uuid != native_target.uuid) &&
559
+ (native_target.dependencies.map(&:target).map(&:uuid).include? embedded_target.uuid))
560
+ end
561
+ end
562
+
529
563
  # @return [PBXGroup] The group which holds the product file references.
530
564
  #
531
565
  def products_group
@@ -437,7 +437,7 @@ module Xcodeproj
437
437
  #
438
438
  def extension_target_type?
439
439
  case symbol_type
440
- when :app_extension, :watch_extension, :watch2_extension, :tv_extension
440
+ when :app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension
441
441
  true
442
442
  else
443
443
  false
@@ -148,6 +148,64 @@ module Xcodeproj
148
148
  @xml_element.add_element(ref.xml_element)
149
149
  end
150
150
 
151
+ # @return [Array<SkippedTest>]
152
+ # The list of SkippedTest this action will skip.
153
+ #
154
+ def skipped_tests
155
+ return [] if @xml_element.elements['SkippedTests'].nil?
156
+ @xml_element.elements['SkippedTests'].get_elements('Test').map do |node|
157
+ TestableReference::SkippedTest.new(node)
158
+ end
159
+ end
160
+
161
+ # @param [Array<SkippedTest>] tests
162
+ # Set the list of SkippedTest this action will skip.
163
+ #
164
+ def skipped_tests=(tests)
165
+ @xml_element.delete_element('SkippedTests') unless @xml_element.elements['SkippedTests'].nil?
166
+ if tests.nil?
167
+ return
168
+ end
169
+ entries = @xml_element.add_element('SkippedTests')
170
+ tests.each do |skipped|
171
+ entries.add_element(skipped.xml_element)
172
+ end
173
+ end
174
+
175
+ # @param [SkippedTest] skipped_test
176
+ # The SkippedTest to add to the list of tests this action will skip
177
+ #
178
+ def add_skipped_test(skipped_test)
179
+ entries = @xml_element.elements['SkippedTests'] || @xml_element.add_element('SkippedTests')
180
+ entries.add_element(skipped_test.xml_element)
181
+ end
182
+
183
+ class SkippedTest < XMLElementWrapper
184
+ # @param [REXML::Element] node
185
+ # The 'Test' XML node that this object will wrap.
186
+ # If nil, will create a default XML node to use.
187
+ #
188
+ def initialize(node = nil)
189
+ create_xml_element_with_fallback(node, 'Test') do
190
+ self.identifier = node.attributes['Identifier'] unless node.nil?
191
+ end
192
+ end
193
+
194
+ # @return [String]
195
+ # Skipped test class name
196
+ #
197
+ def identifier
198
+ @xml_element.attributes['Identifier']
199
+ end
200
+
201
+ # @param [String] value
202
+ # Set the name of the skipped test class name
203
+ #
204
+ def identifier=(value)
205
+ @xml_element.attributes['Identifier'] = value
206
+ end
207
+ end
208
+
151
209
  # @todo handle 'AdditionalOptions' tag
152
210
  end
153
211
  end
metadata CHANGED
@@ -1,61 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-01 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colored
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: claide
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.0
48
- - - <
48
+ - - "<"
49
49
  - !ruby/object:Gem::Version
50
50
  version: '2.0'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: 1.0.0
58
- - - <
58
+ - - "<"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.0'
61
61
  description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
@@ -138,17 +138,17 @@ require_paths:
138
138
  - lib
139
139
  required_ruby_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - '>='
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: 2.0.0
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - '>='
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.6.3
151
+ rubygems_version: 2.6.6
152
152
  signing_key:
153
153
  specification_version: 3
154
154
  summary: Create and modify Xcode projects from Ruby.