xcodeproj 0.6.0 → 0.7.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 +1 -1
- data/lib/xcodeproj.rb +1 -1
- data/lib/xcodeproj/config.rb +10 -6
- data/lib/xcodeproj/project.rb +16 -0
- data/lib/xcodeproj/workspace.rb +43 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83d94cd76866abf1c5e5fec10b67b4a52e8f6ea
|
4
|
+
data.tar.gz: 28243c4a1427bdabec3efdc7cadc6fb27e50e8a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 520ebdfb68a640a71d30e4bfd7d298f8c214626a83ba6de858b84df8865dae8590a417bf4f3a34b6de9e4b46962299356874d7d63240acd966f09ca1a0c5294a
|
7
|
+
data.tar.gz: 1c2d9f6d83f300361901848ce6c0ab417034797d4e660249117f6123831036a9cdd399df5a4233b35a163ba56db90d43015a626e022a7d2a9d22e3dfc05e12bd
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ by performing the following command:
|
|
21
21
|
$ [sudo] gem install xcodeproj
|
22
22
|
|
23
23
|
|
24
|
-
##
|
24
|
+
## Collaborate
|
25
25
|
|
26
26
|
All Xcodeproj development happens on [GitHub][xcodeproj]. Contributing patches
|
27
27
|
is really easy and gratifying. You even get push access when one of your patches
|
data/lib/xcodeproj.rb
CHANGED
data/lib/xcodeproj/config.rb
CHANGED
@@ -66,9 +66,9 @@ module Xcodeproj
|
|
66
66
|
#
|
67
67
|
# @return [String] The serialized internal data.
|
68
68
|
#
|
69
|
-
def to_s
|
69
|
+
def to_s(prefix = nil)
|
70
70
|
[includes.map { |i| "#include \"#{i}\""} +
|
71
|
-
to_hash.sort_by(&:first).map { |k, v| "#{k} = #{v}" }].join("\n")
|
71
|
+
to_hash(prefix).sort_by(&:first).map { |k, v| "#{k} = #{v}" }].join("\n")
|
72
72
|
end
|
73
73
|
|
74
74
|
# Writes the serialized representation of the internal data to the given
|
@@ -79,8 +79,8 @@ module Xcodeproj
|
|
79
79
|
#
|
80
80
|
# @return [void]
|
81
81
|
#
|
82
|
-
def save_as(pathname)
|
83
|
-
pathname.open('w') { |file| file << to_s }
|
82
|
+
def save_as(pathname, prefix = nil)
|
83
|
+
pathname.open('w') { |file| file << to_s(prefix) }
|
84
84
|
end
|
85
85
|
|
86
86
|
# The hash representation of the xcconfig. The hash includes the
|
@@ -92,7 +92,7 @@ module Xcodeproj
|
|
92
92
|
#
|
93
93
|
# @return [Hash] The hash representation
|
94
94
|
#
|
95
|
-
def to_hash
|
95
|
+
def to_hash(prefix = nil)
|
96
96
|
hash = @attributes.dup
|
97
97
|
flags = hash['OTHER_LDFLAGS'] || ''
|
98
98
|
flags = flags.dup.strip
|
@@ -101,7 +101,11 @@ module Xcodeproj
|
|
101
101
|
flags << weak_frameworks.to_a.sort.reduce('') {| memo, f | memo << " -weak_framework #{f}" }
|
102
102
|
hash['OTHER_LDFLAGS'] = flags.strip
|
103
103
|
hash.delete('OTHER_LDFLAGS') if flags.strip.empty?
|
104
|
-
|
104
|
+
if prefix
|
105
|
+
Hash[hash.map {|k, v| [prefix + k, v]}]
|
106
|
+
else
|
107
|
+
hash
|
108
|
+
end
|
105
109
|
end
|
106
110
|
|
107
111
|
#-------------------------------------------------------------------------#
|
data/lib/xcodeproj/project.rb
CHANGED
@@ -653,6 +653,22 @@ module Xcodeproj
|
|
653
653
|
end
|
654
654
|
|
655
655
|
#-------------------------------------------------------------------------#
|
656
|
+
# Get list of shared schemes in project
|
657
|
+
#
|
658
|
+
# @param [String] path
|
659
|
+
# project path
|
660
|
+
#
|
661
|
+
# @return [Array]
|
662
|
+
#
|
663
|
+
def self.schemes project_path
|
664
|
+
schemes = Dir[File.join(project_path, 'xcshareddata', 'xcschemes', '*.xcscheme')].map do |scheme|
|
665
|
+
File.basename(scheme, '.xcscheme')
|
666
|
+
end
|
667
|
+
schemes << File.basename(project_path, '.xcodeproj') if schemes.empty?
|
668
|
+
schemes
|
669
|
+
end
|
670
|
+
|
671
|
+
#-------------------------------------------------------------------------#
|
656
672
|
|
657
673
|
end
|
658
674
|
end
|
data/lib/xcodeproj/workspace.rb
CHANGED
@@ -12,11 +12,13 @@ module Xcodeproj
|
|
12
12
|
# workspace.
|
13
13
|
#
|
14
14
|
attr_reader :projpaths
|
15
|
+
attr_reader :schemes
|
15
16
|
|
16
17
|
# @param [Array] projpaths @see projpaths
|
17
18
|
#
|
18
19
|
def initialize(*projpaths)
|
19
20
|
@projpaths = projpaths.flatten
|
21
|
+
@schemes = {}
|
20
22
|
end
|
21
23
|
|
22
24
|
#-------------------------------------------------------------------------#
|
@@ -30,12 +32,14 @@ module Xcodeproj
|
|
30
32
|
#
|
31
33
|
def self.new_from_xcworkspace(path)
|
32
34
|
begin
|
33
|
-
from_s(File.read(File.join(path, 'contents.xcworkspacedata')))
|
35
|
+
from_s(File.read(File.join(path, 'contents.xcworkspacedata')), File.expand_path(File.dirname(path)))
|
34
36
|
rescue Errno::ENOENT
|
35
37
|
new
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
41
|
+
#-------------------------------------------------------------------------#
|
42
|
+
|
39
43
|
# Returns a workspace generated by reading the contents of the given
|
40
44
|
# XML representation.
|
41
45
|
#
|
@@ -44,12 +48,14 @@ module Xcodeproj
|
|
44
48
|
#
|
45
49
|
# @return [Workspace] the generated workspace.
|
46
50
|
#
|
47
|
-
def self.from_s(xml)
|
51
|
+
def self.from_s(xml, workspace_path='')
|
48
52
|
document = REXML::Document.new(xml)
|
49
53
|
projpaths = document.get_elements("/Workspace/FileRef").map do |node|
|
50
54
|
node.attribute("location").to_s.sub(/^group:/, '')
|
51
55
|
end
|
52
|
-
new(projpaths)
|
56
|
+
instance = new(projpaths)
|
57
|
+
instance.load_schemes(workspace_path)
|
58
|
+
instance
|
53
59
|
end
|
54
60
|
|
55
61
|
#-------------------------------------------------------------------------#
|
@@ -64,6 +70,7 @@ module Xcodeproj
|
|
64
70
|
#
|
65
71
|
def <<(projpath)
|
66
72
|
@projpaths << projpath
|
73
|
+
load_schemes_from_project File.expand_path(projpath)
|
67
74
|
end
|
68
75
|
|
69
76
|
# Checks if the workspace contains the project with the given path.
|
@@ -109,5 +116,38 @@ module Xcodeproj
|
|
109
116
|
|
110
117
|
#-------------------------------------------------------------------------#
|
111
118
|
|
119
|
+
# Load all schemes from all projects in workspace
|
120
|
+
#
|
121
|
+
# @param [String] workspace_dir_path
|
122
|
+
# path of workspaces dir
|
123
|
+
#
|
124
|
+
# @return [void]
|
125
|
+
#
|
126
|
+
def load_schemes workspace_dir_path
|
127
|
+
@projpaths.each do |projpath|
|
128
|
+
project_full_path = File.expand_path(File.join(workspace_dir_path, projpath))
|
129
|
+
load_schemes_from_project project_full_path
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
#-------------------------------------------------------------------------#
|
134
|
+
|
135
|
+
private
|
136
|
+
# Load all schemes from project
|
137
|
+
#
|
138
|
+
# @param [String] project_full_path
|
139
|
+
# project full path
|
140
|
+
#
|
141
|
+
# @return [void]
|
142
|
+
#
|
143
|
+
def load_schemes_from_project project_full_path
|
144
|
+
schemes = Xcodeproj::Project.schemes project_full_path
|
145
|
+
schemes.each do |scheme_name|
|
146
|
+
@schemes[scheme_name] = project_full_path
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
#-------------------------------------------------------------------------#
|
151
|
+
|
112
152
|
end
|
113
153
|
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.7.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: 2013-
|
11
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|