xcodeproj 0.19.2 → 0.19.3

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: 1129b473d86da3499713744a267d7d8f5ffd9efb
4
- data.tar.gz: ab2240c06b99dc3cccdfc3efaa471425b06d6ee6
3
+ metadata.gz: b11e16ee772fb9a6ff3bbd07499cb06885df731b
4
+ data.tar.gz: c735f33b3e62c3401d7ef35dd916dcae3275a540
5
5
  SHA512:
6
- metadata.gz: ca89358ff49c9a8688a25ab5bcfef6c43903879b68f3757fef972a60a8d16b2fa96c025dee010323abb0c90053466d3f2dad066c3b43f4cfa823f3af9bc6bad6
7
- data.tar.gz: 563f05cce3f9828c5e9869f585ebd775d5c43ad3492735a3544bf5bd05ea6201aea3c3007cb75c431bccef265186ace283b9bd167f3eb135586dc5cfe4bdf073
6
+ metadata.gz: ba65247e5b10b9cd78af4a7f455b267aae9baef88d71aec7eccc502f56be2cb4b2ae26dc4acdb643acd2bab68d2791b8fb54617fe85f2ee7cda483077b1fe311
7
+ data.tar.gz: 9473e5e8c751dab5aedf06638c111394e6fe71ec2e855199637e31aee1b57b61986126eae88eb0c972e7f7bce15568156d842a513c9ef9f33f402e21f5c53966
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 improve the performance of Xcodeproj it is possible to install [LibXML Ruby](http://xml4r.github.io/libxml-ruby/):
24
-
25
- $ [sudo] gem install libxml-ruby
26
-
27
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):
28
24
 
29
25
  $ brew install xcproj
@@ -20,13 +20,6 @@ module Xcodeproj
20
20
  autoload :Workspace, 'xcodeproj/workspace'
21
21
  autoload :XCScheme, 'xcodeproj/scheme'
22
22
  autoload :XcodebuildHelper, 'xcodeproj/xcodebuild_helper'
23
-
24
- # TODO: Delete me (compatibility with CocoaPods 0.33.1)
25
- def self.read_plist(path)
26
- PlistHelper.read(path)
27
- end
28
-
29
- def self.write_plist(hash, path)
30
- PlistHelper.write(hash, path)
31
- end
32
23
  end
24
+
25
+ require 'xcodeproj/ext'
@@ -31,7 +31,7 @@ module Xcodeproj
31
31
  @attributes = {}
32
32
  @includes = []
33
33
  @other_linker_flags = {}
34
- [:simple, :frameworks, :weak_frameworks, :libraries].each do |key|
34
+ [:simple, :frameworks, :weak_frameworks, :libraries, :force_load].each do |key|
35
35
  @other_linker_flags[key] = Set.new
36
36
  end
37
37
  merge!(extract_hash(xcconfig_hash_or_file))
@@ -94,11 +94,16 @@ module Xcodeproj
94
94
  :frameworks => '-framework ',
95
95
  :weak_frameworks => '-weak_framework ',
96
96
  :libraries => '-l',
97
+ :force_load => '-force_load',
97
98
  }
98
- [:libraries, :frameworks, :weak_frameworks].each do |key|
99
+ [:libraries, :frameworks, :weak_frameworks, :force_load].each do |key|
99
100
  modifier = modifiers[key]
100
101
  sorted = other_linker_flags[key].to_a.sort
101
- list += sorted.map { |l| %(#{modifier}"#{l}") }
102
+ if key == :force_load
103
+ list += sorted.map { |l| %(#{modifier} #{l}) }
104
+ else
105
+ list += sorted.map { |l| %(#{modifier}"#{l}") }
106
+ end
102
107
  end
103
108
 
104
109
  result = attributes.dup
@@ -17,6 +17,7 @@ module Xcodeproj
17
17
  :weak_frameworks => [],
18
18
  :libraries => [],
19
19
  :simple => [],
20
+ :force_load => [],
20
21
  }
21
22
 
22
23
  key = nil
@@ -28,6 +29,8 @@ module Xcodeproj
28
29
  key = :weak_frameworks
29
30
  when '-l'
30
31
  key = :libraries
32
+ when '-force_load'
33
+ key = :force_load
31
34
  else
32
35
  if key
33
36
  result[key] << token
@@ -1 +1,12 @@
1
- # TODO: Delete me
1
+ begin
2
+ require 'xcodeproj/plist_helper'
3
+ rescue LoadError
4
+ require 'rbconfig'
5
+ if RUBY_VERSION == '1.8.7' && RbConfig::CONFIG['prefix'] =~ %r{^/System/Library/Frameworks/Ruby.framework/}
6
+ $:.unshift(File.expand_path('../../../ext', __FILE__))
7
+ require 'xcodeproj/xcodeproj_ext'
8
+ else
9
+ raise 'The xcodeproj gem is only supported on Ruby versions that include' \
10
+ 'the Fiddle API or with Ruby 1.8.7 that came with OS X 10.8.x.'
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '0.19.2' unless defined? Xcodeproj::VERSION
4
+ VERSION = '0.19.3' unless defined? Xcodeproj::VERSION
5
5
  end
@@ -1,15 +1,19 @@
1
- require 'cfpropertylist'
2
- require 'open3'
1
+ require 'fiddle'
3
2
 
4
3
  module Xcodeproj
4
+ # TODO: Delete me (compatibility with Ruby 1.8.7 C ext bundle)
5
+ def self.read_plist(path)
6
+ PlistHelper.read(path)
7
+ end
8
+
9
+ # TODO: Delete me (compatibility with Ruby 1.8.7 C ext bundle)
10
+ def self.write_plist(hash, path)
11
+ PlistHelper.write(hash, path)
12
+ end
13
+
5
14
  # Provides support for loading and serializing property list files.
6
15
  #
7
- # @note CFPropertyList will automatically pick up the `libxml` strategy or
8
- # other faster strategies, if their dependencies are available.
9
- #
10
16
  module PlistHelper
11
- PLUTIL_BIN = '/usr/bin/plutil'
12
-
13
17
  class << self
14
18
  # Serializes a hash as an XML property list file.
15
19
  #
@@ -24,100 +28,404 @@ module Xcodeproj
24
28
  if hash.respond_to?(:to_hash)
25
29
  hash = hash.to_hash
26
30
  else
27
- raise TypeError, "The given `#{hash}`, must be a hash or " \
28
- 'respond to to_hash'
31
+ raise TypeError, "The given `#{hash.inspect}` must be a hash or " \
32
+ "respond to #to_hash'."
29
33
  end
30
34
  end
31
35
 
32
36
  unless path.is_a?(String) || path.is_a?(Pathname)
33
- raise TypeError, "The given `#{path}`, must be a string or " \
34
- 'pathname'
35
- end
36
- plist = CFPropertyList::List.new
37
- options = { :convert_unknown_to_string => true }
38
- plist.value = CFPropertyList.guess(hash, options)
39
-
40
- if plutil_available?
41
- contents = plist.to_str(CFPropertyList::List::FORMAT_XML)
42
- plutil_save(contents, path)
43
- else
44
- plist.save(path, CFPropertyList::List::FORMAT_XML)
37
+ raise TypeError, "The given `#{path}` must be a string or 'pathname'."
45
38
  end
39
+ path = path.to_s
40
+
41
+ CoreFoundation.RubyHashPropertyListWrite(hash, path)
46
42
  end
47
43
 
48
- # @return [String] Returns the native objects loaded from a property list
44
+ # @return [Hash] Returns the native objects loaded from a property list
49
45
  # file.
50
46
  #
51
47
  # @param [#to_s] path
52
48
  # The path of the file.
53
49
  #
54
50
  def read(path)
51
+ path = path.to_s
55
52
  unless File.exist?(path)
56
- raise ArgumentError, "The file `#{path}` doesn't exists"
53
+ raise ArgumentError, "The plist file at path `#{path}` doesn't exist."
57
54
  end
58
- xml = plist_xml_contents(path)
59
- plist = CFPropertyList::List.new
60
- plist.load_xml_str(xml)
61
- CFPropertyList.native_types(plist.value)
55
+ CoreFoundation.RubyHashPropertyListRead(path)
62
56
  end
57
+ end
58
+ end
59
+ end
63
60
 
64
- private
61
+ # This module provides an interface to the CoreFoundation OS X framework.
62
+ # Specifically it bridges the functions required to be able to read and write
63
+ # property lists.
64
+ #
65
+ # Everything in here should be considered an implementation detail and thus is
66
+ # not further documented.
67
+ #
68
+ # @todo Move this out into its own gem.
69
+ #
70
+ module CoreFoundation
71
+ PATH = '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'
65
72
 
66
- # @!group Private Helpers
67
- #-----------------------------------------------------------------------#
73
+ # rubocop:disable Style/MethodName
74
+ # rubocop:disable Style/VariableName
68
75
 
69
- # @return [String] Returns the contents of a property list file with
70
- # Converting it to XML using the `plutil` tool if needed and
71
- # available.
72
- #
73
- # @param [#to_s] path
74
- # The path of the file.
75
- #
76
- def plist_xml_contents(path)
77
- contents = File.read(path)
78
- if contents.include?('?xml')
79
- contents
80
- elsif plutil_available?
81
- plutil_contents(path)
82
- else
83
- raise "Unable to convert the `#{path}` plist file to XML"
84
- end
85
- end
76
+ # @!group Ruby hash as property list (de)serialization
77
+ #---------------------------------------------------------------------------#
86
78
 
87
- # @return [String] The contents of plist file normalized to XML via
88
- # `plutil` tool.
89
- #
90
- # @param [#to_s] path
91
- # The path of the file.
92
- #
93
- # @note This method was extracted to simplify testing.
94
- #
95
- def plutil_contents(path)
96
- `#{PLUTIL_BIN} -convert xml1 "#{path}" -o -`
97
- end
79
+ def self.RubyHashPropertyListWrite(hash, path)
80
+ url = CFURLCreateFromFileSystemRepresentation(NULL,
81
+ path,
82
+ path.bytesize,
83
+ FALSE)
84
+ stream = CFWriteStreamCreateWithFile(NULL, url)
85
+ unless CFWriteStreamOpen(stream) == TRUE
86
+ raise IOError, 'Unable to open stream.'
87
+ end
98
88
 
99
- # Saves a property to an XML file via the plutil tool.
100
- #
101
- # @param [#to_s] contents.
102
- # The contents of the property list.
103
- #
104
- # @param [#to_s] path
105
- # The path of the file.
106
- #
107
- def plutil_save(contents, path)
108
- Open3.popen3("#{PLUTIL_BIN} -convert xml1 -o '#{path}' -") do |stdin, stdout, _stderr|
109
- stdin.puts(contents)
110
- stdin.close
111
- stdout.read # Make Ruby 1.8.7 wait
112
- end
89
+ plist = RubyHashToCFDictionary(hash)
90
+
91
+ error_ptr = CFTypeRefPointer()
92
+ result = CFPropertyListWrite(plist,
93
+ stream,
94
+ KCFPropertyListXMLFormat_v1_0,
95
+ 0,
96
+ error_ptr)
97
+ CFWriteStreamClose(stream)
98
+
99
+ if result == 0
100
+ description = CFCopyDescription(error_ptr.ptr)
101
+ raise IOError, "Unable to write plist data: #{description}"
102
+ end
103
+ result
104
+ end
105
+
106
+ def self.RubyHashPropertyListRead(path)
107
+ url = CFURLCreateFromFileSystemRepresentation(NULL,
108
+ path,
109
+ path.bytesize,
110
+ FALSE)
111
+ stream = CFReadStreamCreateWithFile(NULL, url)
112
+ unless CFReadStreamOpen(stream) == TRUE
113
+ raise IOError, 'Unable to open stream.'
114
+ end
115
+
116
+ error_ptr = CFTypeRefPointer()
117
+ plist = CFPropertyListCreateWithStream(NULL,
118
+ stream,
119
+ 0,
120
+ KCFPropertyListImmutable,
121
+ NULL,
122
+ error_ptr)
123
+ CFReadStreamClose(stream)
124
+
125
+ if plist.null?
126
+ description = CFCopyDescription(error_ptr.ptr)
127
+ raise IOError, "Unable to read plist data: #{description}"
128
+ elsif CFGetTypeID(plist) != CFDictionaryGetTypeID()
129
+ raise TypeError, 'Expected a plist with a dictionary root object.'
130
+ end
131
+
132
+ CFDictionaryToRubyHash(plist)
133
+ end
134
+
135
+ # @!group Types
136
+ #---------------------------------------------------------------------------#
137
+
138
+ # rubocop:disable Style/ConstantName
139
+
140
+ NULL = Fiddle::NULL
141
+
142
+ Void = Fiddle::TYPE_VOID
143
+ VoidPointer = Fiddle::TYPE_VOIDP
144
+ FunctionPointer = VoidPointer
145
+
146
+ UInt32 = -Fiddle::TYPE_INT
147
+ UInt8 = -Fiddle::TYPE_CHAR
148
+
149
+ SInt32Pointer = VoidPointer
150
+ UInt8Pointer = VoidPointer
151
+ CharPointer = VoidPointer
152
+
153
+ Boolean = Fiddle::TYPE_CHAR
154
+ TRUE = 1
155
+ FALSE = 0
156
+
157
+ CFTypeRef = VoidPointer
158
+ CFTypeRefPointer = VoidPointer
159
+ CFIndex = Fiddle::TYPE_LONG
160
+ CFTypeID = -Fiddle::TYPE_LONG
161
+ CFOptionFlags = UInt32
162
+
163
+ CFPropertyListMutabilityOptions = Fiddle::TYPE_INT
164
+ KCFPropertyListImmutable = 0
165
+
166
+ CFPropertyListFormat = Fiddle::TYPE_INT
167
+ KCFPropertyListXMLFormat_v1_0 = 100
168
+ CFPropertyListFormatPointer = VoidPointer
169
+
170
+ CFStringEncoding = UInt32
171
+ KCFStringEncodingUTF8 = 0x08000100
172
+
173
+ # rubocop:enable Style/ConstantName
174
+
175
+ private
176
+
177
+ # @!group Helpers
178
+ #---------------------------------------------------------------------------#
179
+
180
+ def self.image
181
+ @image ||= Fiddle.dlopen(PATH)
182
+ end
183
+
184
+ def self.free_function
185
+ @ruby_free ||= Fiddle::Function.new(Fiddle::RUBY_FREE, [VoidPointer], Void)
186
+ end
187
+
188
+ def self.CFRelease_function
189
+ @CFRelease ||= Fiddle::Function.new(image['CFRelease'], [CFTypeRef], Void)
190
+ end
191
+
192
+ def self.extern(symbol, parameter_types, return_type)
193
+ symbol = symbol.to_s
194
+ create_function = symbol.include?('Create')
195
+ function_cache_key = "@__#{symbol}__"
196
+
197
+ # Define a singleton method on the CoreFoundation module.
198
+ define_singleton_method(symbol) do |*args|
199
+ unless args.size == parameter_types.size
200
+ raise ArgumentError, "wrong number of arguments (#{args.size} for " \
201
+ "#{parameter_types.size})"
113
202
  end
114
203
 
115
- # @return [Bool] Whether the `plutil` tool is available.
116
- #
117
- def plutil_available?
118
- @plutil_available = File.executable?(PLUTIL_BIN) if @plutil_available.nil?
119
- @plutil_available
204
+ unless function = instance_variable_get(function_cache_key)
205
+ function = Fiddle::Function.new(image[symbol],
206
+ parameter_types,
207
+ return_type)
208
+ instance_variable_set(function_cache_key, function)
120
209
  end
210
+
211
+ result = function.call(*args)
212
+ create_function ? CFAutoRelease(result) : result
121
213
  end
122
214
  end
215
+
216
+ public
217
+
218
+ # @!group CoreFoundation function definitions
219
+ #---------------------------------------------------------------------------#
220
+
221
+ # CFTypeRef description
222
+ extern :CFShow, [CFTypeRef], Void
223
+ extern :CFCopyDescription, [CFTypeRef], CFTypeRef
224
+
225
+ # CFType reflection
226
+ extern :CFGetTypeID, [CFTypeRef], CFTypeID
227
+ extern :CFDictionaryGetTypeID, [], CFTypeID
228
+ extern :CFStringGetTypeID, [], CFTypeID
229
+ extern :CFArrayGetTypeID, [], CFTypeID
230
+ extern :CFBooleanGetTypeID, [], CFTypeID
231
+
232
+ # CFStream
233
+ extern :CFWriteStreamCreateWithFile, [CFTypeRef, CFTypeRef], CFTypeRef
234
+ extern :CFWriteStreamOpen, [CFTypeRef], Boolean
235
+ extern :CFWriteStreamClose, [CFTypeRef], Void
236
+ extern :CFReadStreamCreateWithFile, [CFTypeRef, CFTypeRef], CFTypeRef
237
+ extern :CFReadStreamOpen, [CFTypeRef], Boolean
238
+ extern :CFReadStreamClose, [CFTypeRef], Void
239
+
240
+ # CFURL
241
+ extern :CFURLCreateFromFileSystemRepresentation, [CFTypeRef, UInt8Pointer, CFIndex, Boolean], CFTypeRef
242
+
243
+ # CFPropertyList
244
+ extern :CFPropertyListWrite, [CFTypeRef, CFTypeRef, CFPropertyListFormat, CFOptionFlags, CFTypeRefPointer], CFIndex
245
+ extern :CFPropertyListCreateWithStream, [CFTypeRef, CFTypeRef, CFIndex, CFOptionFlags, CFPropertyListFormatPointer, CFTypeRefPointer], CFTypeRef
246
+
247
+ # CFString
248
+ extern :CFStringCreateExternalRepresentation, [CFTypeRef, CFTypeRef, CFStringEncoding, UInt8], CFTypeRef
249
+ extern :CFStringCreateWithCString, [CFTypeRef, CharPointer, CFStringEncoding], CFTypeRef
250
+
251
+ # CFData
252
+ extern :CFDataGetLength, [CFTypeRef], CFIndex
253
+ extern :CFDataGetBytePtr, [CFTypeRef], VoidPointer
254
+
255
+ # CFDictionary
256
+ extern :CFDictionaryCreateMutable, [CFTypeRef, CFIndex, VoidPointer, VoidPointer], CFTypeRef
257
+ extern :CFDictionaryAddValue, [CFTypeRef, CFTypeRef, CFTypeRef], VoidPointer
258
+ extern :CFDictionaryApplyFunction, [CFTypeRef, FunctionPointer, VoidPointer], Void
259
+
260
+ # CFArray
261
+ extern :CFArrayCreateMutable, [CFTypeRef, CFIndex, VoidPointer], CFTypeRef
262
+ extern :CFArrayAppendValue, [CFTypeRef, CFTypeRef], VoidPointer
263
+ extern :CFArrayGetCount, [CFTypeRef], CFIndex
264
+ extern :CFArrayGetValueAtIndex, [CFTypeRef, CFIndex], CFTypeRef
265
+
266
+ # CFBoolean
267
+ extern :CFBooleanGetValue, [CFTypeRef], Boolean
268
+
269
+ # @!group Custom convenience functions
270
+ #---------------------------------------------------------------------------#
271
+
272
+ def self.CFBooleanTrue
273
+ @CFBooleanTrue ||= Fiddle::Pointer.new(image['kCFBooleanTrue']).ptr
274
+ end
275
+
276
+ def self.CFBooleanFalse
277
+ @CFBooleanFalse ||= Fiddle::Pointer.new(image['kCFBooleanFalse']).ptr
278
+ end
279
+
280
+ def self.CFTypeArrayCallBacks
281
+ @CFTypeArrayCallBacks ||= image['kCFTypeArrayCallBacks']
282
+ end
283
+
284
+ def self.CFTypeDictionaryKeyCallBacks
285
+ @CFTypeDictionaryKeyCallBacks ||= image['kCFTypeDictionaryKeyCallBacks']
286
+ end
287
+
288
+ def self.CFTypeDictionaryValueCallBacks
289
+ @CFTypeDictionaryValueCallBacks ||= image['kCFTypeDictionaryValueCallBacks']
290
+ end
291
+
292
+ # This pointer will assign `CFRelease` as the free function when
293
+ # dereferencing the pointer.
294
+ #
295
+ def self.CFTypeRefPointer
296
+ pointer = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INTPTR_T, free_function)
297
+ def pointer.ptr
298
+ CFAutoRelease(super)
299
+ end
300
+ pointer
301
+ end
302
+
303
+ def self.CFAutoRelease(cf_type_reference)
304
+ cf_type_reference.free = CFRelease_function() unless cf_type_reference.null?
305
+ cf_type_reference
306
+ end
307
+
308
+ def self.CFDictionaryApplyBlock(dictionary, &applier)
309
+ param_types = [CFTypeRef, CFTypeRef, VoidPointer]
310
+ closure = Fiddle::Closure::BlockCaller.new(Void, param_types, &applier)
311
+ closure_function = Fiddle::Function.new(closure, param_types, Void)
312
+ CFDictionaryApplyFunction(dictionary, closure_function, NULL)
313
+ end
314
+
315
+ def self.CFArrayApplyBlock(array)
316
+ CFArrayGetCount(array).times do |index|
317
+ yield CFArrayGetValueAtIndex(array, index)
318
+ end
319
+ end
320
+
321
+ # @!group CFTypeRef to Ruby value conversion
322
+ #---------------------------------------------------------------------------#
323
+
324
+ def self.CFTypeRefToRubyValue(cf_type_reference)
325
+ case CFGetTypeID(cf_type_reference)
326
+ when CFStringGetTypeID()
327
+ CFStringToRubyString(cf_type_reference)
328
+ when CFDictionaryGetTypeID()
329
+ CFDictionaryToRubyHash(cf_type_reference)
330
+ when CFArrayGetTypeID()
331
+ CFArrayToRubyArray(cf_type_reference)
332
+ when CFBooleanGetTypeID()
333
+ CFBooleanToRubyBoolean(cf_type_reference)
334
+ else
335
+ description = CFStringToRubyString(CFCopyDescription(cf_type_reference))
336
+ raise TypeError, "Unknown type: #{description}"
337
+ end
338
+ end
339
+
340
+ def self.CFStringToRubyString(string)
341
+ data = CFStringCreateExternalRepresentation(NULL,
342
+ string,
343
+ KCFStringEncodingUTF8,
344
+ 0)
345
+ if data.null?
346
+ raise TypeError, 'Unable to convert CFStringRef.'
347
+ end
348
+ bytes_ptr = CFDataGetBytePtr(data)
349
+ result = bytes_ptr.to_str(CFDataGetLength(data))
350
+ result.force_encoding(Encoding::UTF_8)
351
+ result
352
+ end
353
+
354
+ def self.CFDictionaryToRubyHash(dictionary)
355
+ result = {}
356
+ CFDictionaryApplyBlock(dictionary) do |key, value|
357
+ result[CFStringToRubyString(key)] = CFTypeRefToRubyValue(value)
358
+ end
359
+ result
360
+ end
361
+
362
+ def self.CFArrayToRubyArray(array)
363
+ result = []
364
+ CFArrayApplyBlock(array) do |element|
365
+ result << CFTypeRefToRubyValue(element)
366
+ end
367
+ result
368
+ end
369
+
370
+ def self.CFBooleanToRubyBoolean(boolean)
371
+ CFBooleanGetValue(boolean) == TRUE
372
+ end
373
+
374
+ # @!group Ruby value to CFTypeRef conversion
375
+ #---------------------------------------------------------------------------#
376
+
377
+ def self.RubyValueToCFTypeRef(value)
378
+ result = case value
379
+ when String
380
+ RubyStringToCFString(value)
381
+ when Hash
382
+ RubyHashToCFDictionary(value)
383
+ when Array
384
+ RubyArrayToCFArray(value)
385
+ when true, false
386
+ RubyBooleanToCFBoolean(value)
387
+ else
388
+ RubyStringToCFString(value.to_s)
389
+ end
390
+ if result.null?
391
+ raise TypeError, "Unable to convert Ruby value `#{value.inspect}' " \
392
+ 'into a CFTypeRef.'
393
+ end
394
+ result
395
+ end
396
+
397
+ def self.RubyStringToCFString(string)
398
+ CFStringCreateWithCString(NULL,
399
+ Fiddle::Pointer[string],
400
+ KCFStringEncodingUTF8)
401
+ end
402
+
403
+ def self.RubyHashToCFDictionary(hash)
404
+ result = CFDictionaryCreateMutable(NULL,
405
+ 0,
406
+ CFTypeDictionaryKeyCallBacks(),
407
+ CFTypeDictionaryValueCallBacks())
408
+ hash.each do |key, value|
409
+ key = RubyStringToCFString(key.to_s)
410
+ value = RubyValueToCFTypeRef(value)
411
+ CFDictionaryAddValue(result, key, value)
412
+ end
413
+ result
414
+ end
415
+
416
+ def self.RubyArrayToCFArray(array)
417
+ result = CFArrayCreateMutable(NULL, 0, CFTypeArrayCallBacks())
418
+ array.each do |element|
419
+ element = RubyValueToCFTypeRef(element)
420
+ CFArrayAppendValue(result, element)
421
+ end
422
+ result
423
+ end
424
+
425
+ def self.RubyBooleanToCFBoolean(value)
426
+ value ? CFBooleanTrue() : CFBooleanFalse()
427
+ end
428
+
429
+ # rubocop:enable Style/MethodName
430
+ # rubocop:enable Style/VariableName
123
431
  end
@@ -172,7 +172,7 @@ module Xcodeproj
172
172
  #
173
173
  def initialize_from_file
174
174
  pbxproj_path = path + 'project.pbxproj'
175
- plist = Xcodeproj::PlistHelper.read(pbxproj_path.to_s)
175
+ plist = Xcodeproj.read_plist(pbxproj_path.to_s)
176
176
  root_object_uuid = plist['rootObject']
177
177
  root_object.remove_referrer(self) if root_object
178
178
  @root_object = new_from_plist(root_object_uuid, plist['objects'], self)
@@ -302,7 +302,7 @@ module Xcodeproj
302
302
  save_path ||= path
303
303
  FileUtils.mkdir_p(save_path)
304
304
  file = File.join(save_path, 'project.pbxproj')
305
- Xcodeproj::PlistHelper.write(to_hash, file)
305
+ Xcodeproj.write_plist(to_hash, file)
306
306
  fix_encoding(file)
307
307
  XCProjHelper.touch(save_path) unless disable_xcproj?
308
308
  end
@@ -701,7 +701,7 @@ module Xcodeproj
701
701
  end
702
702
 
703
703
  xcschememanagement_path = schemes_dir + 'xcschememanagement.plist'
704
- Xcodeproj::PlistHelper.write(xcschememanagement, xcschememanagement_path)
704
+ Xcodeproj.write_plist(xcschememanagement, xcschememanagement_path)
705
705
  end
706
706
 
707
707
  #-------------------------------------------------------------------------#
@@ -139,7 +139,7 @@ module Xcodeproj
139
139
  new_file_reference(ref, child_path, :group)
140
140
  elsif File.basename(child_path) == '.xccurrentversion'
141
141
  full_path = path + File.basename(child_path)
142
- xccurrentversion = Xcodeproj::PlistHelper.read(full_path)
142
+ xccurrentversion = Xcodeproj.read_plist(full_path)
143
143
  current_version_name = xccurrentversion['_XCCurrentVersionName']
144
144
  end
145
145
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-25 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
- - !ruby/object:Gem::Dependency
42
- name: CFPropertyList
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.2'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.2'
55
41
  description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
56
42
  boring management tasks or build Xcode-friendly libraries. Also includes support
57
43
  for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
@@ -63,6 +49,7 @@ extra_rdoc_files: []
63
49
  files:
64
50
  - README.md
65
51
  - LICENSE
52
+ - ext/xcodeproj/xcodeproj_ext.bundle
66
53
  - lib/xcodeproj/command/project_diff.rb
67
54
  - lib/xcodeproj/command/show.rb
68
55
  - lib/xcodeproj/command/sort.rb