xcodeproj 0.21.2 → 0.22.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 +4 -4
- data/README.md +0 -4
- data/lib/xcodeproj/constants.rb +6 -4
- data/lib/xcodeproj/gem_version.rb +1 -1
- data/lib/xcodeproj/plist_helper.rb +271 -12
- data/lib/xcodeproj/project.rb +0 -11
- data/lib/xcodeproj/project/object/native_target.rb +1 -1
- metadata +17 -18
- data/lib/xcodeproj/project/xcproj_helper.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0756fa72953f3c4cbdfe7e1768661b651b702b41
|
4
|
+
data.tar.gz: b7b626d31419f44580ce1b5b72f51f61daccc88a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91766ef57577045727bbd164e750047813966c3ff806e9923fdfcf14485e55c8902d7b43f843898abc9d71b4b2d56cf63b3fedd2c426dcdd4e8fc43755c338e7
|
7
|
+
data.tar.gz: 8b20be7de31f3fd85569dbccde9da1ea5056d5587a581030afeba12cbab40438f62e2c964653ef71379c835c12f1888e3866581dafe3c46921e33415ae4bc227
|
data/README.md
CHANGED
@@ -20,10 +20,6 @@ by performing the following command:
|
|
20
20
|
|
21
21
|
$ [sudo] gem install xcodeproj
|
22
22
|
|
23
|
-
To make Xcodeproj output projects in the same format of Xcode (deprecated ASCII Plists format) in order to reduce the SCM noise it is possible to install [xcproj](https://github.com/0xced/xcproj):
|
24
|
-
|
25
|
-
$ brew install xcproj
|
26
|
-
|
27
23
|
## Collaborate
|
28
24
|
|
29
25
|
All Xcodeproj development happens on [GitHub][xcodeproj]. Contributing patches
|
data/lib/xcodeproj/constants.rb
CHANGED
@@ -96,6 +96,8 @@ module Xcodeproj
|
|
96
96
|
:bundle => 'com.apple.product-type.bundle',
|
97
97
|
:unit_test_bundle => 'com.apple.product-type.bundle.unit-test',
|
98
98
|
:app_extension => 'com.apple.product-type.app-extension',
|
99
|
+
:watch_app => 'com.apple.product-type.application.watchapp',
|
100
|
+
:watch_extension => 'com.apple.product-type.watchkit-extension',
|
99
101
|
}.freeze
|
100
102
|
|
101
103
|
# @return [Hash] The extensions or the various product UTIs.
|
@@ -233,13 +235,13 @@ module Xcodeproj
|
|
233
235
|
'GCC_WARN_UNUSED_VARIABLE' => 'YES',
|
234
236
|
},
|
235
237
|
:release => {
|
236
|
-
'COPY_PHASE_STRIP' => '
|
238
|
+
'COPY_PHASE_STRIP' => 'YES',
|
237
239
|
'ENABLE_NS_ASSERTIONS' => 'NO',
|
238
240
|
'VALIDATE_PRODUCT' => 'YES',
|
239
241
|
}.freeze,
|
240
242
|
:debug => {
|
241
243
|
'ONLY_ACTIVE_ARCH' => 'YES',
|
242
|
-
'COPY_PHASE_STRIP' => '
|
244
|
+
'COPY_PHASE_STRIP' => 'NO',
|
243
245
|
'GCC_DYNAMIC_NO_PIC' => 'NO',
|
244
246
|
'GCC_OPTIMIZATION_LEVEL' => '0',
|
245
247
|
'GCC_PREPROCESSOR_DEFINITIONS' => ['DEBUG=1', '$(inherited)'],
|
@@ -270,8 +272,8 @@ module Xcodeproj
|
|
270
272
|
:reference => '2',
|
271
273
|
}.freeze
|
272
274
|
|
273
|
-
# @return [
|
275
|
+
# @return [Array] The extensions which are associated with header files.
|
274
276
|
#
|
275
|
-
HEADER_FILES_EXTENSIONS = %w(.h .hh .hpp .ipp).freeze
|
277
|
+
HEADER_FILES_EXTENSIONS = %w(.h .hh .hpp .ipp .tpp).freeze
|
276
278
|
end
|
277
279
|
end
|
@@ -23,14 +23,12 @@ module Xcodeproj
|
|
23
23
|
# @param [#to_s] path
|
24
24
|
# The path of the file.
|
25
25
|
#
|
26
|
-
def write(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"respond to #to_hash'."
|
33
|
-
end
|
26
|
+
def write(possible_hash, path)
|
27
|
+
if possible_hash.respond_to?(:to_hash)
|
28
|
+
hash = possible_hash.to_hash
|
29
|
+
else
|
30
|
+
raise TypeError, "The given `#{possible_hash.inspect}` must respond " \
|
31
|
+
"to #to_hash'."
|
34
32
|
end
|
35
33
|
|
36
34
|
unless path.is_a?(String) || path.is_a?(Pathname)
|
@@ -39,7 +37,11 @@ module Xcodeproj
|
|
39
37
|
path = path.to_s
|
40
38
|
raise IOError, 'Empty path.' if path == ''
|
41
39
|
|
42
|
-
|
40
|
+
if DevToolsCore.load_xcode_frameworks && path.end_with?('pbxproj')
|
41
|
+
ruby_hash_write_xcode(hash, path)
|
42
|
+
else
|
43
|
+
CoreFoundation.RubyHashPropertyListWrite(hash, path)
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
# @return [Hash] Returns the native objects loaded from a property list
|
@@ -51,14 +53,16 @@ module Xcodeproj
|
|
51
53
|
def read(path)
|
52
54
|
path = path.to_s
|
53
55
|
unless File.exist?(path)
|
54
|
-
raise
|
56
|
+
raise Informative, "The plist file at path `#{path}` doesn't exist."
|
55
57
|
end
|
56
58
|
if file_in_conflict?(path)
|
57
|
-
raise
|
59
|
+
raise Informative, "The file `#{path}` is in a merge conflict."
|
58
60
|
end
|
59
61
|
CoreFoundation.RubyHashPropertyListRead(path)
|
60
62
|
end
|
61
63
|
|
64
|
+
private
|
65
|
+
|
62
66
|
# @return [Bool] Checks whether there are merge conflicts in the file.
|
63
67
|
#
|
64
68
|
# @param [#to_s] path
|
@@ -70,6 +74,33 @@ module Xcodeproj
|
|
70
74
|
ensure
|
71
75
|
file.close
|
72
76
|
end
|
77
|
+
|
78
|
+
# Serializes a hash as an ASCII plist, using Xcode.
|
79
|
+
#
|
80
|
+
# @param [Hash] hash
|
81
|
+
# The hash to store.
|
82
|
+
#
|
83
|
+
# @param [String] path
|
84
|
+
# The path of the file.
|
85
|
+
#
|
86
|
+
def ruby_hash_write_xcode(hash, path)
|
87
|
+
path = File.expand_path(path)
|
88
|
+
success = true
|
89
|
+
|
90
|
+
begin
|
91
|
+
plist = DevToolsCore::CFDictionary.new(CoreFoundation.RubyHashToCFDictionary(hash))
|
92
|
+
data = DevToolsCore::NSData.new(plist.plistDescriptionUTF8Data)
|
93
|
+
success &= data.writeToFileAtomically(path)
|
94
|
+
|
95
|
+
project = DevToolsCore::PBXProject.new(path)
|
96
|
+
success &= project.writeToFileSystemProjectFile
|
97
|
+
project.close
|
98
|
+
rescue Fiddle::DLError
|
99
|
+
success = false
|
100
|
+
end
|
101
|
+
|
102
|
+
CoreFoundation.RubyHashPropertyListWrite(hash, path) unless success
|
103
|
+
end
|
73
104
|
end
|
74
105
|
end
|
75
106
|
end
|
@@ -172,6 +203,15 @@ module CoreFoundation
|
|
172
203
|
TRUE = 1
|
173
204
|
FALSE = 0
|
174
205
|
|
206
|
+
SINT64_MAX = 2**63 - 1
|
207
|
+
SINT64_MIN = -SINT64_MAX - 1
|
208
|
+
|
209
|
+
SIZEOF_SINT64 = 8
|
210
|
+
SIZEOF_FLOAT64 = 8
|
211
|
+
|
212
|
+
SINT64_PACK_TEMPLATE = 'q'
|
213
|
+
FLOAT64_PACK_TEMPLATE = 'd'
|
214
|
+
|
175
215
|
CFTypeRef = VoidPointer
|
176
216
|
CFTypeRefPointer = VoidPointer
|
177
217
|
CFIndex = Fiddle::TYPE_LONG
|
@@ -188,6 +228,10 @@ module CoreFoundation
|
|
188
228
|
CFStringEncoding = UInt32
|
189
229
|
KCFStringEncodingUTF8 = 0x08000100
|
190
230
|
|
231
|
+
CFNumberType = Fiddle::TYPE_INT
|
232
|
+
KCFNumberSInt64Type = 4
|
233
|
+
KCFNumberFloat64Type = 6
|
234
|
+
|
191
235
|
# rubocop:enable Style/ConstantName
|
192
236
|
|
193
237
|
private
|
@@ -207,7 +251,7 @@ module CoreFoundation
|
|
207
251
|
@CFRelease ||= Fiddle::Function.new(image['CFRelease'], [CFTypeRef], Void)
|
208
252
|
end
|
209
253
|
|
210
|
-
def self.
|
254
|
+
def self.extern_image(image, symbol, parameter_types, return_type)
|
211
255
|
symbol = symbol.to_s
|
212
256
|
create_function = symbol.include?('Create')
|
213
257
|
function_cache_key = "@__#{symbol}__"
|
@@ -231,6 +275,10 @@ module CoreFoundation
|
|
231
275
|
end
|
232
276
|
end
|
233
277
|
|
278
|
+
def self.extern(symbol, parameter_types, return_type)
|
279
|
+
extern_image(image, symbol, parameter_types, return_type)
|
280
|
+
end
|
281
|
+
|
234
282
|
public
|
235
283
|
|
236
284
|
# @!group CoreFoundation function definitions
|
@@ -246,6 +294,7 @@ module CoreFoundation
|
|
246
294
|
extern :CFStringGetTypeID, [], CFTypeID
|
247
295
|
extern :CFArrayGetTypeID, [], CFTypeID
|
248
296
|
extern :CFBooleanGetTypeID, [], CFTypeID
|
297
|
+
extern :CFNumberGetTypeID, [], CFTypeID
|
249
298
|
|
250
299
|
# CFStream
|
251
300
|
extern :CFWriteStreamCreateWithFile, [CFTypeRef, CFTypeRef], CFTypeRef
|
@@ -284,6 +333,11 @@ module CoreFoundation
|
|
284
333
|
# CFBoolean
|
285
334
|
extern :CFBooleanGetValue, [CFTypeRef], Boolean
|
286
335
|
|
336
|
+
# CFNumber
|
337
|
+
extern :CFNumberIsFloatType, [CFTypeRef], Boolean
|
338
|
+
extern :CFNumberGetValue, [CFTypeRef, CFNumberType, VoidPointer], Boolean
|
339
|
+
extern :CFNumberCreate, [CFTypeRef, CFNumberType, VoidPointer], CFTypeRef
|
340
|
+
|
287
341
|
# @!group Custom convenience functions
|
288
342
|
#---------------------------------------------------------------------------#
|
289
343
|
|
@@ -352,6 +406,8 @@ module CoreFoundation
|
|
352
406
|
CFArrayToRubyArray(cf_type_reference)
|
353
407
|
when CFBooleanGetTypeID()
|
354
408
|
CFBooleanToRubyBoolean(cf_type_reference)
|
409
|
+
when CFNumberGetTypeID()
|
410
|
+
CFNumberToRubyNumber(cf_type_reference)
|
355
411
|
else
|
356
412
|
description = CFStringToRubyString(CFCopyDescription(cf_type_reference))
|
357
413
|
raise TypeError, "Unknown type: #{description}"
|
@@ -392,6 +448,21 @@ module CoreFoundation
|
|
392
448
|
CFBooleanGetValue(boolean) == TRUE
|
393
449
|
end
|
394
450
|
|
451
|
+
def self.CFNumberToRubyNumber(number)
|
452
|
+
if CFNumberIsFloatType(number) == FALSE
|
453
|
+
value_type = KCFNumberSInt64Type
|
454
|
+
pack_template = SINT64_PACK_TEMPLATE
|
455
|
+
size = SIZEOF_SINT64
|
456
|
+
else
|
457
|
+
value_type = KCFNumberFloat64Type
|
458
|
+
pack_template = FLOAT64_PACK_TEMPLATE
|
459
|
+
size = SIZEOF_FLOAT64
|
460
|
+
end
|
461
|
+
ptr = Fiddle::Pointer.malloc(size)
|
462
|
+
CFNumberGetValue(number, value_type, ptr)
|
463
|
+
ptr.to_str.unpack(pack_template).first
|
464
|
+
end
|
465
|
+
|
395
466
|
# @!group Ruby value to CFTypeRef conversion
|
396
467
|
#---------------------------------------------------------------------------#
|
397
468
|
|
@@ -405,6 +476,8 @@ module CoreFoundation
|
|
405
476
|
RubyArrayToCFArray(value)
|
406
477
|
when true, false
|
407
478
|
RubyBooleanToCFBoolean(value)
|
479
|
+
when Numeric
|
480
|
+
RubyNumberToCFNumber(value)
|
408
481
|
else
|
409
482
|
RubyStringToCFString(value.to_s)
|
410
483
|
end
|
@@ -443,6 +516,21 @@ module CoreFoundation
|
|
443
516
|
result
|
444
517
|
end
|
445
518
|
|
519
|
+
def self.RubyNumberToCFNumber(value)
|
520
|
+
case value
|
521
|
+
when Float
|
522
|
+
value_type = KCFNumberFloat64Type
|
523
|
+
pack_template = FLOAT64_PACK_TEMPLATE
|
524
|
+
when SINT64_MIN..SINT64_MAX
|
525
|
+
value_type = KCFNumberSInt64Type
|
526
|
+
pack_template = SINT64_PACK_TEMPLATE
|
527
|
+
else # the value is too big to be stored in a CFNumber so store it as a CFString
|
528
|
+
return RubyStringToCFString(value.to_s)
|
529
|
+
end
|
530
|
+
ptr = Fiddle::Pointer.to_ptr([value].pack(pack_template))
|
531
|
+
CFNumberCreate(NULL, value_type, ptr)
|
532
|
+
end
|
533
|
+
|
446
534
|
def self.RubyBooleanToCFBoolean(value)
|
447
535
|
value ? CFBooleanTrue() : CFBooleanFalse()
|
448
536
|
end
|
@@ -450,3 +538,174 @@ module CoreFoundation
|
|
450
538
|
# rubocop:enable Style/MethodName
|
451
539
|
# rubocop:enable Style/VariableName
|
452
540
|
end
|
541
|
+
|
542
|
+
module DevToolsCore
|
543
|
+
def self.silence_stderr
|
544
|
+
begin
|
545
|
+
orig_stderr = $stderr.clone
|
546
|
+
$stderr.reopen File.new('/dev/null', 'w')
|
547
|
+
retval = yield
|
548
|
+
ensure
|
549
|
+
$stderr.reopen orig_stderr
|
550
|
+
end
|
551
|
+
retval
|
552
|
+
end
|
553
|
+
|
554
|
+
# rubocop:disable Style/MethodName
|
555
|
+
# rubocop:disable Style/VariableName
|
556
|
+
|
557
|
+
class NSObject
|
558
|
+
private
|
559
|
+
|
560
|
+
def self.objc_class
|
561
|
+
@objc_class ||= CoreFoundation.objc_getClass(name.split('::').last)
|
562
|
+
end
|
563
|
+
|
564
|
+
def self.image
|
565
|
+
@image ||= Fiddle::Handle.new
|
566
|
+
end
|
567
|
+
|
568
|
+
def self.extern(symbol, parameter_types, return_type)
|
569
|
+
CoreFoundation.extern_image(image, symbol, parameter_types, return_type)
|
570
|
+
end
|
571
|
+
|
572
|
+
def self.objc_msgSend(args, return_type = CoreFoundation::VoidPointer)
|
573
|
+
arguments = [CoreFoundation::VoidPointer, CoreFoundation::VoidPointer] + args
|
574
|
+
|
575
|
+
Fiddle::Function.new(image['objc_msgSend'], arguments, return_type)
|
576
|
+
end
|
577
|
+
|
578
|
+
def self.respondsToSelector(instance, sel)
|
579
|
+
selector = CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(sel))
|
580
|
+
respondsToSelector = objc_msgSend([CoreFoundation::CharPointer], CoreFoundation::Boolean)
|
581
|
+
result = respondsToSelector.call(
|
582
|
+
instance,
|
583
|
+
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString('respondsToSelector:')),
|
584
|
+
selector)
|
585
|
+
result == CoreFoundation::TRUE ? true : false
|
586
|
+
end
|
587
|
+
|
588
|
+
Class = CoreFoundation::VoidPointer
|
589
|
+
ID = CoreFoundation::VoidPointer
|
590
|
+
SEL = CoreFoundation::VoidPointer
|
591
|
+
|
592
|
+
extern :NSSelectorFromString, [CoreFoundation::CFTypeRef], SEL
|
593
|
+
|
594
|
+
extern :objc_getClass, [CoreFoundation::CharPointer], Class
|
595
|
+
extern :class_getName, [Class], CoreFoundation::CharPointer
|
596
|
+
end
|
597
|
+
|
598
|
+
XCODE_PATH = Pathname.new(`xcrun xcode-select -p`.strip).dirname
|
599
|
+
|
600
|
+
def self.load_xcode_framework(framework)
|
601
|
+
Fiddle.dlopen(XCODE_PATH.join(framework).to_s)
|
602
|
+
rescue Fiddle::DLError
|
603
|
+
nil
|
604
|
+
end
|
605
|
+
|
606
|
+
def self.load_xcode_frameworks
|
607
|
+
load_xcode_framework('SharedFrameworks/DVTFoundation.framework/DVTFoundation')
|
608
|
+
load_xcode_framework('SharedFrameworks/DVTSourceControl.framework/DVTSourceControl')
|
609
|
+
load_xcode_framework('SharedFrameworks/CSServiceClient.framework/CSServiceClient')
|
610
|
+
load_xcode_framework('Frameworks/IDEFoundation.framework/IDEFoundation')
|
611
|
+
load_xcode_framework('PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core')
|
612
|
+
end
|
613
|
+
|
614
|
+
class CFDictionary < NSObject
|
615
|
+
public
|
616
|
+
|
617
|
+
def initialize(dictionary)
|
618
|
+
@dictionary = dictionary
|
619
|
+
end
|
620
|
+
|
621
|
+
def plistDescriptionUTF8Data
|
622
|
+
selector = 'plistDescriptionUTF8Data'
|
623
|
+
return nil unless NSObject.respondsToSelector(@dictionary, selector)
|
624
|
+
|
625
|
+
plistDescriptionUTF8Data = CFDictionary.objc_msgSend([])
|
626
|
+
plistDescriptionUTF8Data.call(
|
627
|
+
@dictionary,
|
628
|
+
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)))
|
629
|
+
end
|
630
|
+
|
631
|
+
def self.image
|
632
|
+
@image ||= DevToolsCore.load_xcode_frameworks
|
633
|
+
end
|
634
|
+
end
|
635
|
+
|
636
|
+
class NSData < NSObject
|
637
|
+
public
|
638
|
+
|
639
|
+
def initialize(data)
|
640
|
+
@data = data
|
641
|
+
end
|
642
|
+
|
643
|
+
def writeToFileAtomically(path)
|
644
|
+
selector = 'writeToFile:atomically:'
|
645
|
+
return false unless NSObject.respondsToSelector(@data, selector)
|
646
|
+
|
647
|
+
writeToFileAtomically = NSData.objc_msgSend([CoreFoundation::VoidPointer, CoreFoundation::Boolean], CoreFoundation::Boolean)
|
648
|
+
result = writeToFileAtomically.call(
|
649
|
+
@data,
|
650
|
+
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
|
651
|
+
CoreFoundation.RubyStringToCFString(path),
|
652
|
+
1)
|
653
|
+
result == CoreFoundation::TRUE ? true : false
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
class PBXProject < NSObject
|
658
|
+
public
|
659
|
+
|
660
|
+
def initialize(path)
|
661
|
+
DevToolsCore.silence_stderr do
|
662
|
+
CoreFoundation.IDEInitialize(1, CoreFoundation::NULL)
|
663
|
+
CoreFoundation.XCInitializeCoreIfNeeded(1)
|
664
|
+
end
|
665
|
+
|
666
|
+
selector = 'projectWithFile:'
|
667
|
+
|
668
|
+
if NSObject.respondsToSelector(PBXProject.objc_class, selector)
|
669
|
+
projectWithFile = PBXProject.objc_msgSend([CoreFoundation::VoidPointer])
|
670
|
+
@project = projectWithFile.call(
|
671
|
+
PBXProject.objc_class,
|
672
|
+
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
|
673
|
+
CoreFoundation.RubyStringToCFString(path))
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
def close
|
678
|
+
selector = 'close'
|
679
|
+
return unless NSObject.respondsToSelector(@project, selector)
|
680
|
+
|
681
|
+
close = PBXProject.objc_msgSend([], CoreFoundation::Void)
|
682
|
+
close.call(@project, CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)))
|
683
|
+
end
|
684
|
+
|
685
|
+
def writeToFileSystemProjectFile
|
686
|
+
selector = 'writeToFileSystemProjectFile:userFile:checkNeedsRevert:'
|
687
|
+
return unless NSObject.respondsToSelector(@project, selector)
|
688
|
+
|
689
|
+
writeToFile = PBXProject.objc_msgSend([CoreFoundation::Boolean, CoreFoundation::Boolean, CoreFoundation::Boolean], CoreFoundation::Boolean)
|
690
|
+
result = writeToFile.call(
|
691
|
+
@project,
|
692
|
+
CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
|
693
|
+
1,
|
694
|
+
0,
|
695
|
+
1)
|
696
|
+
result == CoreFoundation::TRUE ? true : false
|
697
|
+
end
|
698
|
+
|
699
|
+
private
|
700
|
+
|
701
|
+
def self.image
|
702
|
+
@image ||= DevToolsCore.load_xcode_frameworks
|
703
|
+
end
|
704
|
+
|
705
|
+
extern :IDEInitialize, [CoreFoundation::Boolean, ID], CoreFoundation::Void
|
706
|
+
extern :XCInitializeCoreIfNeeded, [CoreFoundation::Boolean], CoreFoundation::Void
|
707
|
+
end
|
708
|
+
|
709
|
+
# rubocop:enable Style/MethodName
|
710
|
+
# rubocop:enable Style/VariableName
|
711
|
+
end
|
data/lib/xcodeproj/project.rb
CHANGED
@@ -4,7 +4,6 @@ require 'securerandom'
|
|
4
4
|
|
5
5
|
require 'xcodeproj/project/object'
|
6
6
|
require 'xcodeproj/project/project_helper'
|
7
|
-
require 'xcodeproj/project/xcproj_helper'
|
8
7
|
require 'xcodeproj/plist_helper'
|
9
8
|
|
10
9
|
module Xcodeproj
|
@@ -156,15 +155,6 @@ module Xcodeproj
|
|
156
155
|
|
157
156
|
alias_method :inspect, :to_s
|
158
157
|
|
159
|
-
# @return [Boolean] Whether the `xcproj` conversion should be disabled. The
|
160
|
-
# conversion can also be disabled via the `XCODEPROJ_DISABLE_XCPROJ`
|
161
|
-
# environment variable.
|
162
|
-
#
|
163
|
-
attr_accessor :disable_xcproj
|
164
|
-
def disable_xcproj?
|
165
|
-
@disable_xcproj || ENV['XCODEPROJ_DISABLE_XCPROJ']
|
166
|
-
end
|
167
|
-
|
168
158
|
public
|
169
159
|
|
170
160
|
# @!group Initialization
|
@@ -329,7 +319,6 @@ module Xcodeproj
|
|
329
319
|
file = File.join(save_path, 'project.pbxproj')
|
330
320
|
Xcodeproj.write_plist(to_hash, file)
|
331
321
|
fix_encoding(file)
|
332
|
-
XCProjHelper.touch(save_path) unless disable_xcproj?
|
333
322
|
end
|
334
323
|
|
335
324
|
# Simple workaround to escape characters which are outside of ASCII
|
@@ -410,7 +410,7 @@ module Xcodeproj
|
|
410
410
|
build_file = project.new(PBXBuildFile)
|
411
411
|
build_file.file_ref = file
|
412
412
|
|
413
|
-
extension = File.extname(file.path)
|
413
|
+
extension = File.extname(file.path).downcase
|
414
414
|
header_extensions = Constants::HEADER_FILES_EXTENSIONS
|
415
415
|
if header_extensions.include?(extension)
|
416
416
|
headers_build_phase.files << build_file
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodeproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.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: 2015-
|
11
|
+
date: 2015-02-25 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
|
description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
|
@@ -47,22 +47,26 @@ executables:
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
- README.md
|
51
50
|
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- bin/xcodeproj
|
53
|
+
- lib/xcodeproj.rb
|
54
|
+
- lib/xcodeproj/command.rb
|
52
55
|
- lib/xcodeproj/command/config_dump.rb
|
53
56
|
- lib/xcodeproj/command/project_diff.rb
|
54
57
|
- lib/xcodeproj/command/show.rb
|
55
58
|
- lib/xcodeproj/command/sort.rb
|
56
59
|
- lib/xcodeproj/command/target_diff.rb
|
57
|
-
- lib/xcodeproj/command.rb
|
58
|
-
- lib/xcodeproj/config/other_linker_flags_parser.rb
|
59
60
|
- lib/xcodeproj/config.rb
|
61
|
+
- lib/xcodeproj/config/other_linker_flags_parser.rb
|
60
62
|
- lib/xcodeproj/constants.rb
|
61
63
|
- lib/xcodeproj/differ.rb
|
62
64
|
- lib/xcodeproj/gem_version.rb
|
63
65
|
- lib/xcodeproj/helper.rb
|
64
66
|
- lib/xcodeproj/plist_helper.rb
|
67
|
+
- lib/xcodeproj/project.rb
|
65
68
|
- lib/xcodeproj/project/case_converter.rb
|
69
|
+
- lib/xcodeproj/project/object.rb
|
66
70
|
- lib/xcodeproj/project/object/build_configuration.rb
|
67
71
|
- lib/xcodeproj/project/object/build_file.rb
|
68
72
|
- lib/xcodeproj/project/object/build_phase.rb
|
@@ -77,20 +81,15 @@ files:
|
|
77
81
|
- lib/xcodeproj/project/object/reference_proxy.rb
|
78
82
|
- lib/xcodeproj/project/object/root_object.rb
|
79
83
|
- lib/xcodeproj/project/object/target_dependency.rb
|
80
|
-
- lib/xcodeproj/project/object.rb
|
81
84
|
- lib/xcodeproj/project/object_attributes.rb
|
82
85
|
- lib/xcodeproj/project/object_dictionary.rb
|
83
86
|
- lib/xcodeproj/project/object_list.rb
|
84
87
|
- lib/xcodeproj/project/project_helper.rb
|
85
|
-
- lib/xcodeproj/project/xcproj_helper.rb
|
86
|
-
- lib/xcodeproj/project.rb
|
87
88
|
- lib/xcodeproj/scheme.rb
|
88
89
|
- lib/xcodeproj/user_interface.rb
|
89
|
-
- lib/xcodeproj/workspace/file_reference.rb
|
90
90
|
- lib/xcodeproj/workspace.rb
|
91
|
+
- lib/xcodeproj/workspace/file_reference.rb
|
91
92
|
- lib/xcodeproj/xcodebuild_helper.rb
|
92
|
-
- lib/xcodeproj.rb
|
93
|
-
- bin/xcodeproj
|
94
93
|
homepage: https://github.com/cocoapods/xcodeproj
|
95
94
|
licenses:
|
96
95
|
- MIT
|
@@ -101,17 +100,17 @@ require_paths:
|
|
101
100
|
- lib
|
102
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
102
|
requirements:
|
104
|
-
- -
|
103
|
+
- - ">="
|
105
104
|
- !ruby/object:Gem::Version
|
106
105
|
version: 2.0.0
|
107
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
107
|
requirements:
|
109
|
-
- -
|
108
|
+
- - ">="
|
110
109
|
- !ruby/object:Gem::Version
|
111
110
|
version: '0'
|
112
111
|
requirements: []
|
113
112
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.4.5
|
115
114
|
signing_key:
|
116
115
|
specification_version: 3
|
117
116
|
summary: Create and modify Xcode projects from Ruby.
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Xcodeproj
|
2
|
-
class Project
|
3
|
-
module XCProjHelper
|
4
|
-
class << self
|
5
|
-
# @return [Bool] Whether the xcproj tool is available.
|
6
|
-
#
|
7
|
-
def available?
|
8
|
-
`which xcproj`
|
9
|
-
$?.exitstatus.zero?
|
10
|
-
end
|
11
|
-
|
12
|
-
# Touches the project at the given path if the xcproj tool is
|
13
|
-
# available.
|
14
|
-
#
|
15
|
-
# @return [void]
|
16
|
-
#
|
17
|
-
def touch(path)
|
18
|
-
if available?
|
19
|
-
command = "xcproj --project \"#{path}\" touch"
|
20
|
-
success, output = execute(command)
|
21
|
-
unless success
|
22
|
-
message = 'The `xcproj` tool has failed to touch the project. ' \
|
23
|
-
'Check whether your installation of `xcproj` is ' \
|
24
|
-
"functional.\n\n"
|
25
|
-
message << command << "\n"
|
26
|
-
message << output
|
27
|
-
UI.warn(message)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
# @!group Private Helpers
|
35
|
-
#---------------------------------------------------------------------#
|
36
|
-
|
37
|
-
# Executes the given command redirecting the standard error to the
|
38
|
-
# standard output.
|
39
|
-
#
|
40
|
-
# @return [Array<Bool, String>] A tuple where the firs element
|
41
|
-
# indicates whether the exit status of the command was 0 and the
|
42
|
-
# second the output printed by the command.
|
43
|
-
#
|
44
|
-
def execute(command)
|
45
|
-
output = `#{command} 2>&1`
|
46
|
-
success = $?.exitstatus.zero?
|
47
|
-
[success, output]
|
48
|
-
end
|
49
|
-
|
50
|
-
#---------------------------------------------------------------------#
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|