xcodeproj 0.16.1 → 0.17.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/ext/xcodeproj/prebuilt/universal-darwin12.0-1.8.7/xcodeproj_ext.bundle +0 -0
- data/ext/xcodeproj/prebuilt/universal.x86_64-darwin13-2.0.0/xcodeproj_ext.bundle +0 -0
- data/lib/xcodeproj/gem_version.rb +1 -1
- data/lib/xcodeproj/workspace.rb +21 -20
- data/lib/xcodeproj/workspace/file_reference.rb +87 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c9efc19e5ebe6d1e236953a4ba523bd76284aa
|
4
|
+
data.tar.gz: 265bccb8aef4feda776f3161a2b7144d04092199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f600fece068a72b186a2e4fbe2a62a96129256cd7c4356d1fce4e945ac2150e5f646acaae768fc534d968b5426a440e5dd0b245aaa473bffa853fc3e1eaa154
|
7
|
+
data.tar.gz: 0d36f633574ac627ed5737ebd6f963c2918f68fbf1afbd26d4b20e9f4e2989326aa548add0c3fa1910b1bbdeb55f9b4dcdd8dab45d7eabc8a51aa5c09c155aff
|
Binary file
|
Binary file
|
data/lib/xcodeproj/workspace.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'rexml/document'
|
3
|
+
require 'xcodeproj/workspace/file_reference'
|
3
4
|
|
4
5
|
module Xcodeproj
|
5
6
|
|
@@ -9,15 +10,16 @@ module Xcodeproj
|
|
9
10
|
class Workspace
|
10
11
|
|
11
12
|
# @return [Array<String>] the paths of the projects contained in the
|
13
|
+
# @return [Array<FileReference>] the paths of the projects contained in the
|
12
14
|
# workspace.
|
13
15
|
#
|
14
|
-
attr_reader :
|
16
|
+
attr_reader :file_references
|
15
17
|
attr_reader :schemes
|
16
18
|
|
17
|
-
# @param [Array]
|
19
|
+
# @param [Array] file_references @see file_references
|
18
20
|
#
|
19
|
-
def initialize(*
|
20
|
-
@
|
21
|
+
def initialize(*file_references)
|
22
|
+
@file_references = file_references.flatten
|
21
23
|
@schemes = {}
|
22
24
|
end
|
23
25
|
|
@@ -50,10 +52,10 @@ module Xcodeproj
|
|
50
52
|
#
|
51
53
|
def self.from_s(xml, workspace_path='')
|
52
54
|
document = REXML::Document.new(xml)
|
53
|
-
|
54
|
-
|
55
|
+
file_references = document.get_elements("/Workspace/FileRef").map do |node|
|
56
|
+
FileReference.from_node(node)
|
55
57
|
end
|
56
|
-
instance = new(
|
58
|
+
instance = new(file_references)
|
57
59
|
instance.load_schemes(workspace_path)
|
58
60
|
instance
|
59
61
|
end
|
@@ -69,19 +71,20 @@ module Xcodeproj
|
|
69
71
|
# @return [void]
|
70
72
|
#
|
71
73
|
def <<(projpath)
|
72
|
-
@
|
74
|
+
@file_references << projpath
|
73
75
|
load_schemes_from_project File.expand_path(projpath)
|
74
76
|
end
|
75
77
|
|
76
|
-
# Checks if the workspace contains the project with the given
|
78
|
+
# Checks if the workspace contains the project with the given file
|
79
|
+
# reference.
|
77
80
|
#
|
78
|
-
# @param [
|
79
|
-
# The
|
81
|
+
# @param [FileReference] file_reference
|
82
|
+
# The file_reference to the project.
|
80
83
|
#
|
81
84
|
# @return [Boolean] whether the project is contained in the workspace.
|
82
85
|
#
|
83
|
-
def include?(
|
84
|
-
@
|
86
|
+
def include?(file_reference)
|
87
|
+
@file_references.include?(file_reference)
|
85
88
|
end
|
86
89
|
|
87
90
|
# The template to generate a workspace XML representation.
|
@@ -92,10 +95,8 @@ module Xcodeproj
|
|
92
95
|
#
|
93
96
|
def to_s
|
94
97
|
REXML::Document.new(TEMPLATE).tap do |document|
|
95
|
-
@
|
96
|
-
document.root <<
|
97
|
-
el.attributes['location'] = "group:#{projpath}"
|
98
|
-
end
|
98
|
+
@file_references.each do |file_reference|
|
99
|
+
document.root << file_reference.to_node
|
99
100
|
end
|
100
101
|
end.to_s
|
101
102
|
end
|
@@ -124,9 +125,9 @@ module Xcodeproj
|
|
124
125
|
# @return [void]
|
125
126
|
#
|
126
127
|
def load_schemes workspace_dir_path
|
127
|
-
@
|
128
|
-
project_full_path =
|
129
|
-
load_schemes_from_project
|
128
|
+
@file_references.each do |file_reference|
|
129
|
+
project_full_path = file_reference.absolute_path(workspace_dir_path)
|
130
|
+
load_schemes_from_project(project_full_path)
|
130
131
|
end
|
131
132
|
end
|
132
133
|
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Xcodeproj
|
2
|
+
class Workspace
|
3
|
+
# Describes a file reference of a Workspace.
|
4
|
+
#
|
5
|
+
class FileReference
|
6
|
+
# @return [String] the path to the project
|
7
|
+
#
|
8
|
+
attr_reader :path
|
9
|
+
|
10
|
+
# @return [String] the type of reference to the project
|
11
|
+
#
|
12
|
+
# This can be of the following values:
|
13
|
+
# - absolute
|
14
|
+
# - group
|
15
|
+
# - container
|
16
|
+
# - developer (unsupported)
|
17
|
+
#
|
18
|
+
attr_reader :type
|
19
|
+
|
20
|
+
# @param [#to_s] path @see path
|
21
|
+
# @param [#to_s] type @see type
|
22
|
+
#
|
23
|
+
def initialize(path, type="group")
|
24
|
+
@path = path.to_s
|
25
|
+
@type = type.to_s
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Bool] Wether a file reference is equal to another.
|
29
|
+
#
|
30
|
+
def ==(other)
|
31
|
+
path == other.path && type == other.type
|
32
|
+
end
|
33
|
+
alias_method :eql?, :==
|
34
|
+
|
35
|
+
# @return [Fixnum] A hash identical for equals objects.
|
36
|
+
#
|
37
|
+
def hash
|
38
|
+
[path, type].hash
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns a file reference given XML representation.
|
42
|
+
#
|
43
|
+
# @param [REXML::Element] xml_node
|
44
|
+
# the XML representation.
|
45
|
+
#
|
46
|
+
# @return [FileReference] The new file reference instance.
|
47
|
+
#
|
48
|
+
def self.from_node(xml_node)
|
49
|
+
type, path = xml_node.attribute('location').value.split(':', 2)
|
50
|
+
new(path, type)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [REXML::Element] the XML representation of the file reference.
|
54
|
+
#
|
55
|
+
def to_node
|
56
|
+
REXML::Element.new("FileRef").tap do |element|
|
57
|
+
element.attributes['location'] = "#{type}:#{path}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns the absolute path of a file reference given the path of the
|
62
|
+
# directory containing workspace.
|
63
|
+
#
|
64
|
+
# @param [#to_s] workspace_dir_path
|
65
|
+
# The Path of the directory containing the workspace.
|
66
|
+
#
|
67
|
+
# @return [String] The absolute path to the project.
|
68
|
+
#
|
69
|
+
def absolute_path(workspace_dir_path)
|
70
|
+
workspace_dir_path = workspace_dir_path.to_s
|
71
|
+
case type
|
72
|
+
when 'group'
|
73
|
+
File.expand_path(File.join(workspace_dir_path, path))
|
74
|
+
when 'container'
|
75
|
+
File.expand_path(File.join(workspace_dir_path, path))
|
76
|
+
when 'absolute'
|
77
|
+
File.expand_path(path)
|
78
|
+
when 'developer'
|
79
|
+
raise "Developer workspace file reference type is not yet " \
|
80
|
+
"#{self}"
|
81
|
+
else
|
82
|
+
raise "Unsupported workspace file reference type #{type}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
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.
|
4
|
+
version: 0.17.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: 2014-
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/xcodeproj/scheme.rb
|
93
93
|
- lib/xcodeproj/user_interface.rb
|
94
94
|
- lib/xcodeproj/workspace.rb
|
95
|
+
- lib/xcodeproj/workspace/file_reference.rb
|
95
96
|
- lib/xcodeproj/xcodebuild_helper.rb
|
96
97
|
homepage: https://github.com/cocoapods/xcodeproj
|
97
98
|
licenses:
|