pbxproject 0.1.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/.document +5 -0
- data/.rspec +2 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +28 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/pbxproject +7 -0
- data/data.pbxproj +337 -0
- data/examples/project.pbxproj +337 -0
- data/examples/project.pbxproj.new +337 -0
- data/lib/pbxproject.rb +2 -0
- data/lib/pbxproject/cli.rb +22 -0
- data/lib/pbxproject/pbxproject.rb +258 -0
- data/lib/pbxproject/pbxtypes.rb +326 -0
- data/pbxproject.gemspec +73 -0
- data/spec/pbxproject_spec.rb +187 -0
- data/spec/spec_helper.rb +12 -0
- metadata +122 -0
data/pbxproject.gemspec
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{pbxproject}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Mikko Kokkonen"]
|
12
|
+
s.date = %q{2011-04-22}
|
13
|
+
s.default_executable = %q{pbxproject}
|
14
|
+
s.description = %q{makes managing XCode 4 project files as easy as modifying ruby classes.}
|
15
|
+
s.email = %q{mikko.kokkonen@me.com}
|
16
|
+
s.executables = ["pbxproject"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"bin/pbxproject",
|
31
|
+
"data.pbxproj",
|
32
|
+
"examples/project.pbxproj",
|
33
|
+
"examples/project.pbxproj.new",
|
34
|
+
"lib/pbxproject.rb",
|
35
|
+
"lib/pbxproject/cli.rb",
|
36
|
+
"lib/pbxproject/pbxproject.rb",
|
37
|
+
"lib/pbxproject/pbxtypes.rb",
|
38
|
+
"pbxproject.gemspec",
|
39
|
+
"spec/pbxproject_spec.rb",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
42
|
+
s.homepage = %q{http://github.com/mikian/pbxproject}
|
43
|
+
s.licenses = ["MIT"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.6.2}
|
46
|
+
s.summary = %q{XCode 4 project management}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/pbxproject_spec.rb",
|
49
|
+
"spec/spec_helper.rb"
|
50
|
+
]
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
s.specification_version = 3
|
54
|
+
|
55
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
57
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
59
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
64
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
65
|
+
end
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
70
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "initialization" do
|
4
|
+
it "should fail while initializing with non-existing file" do
|
5
|
+
lambda{PBXProject::PBXProject.new :file => 'nonsense'}.should raise_error
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have ready state when initializing done" do
|
9
|
+
pbx = PBXProject::PBXProject.new :file => 'examples/project.pbxproj'
|
10
|
+
pbx.state.should == :ready
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "parsing" do
|
15
|
+
before :each do
|
16
|
+
@pbx = PBXProject::PBXProject.new :file => 'examples/project.pbxproj'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be succesful" do
|
20
|
+
@pbx.parse.should eql true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return all required sections" do
|
24
|
+
@pbx.parse.should eql true
|
25
|
+
@pbx.sections.keys.should eql ["PBXBuildFile", "PBXFileReference", "PBXFrameworksBuildPhase",
|
26
|
+
"PBXGroup", "PBXNativeTarget", "PBXProject", "PBXResourcesBuildPhase",
|
27
|
+
"PBXShellScriptBuildPhase", "PBXSourcesBuildPhase", "PBXVariantGroup",
|
28
|
+
"XCBuildConfiguration", "XCConfigurationList"]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "finding" do
|
33
|
+
before :each do
|
34
|
+
@pbx = PBXProject::PBXProject.new :file => 'examples/project.pbxproj'
|
35
|
+
@pbx.parse
|
36
|
+
end
|
37
|
+
|
38
|
+
it "target 'Foo'" do
|
39
|
+
target = @pbx.find_item :name => 'Foo', :type => PBXProject::PBXTypes::PBXNativeTarget
|
40
|
+
target.name.value.should eql 'Foo'
|
41
|
+
end
|
42
|
+
|
43
|
+
it "group 'iPhone'" do
|
44
|
+
group = @pbx.find_item :name => 'iPhone', :type => PBXProject::PBXTypes::PBXGroup
|
45
|
+
group.guid.should eql 'C0D293B4135FD66F001979A0'
|
46
|
+
group.name.value.should eql 'iPhone'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "shellScript" do
|
50
|
+
script = @pbx.find_item :guid => 'C0D293C7135FD6D7001979A0', :type => PBXProject::PBXTypes::PBXShellScriptBuildPhase
|
51
|
+
script.shellScript.value.should eql '"rake build:prepare"'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "adding" do
|
56
|
+
before :each do
|
57
|
+
@pbx = PBXProject::PBXProject.new :file => 'examples/project.pbxproj'
|
58
|
+
@pbx.parse
|
59
|
+
end
|
60
|
+
|
61
|
+
it "shellScript" do
|
62
|
+
# Create shellScript
|
63
|
+
shellScript = PBXProject::PBXTypes::PBXShellScriptBuildPhase.new :shellPath => "/bin/sh",
|
64
|
+
:shellScript => '"(cd $PROJECT_DIR; rake build:prepare)"'
|
65
|
+
|
66
|
+
@pbx.add_item(shellScript).should eql shellScript.guid
|
67
|
+
end
|
68
|
+
|
69
|
+
it "shellScript to target 'Foo'" do
|
70
|
+
# Create shellScript
|
71
|
+
shellScript = PBXProject::PBXTypes::PBXShellScriptBuildPhase.new :shellPath => "/bin/sh",
|
72
|
+
:shellScript => '"(cd $PROJECT_DIR; rake build:prepare)"'
|
73
|
+
|
74
|
+
@pbx.add_item(shellScript).should eql shellScript.guid
|
75
|
+
|
76
|
+
# get our target
|
77
|
+
target = @pbx.find_item :name => 'Foo', :type => PBXProject::PBXTypes::PBXNativeTarget
|
78
|
+
target.name.value.should eql 'Foo'
|
79
|
+
|
80
|
+
# and add it to target
|
81
|
+
target.add_build_phase(shellScript)
|
82
|
+
target.buildPhases.count.should be 5
|
83
|
+
end
|
84
|
+
|
85
|
+
it "source library to target 'Foo'" do
|
86
|
+
# Add source files
|
87
|
+
files = [['Action.m', 'lib/foo'], ['Action.h', 'lib/foo']]
|
88
|
+
fileref = []
|
89
|
+
|
90
|
+
files.each do |f|
|
91
|
+
fileref.push PBXProject::PBXTypes::PBXFileReference.new(:name => f[0], :path => f[1], :sourceTree => '<group>')
|
92
|
+
@pbx.add_item(fileref.last).should eql fileref.last.guid
|
93
|
+
end
|
94
|
+
|
95
|
+
buildfiles = []
|
96
|
+
fileref.each do |f|
|
97
|
+
# Add build files
|
98
|
+
buildfiles.push PBXProject::PBXTypes::PBXBuildFile.new(:comment => f.name.value, :fileRef => f.guid)
|
99
|
+
@pbx.add_item(buildfiles.last).should eql buildfiles.last.guid
|
100
|
+
|
101
|
+
# Add fileref to group
|
102
|
+
group = @pbx.find_item :comment => 'Foo', :type => PBXProject::PBXTypes::PBXGroup
|
103
|
+
group.add_children(f)
|
104
|
+
end
|
105
|
+
|
106
|
+
@pbx.sections['PBXGroup'].each do |g|
|
107
|
+
# puts g.to_pbx
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "PBX format" do
|
113
|
+
before :all do
|
114
|
+
@expected = []
|
115
|
+
File.open('examples/project.pbxproj', 'r').each_line do |line|
|
116
|
+
@expected.push line
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
before :each do
|
121
|
+
@pbx = PBXProject::PBXProject.new :file => 'examples/project.pbxproj'
|
122
|
+
@pbx.parse
|
123
|
+
end
|
124
|
+
|
125
|
+
it "PBXBuildFile" do
|
126
|
+
@pbx.sections['PBXBuildFile'].first.to_pbx(2).should == @expected[9]
|
127
|
+
end
|
128
|
+
|
129
|
+
it "PBXFileReference" do
|
130
|
+
@pbx.sections['PBXFileReference'].first.to_pbx(2).should == @expected[22]
|
131
|
+
end
|
132
|
+
|
133
|
+
it "PBXFrameworksBuildPhase" do
|
134
|
+
pbx = @pbx.sections['PBXFrameworksBuildPhase'].first.to_pbx(2)
|
135
|
+
pbx.should == @expected[41..50].join("")
|
136
|
+
end
|
137
|
+
|
138
|
+
it "PBXGroup" do
|
139
|
+
pbx = @pbx.sections['PBXGroup'].first.to_pbx(2)
|
140
|
+
pbx.should == @expected[54..62].join("")
|
141
|
+
end
|
142
|
+
|
143
|
+
it "PBXNativeTarget" do
|
144
|
+
pbx = @pbx.sections['PBXNativeTarget'].first.to_pbx(2)
|
145
|
+
pbx.should == @expected[127..144].join("")
|
146
|
+
end
|
147
|
+
|
148
|
+
it "PBXProject" do
|
149
|
+
pbx = @pbx.sections['PBXProject'].first.to_pbx(2)
|
150
|
+
pbx.should == @expected[148..167].join("")
|
151
|
+
end
|
152
|
+
|
153
|
+
it "PBXResourcesBuildPhase" do
|
154
|
+
pbx = @pbx.sections['PBXResourcesBuildPhase'].first.to_pbx(2)
|
155
|
+
pbx.should == @expected[171..180].join("")
|
156
|
+
end
|
157
|
+
|
158
|
+
it "PBXShellScriptBuildPhase" do
|
159
|
+
pbx = @pbx.sections['PBXShellScriptBuildPhase'].first.to_pbx(2)
|
160
|
+
pbx.should == @expected[184..197].join("")
|
161
|
+
end
|
162
|
+
|
163
|
+
it "PBXSourcesBuildPhase" do
|
164
|
+
pbx = @pbx.sections['PBXSourcesBuildPhase'].first.to_pbx(2)
|
165
|
+
pbx.should == @expected[201..211].join("")
|
166
|
+
end
|
167
|
+
|
168
|
+
it "PBXVariantGroup" do
|
169
|
+
pbx = @pbx.sections['PBXVariantGroup'].first.to_pbx(2)
|
170
|
+
pbx.should == @expected[215..222].join("")
|
171
|
+
end
|
172
|
+
|
173
|
+
it "XCBuildConfiguration" do
|
174
|
+
pbx = @pbx.sections['XCBuildConfiguration'].first.to_pbx(2)
|
175
|
+
pbx.should == @expected[242..268].join("")
|
176
|
+
end
|
177
|
+
|
178
|
+
it "XCConfigurationList" do
|
179
|
+
pbx = @pbx.sections['XCConfigurationList'].first.to_pbx(2)
|
180
|
+
pbx.should == @expected[316..324].join("")
|
181
|
+
end
|
182
|
+
|
183
|
+
it "PBXProject" do
|
184
|
+
pbx = @pbx.to_pbx
|
185
|
+
# pbx.should == @expected.join("")
|
186
|
+
end
|
187
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'pbxproject'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pbxproject
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mikko Kokkonen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-22 00:00:00 +09:00
|
14
|
+
default_executable: pbxproject
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.0
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.0.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: jeweler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.2
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rcov
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
description: makes managing XCode 4 project files as easy as modifying ruby classes.
|
61
|
+
email: mikko.kokkonen@me.com
|
62
|
+
executables:
|
63
|
+
- pbxproject
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files:
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.rdoc
|
69
|
+
files:
|
70
|
+
- .document
|
71
|
+
- .rspec
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.rdoc
|
76
|
+
- Rakefile
|
77
|
+
- VERSION
|
78
|
+
- bin/pbxproject
|
79
|
+
- data.pbxproj
|
80
|
+
- examples/project.pbxproj
|
81
|
+
- examples/project.pbxproj.new
|
82
|
+
- lib/pbxproject.rb
|
83
|
+
- lib/pbxproject/cli.rb
|
84
|
+
- lib/pbxproject/pbxproject.rb
|
85
|
+
- lib/pbxproject/pbxtypes.rb
|
86
|
+
- pbxproject.gemspec
|
87
|
+
- spec/pbxproject_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
has_rdoc: true
|
90
|
+
homepage: http://github.com/mikian/pbxproject
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: -1983683403285540798
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: "0"
|
113
|
+
requirements: []
|
114
|
+
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.6.2
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: XCode 4 project management
|
120
|
+
test_files:
|
121
|
+
- spec/pbxproject_spec.rb
|
122
|
+
- spec/spec_helper.rb
|