xcodeproject 0.1.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +7 -0
- data/README.md +123 -2
- data/lib/xcodeproject/build_phase_node.rb +1 -1
- data/lib/xcodeproject/builder.rb +21 -0
- data/lib/xcodeproject/data.rb +1 -1
- data/lib/xcodeproject/exceptions.rb +1 -1
- data/lib/xcodeproject/extend/array.rb +1 -1
- data/lib/xcodeproject/extend/hash.rb +1 -1
- data/lib/xcodeproject/file_node.rb +1 -1
- data/lib/xcodeproject/formatter.rb +1 -1
- data/lib/xcodeproject/node.rb +1 -1
- data/lib/xcodeproject/pbx_build_file.rb +1 -1
- data/lib/xcodeproject/pbx_file_reference.rb +1 -1
- data/lib/xcodeproject/pbx_group.rb +9 -1
- data/lib/xcodeproject/pbx_native_target.rb +1 -1
- data/lib/xcodeproject/pbx_project.rb +1 -1
- data/lib/xcodeproject/project.rb +21 -1
- data/lib/xcodeproject/root_node.rb +2 -2
- data/lib/xcodeproject/spec/build_phase_node_spec.rb +5 -5
- data/lib/xcodeproject/spec/file_node_spec.rb +7 -7
- data/lib/xcodeproject/spec/pbx_build_file_spec.rb +2 -2
- data/lib/xcodeproject/spec/pbx_file_reference_spec.rb +1 -1
- data/lib/xcodeproject/spec/pbx_group_spec.rb +55 -11
- data/lib/xcodeproject/spec/pbx_native_target_spec.rb +2 -2
- data/lib/xcodeproject/spec/pbx_project_spec.rb +4 -4
- data/lib/xcodeproject/spec/project_spec.rb +7 -7
- data/lib/xcodeproject/spec/spec_helper.rb +1 -1
- data/lib/xcodeproject/spec/xc_configuration_list_spec.rb +2 -2
- data/lib/xcodeproject/uuid_generator.rb +1 -1
- data/lib/xcodeproject/version.rb +2 -2
- data/lib/xcodeproject/xc_build_configuration.rb +1 -1
- data/lib/xcodeproject/xc_configuration_list.rb +1 -1
- data/rakefile +4 -0
- data/xcodeproject.gemspec +4 -2
- metadata +33 -5
data/.yardopts
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
XcodeProject
|
2
2
|
===
|
3
3
|
Ruby API for working with Xcode project files
|
4
4
|
|
@@ -6,9 +6,130 @@ Installation
|
|
6
6
|
---
|
7
7
|
`gem install xcodeproject`
|
8
8
|
|
9
|
+
Getting started
|
10
|
+
---
|
11
|
+
A simple example that displays all targets of the project will look like this:
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'xcodeproject'
|
15
|
+
|
16
|
+
proj = XcodeProject::Project.new('path/to/example.xcodeproj')
|
17
|
+
proj.read.targets.each do |target|
|
18
|
+
puts target.name
|
19
|
+
end
|
20
|
+
|
21
|
+
First, you must create an XcodeProject::Project object like this:
|
22
|
+
|
23
|
+
proj = XcodeProject::Project.new('path/to/example.xcodeproj')
|
24
|
+
|
25
|
+
Or you can find all projects are located in the specified directory:
|
26
|
+
|
27
|
+
projs = XcodeProject::Project.find_projs('path/to/dir')
|
28
|
+
|
29
|
+
After creating the project object, you can read the data from it:
|
30
|
+
|
31
|
+
data = proj.read
|
32
|
+
p data.target('example').config('Release').build_settings
|
33
|
+
|
34
|
+
Or rewrite data:
|
35
|
+
|
36
|
+
proj.change do |data|
|
37
|
+
data.target('example').config('Release').build_settings['GCC_VERSION'] = 'com.apple.compilers.llvmgcc42'
|
38
|
+
end
|
39
|
+
|
40
|
+
Files, groups and directories
|
41
|
+
---
|
42
|
+
Displaying all of top-level groups:
|
43
|
+
|
44
|
+
data.main_group.children.each do |child|
|
45
|
+
p child.name
|
46
|
+
end
|
47
|
+
|
48
|
+
Displaying files of specified group:
|
49
|
+
|
50
|
+
group = data.group('path/from/main_group')
|
51
|
+
group.files.each do |file|
|
52
|
+
p file.name
|
53
|
+
end
|
54
|
+
|
55
|
+
You can get group's (or file's) group path (the path from the main group):
|
56
|
+
|
57
|
+
group.group_path
|
58
|
+
|
59
|
+
Directories are groups that are explicitly represented in the file system. For them, you can also get a file path:
|
60
|
+
|
61
|
+
group.total_path
|
62
|
+
|
63
|
+
You can add a group to project by specifying the path from the main group:
|
64
|
+
|
65
|
+
data.add_group('path/from/main_group')
|
66
|
+
|
67
|
+
Or from the current group:
|
68
|
+
|
69
|
+
group.add_group('path/from/current_group')
|
70
|
+
|
71
|
+
To add a directory to the project, you must specify the file path to it:
|
72
|
+
|
73
|
+
data.add_dir('group_path/to/parent', '/file_path/to/dir')
|
74
|
+
group.add_dir('/file_path/to/dir')
|
75
|
+
|
76
|
+
Adding files are same:
|
77
|
+
|
78
|
+
data.add_file('group_path/to/parent', '/file_path/to/file')
|
79
|
+
group.add_file('/file_path/to/file')
|
80
|
+
|
81
|
+
You can also remove files, groups and directories from the project:
|
82
|
+
|
83
|
+
data.remove_file('path/from/main_group')
|
84
|
+
data.remove_group('path/from/main_group')
|
85
|
+
|
86
|
+
group.remove_file('path/from/current_group')
|
87
|
+
group.remove_group('path/from/current_group')
|
88
|
+
|
89
|
+
Targets
|
90
|
+
---
|
91
|
+
Getting the target object is simple:
|
92
|
+
|
93
|
+
target = data.target('example')
|
94
|
+
|
95
|
+
After adding a file to the project, you can add it to target's build phase:
|
96
|
+
|
97
|
+
file = main_group.add_file('/file_path/to/file')
|
98
|
+
target.add_source(file)
|
99
|
+
|
100
|
+
Or remove from target's build phase:
|
101
|
+
|
102
|
+
target.remove_source(file)
|
103
|
+
|
104
|
+
Building the project
|
105
|
+
---
|
106
|
+
XcodeProject uses XcodeBuilder for building projects
|
107
|
+
|
108
|
+
Building the project:
|
109
|
+
|
110
|
+
proj.build
|
111
|
+
|
112
|
+
Cleaning the project:
|
113
|
+
|
114
|
+
proj.clean
|
115
|
+
|
116
|
+
Archiving the project:
|
117
|
+
|
118
|
+
proj.builder.scheme = 'example'
|
119
|
+
proj.archive
|
120
|
+
|
121
|
+
You can specify options for builder:
|
122
|
+
|
123
|
+
proj.builder.configuration = 'Debug'
|
124
|
+
proj.builder.arch = 'armv7'
|
125
|
+
proj.build
|
126
|
+
|
127
|
+
You can find out more about XcodeBuilder [here][xcodebuilder].
|
128
|
+
|
9
129
|
License
|
10
130
|
---
|
11
|
-
|
131
|
+
XcodeProject is provided under the terms of the [the MIT license][license]
|
12
132
|
|
133
|
+
[xcodebuilder]:https://github.com/lukeredpath/xcodebuild-rb
|
13
134
|
[license]:http://www.opensource.org/licenses/MIT
|
14
135
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'xcodebuild'
|
2
|
+
|
3
|
+
module XcodeProject
|
4
|
+
class Builder < XcodeBuild::Tasks::BuildTask
|
5
|
+
def initialize (&block)
|
6
|
+
super(block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def build
|
10
|
+
run('build')
|
11
|
+
end
|
12
|
+
|
13
|
+
def clean
|
14
|
+
run('clean')
|
15
|
+
end
|
16
|
+
|
17
|
+
def archive
|
18
|
+
run('archive')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/xcodeproject/data.rb
CHANGED
data/lib/xcodeproject/node.rb
CHANGED
@@ -2,7 +2,7 @@ require 'xcodeproject/pbx_file_reference'
|
|
2
2
|
require 'xcodeproject/exceptions'
|
3
3
|
require 'pathname'
|
4
4
|
|
5
|
-
module
|
5
|
+
module XcodeProject
|
6
6
|
class PBXGroup < FileNode
|
7
7
|
def initialize (root, uuid, data)
|
8
8
|
super(root, uuid, data)
|
@@ -13,6 +13,14 @@ module XCodeProject
|
|
13
13
|
@children.map {|uuid| root.object!(uuid)}
|
14
14
|
end
|
15
15
|
|
16
|
+
def groups
|
17
|
+
children.select {|child| child.is_a?(PBXGroup) }
|
18
|
+
end
|
19
|
+
|
20
|
+
def files
|
21
|
+
children.select {|child| child.is_a?(PBXFileReference) }
|
22
|
+
end
|
23
|
+
|
16
24
|
def child (gpath)
|
17
25
|
gpath = Pathname.new(gpath).cleanpath
|
18
26
|
|
data/lib/xcodeproject/project.rb
CHANGED
@@ -20,12 +20,14 @@
|
|
20
20
|
# IN THE SOFTWARE.
|
21
21
|
#++
|
22
22
|
|
23
|
+
require 'xcodeproject/builder'
|
23
24
|
require 'xcodeproject/data'
|
24
25
|
require 'pathname'
|
25
26
|
require 'find'
|
26
27
|
|
27
|
-
module
|
28
|
+
module XcodeProject
|
28
29
|
class Project
|
30
|
+
attr_reader :builder
|
29
31
|
attr_reader :bundle_path
|
30
32
|
attr_reader :file_path
|
31
33
|
attr_reader :name
|
@@ -45,6 +47,12 @@ module XCodeProject
|
|
45
47
|
@bundle_path = path
|
46
48
|
@file_path = bundle_path.join('project.pbxproj')
|
47
49
|
@name = bundle_path.basename('.*').to_s
|
50
|
+
|
51
|
+
@builder = Builder.new do |t|
|
52
|
+
t.project_name = path.basename
|
53
|
+
t.invoke_from_within = path.dirname
|
54
|
+
t.formatter = XcodeBuild::Formatters::ProgressFormatter.new
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
def change
|
@@ -63,6 +71,18 @@ module XCodeProject
|
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
74
|
+
def build
|
75
|
+
builder.build
|
76
|
+
end
|
77
|
+
|
78
|
+
def clean
|
79
|
+
builder.clean
|
80
|
+
end
|
81
|
+
|
82
|
+
def archive
|
83
|
+
builder.archive
|
84
|
+
end
|
85
|
+
|
66
86
|
def doctor
|
67
87
|
change {|data| data.doctor }
|
68
88
|
end
|
@@ -31,7 +31,7 @@ require 'xcodeproject/extend/string'
|
|
31
31
|
require 'xcodeproject/extend/array'
|
32
32
|
require 'xcodeproject/extend/hash'
|
33
33
|
|
34
|
-
module
|
34
|
+
module XcodeProject
|
35
35
|
class RootNode
|
36
36
|
def initialize (data, wd)
|
37
37
|
@data, @wd = data, Pathname.new(wd)
|
@@ -50,7 +50,7 @@ module XCodeProject
|
|
50
50
|
|
51
51
|
def object (uuid)
|
52
52
|
data = @objects[uuid]
|
53
|
-
|
53
|
+
XcodeProject.const_get(data['isa']).new(self, uuid, data) unless data.nil?
|
54
54
|
end
|
55
55
|
|
56
56
|
def object! (uuid)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::BuildPhaseNode do
|
4
4
|
let(:root) { prepare_example_project.read.send(:root) }
|
5
5
|
let(:file_ref) { root.project.main_group.file_ref('group1a/file2c.m') }
|
6
6
|
let(:build_file) { root.project.target('example').sources_build_phase.send(:build_file, file_ref.uuid) }
|
@@ -9,7 +9,7 @@ describe XCodeProject::BuildPhaseNode do
|
|
9
9
|
describe "#files" do
|
10
10
|
it "returns an array of files" do
|
11
11
|
obj.files.should be_an_instance_of(Array)
|
12
|
-
obj.files.each {|obj| obj.should be_an_instance_of(
|
12
|
+
obj.files.each {|obj| obj.should be_an_instance_of(XcodeProject::PBXFileReference) }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -56,19 +56,19 @@ describe XCodeProject::BuildPhaseNode do
|
|
56
56
|
describe "#build_files" do
|
57
57
|
it "returns an array of files" do
|
58
58
|
obj.send(:build_files).should be_an_instance_of(Array)
|
59
|
-
obj.send(:build_files).each {|obj| obj.should be_an_instance_of(
|
59
|
+
obj.send(:build_files).each {|obj| obj.should be_an_instance_of(XcodeProject::PBXBuildFile) }
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe "#build_file" do
|
64
64
|
it "returns the object" do
|
65
|
-
obj.send(:build_file, file_ref.uuid).should be_an_instance_of(
|
65
|
+
obj.send(:build_file, file_ref.uuid).should be_an_instance_of(XcodeProject::PBXBuildFile)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "#add_build_file" do
|
70
70
|
it "adds the build file, returns the object" do
|
71
|
-
obj.send(:add_build_file, file_ref.uuid).should be_an_instance_of(
|
71
|
+
obj.send(:add_build_file, file_ref.uuid).should be_an_instance_of(XcodeProject::PBXBuildFile)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::FileNode do
|
4
4
|
let(:data_name) { Hash['name', 'file.name'] }
|
5
5
|
let(:data_path) { Hash['path', 'path/to/file.name'] }
|
6
6
|
let(:data_path_name) { data_path.merge!(data_name) }
|
@@ -10,19 +10,19 @@ describe XCodeProject::FileNode do
|
|
10
10
|
context "if the name is initialized " do
|
11
11
|
it "returns the name as is" do
|
12
12
|
[data_name, data_path_name].each do |data|
|
13
|
-
|
13
|
+
XcodeProject::FileNode.new(stub, stub, data).name.should eql(data['name'])
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
17
|
context "if the name isn't initialized" do
|
18
18
|
context "and the path is initialized " do
|
19
19
|
it "returns the name as basename of the path" do
|
20
|
-
|
20
|
+
XcodeProject::FileNode.new(stub, stub, data_path).name.should eql(File.basename(data_path['path']))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
context "and the path isn't initialized" do
|
24
24
|
it "returns nil" do
|
25
|
-
|
25
|
+
XcodeProject::FileNode.new(stub, stub, data_empty).name.should be_nil
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -32,13 +32,13 @@ describe XCodeProject::FileNode do
|
|
32
32
|
context "if the path is initialized " do
|
33
33
|
it "returns the path as is" do
|
34
34
|
[data_path, data_path_name].each do |data|
|
35
|
-
|
35
|
+
XcodeProject::FileNode.new(stub, stub, data_path).path.should eql(data['path'])
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
39
|
context "if the path isn't initialized" do
|
40
40
|
it "returns nil" do
|
41
|
-
|
41
|
+
XcodeProject::FileNode.new(stub, stub, data_empty).path.should be_nil
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -58,7 +58,7 @@ describe XCodeProject::FileNode do
|
|
58
58
|
context "if the object is nested file node" do
|
59
59
|
it "returns the parent object" do
|
60
60
|
file_nodes_gpaths do |gpath|
|
61
|
-
main_group.child(gpath).parent.should be_an_instance_of(
|
61
|
+
main_group.child(gpath).parent.should be_an_instance_of(XcodeProject::PBXGroup)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::PBXBuildFile do
|
4
4
|
let(:root) { prepare_example_project.read.send(:root) }
|
5
5
|
let(:obj_file_ref) { root.project.main_group.file_ref("group1a/file2c.m") }
|
6
6
|
let(:obj) { root.project.target('example').sources_build_phase.send(:build_file, obj_file_ref.uuid) }
|
7
7
|
|
8
8
|
describe "#file_ref" do
|
9
9
|
it "returns the object" do
|
10
|
-
obj.file_ref.should be_an_instance_of(
|
10
|
+
obj.file_ref.should be_an_instance_of(XcodeProject::PBXFileReference)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::PBXFileReference do
|
4
4
|
let(:root) { prepare_example_project.read.send(:root) }
|
5
5
|
let(:obj_gpath) { "group1a/file2c.m" }
|
6
6
|
let(:obj) { root.project.main_group.file_ref(obj_gpath) }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::PBXGroup do
|
4
4
|
let(:root) { prepare_example_project.read.send(:root) }
|
5
5
|
let(:obj) { root.project.main_group.group('group1a') }
|
6
6
|
|
@@ -21,6 +21,50 @@ describe XCodeProject::PBXGroup do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
describe "#files" do
|
25
|
+
context "if children exists" do
|
26
|
+
it "Returns an array of only those children who are files" do
|
27
|
+
chs = obj.files
|
28
|
+
chs.should be_an_instance_of(Array)
|
29
|
+
chs.size.should > 0
|
30
|
+
chs.each do |child|
|
31
|
+
child.should be_an_instance_of(XcodeProject::PBXFileReference)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
context "if children doesn't exist" do
|
36
|
+
let(:obj) { root.project.main_group.group("group1a/dir2c") }
|
37
|
+
|
38
|
+
it "returns an empty array" do
|
39
|
+
chs = obj.files
|
40
|
+
chs.should be_an_instance_of(Array)
|
41
|
+
chs.size.should eql(0)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#groups" do
|
47
|
+
context "if children exists" do
|
48
|
+
it "Returns an array of only those children who are group" do
|
49
|
+
chs = obj.groups
|
50
|
+
chs.should be_an_instance_of(Array)
|
51
|
+
chs.size.should > 0
|
52
|
+
chs.each do |child|
|
53
|
+
child.should be_an_instance_of(XcodeProject::PBXGroup)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
context "if children doesn't exist" do
|
58
|
+
let(:obj) { root.project.main_group.group("group1a/dir2c/dir3a/dir4a") }
|
59
|
+
|
60
|
+
it "returns an empty array" do
|
61
|
+
chs = obj.groups
|
62
|
+
chs.should be_an_instance_of(Array)
|
63
|
+
chs.size.should eql(0)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
24
68
|
describe "#child" do
|
25
69
|
context "if passed '.'" do
|
26
70
|
it "returns the self" do
|
@@ -101,7 +145,7 @@ describe XCodeProject::PBXGroup do
|
|
101
145
|
describe "#group" do
|
102
146
|
context "if the group exists" do
|
103
147
|
it "returns the object" do
|
104
|
-
obj.group('group2a').should be_an_instance_of(
|
148
|
+
obj.group('group2a').should be_an_instance_of(XcodeProject::PBXGroup)
|
105
149
|
end
|
106
150
|
end
|
107
151
|
context "if the group doesn't exist" do
|
@@ -114,7 +158,7 @@ describe XCodeProject::PBXGroup do
|
|
114
158
|
describe "#file_ref" do
|
115
159
|
context "if the file reference exists" do
|
116
160
|
it "returns the object" do
|
117
|
-
obj.file_ref('file2c.m').should be_an_instance_of(
|
161
|
+
obj.file_ref('file2c.m').should be_an_instance_of(XcodeProject::PBXFileReference)
|
118
162
|
end
|
119
163
|
end
|
120
164
|
context "if the file reference doesn't exist" do
|
@@ -127,12 +171,12 @@ describe XCodeProject::PBXGroup do
|
|
127
171
|
describe "#add_file_ref" do
|
128
172
|
context "if passed the relative path" do
|
129
173
|
it "adds the file reference, returns the object" do
|
130
|
-
obj.send(:add_file_ref, 'dir1b/file2b.m').should be_an_instance_of(
|
174
|
+
obj.send(:add_file_ref, 'dir1b/file2b.m').should be_an_instance_of(XcodeProject::PBXFileReference)
|
131
175
|
end
|
132
176
|
end
|
133
177
|
context "if passed the absolute path" do
|
134
178
|
it "adds the file reference, returns the object" do
|
135
|
-
obj.send(:add_file_ref, "#{example_project_dir}/dir1b/file2b.m").should be_an_instance_of(
|
179
|
+
obj.send(:add_file_ref, "#{example_project_dir}/dir1b/file2b.m").should be_an_instance_of(XcodeProject::PBXFileReference)
|
136
180
|
end
|
137
181
|
end
|
138
182
|
context "if file reference already exists" do
|
@@ -143,7 +187,7 @@ describe XCodeProject::PBXGroup do
|
|
143
187
|
end
|
144
188
|
context "if file doesn't exit" do
|
145
189
|
it "raise an exception " do
|
146
|
-
lambda { obj.send(:add_file_ref, "file2c_ghost.m") }.should raise_exception(
|
190
|
+
lambda { obj.send(:add_file_ref, "file2c_ghost.m") }.should raise_exception(XcodeProject::FilePathError)
|
147
191
|
end
|
148
192
|
end
|
149
193
|
end
|
@@ -151,7 +195,7 @@ describe XCodeProject::PBXGroup do
|
|
151
195
|
describe "#add_group" do
|
152
196
|
it "adds the group, returns the object" do
|
153
197
|
group_obj = obj.add_group("group2a_ghost")
|
154
|
-
group_obj.should be_an_instance_of(
|
198
|
+
group_obj.should be_an_instance_of(XcodeProject::PBXGroup)
|
155
199
|
group_obj.group?.should eql(true)
|
156
200
|
end
|
157
201
|
end
|
@@ -159,7 +203,7 @@ describe XCodeProject::PBXGroup do
|
|
159
203
|
describe "#add_dir" do
|
160
204
|
it "adds the group, returns the object" do
|
161
205
|
group_obj = obj.add_dir("dir1c")
|
162
|
-
group_obj.should be_an_instance_of(
|
206
|
+
group_obj.should be_an_instance_of(XcodeProject::PBXGroup)
|
163
207
|
group_obj.dir?.should eql(true)
|
164
208
|
end
|
165
209
|
it "adds all dir's children" do
|
@@ -172,7 +216,7 @@ describe XCodeProject::PBXGroup do
|
|
172
216
|
end
|
173
217
|
context "if dir doesn't exit" do
|
174
218
|
it "raise an exception " do
|
175
|
-
lambda { obj.add_dir("dir2c_ghost") }.should raise_exception(
|
219
|
+
lambda { obj.add_dir("dir2c_ghost") }.should raise_exception(XcodeProject::FilePathError)
|
176
220
|
end
|
177
221
|
end
|
178
222
|
end
|
@@ -180,7 +224,7 @@ describe XCodeProject::PBXGroup do
|
|
180
224
|
describe "#create_group" do
|
181
225
|
context "if passed a group name" do
|
182
226
|
it "creates and returns the group object" do
|
183
|
-
obj.create_group('group2a_ghost').should be_an_instance_of(
|
227
|
+
obj.create_group('group2a_ghost').should be_an_instance_of(XcodeProject::PBXGroup)
|
184
228
|
end
|
185
229
|
end
|
186
230
|
context "if passed a group path" do
|
@@ -190,7 +234,7 @@ describe XCodeProject::PBXGroup do
|
|
190
234
|
'group2a_ghost/group3a_ghost',
|
191
235
|
'group2a_ghost/../create_group2a_ghost/./group3a_ghost'
|
192
236
|
].each do |gpath|
|
193
|
-
obj.create_group(gpath).should be_an_instance_of(
|
237
|
+
obj.create_group(gpath).should be_an_instance_of(XcodeProject::PBXGroup)
|
194
238
|
end
|
195
239
|
end
|
196
240
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::PBXNativeTarget do
|
4
4
|
before(:each) { @data = prepare_example_project.read }
|
5
5
|
let(:obj) { obj = @data.target('example') }
|
6
6
|
|
@@ -30,7 +30,7 @@ describe XCodeProject::PBXNativeTarget do
|
|
30
30
|
|
31
31
|
describe "#build_configurations_list" do
|
32
32
|
it "returns the build configuration list object" do
|
33
|
-
obj.build_configurations_list.should be_an_instance_of(
|
33
|
+
obj.build_configurations_list.should be_an_instance_of(XcodeProject::XCConfigurationList)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::PBXProject do
|
4
4
|
before(:each) { @data = prepare_example_project.read }
|
5
5
|
let(:obj) { @data.project }
|
6
6
|
|
@@ -8,14 +8,14 @@ describe XCodeProject::PBXProject do
|
|
8
8
|
it "returns the array of target objects" do
|
9
9
|
targets = obj.targets
|
10
10
|
targets.should be_an_instance_of(Array)
|
11
|
-
targets.each {|obj| obj.should be_an_instance_of(
|
11
|
+
targets.each {|obj| obj.should be_an_instance_of(XcodeProject::PBXNativeTarget) }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "#target" do
|
16
16
|
context "if the target exists" do
|
17
17
|
it "returns the object" do
|
18
|
-
obj.target('example').should be_an_instance_of(
|
18
|
+
obj.target('example').should be_an_instance_of(XcodeProject::PBXNativeTarget)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
context "if the target doesn't exist" do
|
@@ -27,7 +27,7 @@ describe XCodeProject::PBXProject do
|
|
27
27
|
|
28
28
|
describe "#main_group" do
|
29
29
|
it "returns the main group object" do
|
30
|
-
obj.main_group.should be_an_instance_of(
|
30
|
+
obj.main_group.should be_an_instance_of(XcodeProject::PBXGroup)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::Project do
|
4
4
|
let(:proj) { prepare_example_project }
|
5
5
|
|
6
6
|
describe "#new" do
|
7
7
|
context "if the project file exists" do
|
8
8
|
it "constructs an project object" do
|
9
|
-
|
9
|
+
XcodeProject::Project.new(example_project_bundle_path).should be_an_instance_of(XcodeProject::Project)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
context "if the project file doesn't exist" do
|
14
14
|
let(:proj_ne) { "#{example_empty_sandbox_path}/ghost.xcodeproj" }
|
15
15
|
it "trows the exception" do
|
16
|
-
lambda {
|
16
|
+
lambda { XcodeProject::Project.new(proj_ne) }.should raise_exception(XcodeProject::FilePathError)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -33,7 +33,7 @@ describe XCodeProject::Project do
|
|
33
33
|
describe "#find_projs" do
|
34
34
|
context "if a path contains project files" do
|
35
35
|
it "returns an array of project objects" do
|
36
|
-
projs =
|
36
|
+
projs = XcodeProject::Project.find_projs(example_sandbox_path)
|
37
37
|
projs.size.should eql(1)
|
38
38
|
projs.first.bundle_path.should eql(proj.bundle_path)
|
39
39
|
end
|
@@ -41,7 +41,7 @@ describe XCodeProject::Project do
|
|
41
41
|
|
42
42
|
context "if a path doesn't contain project files" do
|
43
43
|
it "returns an empty array" do
|
44
|
-
projs =
|
44
|
+
projs = XcodeProject::Project.find_projs(example_empty_sandbox_path)
|
45
45
|
projs.size.should eql(0)
|
46
46
|
end
|
47
47
|
end
|
@@ -49,7 +49,7 @@ describe XCodeProject::Project do
|
|
49
49
|
|
50
50
|
describe "#read" do
|
51
51
|
it "returns the data object" do
|
52
|
-
proj.read.should be_an_instance_of(
|
52
|
+
proj.read.should be_an_instance_of(XcodeProject::Data)
|
53
53
|
end
|
54
54
|
|
55
55
|
it "reads the project file" do
|
@@ -71,7 +71,7 @@ describe XCodeProject::Project do
|
|
71
71
|
it "reads the file file and then writes it" do
|
72
72
|
proj_mock = mock.proxy(proj)
|
73
73
|
proj_mock.read
|
74
|
-
proj_mock.write(is_a(
|
74
|
+
proj_mock.write(is_a(XcodeProject::Data))
|
75
75
|
proj.change {|data| }
|
76
76
|
end
|
77
77
|
end
|
@@ -34,7 +34,7 @@ def prepare_example_project
|
|
34
34
|
%x{ rm -vr #{example_project_dir} }
|
35
35
|
%x{ cp -vr #{proj_source_dir} #{example_sandbox_path} }
|
36
36
|
|
37
|
-
|
37
|
+
XcodeProject::Project.new(example_project_bundle_path)
|
38
38
|
end
|
39
39
|
|
40
40
|
def example_sandbox_path; Pathname.new('/tmp/example_sandbox') end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe XcodeProject::XCConfigurationList do
|
4
4
|
before(:each) { @data = prepare_example_project.read }
|
5
5
|
let(:obj) { obj = @data.target('example').build_configurations_list }
|
6
6
|
|
@@ -8,7 +8,7 @@ describe XCodeProject::XCConfigurationList do
|
|
8
8
|
let(:name) { 'Release' }
|
9
9
|
|
10
10
|
it "returns build configuration object" do
|
11
|
-
obj.build_configuration(name).should be_an_instance_of(
|
11
|
+
obj.build_configuration(name).should be_an_instance_of(XcodeProject::XCBuildConfiguration)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/lib/xcodeproject/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.
|
1
|
+
module XcodeProject
|
2
|
+
VERSION = "0.2.3"
|
3
3
|
end
|
data/rakefile
CHANGED
data/xcodeproject.gemspec
CHANGED
@@ -3,9 +3,9 @@ require File.expand_path('../lib/xcodeproject/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = 'xcodeproject'
|
6
|
-
gem.version =
|
6
|
+
gem.version = XcodeProject::VERSION
|
7
7
|
gem.summary = 'Read, write and build xcode projects'
|
8
|
-
gem.description = '
|
8
|
+
gem.description = 'XcodeProject is Ruby API for working with Xcode project files'
|
9
9
|
gem.author = 'Andrey Nesterov'
|
10
10
|
gem.email = 'ae.nesterov@gmail.com'
|
11
11
|
gem.homepage = 'https://github.com/manifest/xcodeproject'
|
@@ -22,5 +22,7 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_runtime_dependency 'uuid', '~> 2.3'
|
23
23
|
gem.add_development_dependency 'rspec', '~> 2.10'
|
24
24
|
gem.add_development_dependency 'rr', '~> 1.0'
|
25
|
+
gem.add_development_dependency 'redcarpet', '~> 1.17'
|
26
|
+
gem.add_development_dependency 'yard', '~> 0.7'
|
25
27
|
end
|
26
28
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 2
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrey Nesterov
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-06-
|
17
|
+
date: 2012-06-14 00:00:00 +04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -69,7 +69,33 @@ dependencies:
|
|
69
69
|
version: "1.0"
|
70
70
|
type: :development
|
71
71
|
version_requirements: *id004
|
72
|
-
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: redcarpet
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 1
|
81
|
+
- 17
|
82
|
+
version: "1.17"
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id005
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: yard
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
- 7
|
95
|
+
version: "0.7"
|
96
|
+
type: :development
|
97
|
+
version_requirements: *id006
|
98
|
+
description: XcodeProject is Ruby API for working with Xcode project files
|
73
99
|
email: ae.nesterov@gmail.com
|
74
100
|
executables: []
|
75
101
|
|
@@ -79,11 +105,13 @@ extra_rdoc_files: []
|
|
79
105
|
|
80
106
|
files:
|
81
107
|
- .gitignore
|
108
|
+
- .yardopts
|
82
109
|
- Gemfile
|
83
110
|
- LICENSE
|
84
111
|
- README.md
|
85
112
|
- lib/xcodeproject.rb
|
86
113
|
- lib/xcodeproject/build_phase_node.rb
|
114
|
+
- lib/xcodeproject/builder.rb
|
87
115
|
- lib/xcodeproject/data.rb
|
88
116
|
- lib/xcodeproject/exceptions.rb
|
89
117
|
- lib/xcodeproject/extend/array.rb
|