zerg_xcode 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.project +17 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +30 -0
- data/Rakefile +50 -23
- data/VERSION +1 -0
- data/lib/zerg_xcode/file_format/archiver.rb +0 -24
- data/lib/zerg_xcode/file_format/id_generator.rb +30 -0
- data/lib/zerg_xcode/file_format/lexer.rb +113 -56
- data/lib/zerg_xcode/file_format/parser.rb +28 -34
- data/lib/zerg_xcode/file_format/scan_buffer.rb +46 -0
- data/lib/zerg_xcode/objects/pbx_project.rb +1 -1
- data/lib/zerg_xcode/objects/xcode_object.rb +2 -1
- data/lib/zerg_xcode/{file_format/paths.rb → paths.rb} +5 -6
- data/lib/zerg_xcode/shortcuts.rb +2 -2
- data/lib/zerg_xcode.rb +7 -1
- data/spec/archiver_spec.rb +83 -0
- data/spec/builder/runner_spec.rb +27 -0
- data/spec/builder/sdk_spec.rb +11 -0
- data/spec/encoder_spec.rb +17 -0
- data/{test → spec}/fixtures/ClosedLib/ClosedLib.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/fixtures/ClosedLib/ClosedLib_Prefix.pch +0 -0
- data/{test → spec}/fixtures/ClosedLib/ClosedNative.c +0 -0
- data/{test → spec}/fixtures/ClosedLib/ClosedNative.h +0 -0
- data/{test → spec}/fixtures/FlatTestApp/FlatTestApp.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/fixtures/TestApp/TestApp.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/fixtures/TestApp30.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/fixtures/TestLib30.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/fixtures/ZergSupport.xcodeproj/project.pbxproj +0 -0
- data/{test → spec}/fixtures/project.pbxproj +0 -0
- data/{test → spec}/fixtures/project.pbxproj.compat +0 -0
- data/spec/id_generator_spec.rb +38 -0
- data/spec/lexer_spec.rb +111 -0
- data/spec/parser_spec.rb +34 -0
- data/spec/paths_spec.rb +75 -0
- data/spec/shortcuts_spec.rb +24 -0
- data/test/objects/pbx_build_file_test.rb +3 -3
- data/test/objects/pbx_build_phase_test.rb +1 -1
- data/test/objects/pbx_container_item_proxy_test.rb +1 -1
- data/test/objects/pbx_group_test.rb +1 -1
- data/test/objects/pbx_native_target_test.rb +2 -2
- data/test/objects/pbx_project_test.rb +9 -9
- data/test/objects/pbx_target_dependency_test.rb +1 -1
- data/test/objects/xc_configuration_list_test.rb +1 -1
- data/test/plugins/addlibrary_test.rb +2 -2
- data/test/plugins/core/core_test.rb +1 -1
- data/test/plugins/import_test.rb +71 -71
- data/test/plugins/irb_test.rb +3 -3
- data/test/plugins/ls_test.rb +3 -3
- data/test/plugins/lstargets_test.rb +3 -3
- data/test/plugins/retarget_test.rb +2 -2
- data/zerg_xcode.gemspec +112 -17
- metadata +115 -113
- data/test/builder/runner_test.rb +0 -35
- data/test/builder/sdk_test.rb +0 -17
- data/test/file_format/archiver_test.rb +0 -74
- data/test/file_format/encoder_test.rb +0 -15
- data/test/file_format/lexer_test.rb +0 -60
- data/test/file_format/parser_test.rb +0 -49
- data/test/file_format/path_test.rb +0 -47
- data/test/shortcuts_test.rb +0 -22
metadata
CHANGED
@@ -1,71 +1,101 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: zerg_xcode
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Victor Costan
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
date: 2012-01-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &70360439882840 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70360439882840
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
requirement: &70360439895920 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.6.4
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70360439895920
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rcov
|
38
|
+
requirement: &70360439892000 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70360439892000
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &70360439948260 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.7.0
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70360439948260
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: flexmock
|
60
|
+
requirement: &70360439945920 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70360439945920
|
69
|
+
description:
|
17
70
|
email: victor@zergling.net
|
18
|
-
executables:
|
71
|
+
executables:
|
19
72
|
- zerg-xcode
|
20
73
|
extensions: []
|
21
|
-
|
22
|
-
extra_rdoc_files:
|
23
|
-
- CHANGELOG
|
74
|
+
extra_rdoc_files:
|
24
75
|
- LICENSE
|
25
76
|
- README.textile
|
26
|
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
- lib/zerg_xcode/builder/sdks.rb
|
30
|
-
- lib/zerg_xcode/file_format/archiver.rb
|
31
|
-
- lib/zerg_xcode/file_format/encoder.rb
|
32
|
-
- lib/zerg_xcode/file_format/lexer.rb
|
33
|
-
- lib/zerg_xcode/file_format/parser.rb
|
34
|
-
- lib/zerg_xcode/file_format/paths.rb
|
35
|
-
- lib/zerg_xcode/objects/pbx_build_file.rb
|
36
|
-
- lib/zerg_xcode/objects/pbx_build_phase.rb
|
37
|
-
- lib/zerg_xcode/objects/pbx_container_item_proxy.rb
|
38
|
-
- lib/zerg_xcode/objects/pbx_group.rb
|
39
|
-
- lib/zerg_xcode/objects/pbx_native_target.rb
|
40
|
-
- lib/zerg_xcode/objects/pbx_project.rb
|
41
|
-
- lib/zerg_xcode/objects/pbx_target_dependency.rb
|
42
|
-
- lib/zerg_xcode/objects/xc_configuration_list.rb
|
43
|
-
- lib/zerg_xcode/objects/xcode_object.rb
|
44
|
-
- lib/zerg_xcode/plugins/addlibrary.rb
|
45
|
-
- lib/zerg_xcode/plugins/core/core.rb
|
46
|
-
- lib/zerg_xcode/plugins/help.rb
|
47
|
-
- lib/zerg_xcode/plugins/import.rb
|
48
|
-
- lib/zerg_xcode/plugins/irb.rb
|
49
|
-
- lib/zerg_xcode/plugins/ls.rb
|
50
|
-
- lib/zerg_xcode/plugins/lstargets.rb
|
51
|
-
- lib/zerg_xcode/plugins/retarget.rb
|
52
|
-
- lib/zerg_xcode/shortcuts.rb
|
53
|
-
files:
|
77
|
+
files:
|
78
|
+
- .document
|
79
|
+
- .project
|
54
80
|
- CHANGELOG
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
55
83
|
- LICENSE
|
56
84
|
- Manifest
|
57
85
|
- README.textile
|
58
86
|
- RUBYFORGE
|
59
87
|
- Rakefile
|
88
|
+
- VERSION
|
60
89
|
- bin/zerg-xcode
|
61
90
|
- lib/zerg_xcode.rb
|
62
91
|
- lib/zerg_xcode/builder/runner.rb
|
63
92
|
- lib/zerg_xcode/builder/sdks.rb
|
64
93
|
- lib/zerg_xcode/file_format/archiver.rb
|
65
94
|
- lib/zerg_xcode/file_format/encoder.rb
|
95
|
+
- lib/zerg_xcode/file_format/id_generator.rb
|
66
96
|
- lib/zerg_xcode/file_format/lexer.rb
|
67
97
|
- lib/zerg_xcode/file_format/parser.rb
|
68
|
-
- lib/zerg_xcode/file_format/
|
98
|
+
- lib/zerg_xcode/file_format/scan_buffer.rb
|
69
99
|
- lib/zerg_xcode/objects/pbx_build_file.rb
|
70
100
|
- lib/zerg_xcode/objects/pbx_build_phase.rb
|
71
101
|
- lib/zerg_xcode/objects/pbx_container_item_proxy.rb
|
@@ -75,6 +105,7 @@ files:
|
|
75
105
|
- lib/zerg_xcode/objects/pbx_target_dependency.rb
|
76
106
|
- lib/zerg_xcode/objects/xc_configuration_list.rb
|
77
107
|
- lib/zerg_xcode/objects/xcode_object.rb
|
108
|
+
- lib/zerg_xcode/paths.rb
|
78
109
|
- lib/zerg_xcode/plugins/addlibrary.rb
|
79
110
|
- lib/zerg_xcode/plugins/core/core.rb
|
80
111
|
- lib/zerg_xcode/plugins/help.rb
|
@@ -84,24 +115,26 @@ files:
|
|
84
115
|
- lib/zerg_xcode/plugins/lstargets.rb
|
85
116
|
- lib/zerg_xcode/plugins/retarget.rb
|
86
117
|
- lib/zerg_xcode/shortcuts.rb
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
118
|
+
- spec/archiver_spec.rb
|
119
|
+
- spec/builder/runner_spec.rb
|
120
|
+
- spec/builder/sdk_spec.rb
|
121
|
+
- spec/encoder_spec.rb
|
122
|
+
- spec/fixtures/ClosedLib/ClosedLib.xcodeproj/project.pbxproj
|
123
|
+
- spec/fixtures/ClosedLib/ClosedLib_Prefix.pch
|
124
|
+
- spec/fixtures/ClosedLib/ClosedNative.c
|
125
|
+
- spec/fixtures/ClosedLib/ClosedNative.h
|
126
|
+
- spec/fixtures/FlatTestApp/FlatTestApp.xcodeproj/project.pbxproj
|
127
|
+
- spec/fixtures/TestApp/TestApp.xcodeproj/project.pbxproj
|
128
|
+
- spec/fixtures/TestApp30.xcodeproj/project.pbxproj
|
129
|
+
- spec/fixtures/TestLib30.xcodeproj/project.pbxproj
|
130
|
+
- spec/fixtures/ZergSupport.xcodeproj/project.pbxproj
|
131
|
+
- spec/fixtures/project.pbxproj
|
132
|
+
- spec/fixtures/project.pbxproj.compat
|
133
|
+
- spec/id_generator_spec.rb
|
134
|
+
- spec/lexer_spec.rb
|
135
|
+
- spec/parser_spec.rb
|
136
|
+
- spec/paths_spec.rb
|
137
|
+
- spec/shortcuts_spec.rb
|
105
138
|
- test/objects/pbx_build_file_test.rb
|
106
139
|
- test/objects/pbx_build_phase_test.rb
|
107
140
|
- test/objects/pbx_container_item_proxy_test.rb
|
@@ -119,63 +152,32 @@ files:
|
|
119
152
|
- test/plugins/ls_test.rb
|
120
153
|
- test/plugins/lstargets_test.rb
|
121
154
|
- test/plugins/retarget_test.rb
|
122
|
-
- test/shortcuts_test.rb
|
123
155
|
- zerg_xcode.gemspec
|
124
|
-
|
125
|
-
homepage: http://www.zergling.net/
|
156
|
+
homepage: http://github.com/zerglings/zerg_xcode
|
126
157
|
licenses: []
|
127
|
-
|
128
158
|
post_install_message:
|
129
|
-
rdoc_options:
|
130
|
-
|
131
|
-
- --inline-source
|
132
|
-
- --title
|
133
|
-
- Zerg_xcode
|
134
|
-
- --main
|
135
|
-
- README.textile
|
136
|
-
require_paths:
|
159
|
+
rdoc_options: []
|
160
|
+
require_paths:
|
137
161
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
segments:
|
169
|
+
- 0
|
170
|
+
hash: -3299336587567125592
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ! '>='
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
150
177
|
requirements: []
|
151
|
-
|
152
|
-
|
153
|
-
rubygems_version: 1.3.5
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 1.8.10
|
154
180
|
signing_key:
|
155
181
|
specification_version: 3
|
156
182
|
summary: Automated modifications for Xcode project files
|
157
|
-
test_files:
|
158
|
-
- test/builder/runner_test.rb
|
159
|
-
- test/builder/sdk_test.rb
|
160
|
-
- test/file_format/archiver_test.rb
|
161
|
-
- test/file_format/encoder_test.rb
|
162
|
-
- test/file_format/lexer_test.rb
|
163
|
-
- test/file_format/parser_test.rb
|
164
|
-
- test/file_format/path_test.rb
|
165
|
-
- test/objects/pbx_build_file_test.rb
|
166
|
-
- test/objects/pbx_build_phase_test.rb
|
167
|
-
- test/objects/pbx_container_item_proxy_test.rb
|
168
|
-
- test/objects/pbx_group_test.rb
|
169
|
-
- test/objects/pbx_native_target_test.rb
|
170
|
-
- test/objects/pbx_project_test.rb
|
171
|
-
- test/objects/pbx_target_dependency_test.rb
|
172
|
-
- test/objects/xc_configuration_list_test.rb
|
173
|
-
- test/objects/xcode_object_test.rb
|
174
|
-
- test/plugins/addlibrary_test.rb
|
175
|
-
- test/plugins/core/core_test.rb
|
176
|
-
- test/plugins/import_test.rb
|
177
|
-
- test/plugins/irb_test.rb
|
178
|
-
- test/plugins/ls_test.rb
|
179
|
-
- test/plugins/lstargets_test.rb
|
180
|
-
- test/plugins/retarget_test.rb
|
181
|
-
- test/shortcuts_test.rb
|
183
|
+
test_files: []
|
data/test/builder/runner_test.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class RunnerTest < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@project = ZergXcode.load 'test/fixtures/ClosedLib'
|
11
|
-
@configuration = 'Release'
|
12
|
-
@sdk = ZergXcode::Builder::Sdk.all.
|
13
|
-
select { |s| /iPhone .* 3\.0$/ =~ s[:name] }.first
|
14
|
-
@golden_build_path = 'test/fixtures/ClosedLib/build/Release-iphoneos'
|
15
|
-
@product = @golden_build_path + '/libClosedLib.a'
|
16
|
-
end
|
17
|
-
|
18
|
-
def teardown
|
19
|
-
ZergXcode::Builder::Runner.clean @project, @sdk, @configuration
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_clean_build_clean
|
23
|
-
assert ZergXcode::Builder::Runner.clean(@project, @sdk, @configuration),
|
24
|
-
'Initial clean failed'
|
25
|
-
|
26
|
-
build_path = ZergXcode::Builder::Runner.build @project, @sdk, @configuration
|
27
|
-
assert build_path, 'Build failed'
|
28
|
-
assert_equal @golden_build_path, build_path, 'Build returned incorrect path'
|
29
|
-
assert File.exist?(@product), 'Build product not found'
|
30
|
-
|
31
|
-
assert ZergXcode::Builder::Runner.clean(@project, @sdk, @configuration),
|
32
|
-
'Post-build clean failed'
|
33
|
-
assert !File.exist?(@product), 'Build product not removed by clean'
|
34
|
-
end
|
35
|
-
end
|
data/test/builder/sdk_test.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class SdkTest < Test::Unit::TestCase
|
9
|
-
def test_all
|
10
|
-
all_sdks = ZergXcode::Builder::Sdk.all
|
11
|
-
mac105 = { :group => 'Mac OS X SDKs', :name => 'Mac OS X 10.5',
|
12
|
-
:arg => 'macosx10.5' }
|
13
|
-
assert_operator all_sdks, :include?, mac105, 'MacOS 10.5 SDK included'
|
14
|
-
|
15
|
-
assert_operator all_sdks, :equal?, all_sdks, 'SDKs are cached'
|
16
|
-
end
|
17
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class ArchiverTest < Test::Unit::TestCase
|
9
|
-
Parser = ZergXcode::Parser
|
10
|
-
Archiver = ZergXcode::Archiver
|
11
|
-
XcodeObject = ZergXcode::XcodeObject
|
12
|
-
|
13
|
-
def setup
|
14
|
-
@sub1 = XcodeObject.new :array => ['a', 'b', 'c'], :string => 's'
|
15
|
-
@sub1.archive_id = '39'
|
16
|
-
@sub2 = XcodeObject.new :hash => { :k => 'v', :k2 => 'v2' }, :sub1 => @sub1
|
17
|
-
@sub2.archive_id = '42'
|
18
|
-
@root = XcodeObject.new :sub1 => @sub1, :sub2 => @sub2
|
19
|
-
@root.archive_id = '49'
|
20
|
-
@root.version = 45
|
21
|
-
|
22
|
-
@archived = {
|
23
|
-
"archiveVersion" => '1',
|
24
|
-
"rootObject" => '49',
|
25
|
-
"classes" => {},
|
26
|
-
"objectVersion" => '45',
|
27
|
-
"objects" => {
|
28
|
-
"49" => { :sub1 => "39", :sub2 => "42" },
|
29
|
-
"39" => { :array => ["a", "b", "c"], :string => "s" },
|
30
|
-
"42" => { :hash => { :k => "v", :k2 => "v2" }, :sub1 => "39" }
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
@pbxdata = File.read 'test/fixtures/project.pbxproj'
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_archive_to_hash
|
38
|
-
hash = Archiver.archive_to_hash @root
|
39
|
-
assert_equal @archived, hash
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_unarchive_hash
|
43
|
-
root = Archiver.unarchive_hash @archived
|
44
|
-
assert_equal @sub1[:s], root[:sub1][:s]
|
45
|
-
assert_equal @sub1[:array], root[:sub1][:array]
|
46
|
-
assert_equal @sub2[:hash], root[:sub2][:hash]
|
47
|
-
assert_equal root[:sub1], root[:sub2][:sub1], 'Object graph split'
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_generator
|
51
|
-
generator = Archiver::IdGenerator.new
|
52
|
-
assert_equal '49', generator.id_for(@root)
|
53
|
-
assert_equal '42', generator.id_for(@sub2)
|
54
|
-
new_id = generator.id_for @root
|
55
|
-
assert '49' != new_id, 'Initial ID generated twice'
|
56
|
-
newer_id = generator.id_for @root
|
57
|
-
assert !['49', new_id].include?(newer_id), 'New ID generated twice'
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_archive_passthrough
|
61
|
-
golden_hash = Parser.parse @pbxdata
|
62
|
-
project = Archiver.unarchive @pbxdata
|
63
|
-
dupdata = Archiver.archive project
|
64
|
-
|
65
|
-
assert_equal golden_hash, Parser.parse(dupdata)
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_unarchive
|
69
|
-
project = Archiver.unarchive @pbxdata
|
70
|
-
|
71
|
-
assert_equal 'TestApp.app',
|
72
|
-
project['targets'][0]['productReference']['path']
|
73
|
-
end
|
74
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class EncoderTest < Test::Unit::TestCase
|
9
|
-
def test_encoder
|
10
|
-
pbxdata = File.read 'test/fixtures/project.pbxproj'
|
11
|
-
golden_encoded_proj = File.read 'test/fixtures/project.pbxproj.compat'
|
12
|
-
proj = ZergXcode::Parser.parse pbxdata
|
13
|
-
assert_equal golden_encoded_proj, ZergXcode::Encoder.encode(proj)
|
14
|
-
end
|
15
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class LexerTest < Test::Unit::TestCase
|
9
|
-
def test_lexer
|
10
|
-
pbxdata = File.read 'test/fixtures/project.pbxproj'
|
11
|
-
golden_starts = [[:encoding, "UTF8"],
|
12
|
-
:begin_hash,
|
13
|
-
[:symbol, "archiveVersion"], :assign, [:symbol, "1"],
|
14
|
-
:stop,
|
15
|
-
[:symbol, "classes"], :assign, :begin_hash, :end_hash,
|
16
|
-
:stop,
|
17
|
-
[:symbol, "objectVersion"], :assign, [:symbol, "45"],
|
18
|
-
:stop,
|
19
|
-
[:symbol, "objects"], :assign, :begin_hash,
|
20
|
-
[:symbol, "1D3623260D0F684500981E51"], :assign,
|
21
|
-
:begin_hash,
|
22
|
-
[:symbol, "isa"], :assign, [:symbol, "PBXBuildFile"],
|
23
|
-
:stop,
|
24
|
-
[:symbol, "fileRef"], :assign,
|
25
|
-
[:symbol, "1D3623250D0F684500981E51"],
|
26
|
-
:stop,
|
27
|
-
:end_hash,
|
28
|
-
:stop,
|
29
|
-
[:symbol, "1D60589B0D05DD56006BFB54"], :assign,
|
30
|
-
:begin_hash,
|
31
|
-
[:symbol, "isa"], :assign, [:symbol, "PBXBuildFile"],
|
32
|
-
:stop,
|
33
|
-
[:symbol, "fileRef"], :assign,
|
34
|
-
[:symbol, "29B97316FDCFA39411CA2CEA"],
|
35
|
-
:stop,
|
36
|
-
:end_hash,
|
37
|
-
:stop,
|
38
|
-
[:symbol, "1D60589F0D05DD5A006BFB54"], :assign,
|
39
|
-
:begin_hash,
|
40
|
-
[:symbol, "isa"], :assign, [:symbol, "PBXBuildFile"],
|
41
|
-
:stop,
|
42
|
-
[:symbol, "fileRef"], :assign,
|
43
|
-
[:symbol, "1D30AB110D05D00D00671497"],
|
44
|
-
:stop,
|
45
|
-
:end_hash,
|
46
|
-
:stop]
|
47
|
-
|
48
|
-
tokens = ZergXcode::Lexer.tokenize pbxdata
|
49
|
-
assert_equal golden_starts, tokens[0, golden_starts.length]
|
50
|
-
#p tokens.length
|
51
|
-
#p tokens[197, 50]
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_escaped_string
|
55
|
-
pbxdata = File.read 'test/fixtures/ZergSupport.xcodeproj/project.pbxproj'
|
56
|
-
tokens = ZergXcode::Lexer.tokenize pbxdata
|
57
|
-
assert tokens.include?([:string,
|
58
|
-
"\"$(SRCROOT)/build/Debug-iphonesimulator\""])
|
59
|
-
end
|
60
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class ParserTest < Test::Unit::TestCase
|
9
|
-
def test_parser
|
10
|
-
pbxdata = File.read 'test/fixtures/project.pbxproj'
|
11
|
-
proj = ZergXcode::Parser.parse pbxdata
|
12
|
-
|
13
|
-
assert proj.kind_of?(Hash), 'Project structure should be a hash'
|
14
|
-
assert_equal '1', proj['archiveVersion'], 'Archive version'
|
15
|
-
assert_equal '45', proj['objectVersion'], 'Object version'
|
16
|
-
assert_equal '29B97313FDCFA39411CA2CEA', proj['rootObject'], 'Root object'
|
17
|
-
|
18
|
-
golden_file_ref = {
|
19
|
-
'isa' => 'PBXBuildFile',
|
20
|
-
'fileRef' => '28AD733E0D9D9553002E5188'
|
21
|
-
}
|
22
|
-
assert_equal golden_file_ref, proj['objects']['28AD733F0D9D9553002E5188']
|
23
|
-
|
24
|
-
golden_file = {
|
25
|
-
'isa' => 'PBXFileReference',
|
26
|
-
'fileEncoding' => '4',
|
27
|
-
'lastKnownFileType' => 'sourcecode.c.h',
|
28
|
-
'path' => 'TestAppViewController.h',
|
29
|
-
'sourceTree' => "<group>"
|
30
|
-
}
|
31
|
-
assert_equal golden_file, proj['objects']['28D7ACF60DDB3853001CB0EB']
|
32
|
-
|
33
|
-
golden_config = {
|
34
|
-
'isa' => 'XCBuildConfiguration',
|
35
|
-
'buildSettings' => {
|
36
|
-
'ARCHS' => "$(ARCHS_STANDARD_32_BIT)",
|
37
|
-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" => "iPhone Developer",
|
38
|
-
'GCC_C_LANGUAGE_STANDARD' => 'c99',
|
39
|
-
'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES',
|
40
|
-
'GCC_WARN_UNUSED_VARIABLE' => 'YES',
|
41
|
-
'ONLY_ACTIVE_ARCH' => 'YES',
|
42
|
-
'PREBINDING' => 'NO',
|
43
|
-
'SDKROOT' => 'iphoneos2.2.1'
|
44
|
-
},
|
45
|
-
'name' => 'Debug'
|
46
|
-
}
|
47
|
-
assert_equal golden_config, proj['objects']['C01FCF4F08A954540054247B']
|
48
|
-
end
|
49
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class PathTest < Test::Unit::TestCase
|
9
|
-
Paths = ZergXcode::Paths
|
10
|
-
|
11
|
-
def test_project_file_at
|
12
|
-
assert_equal 'test/fixtures/ZergSupport.xcodeproj/project.pbxproj',
|
13
|
-
Paths.project_file_at('test/fixtures/ZergSupport'), 'short'
|
14
|
-
assert_equal 'test/fixtures/ZergSupport.xcodeproj/project.pbxproj',
|
15
|
-
Paths.project_file_at('test/fixtures/ZergSupport.xcodeproj'),
|
16
|
-
'full project name'
|
17
|
-
assert_equal 'test/fixtures/project.pbxproj',
|
18
|
-
Paths.project_file_at('test/fixtures'),
|
19
|
-
'enclosing dir with weird name'
|
20
|
-
assert_equal 'test/fixtures/project.pbxproj',
|
21
|
-
Paths.project_file_at('test'),
|
22
|
-
'subdir with weird name'
|
23
|
-
assert_equal 'test/fixtures/TestApp/TestApp.xcodeproj/project.pbxproj',
|
24
|
-
Paths.project_file_at('test/fixtures/TestApp'),
|
25
|
-
'project in subdir'
|
26
|
-
assert_equal 'test/fixtures/TestApp/TestApp.xcodeproj/project.pbxproj',
|
27
|
-
Paths.project_file_at('test/fixtures/TestApp/TestApp.xcodeproj'),
|
28
|
-
'full project name in subdir'
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_project_root_at
|
32
|
-
assert_equal 'test/fixtures',
|
33
|
-
Paths.project_root_at('test/fixtures/ZergSupport'),
|
34
|
-
'short project name'
|
35
|
-
assert_equal 'test/fixtures',
|
36
|
-
Paths.project_root_at('test/fixtures/ZergSupport.xcodeproj'),
|
37
|
-
'full project name'
|
38
|
-
assert_equal 'test', Paths.project_root_at('test/fixtures'),
|
39
|
-
'enclosing dir with weird name'
|
40
|
-
assert_equal 'test', Paths.project_root_at('test'), 'subdir with weird name'
|
41
|
-
assert_equal 'test/fixtures/TestApp',
|
42
|
-
Paths.project_root_at('test/fixtures/TestApp'), 'project dir'
|
43
|
-
assert_equal 'test/fixtures/TestApp',
|
44
|
-
Paths.project_root_at('test/fixtures/TestApp/TestApp.xcodeproj'),
|
45
|
-
'full project name in subdir'
|
46
|
-
end
|
47
|
-
end
|
data/test/shortcuts_test.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# Author:: Victor Costan
|
2
|
-
# Copyright:: Copyright (C) 2009 Zergling.Net
|
3
|
-
# License:: MIT
|
4
|
-
|
5
|
-
require 'zerg_xcode'
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
class ShortcutsTest < Test::Unit::TestCase
|
9
|
-
def test_load
|
10
|
-
proj = ZergXcode.load 'test/fixtures/ZergSupport'
|
11
|
-
assert_equal ['ZergSupport', 'ZergTestSupport', 'ZergSupportTests'].sort,
|
12
|
-
proj['targets'].map { |target| target['name'] }.sort
|
13
|
-
assert_equal 'test/fixtures/ZergSupport.xcodeproj/project.pbxproj',
|
14
|
-
proj.source_filename, 'Loading did not set project source'
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_plugin
|
18
|
-
ls_instance = ZergXcode.plugin 'ls'
|
19
|
-
ls_class = ZergXcode::Plugins::Ls
|
20
|
-
assert ls_instance.kind_of?(ls_class), 'plugin retrieves wrong object'
|
21
|
-
end
|
22
|
-
end
|