xcodeproj 0.4.3 → 0.5.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.
- data/ext/xcodeproj/xcodeproj_ext.c +1 -1
- data/lib/xcodeproj.rb +9 -7
- data/lib/xcodeproj/command/project_diff.rb +7 -7
- data/lib/xcodeproj/command/show.rb +11 -2
- data/lib/xcodeproj/config.rb +102 -38
- data/lib/xcodeproj/constants.rb +16 -14
- data/lib/xcodeproj/differ.rb +243 -0
- data/lib/xcodeproj/helper.rb +1 -0
- data/lib/xcodeproj/project.rb +92 -68
- data/lib/xcodeproj/project/object.rb +32 -9
- data/lib/xcodeproj/project/object/build_configuration.rb +21 -1
- data/lib/xcodeproj/project/object/build_file.rb +40 -6
- data/lib/xcodeproj/project/object/build_phase.rb +96 -84
- data/lib/xcodeproj/project/object/build_rule.rb +14 -8
- data/lib/xcodeproj/project/object/configuration_list.rb +7 -3
- data/lib/xcodeproj/project/object/container_item_proxy.rb +31 -29
- data/lib/xcodeproj/project/object/file_reference.rb +33 -20
- data/lib/xcodeproj/project/object/group.rb +58 -35
- data/lib/xcodeproj/project/object/native_target.rb +132 -108
- data/lib/xcodeproj/project/object/reference_proxy.rb +7 -3
- data/lib/xcodeproj/project/object/root_object.rb +4 -4
- data/lib/xcodeproj/project/object_attributes.rb +9 -6
- data/lib/xcodeproj/user_interface.rb +26 -0
- data/lib/xcodeproj/workspace.rb +23 -19
- metadata +4 -3
- data/lib/xcodeproj/project/recursive_diff.rb +0 -116
@@ -24,15 +24,17 @@ module Xcodeproj
|
|
24
24
|
#
|
25
25
|
has_one :remote_ref, PBXContainerItemProxy
|
26
26
|
|
27
|
-
# @return
|
27
|
+
# @return [String] the source tree for the path of the reference.
|
28
28
|
#
|
29
|
-
# @example
|
30
|
-
#
|
29
|
+
# @example
|
30
|
+
# "BUILT_PRODUCTS_DIR"
|
31
31
|
#
|
32
32
|
attribute :source_tree, String
|
33
33
|
|
34
34
|
#---------------------------------------------------------------------#
|
35
35
|
|
36
|
+
public
|
37
|
+
|
36
38
|
# @!group Helpers
|
37
39
|
|
38
40
|
# Checks whether the reference is a proxy.
|
@@ -43,6 +45,8 @@ module Xcodeproj
|
|
43
45
|
true
|
44
46
|
end
|
45
47
|
|
48
|
+
#---------------------------------------------------------------------#
|
49
|
+
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -16,11 +16,11 @@ module Xcodeproj
|
|
16
16
|
# @return [Hash{String => String}] attributes the attributes of the
|
17
17
|
# target.
|
18
18
|
#
|
19
|
-
# The hash might contain the following keys:
|
19
|
+
# @note The hash might contain the following keys:
|
20
20
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
21
|
+
# - `CLASSPREFIX`
|
22
|
+
# - `LastUpgradeCheck`
|
23
|
+
# - `ORGANIZATIONNAME`
|
24
24
|
#
|
25
25
|
attribute :attributes, Hash, {'LastUpgradeCheck' => '0450'}
|
26
26
|
|
@@ -107,18 +107,21 @@ module Xcodeproj
|
|
107
107
|
object.send("#{name}=", new_value)
|
108
108
|
end
|
109
109
|
|
110
|
-
# Convenience method that sets the value of this attribute for a
|
111
|
-
#
|
112
|
-
#
|
110
|
+
# Convenience method that sets the value of this attribute for a given
|
111
|
+
# object to the default (if any). It makes sense only for `:simple`
|
112
|
+
# attributes.
|
113
113
|
#
|
114
|
-
# @param
|
115
|
-
#
|
114
|
+
# @param [AbstractObject] object
|
115
|
+
# the object for which to set the default value.
|
116
|
+
#
|
117
|
+
# @note It is extremely important to duplicate the default values
|
118
|
+
# otherwise kittens cry!
|
116
119
|
#
|
117
120
|
# @return [void]
|
118
121
|
#
|
119
122
|
def set_default(object)
|
120
123
|
raise "[Xcodeproj] Set value called for a #{type} attribute" unless type == :simple
|
121
|
-
set_value(object, default_value) if default_value
|
124
|
+
set_value(object, default_value.dup) if default_value
|
122
125
|
end
|
123
126
|
|
124
127
|
# Checks that a given value is compatible with the attribute.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
|
3
|
+
# Manages the UI output so clients can customize it.
|
4
|
+
#
|
5
|
+
module UserInterface
|
6
|
+
|
7
|
+
# Prints a message to standard output.
|
8
|
+
#
|
9
|
+
# @return [void]
|
10
|
+
#
|
11
|
+
def self.puts(message)
|
12
|
+
STDOUT.puts message
|
13
|
+
end
|
14
|
+
|
15
|
+
# Prints a message to standard error.
|
16
|
+
#
|
17
|
+
# @return [void]
|
18
|
+
#
|
19
|
+
def self.warn(message)
|
20
|
+
STDERR.puts message
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
UI = UserInterface
|
25
|
+
end
|
26
|
+
|
data/lib/xcodeproj/workspace.rb
CHANGED
@@ -3,29 +3,28 @@ require 'rexml/document'
|
|
3
3
|
|
4
4
|
module Xcodeproj
|
5
5
|
|
6
|
-
#
|
6
|
+
# Provides support for generating, reading and serializing Xcode Workspace
|
7
7
|
# documents.
|
8
8
|
#
|
9
9
|
class Workspace
|
10
10
|
|
11
11
|
# @return [Array<String>] the paths of the projects contained in the
|
12
|
-
#
|
12
|
+
# workspace.
|
13
13
|
#
|
14
14
|
attr_reader :projpaths
|
15
15
|
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# @param [String] projpaths
|
19
|
-
# one or more `xcodeproj` paths.
|
16
|
+
# @param [Array] projpaths @see projpaths
|
20
17
|
#
|
21
18
|
def initialize(*projpaths)
|
22
|
-
@projpaths = projpaths
|
19
|
+
@projpaths = projpaths.flatten
|
23
20
|
end
|
24
21
|
|
22
|
+
#-------------------------------------------------------------------------#
|
23
|
+
|
25
24
|
# Returns a workspace generated by reading the contents of the given path.
|
26
25
|
#
|
27
|
-
# @param
|
28
|
-
#
|
26
|
+
# @param [String] path
|
27
|
+
# the path of the `xcworkspace` file.
|
29
28
|
#
|
30
29
|
# @return [Workspace] the generated workspace.
|
31
30
|
#
|
@@ -40,8 +39,8 @@ module Xcodeproj
|
|
40
39
|
# Returns a workspace generated by reading the contents of the given
|
41
40
|
# XML representation.
|
42
41
|
#
|
43
|
-
# @param
|
44
|
-
#
|
42
|
+
# @param [String] xml
|
43
|
+
# the XML representation of the workspace.
|
45
44
|
#
|
46
45
|
# @return [Workspace] the generated workspace.
|
47
46
|
#
|
@@ -50,14 +49,16 @@ module Xcodeproj
|
|
50
49
|
projpaths = document.get_elements("/Workspace/FileRef").map do |node|
|
51
50
|
node.attribute("location").to_s.sub(/^group:/, '')
|
52
51
|
end
|
53
|
-
new(
|
52
|
+
new(projpaths)
|
54
53
|
end
|
55
54
|
|
55
|
+
#-------------------------------------------------------------------------#
|
56
|
+
|
56
57
|
# Adds a new path to the list of the of projects contained in the
|
57
|
-
#
|
58
|
+
# workspace.
|
58
59
|
#
|
59
|
-
# @param
|
60
|
-
#
|
60
|
+
# @param [String] projpath
|
61
|
+
# The path of the project to add.
|
61
62
|
#
|
62
63
|
# @return [void]
|
63
64
|
#
|
@@ -67,8 +68,8 @@ module Xcodeproj
|
|
67
68
|
|
68
69
|
# Checks if the workspace contains the project with the given path.
|
69
70
|
#
|
70
|
-
# @param
|
71
|
-
#
|
71
|
+
# @param [String] projpath
|
72
|
+
# The path of the project to add.
|
72
73
|
#
|
73
74
|
# @return [Boolean] whether the project is contained in the workspace.
|
74
75
|
#
|
@@ -94,8 +95,8 @@ module Xcodeproj
|
|
94
95
|
|
95
96
|
# Saves the workspace at the given `xcworkspace` path.
|
96
97
|
#
|
97
|
-
# @param
|
98
|
-
#
|
98
|
+
# @param [String] path
|
99
|
+
# the path where to save the project.
|
99
100
|
#
|
100
101
|
# @return [void]
|
101
102
|
#
|
@@ -105,5 +106,8 @@ module Xcodeproj
|
|
105
106
|
out << to_s
|
106
107
|
end
|
107
108
|
end
|
109
|
+
|
110
|
+
#-------------------------------------------------------------------------#
|
111
|
+
|
108
112
|
end
|
109
113
|
end
|
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
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
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: 2013-02-
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/xcodeproj/command.rb
|
60
60
|
- lib/xcodeproj/config.rb
|
61
61
|
- lib/xcodeproj/constants.rb
|
62
|
+
- lib/xcodeproj/differ.rb
|
62
63
|
- lib/xcodeproj/helper.rb
|
63
64
|
- lib/xcodeproj/project/object/build_configuration.rb
|
64
65
|
- lib/xcodeproj/project/object/build_file.rb
|
@@ -76,8 +77,8 @@ files:
|
|
76
77
|
- lib/xcodeproj/project/object_attributes.rb
|
77
78
|
- lib/xcodeproj/project/object_dictionary.rb
|
78
79
|
- lib/xcodeproj/project/object_list.rb
|
79
|
-
- lib/xcodeproj/project/recursive_diff.rb
|
80
80
|
- lib/xcodeproj/project.rb
|
81
|
+
- lib/xcodeproj/user_interface.rb
|
81
82
|
- lib/xcodeproj/workspace.rb
|
82
83
|
- lib/xcodeproj.rb
|
83
84
|
- ext/xcodeproj/extconf.rb
|
@@ -1,116 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
|
3
|
-
# Computes the recursive difference of two hashes.
|
4
|
-
#
|
5
|
-
# Useful to compare two projects.
|
6
|
-
#
|
7
|
-
# Inspired from 'active_support/core_ext/hash/diff'.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
# h1 = { :common => 'value', :changed => 'v1' }
|
11
|
-
# h2 = { :common => 'value', :changed => 'v2', :addition => 'new_value' }
|
12
|
-
|
13
|
-
# h1.recursive_diff(h2) == {
|
14
|
-
# :changed => {
|
15
|
-
# :self => 'v1',
|
16
|
-
# :other => 'v2'
|
17
|
-
# },
|
18
|
-
# :addition => {
|
19
|
-
# :self => nil,
|
20
|
-
# :other => 'new_value'
|
21
|
-
# }
|
22
|
-
# } #=> true
|
23
|
-
#
|
24
|
-
# @return [Hash] Returns the recursive difference of a hash.
|
25
|
-
#
|
26
|
-
def recursive_diff(other, self_key = 'self', other_key = 'other')
|
27
|
-
if other.is_a?(Hash)
|
28
|
-
r = {}
|
29
|
-
all_keys = self.keys + other.keys
|
30
|
-
all_keys.each do |key|
|
31
|
-
v1 = self[key]
|
32
|
-
v2 = other[key]
|
33
|
-
diff = v1.recursive_diff(v2, self_key, other_key)
|
34
|
-
r[key] = diff if diff
|
35
|
-
end
|
36
|
-
r unless r == {}
|
37
|
-
else
|
38
|
-
super
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# @return [void]
|
43
|
-
#
|
44
|
-
def recursive_delete(key_to_delete)
|
45
|
-
delete(key_to_delete)
|
46
|
-
self.each do |key, value|
|
47
|
-
case value
|
48
|
-
when Hash
|
49
|
-
value.recursive_delete(key_to_delete)
|
50
|
-
when Array
|
51
|
-
value.each { |v| v.recursive_delete(key_to_delete) if v.is_a?(Hash)}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
class Array
|
59
|
-
|
60
|
-
# @return [Array]
|
61
|
-
#
|
62
|
-
def recursive_diff(other, self_key = 'self', other_key = 'other')
|
63
|
-
if other.is_a?(Array)
|
64
|
-
new_objects_self = (self - other)
|
65
|
-
new_objects_other = (other - self)
|
66
|
-
unmatched_objects_self = []
|
67
|
-
array_result = []
|
68
|
-
|
69
|
-
# Try to match objects to reduce noise
|
70
|
-
new_objects_self.each do |value|
|
71
|
-
if value.is_a?(Hash)
|
72
|
-
other_value = new_objects_other.find do |other|
|
73
|
-
other.is_a?(Hash) && (value['displayName'] == other['displayName'])
|
74
|
-
end
|
75
|
-
|
76
|
-
if other_value
|
77
|
-
new_objects_other.delete(other_value)
|
78
|
-
match_diff = value.recursive_diff(other_value, self_key, other_key)
|
79
|
-
array_result << { value['displayName'] => match_diff} unless match_diff == {}
|
80
|
-
else
|
81
|
-
unmatched_objects_self << value
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
unless unmatched_objects_self.empty?
|
87
|
-
array_result << {
|
88
|
-
self_key => unmatched_objects_self.map do |v|
|
89
|
-
{ v['displayName'] => v }
|
90
|
-
end
|
91
|
-
}
|
92
|
-
end
|
93
|
-
|
94
|
-
unless new_objects_other.empty?
|
95
|
-
array_result << {
|
96
|
-
other_key => new_objects_other.map do |v|
|
97
|
-
{ v['displayName'] => v }
|
98
|
-
end
|
99
|
-
}
|
100
|
-
end
|
101
|
-
|
102
|
-
array_result unless array_result == []
|
103
|
-
else
|
104
|
-
super
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
class Object
|
110
|
-
|
111
|
-
# @return [Hash]
|
112
|
-
#
|
113
|
-
def recursive_diff(other, self_key = 'self', other_key = 'other')
|
114
|
-
{ self_key => self, other_key => other } unless self == other
|
115
|
-
end
|
116
|
-
end
|