xcoder 0.0.21 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+ require 'rspec'
2
+ require 'xcoder'
3
+
4
+ describe Xcode::Group do
5
+
6
+ let(:subject) { Xcode.project('TestProject').groups }
7
+
8
+ describe "#groups" do
9
+ context "when a group matches the name specified" do
10
+ it "should return the group" do
11
+ subject.add_group('TestGroup')
12
+ subject.group('TestGroup').should_not be_nil
13
+ end
14
+ end
15
+
16
+ context "when multiple groups match the name specified" do
17
+ it "should return all the matching groups" do
18
+ subject.add_group('TestGroup')
19
+ subject.group('TestGroup').length.should == 2
20
+ end
21
+ end
22
+
23
+ context "when a group does not match the name specified" do
24
+ it "should return an e" do
25
+ subject.group('UnknownGroup').should be_empty
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "#supergroup" do
31
+ it "should return the owning group" do
32
+ group = subject.add_group('Superman')
33
+ group.supergroup.identifier.should == subject.identifier
34
+ end
35
+ end
36
+
37
+ describe "#add_group" do
38
+ it "should return the group" do
39
+ subject.add_group('TestGroup').should_not be_nil
40
+ end
41
+
42
+ context "when adding a group within a group" do
43
+ it "should successfully create the subgroup" do
44
+ subgroup = subject.add_group('GroupWithSubGroup').add_group('Group MED')
45
+
46
+ found_subgroup = subject.group('GroupWithSubGroup').first.group('Group MED').first
47
+ subgroup.should_not be_nil
48
+ found_subgroup.should_not be_nil
49
+
50
+ subgroup.identifier.should == found_subgroup.identifier
51
+ end
52
+ end
53
+
54
+ context "when saving to file" do
55
+ it "should save the group to the file" do
56
+
57
+ # subject.groups.add_group 'TestGroup'
58
+ # framework = subject.groups.add_framework 'QuartzCore'
59
+ #
60
+ # # subject.target('TestProject').framework_build_phase.add_file framework
61
+ #
62
+ # subject.targets.each do |target|
63
+ #
64
+ # target.framework_build_phase.add_build_file framework
65
+ #
66
+ # # target.configs.each do |config|
67
+ # # config.set_other_linker_flags '-ObjC'
68
+ # # end
69
+ # end
70
+ #
71
+ # subject.save!
72
+
73
+ end
74
+
75
+
76
+ end
77
+
78
+ end
79
+
80
+ end
data/spec/project_spec.rb CHANGED
@@ -1,43 +1,100 @@
1
- require 'rspec'
2
- require 'xcoder'
1
+ require_relative 'spec_helper'
3
2
 
4
3
  describe Xcode::Project do
5
- it "should enumerate all projects in current directory" do
6
- projects = Xcode.projects
7
- projects.size.should==1
8
- projects.first.name.should=="TestProject"
9
- end
10
-
11
- it "should fetch project by name" do
12
- p = Xcode.project 'TestProject'
13
- p.should_not be_nil
14
- end
15
-
16
- it "should fetch project by name with extension and path" do
17
- w = Xcode.project "#{File.dirname(__FILE__)}/TestProject/TestProject.xcodeproj"
18
- w.should_not be_nil
19
- end
20
-
21
- it "should have many targets" do
22
- p = Xcode.project "TestProject"
23
- p.targets.size.should==2
24
- p.targets[0].name.should=="TestProject"
25
- p.targets[1].name.should=="TestProjectTests"
4
+
5
+ let(:project) { Xcode.project 'TestProject' }
6
+
7
+
8
+ describe "Targets" do
9
+
10
+ let(:expected_first_target) { "TestProject" }
11
+ let(:expected_second_target) { "TestProjectTests" }
12
+
13
+ describe "#targets" do
14
+
15
+ let(:subject) { project.targets }
16
+
17
+ it "should give the correct number of targets" do
18
+ subject.size.should == 2
19
+ end
20
+
21
+ it "should return the correct targets" do
22
+ subject[0].name.should == expected_first_target
23
+ subject[1].name.should == expected_second_target
24
+ end
25
+
26
+ end
27
+
28
+ describe "#target" do
29
+ context "when the target exists" do
30
+
31
+ let(:subject) { project.target expected_first_target }
32
+
33
+ it "should return the specified target" do
34
+ subject.should_not be_nil
35
+ end
36
+
37
+ end
38
+
39
+ context "when the target does not exist" do
40
+
41
+ let(:subject) { project.target 'UnknownTarget' }
42
+
43
+ it "should raise an error" do
44
+ expect { subject }.to raise_error
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+
26
51
  end
27
52
 
28
- it "should get target by name" do
29
- p = Xcode.project "TestProject"
30
- p.target('TestProjectTests').should_not be_nil
31
- end
32
53
 
33
- it "should have many schemes" do
34
- p = Xcode.project "TestProject"
35
- p.schemes.size.should==1
36
- p.schemes.first.name.should=="TestProject"
54
+ describe "Schemes" do
55
+
56
+ let(:expected_scheme) { "TestProject" }
57
+
58
+ describe "#schemes" do
59
+
60
+ let(:subject) { project.schemes }
61
+
62
+ let(:shared_scheme_count) { Dir["spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/*.xcscheme"].count }
63
+ let(:user_scheme_count) { Dir["spec/TestProject/TestProject.xcodeproj/xcuserdata/#{ENV['USER']}.xcuserdatad/xcschemes/*.xcscheme"].count }
64
+
65
+ it "should find all global schemes and schemes unique to the user" do
66
+ subject.size.should == shared_scheme_count + user_scheme_count
67
+ end
68
+
69
+ it "should return the correct schemes" do
70
+ subject.first.name.should == expected_scheme
71
+ end
72
+
73
+ end
74
+
75
+ describe "#scheme" do
76
+ context "when the scheme exists" do
77
+
78
+ let(:subject) { project.scheme expected_scheme }
79
+
80
+ it "should return the specified scheme" do
81
+ subject.should_not be_nil
82
+ end
83
+
84
+ end
85
+
86
+ context "when the scheme does not exist" do
87
+
88
+ let(:subject) { project.scheme 'UnknownScheme' }
89
+
90
+ it "should raise an error" do
91
+ expect { subject }.to raise_error
92
+ end
93
+
94
+ end
95
+
96
+ end
97
+
37
98
  end
38
99
 
39
- it "should get scheme by name" do
40
- p = Xcode.project "TestProject"
41
- p.scheme('TestProject').should_not be_nil
42
- end
43
100
  end
data/spec/scheme_spec.rb CHANGED
@@ -10,20 +10,5 @@ describe Xcode::Scheme do
10
10
  @scheme.name.should=="TestProject"
11
11
  end
12
12
 
13
- it "should be able to build" do
14
- builder = @scheme.builder
15
- builder.clean
16
- builder.build
17
- File.exists?(builder.app_path).should==true
18
- File.exists?(builder.dsym_path).should==true
19
- end
20
-
21
- it "should be able to package" do
22
- builder = @scheme.builder
23
- builder.clean
24
- builder.build
25
- builder.package
26
- File.exists?(builder.dsym_zip_path).should==true
27
- File.exists?(builder.ipa_path).should==true
28
- end
13
+
29
14
  end
@@ -0,0 +1 @@
1
+ require_relative '../lib/xcoder'
data/spec/target_spec.rb CHANGED
@@ -1,25 +1,81 @@
1
- require 'rspec'
2
- require 'xcoder'
1
+ require_relative 'spec_helper'
3
2
 
4
3
  describe Xcode::Target do
5
- before do
6
- @target = Xcode.project('TestProject').target('TestProject')
4
+
5
+ let(:project) { Xcode.project 'TestProject' }
6
+ let(:subject) { project.target 'TestProject' }
7
+
8
+ let(:first_configuration_name) { "Debug" }
9
+ let(:second_configuration_name) { "Release" }
10
+
11
+ describe "#name" do
12
+
13
+ let(:expected_name) { "TestProject" }
14
+
15
+ it "should have the correct name" do
16
+ subject.name == expected_name
17
+ end
18
+ end
19
+
20
+ describe "#productName" do
21
+
22
+ let(:expected_product_name) { "TestProject" }
23
+
24
+ it "should have the correct productName" do
25
+ subject.name == expected_product_name
26
+ end
7
27
  end
8
28
 
9
- it "should parse the name" do
10
- @target.name.should=="TestProject"
11
- @target.productName.should=="TestProject"
29
+ describe "#configs" do
30
+ it "should return the correct number of configurations" do
31
+ subject.configs.length.should == 2
32
+ end
33
+
34
+ it "should return the correct configuration" do
35
+ subject.configs[0].name == first_configuration_name
36
+ subject.configs[1].name == second_configuration_name
37
+ end
12
38
  end
13
39
 
14
- it "should return a list of configs" do
15
- @target.configs.size.should==2
16
- @target.configs[0].name.should=="Debug"
17
- @target.configs[1].name.should=="Release"
40
+ describe "#config" do
41
+ context "when a context exist with the specified name" do
42
+ it "should return that configuration" do
43
+ subject.config(first_configuration_name).should_not be_nil
44
+ end
45
+
46
+ end
47
+
48
+ context "when no context exists with the specified name" do
49
+ it "should raise an error" do
50
+ expect { subject.config "UnknownConfig" }.to raise_error
51
+ end
52
+
53
+ end
54
+
18
55
  end
19
56
 
20
- it "should return the config by name" do
21
- config = @target.config('Debug')
22
- config.should_not be_nil
23
- config.name.should=='Debug'
57
+ describe "#build_phases" do
58
+ it "should return all the build phases of the target" do
59
+ subject.build_phases.count.should == 3
60
+ end
24
61
  end
62
+
63
+ describe "#framework_build_phase" do
64
+ it "should return the correct build phase" do
65
+ subject.framework_build_phase.should_not be_nil
66
+ end
67
+ end
68
+
69
+ describe "#sources_build_phase" do
70
+ it "should return the correct build phase" do
71
+ subject.sources_build_phase.should_not be_nil
72
+ end
73
+ end
74
+
75
+ describe "#resources_build_phase" do
76
+ it "should return the correct build phase" do
77
+ subject.resources_build_phase.should_not be_nil
78
+ end
79
+ end
80
+
25
81
  end
@@ -0,0 +1,57 @@
1
+ require_relative "spec_helper"
2
+
3
+ describe Xcode do
4
+
5
+ let(:subject) { Xcode }
6
+
7
+ describe "#projects" do
8
+
9
+ context "when there is a project within the current directory" do
10
+
11
+ let(:subject) { Xcode.projects }
12
+
13
+ it "should find the project" do
14
+ subject.size.should == 1
15
+ subject.first.name.should == "TestProject"
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ describe "#project" do
23
+ context "when the target project exists" do
24
+ context "when fetching the project by name" do
25
+
26
+ let(:subject) { Xcode.project 'TestProject' }
27
+
28
+ it "should find the project" do
29
+ subject.should_not be_nil
30
+ end
31
+
32
+ end
33
+
34
+ context "when fetching the project by path" do
35
+
36
+ let(:subject) { Xcode.project "#{File.dirname(__FILE__)}/TestProject/TestProject.xcodeproj" }
37
+
38
+ it "should find the project" do
39
+ subject.should_not be_nil
40
+ end
41
+
42
+ end
43
+ end
44
+
45
+ context "when the target project does not exist" do
46
+
47
+ let(:subject) { Xcode.project 'DoesNotExistProject' }
48
+
49
+ it "should raise an error" do
50
+ expect { subject }.to raise_error
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-10 00:00:00.000000000Z
12
+ date: 2012-02-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70092545388420 !ruby/object:Gem::Requirement
16
+ requirement: &70180396509420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70092545388420
24
+ version_requirements: *70180396509420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: plist
27
- requirement: &70092545388000 !ruby/object:Gem::Requirement
27
+ requirement: &70180396509000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70092545388000
35
+ version_requirements: *70180396509000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &70092545387580 !ruby/object:Gem::Requirement
38
+ requirement: &70180396508580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70092545387580
46
+ version_requirements: *70180396508580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: builder
49
- requirement: &70092545387160 !ruby/object:Gem::Requirement
49
+ requirement: &70180396508160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70092545387160
57
+ version_requirements: *70180396508160
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rest-client
60
- requirement: &70092545386740 !ruby/object:Gem::Requirement
60
+ requirement: &70180396507740 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70092545386740
68
+ version_requirements: *70180396507740
69
69
  description: Provides a ruby based object-model for parsing project structures and
70
70
  invoking builds
71
71
  email:
@@ -78,29 +78,42 @@ files:
78
78
  - .gitignore
79
79
  - .rvmrc
80
80
  - Gemfile
81
+ - Guardfile
81
82
  - README.md
82
83
  - Rakefile
83
84
  - bin/xcoder-build
85
+ - lib/xcode/build_file.rb
86
+ - lib/xcode/build_phase.rb
84
87
  - lib/xcode/builder.rb
85
88
  - lib/xcode/buildfile.rb
86
89
  - lib/xcode/configuration.rb
90
+ - lib/xcode/core_ext/array.rb
91
+ - lib/xcode/core_ext/boolean.rb
92
+ - lib/xcode/core_ext/fixnum.rb
93
+ - lib/xcode/core_ext/hash.rb
94
+ - lib/xcode/core_ext/string.rb
95
+ - lib/xcode/file_reference.rb
96
+ - lib/xcode/group.rb
87
97
  - lib/xcode/info_plist.rb
88
98
  - lib/xcode/keychain.rb
99
+ - lib/xcode/parsers/plutil_project_parser.rb
89
100
  - lib/xcode/project.rb
90
101
  - lib/xcode/provisioning_profile.rb
102
+ - lib/xcode/registry.rb
103
+ - lib/xcode/resource.rb
91
104
  - lib/xcode/scheme.rb
92
105
  - lib/xcode/shell.rb
93
106
  - lib/xcode/target.rb
94
107
  - lib/xcode/test/report_parser.rb
95
108
  - lib/xcode/testflight.rb
109
+ - lib/xcode/variant_group.rb
96
110
  - lib/xcode/version.rb
97
111
  - lib/xcode/workspace.rb
98
112
  - lib/xcoder.rb
99
113
  - spec/Provisioning/TestUser.p12
100
114
  - spec/TestProject/Buildfile
101
115
  - spec/TestProject/TestProject.xcodeproj/project.pbxproj
102
- - spec/TestProject/TestProject.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/TestProject.xcscheme
103
- - spec/TestProject/TestProject.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/xcschememanagement.plist
116
+ - spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme
104
117
  - spec/TestProject/TestProject/AppDelegate.h
105
118
  - spec/TestProject/TestProject/AppDelegate.m
106
119
  - spec/TestProject/TestProject/TestProject-Info.plist
@@ -115,13 +128,18 @@ files:
115
128
  - spec/TestProject/TestProjectTests/en.lproj/InfoPlist.strings
116
129
  - spec/TestWorkspace.xcworkspace/contents.xcworkspacedata
117
130
  - spec/TestWorkspace.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
131
+ - spec/build_phase_spec.rb
132
+ - spec/builder_spec.rb
118
133
  - spec/configuration_spec.rb
134
+ - spec/group_spec.rb
119
135
  - spec/keychain_spec.rb
120
136
  - spec/project_spec.rb
121
137
  - spec/scheme_spec.rb
138
+ - spec/spec_helper.rb
122
139
  - spec/target_spec.rb
123
140
  - spec/test_report_spec.rb
124
141
  - spec/workspace_spec.rb
142
+ - spec/xcode_spec.rb
125
143
  - xcoder.gemspec
126
144
  homepage: https://github.com/rayh/xcoder
127
145
  licenses: []
@@ -151,8 +169,7 @@ test_files:
151
169
  - spec/Provisioning/TestUser.p12
152
170
  - spec/TestProject/Buildfile
153
171
  - spec/TestProject/TestProject.xcodeproj/project.pbxproj
154
- - spec/TestProject/TestProject.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/TestProject.xcscheme
155
- - spec/TestProject/TestProject.xcodeproj/xcuserdata/ray.xcuserdatad/xcschemes/xcschememanagement.plist
172
+ - spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme
156
173
  - spec/TestProject/TestProject/AppDelegate.h
157
174
  - spec/TestProject/TestProject/AppDelegate.m
158
175
  - spec/TestProject/TestProject/TestProject-Info.plist
@@ -167,10 +184,15 @@ test_files:
167
184
  - spec/TestProject/TestProjectTests/en.lproj/InfoPlist.strings
168
185
  - spec/TestWorkspace.xcworkspace/contents.xcworkspacedata
169
186
  - spec/TestWorkspace.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
187
+ - spec/build_phase_spec.rb
188
+ - spec/builder_spec.rb
170
189
  - spec/configuration_spec.rb
190
+ - spec/group_spec.rb
171
191
  - spec/keychain_spec.rb
172
192
  - spec/project_spec.rb
173
193
  - spec/scheme_spec.rb
194
+ - spec/spec_helper.rb
174
195
  - spec/target_spec.rb
175
196
  - spec/test_report_spec.rb
176
197
  - spec/workspace_spec.rb
198
+ - spec/xcode_spec.rb