xcodeproj 0.4.0.rc6 → 0.4.0.rc7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xcodeproj.rb +1 -1
- data/lib/xcodeproj/command.rb +5 -2
- data/lib/xcodeproj/command/project_diff.rb +6 -4
- data/lib/xcodeproj/command/show.rb +5 -13
- data/lib/xcodeproj/command/target_diff.rb +2 -3
- data/lib/xcodeproj/project.rb +7 -7
- data/lib/xcodeproj/project/object.rb +34 -10
- data/lib/xcodeproj/project/object/build_rule.rb +8 -1
- data/lib/xcodeproj/project/object_attributes.rb +4 -4
- metadata +2 -2
data/lib/xcodeproj.rb
CHANGED
data/lib/xcodeproj/command.rb
CHANGED
@@ -66,11 +66,14 @@ module Xcodeproj
|
|
66
66
|
|
67
67
|
rescue Interrupt
|
68
68
|
puts "[!] Cancelled".red
|
69
|
-
Config.instance.verbose? ? raise : exit(1)
|
69
|
+
#Config.instance.verbose? ? raise : exit(1)
|
70
|
+
exit(1)
|
70
71
|
|
71
72
|
rescue Exception => e
|
72
73
|
puts e.message
|
73
|
-
|
74
|
+
unless e.is_a?(Informative)
|
75
|
+
puts *e.backtrace
|
76
|
+
end
|
74
77
|
exit 1
|
75
78
|
end
|
76
79
|
|
@@ -2,15 +2,14 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class ProjectDiff < Command
|
4
4
|
def self.banner
|
5
|
-
%{
|
5
|
+
%{Shows the difference between two projects:
|
6
6
|
|
7
7
|
$ project-diff PROJECT_1 PROJECT_2
|
8
8
|
|
9
|
-
|
9
|
+
It shows the difference in a UUID agnostic fashion.
|
10
10
|
|
11
11
|
To reduce the noise (and to simplify implementation) differences in the
|
12
|
-
|
13
|
-
}
|
12
|
+
order of arrays are ignored.}
|
14
13
|
end
|
15
14
|
|
16
15
|
def self.options
|
@@ -20,6 +19,9 @@ module Xcodeproj
|
|
20
19
|
def initialize(argv)
|
21
20
|
@path_project1 = argv.shift_argument
|
22
21
|
@path_project2 = argv.shift_argument
|
22
|
+
unless @path_project1 && @path_project2
|
23
|
+
raise Informative, "Two project paths are required."
|
24
|
+
end
|
23
25
|
@keys_to_ignore = []
|
24
26
|
while (idx = argv.index('--ignore'))
|
25
27
|
@keys_to_ignore << argv.delete_at(idx + 1)
|
@@ -2,24 +2,16 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class Show < Command
|
4
4
|
def self.banner
|
5
|
-
%{
|
5
|
+
%{Shows an overview of a project in a YAML representation.'
|
6
6
|
|
7
|
-
$
|
7
|
+
$ show [PROJECT]
|
8
8
|
|
9
|
-
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.options
|
14
|
-
[
|
15
|
-
["--project PATH", "The Xcode project document to use."],
|
16
|
-
].concat(super)
|
9
|
+
If no `PROJECT' is specified then the current work directory is searched
|
10
|
+
for one.}
|
17
11
|
end
|
18
12
|
|
19
13
|
def initialize(argv)
|
20
|
-
|
21
|
-
@xcodeproj_path = File.expand_path(argv.shift_argument)
|
22
|
-
end
|
14
|
+
@xcodeproj_path = File.expand_path(argv.shift_argument)
|
23
15
|
super unless argv.empty?
|
24
16
|
end
|
25
17
|
|
@@ -2,12 +2,11 @@ module Xcodeproj
|
|
2
2
|
class Command
|
3
3
|
class TargetDiff < Command
|
4
4
|
def self.banner
|
5
|
-
%{
|
5
|
+
%{Shows the difference between two targets:
|
6
6
|
|
7
7
|
$ targets-diff [target 1] [target 2]
|
8
8
|
|
9
|
-
|
10
|
-
}
|
9
|
+
Only supports build source files atm.}
|
11
10
|
end
|
12
11
|
|
13
12
|
def self.options
|
data/lib/xcodeproj/project.rb
CHANGED
@@ -176,13 +176,13 @@ module Xcodeproj
|
|
176
176
|
#
|
177
177
|
def new_from_plist(uuid, objects_by_uuid_plist, root_object = false)
|
178
178
|
attributes = objects_by_uuid_plist[uuid]
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
179
|
+
if attributes
|
180
|
+
klass = Object.const_get(attributes['isa'])
|
181
|
+
object = klass.new(self, uuid)
|
182
|
+
object.add_referrer(self) if root_object
|
183
|
+
object.configure_with_plist(objects_by_uuid_plist)
|
184
|
+
object
|
185
|
+
end
|
186
186
|
end
|
187
187
|
|
188
188
|
# @return [Hash] The plist representation of the project.
|
@@ -187,7 +187,7 @@ module Xcodeproj
|
|
187
187
|
to_one_attributes.each do |attrb|
|
188
188
|
ref_uuid = object_plist[attrb.plist_name]
|
189
189
|
if ref_uuid
|
190
|
-
ref =
|
190
|
+
ref = object_with_uuid(ref_uuid, objects_by_uuid_plist, attrb)
|
191
191
|
attrb.set_value(self, ref)
|
192
192
|
end
|
193
193
|
object_plist.delete(attrb.plist_name)
|
@@ -197,7 +197,7 @@ module Xcodeproj
|
|
197
197
|
ref_uuids = object_plist[attrb.plist_name] || []
|
198
198
|
list = attrb.get_value(self)
|
199
199
|
ref_uuids.each do |uuid|
|
200
|
-
list << object_with_uuid(uuid, objects_by_uuid_plist)
|
200
|
+
list << object_with_uuid(uuid, objects_by_uuid_plist, attrb)
|
201
201
|
end
|
202
202
|
object_plist.delete(attrb.plist_name)
|
203
203
|
end
|
@@ -208,7 +208,7 @@ module Xcodeproj
|
|
208
208
|
hashes.each do |hash|
|
209
209
|
dictionary = ObjectDictionary.new(attrb, self)
|
210
210
|
hash.each do |key, uuid|
|
211
|
-
dictionary[key] = object_with_uuid(uuid, objects_by_uuid_plist)
|
211
|
+
dictionary[key] = object_with_uuid(uuid, objects_by_uuid_plist, attrb)
|
212
212
|
end
|
213
213
|
list << dictionary
|
214
214
|
end
|
@@ -218,21 +218,45 @@ module Xcodeproj
|
|
218
218
|
unless object_plist.empty?
|
219
219
|
raise "[!] Xcodeproj doesn't know about the following attributes " \
|
220
220
|
"#{object_plist} for the '#{isa}' isa.\n" \
|
221
|
-
"Please file
|
221
|
+
"Please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new"
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
|
-
|
226
|
-
|
225
|
+
# Initializes and returns the object with the given uuid.
|
226
|
+
#
|
227
|
+
# @param [String] uuid
|
228
|
+
# The UUID of the object that should be initialized.
|
229
|
+
#
|
230
|
+
# @param [Hash{String=>String}] objects_by_uuid_plist
|
231
|
+
# The hash contained by `objects` key of the plist containing
|
232
|
+
# the information about the object that should be initialized.
|
233
|
+
#
|
234
|
+
# @param [AbstractObjectAttribute] attribute
|
235
|
+
# The attribute that requested the object. It is used only for
|
236
|
+
# exceptions.
|
237
|
+
#
|
238
|
+
# @raise If the hash for the given UUID contains an unknown ISA.
|
239
|
+
#
|
240
|
+
# @raise If the UUID can't be found in the objects hash.
|
241
|
+
#
|
242
|
+
# @return [AbstractObject] the initialized object.
|
243
|
+
#
|
244
|
+
def object_with_uuid(uuid, objects_by_uuid_plist, attribute)
|
245
|
+
unless object = project.objects_by_uuid[uuid] || project.new_from_plist(uuid, objects_by_uuid_plist)
|
246
|
+
raise "`#{inspect}` attempted to initialize an object with an unknown UUID: "\
|
247
|
+
"`#{uuid}` for attribute: `#{attribute.name}`\n" \
|
248
|
+
"Please file and issue: https://github.com/CocoaPods/Xcodeproj/issues/new"
|
249
|
+
end
|
250
|
+
object
|
227
251
|
rescue NameError => exception
|
228
252
|
attributes = objects_by_uuid_plist[uuid]
|
229
253
|
raise "`#{isa}` attempted to initialize an object with unknown ISA "\
|
230
254
|
"`#{attributes['isa']}` from attributes: `#{attributes}`\n" \
|
231
|
-
"Please file
|
255
|
+
"Please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new"
|
232
256
|
end
|
233
257
|
|
234
258
|
# @note the key for simple and to_one attributes usually appears only
|
235
|
-
# if there is a value. To
|
259
|
+
# if there is a value. To-many keys always appear with an empty
|
236
260
|
# array.
|
237
261
|
#
|
238
262
|
def to_plist
|
@@ -250,7 +274,7 @@ module Xcodeproj
|
|
250
274
|
end
|
251
275
|
|
252
276
|
to_many_attributes.each do |attrb|
|
253
|
-
|
277
|
+
list = attrb.get_value(self)
|
254
278
|
plist[attrb.plist_name] = list.uuids
|
255
279
|
end
|
256
280
|
|
@@ -263,7 +287,7 @@ module Xcodeproj
|
|
263
287
|
end
|
264
288
|
alias :to_hash :to_plist
|
265
289
|
|
266
|
-
# Returns a cascade
|
290
|
+
# Returns a cascade representation of the object without UUIDs.
|
267
291
|
#
|
268
292
|
# This method is designed to work in conjuction with {Hash#recursive_diff}
|
269
293
|
# to provie a complete, yet redable, diff of two projects *not* affected by
|
@@ -23,6 +23,13 @@ module Xcodeproj
|
|
23
23
|
#
|
24
24
|
attribute :file_type, String
|
25
25
|
|
26
|
+
# @return [String] the pattern of the files that should be processed by
|
27
|
+
# this rule. This attribute is an alternative to to `file_type`.
|
28
|
+
#
|
29
|
+
# E.g. `*.css`.
|
30
|
+
#
|
31
|
+
attribute :file_patterns, String
|
32
|
+
|
26
33
|
# @return [String] whether the rule is editable.
|
27
34
|
#
|
28
35
|
# E.g. `1`.
|
@@ -32,7 +39,7 @@ module Xcodeproj
|
|
32
39
|
# @return [ObjectList<PBXFileReference>] the file references for the
|
33
40
|
# output files.
|
34
41
|
#
|
35
|
-
|
42
|
+
attribute :output_files, Array
|
36
43
|
|
37
44
|
# @return [String] the content of the script to use for the build rule.
|
38
45
|
#
|
@@ -52,7 +52,7 @@ module Xcodeproj
|
|
52
52
|
# @return[String] The name of the attribute in camel case.
|
53
53
|
#
|
54
54
|
# @example
|
55
|
-
# attribute.new(:simple, project_root)
|
55
|
+
# attribute.new(:simple, :project_root)
|
56
56
|
# attribute.plist_name #=> projectRoot
|
57
57
|
#
|
58
58
|
def plist_name
|
@@ -85,7 +85,7 @@ module Xcodeproj
|
|
85
85
|
# the value.
|
86
86
|
#
|
87
87
|
def get_value(object)
|
88
|
-
object.send(
|
88
|
+
object.send(name)
|
89
89
|
end
|
90
90
|
|
91
91
|
# Convenience method that sets the value of this attribute for a
|
@@ -103,7 +103,7 @@ module Xcodeproj
|
|
103
103
|
# @return [void]
|
104
104
|
#
|
105
105
|
def set_value(object, new_value)
|
106
|
-
raise "[Xcodeproj] Set value called for to
|
106
|
+
raise "[Xcodeproj] Set value called for a to-many attribute" if type == :to_many
|
107
107
|
object.send("#{name}=", new_value)
|
108
108
|
end
|
109
109
|
|
@@ -117,7 +117,7 @@ module Xcodeproj
|
|
117
117
|
# @return [void]
|
118
118
|
#
|
119
119
|
def set_default(object)
|
120
|
-
raise "[Xcodeproj] Set value called for
|
120
|
+
raise "[Xcodeproj] Set value called for a #{type} attribute" unless type == :simple
|
121
121
|
set_value(object, default_value) if default_value
|
122
122
|
end
|
123
123
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodeproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.rc7
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|