vendor 0.0.1 → 0.0.2

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.
Files changed (166) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile.lock +2 -4
  3. data/LICENSE +20 -0
  4. data/Readme.markdown +91 -10
  5. data/bin/vendor +5 -53
  6. data/lib/vendor.rb +37 -26
  7. data/lib/vendor/api.rb +1 -1
  8. data/lib/vendor/cli.rb +3 -15
  9. data/lib/vendor/cli/app.rb +140 -0
  10. data/lib/vendor/cli/auth.rb +6 -4
  11. data/lib/vendor/cli/console.rb +25 -0
  12. data/lib/vendor/extensions/string.rb +1 -1
  13. data/lib/vendor/template.rb +55 -0
  14. data/lib/vendor/templates/Vendorfile +3 -0
  15. data/lib/vendor/templates/vendorspec +15 -0
  16. data/lib/vendor/ui.rb +62 -0
  17. data/lib/vendor/vendor_file.rb +12 -0
  18. data/lib/vendor/vendor_file/dsl.rb +54 -0
  19. data/lib/vendor/vendor_file/library.rb +16 -0
  20. data/lib/vendor/vendor_file/library/base.rb +95 -0
  21. data/lib/vendor/vendor_file/library/git.rb +71 -0
  22. data/lib/vendor/vendor_file/library/local.rb +22 -0
  23. data/lib/vendor/vendor_file/library/remote.rb +18 -0
  24. data/lib/vendor/vendor_file/loader.rb +36 -0
  25. data/lib/vendor/vendor_file/source.rb +21 -0
  26. data/lib/vendor/vendor_spec.rb +11 -0
  27. data/lib/vendor/vendor_spec/builder.rb +10 -3
  28. data/lib/vendor/version.rb +1 -1
  29. data/lib/vendor/xcode.rb +10 -0
  30. data/lib/vendor/xcode/project.rb +132 -19
  31. data/lib/vendor/xcode/proxy.rb +28 -0
  32. data/lib/vendor/xcode/{object.rb → proxy/base.rb} +52 -25
  33. data/lib/vendor/xcode/proxy/pbx_build_file.rb +9 -0
  34. data/lib/vendor/xcode/proxy/pbx_container_item_proxy.rb +8 -0
  35. data/lib/vendor/xcode/proxy/pbx_file_reference.rb +39 -0
  36. data/lib/vendor/xcode/proxy/pbx_frameworks_build_phase.rb +9 -0
  37. data/lib/vendor/xcode/proxy/pbx_group.rb +35 -0
  38. data/lib/vendor/xcode/{objects → proxy}/pbx_native_target.rb +2 -2
  39. data/lib/vendor/xcode/{objects → proxy}/pbx_project.rb +2 -2
  40. data/lib/vendor/xcode/proxy/pbx_resources_build_phase.rb +7 -0
  41. data/lib/vendor/xcode/proxy/pbx_shell_script_build_phase.rb +7 -0
  42. data/lib/vendor/xcode/proxy/pbx_sources_build_phase.rb +9 -0
  43. data/lib/vendor/xcode/proxy/pbx_target_dependency.rb +7 -0
  44. data/lib/vendor/xcode/proxy/pbx_variant_group.rb +7 -0
  45. data/lib/vendor/xcode/proxy/xc_build_configuration.rb +7 -0
  46. data/lib/vendor/xcode/proxy/xc_configuration_list.rb +9 -0
  47. data/lib/vendor/xcode/proxy/xc_version_group.rb +7 -0
  48. data/spec/{vendor → lib/vendor}/api_spec.rb +0 -0
  49. data/spec/{vendor → lib/vendor}/cli/auth_spec.rb +1 -1
  50. data/spec/{vendor → lib/vendor}/config_spec.rb +1 -1
  51. data/spec/lib/vendor/template_spec.rb +36 -0
  52. data/spec/lib/vendor/vendor_file/dsl_spec.rb +5 -0
  53. data/spec/lib/vendor/vendor_file/library/base_spec.rb +148 -0
  54. data/spec/lib/vendor/vendor_file/library/git_spec.rb +33 -0
  55. data/spec/lib/vendor/vendor_file/library/local_spec.rb +19 -0
  56. data/spec/lib/vendor/vendor_file/library/remote_spec.rb +13 -0
  57. data/spec/lib/vendor/vendor_file/loader_spec.rb +102 -0
  58. data/spec/lib/vendor/vendor_file/source_spec.rb +17 -0
  59. data/spec/{vendor → lib/vendor}/vendor_spec/builder_spec.rb +0 -0
  60. data/spec/{vendor → lib/vendor}/vendor_spec/dsl_spec.rb +0 -0
  61. data/spec/{vendor → lib/vendor}/vendor_spec/loader_spec.rb +1 -1
  62. data/spec/lib/vendor/xcode/project_spec.rb +400 -0
  63. data/spec/{vendor/xcode/object_spec.rb → lib/vendor/xcode/proxy/base_spec.rb} +15 -3
  64. data/spec/lib/vendor/xcode/proxy/pbx_file_reference_spec.rb +25 -0
  65. data/spec/lib/vendor/xcode/proxy/pbx_group_spec.rb +27 -0
  66. data/spec/{vendor/xcode/objects → lib/vendor/xcode/proxy}/pbx_project_spec.rb +1 -1
  67. data/spec/spec_helper.rb +5 -3
  68. data/spec/support/api_stubs.rb +4 -3
  69. data/spec/support/resources/Vendorfile +22 -0
  70. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/BICoreDataCache.mom +0 -0
  71. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/BMMapCalloutView.nib +0 -0
  72. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/Info.plist +0 -0
  73. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/bingmaps_logo.png +0 -0
  74. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/bingmaps_logo@2x.png +0 -0
  75. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_selected_comp.png +0 -0
  76. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_selected_comp@2x.png +0 -0
  77. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected.png +0 -0
  78. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected@2x.png +0 -0
  79. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected_comp.png +0 -0
  80. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected_comp@2x.png +0 -0
  81. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/callout_white.png +0 -0
  82. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/callout_white@2x.png +0 -0
  83. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_selected_comp.png +0 -0
  84. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_selected_comp@2x.png +0 -0
  85. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected.png +0 -0
  86. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected@2x.png +0 -0
  87. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected_comp.png +0 -0
  88. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected_comp@2x.png +0 -0
  89. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/mapConfiguration.plist +0 -0
  90. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/me_dot_128.png +0 -0
  91. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/networkDefaults.plist +0 -0
  92. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_selected_comp.png +0 -0
  93. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_selected_comp@2x.png +0 -0
  94. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected.png +0 -0
  95. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected@2x.png +0 -0
  96. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected_comp.png +0 -0
  97. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected_comp@2x.png +0 -0
  98. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_selected_comp.png +0 -0
  99. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_selected_comp@2x.png +0 -0
  100. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected.png +0 -0
  101. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected@2x.png +0 -0
  102. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected_comp.png +0 -0
  103. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected_comp@2x.png +0 -0
  104. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_selected_comp.png +0 -0
  105. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_selected_comp@2x.png +0 -0
  106. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected.png +0 -0
  107. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected@2x.png +0 -0
  108. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected_comp.png +0 -0
  109. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected_comp@2x.png +0 -0
  110. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/shadow.png +0 -0
  111. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/shadow@2x.png +0 -0
  112. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_selected_comp.png +0 -0
  113. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_selected_comp@2x.png +0 -0
  114. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected.png +0 -0
  115. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected@2x.png +0 -0
  116. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected_comp.png +0 -0
  117. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected_comp@2x.png +0 -0
  118. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMEntity.h +34 -0
  119. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMGeometry.h +67 -0
  120. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMMapView.h +159 -0
  121. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMMarker.h +41 -0
  122. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMMarkerView.h +47 -0
  123. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMPushpinView.h +31 -0
  124. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMReverseGeocoder.h +63 -0
  125. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMTypes.h +25 -0
  126. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMUserLocation.h +26 -0
  127. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BingMaps.h +210 -0
  128. data/spec/support/resources/cache/base/BingMapsIOS/MapControl/libBingMaps.a +0 -0
  129. data/spec/support/resources/cache/base/BingMapsIOS/README.html +8 -0
  130. data/spec/support/resources/cache/base/DKBenchmark-Manifest/data/DKBenchmark.h +18 -0
  131. data/spec/support/resources/cache/base/DKBenchmark-Manifest/data/DKBenchmark.m +73 -0
  132. data/spec/support/resources/cache/base/DKBenchmark-Manifest/vendor.json +1 -0
  133. data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.h +18 -0
  134. data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.m +73 -0
  135. data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.vendorspec +11 -0
  136. data/spec/support/resources/projects/TabBarWithUnitTests/TabBarWithUnitTests.xcodeproj/project.pbxproj +10 -0
  137. data/spec/support/resources/projects/UtilityApplication/UtilityApplication.xcodeproj/project.pbxproj +288 -0
  138. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAAppDelegate.h +15 -0
  139. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAAppDelegate.m +60 -0
  140. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAFlipsideViewController.h +23 -0
  141. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAFlipsideViewController.m +69 -0
  142. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAMainViewController.h +13 -0
  143. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAMainViewController.m +75 -0
  144. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UtilityApplication-Info.plist +42 -0
  145. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UtilityApplication-Prefix.pch +14 -0
  146. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/en.lproj/InfoPlist.strings +2 -0
  147. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/en.lproj/MainStoryboard.storyboard +90 -0
  148. data/spec/support/resources/projects/UtilityApplication/UtilityApplication/main.m +18 -0
  149. data/spec/support/resources/{files → source}/SecondViewController.h +0 -0
  150. data/spec/support/resources/{files → source}/SecondViewController.m +0 -0
  151. data/vendor.gemspec +0 -1
  152. metadata +254 -74
  153. data/LICENCE +0 -19
  154. data/lib/vendor/xcode/objects/pbx_build_file.rb +0 -9
  155. data/lib/vendor/xcode/objects/pbx_container_item_proxy.rb +0 -8
  156. data/lib/vendor/xcode/objects/pbx_file_reference.rb +0 -21
  157. data/lib/vendor/xcode/objects/pbx_frameworks_build_phase.rb +0 -9
  158. data/lib/vendor/xcode/objects/pbx_group.rb +0 -13
  159. data/lib/vendor/xcode/objects/pbx_resources_build_phase.rb +0 -7
  160. data/lib/vendor/xcode/objects/pbx_shell_script_build_phase.rb +0 -7
  161. data/lib/vendor/xcode/objects/pbx_sources_build_phase.rb +0 -9
  162. data/lib/vendor/xcode/objects/pbx_target_dependency.rb +0 -7
  163. data/lib/vendor/xcode/objects/pbx_variant_group.rb +0 -7
  164. data/lib/vendor/xcode/objects/xc_build_configuration.rb +0 -7
  165. data/lib/vendor/xcode/objects/xc_configuration_list.rb +0 -9
  166. data/spec/vendor/xcode/project_spec.rb +0 -211
data/LICENCE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (C) 2011 by Keith Pitt
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,9 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXBuildFile < Vendor::XCode::Object
4
-
5
- reference :file_ref
6
-
7
- end
8
-
9
- end
@@ -1,8 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXContainerItemProxy < Vendor::XCode::Object
4
-
5
-
6
- end
7
-
8
- end
@@ -1,21 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXFileReference < Vendor::XCode::Object
4
-
5
- reference :file_ref
6
-
7
- def name
8
- read_attribute :path
9
- end
10
-
11
- def self.file_type_from_extension(extension)
12
- case extension
13
- when ".h" then "sourcecode.c.h"
14
- when ".m" then "sourcecode.c.objc"
15
- else "unknown"
16
- end
17
- end
18
-
19
- end
20
-
21
- end
@@ -1,9 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXFrameworksBuildPhase < Vendor::XCode::Object
4
-
5
- reference :files
6
-
7
- end
8
-
9
- end
@@ -1,13 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXGroup < Vendor::XCode::Object
4
-
5
- reference :children
6
-
7
- def name
8
- @attributes['name'] || @attributes['path']
9
- end
10
-
11
- end
12
-
13
- end
@@ -1,7 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXResourcesBuildPhase < Vendor::XCode::Object
4
-
5
- end
6
-
7
- end
@@ -1,7 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXShellScriptBuildPhase < Vendor::XCode::Object
4
-
5
- end
6
-
7
- end
@@ -1,9 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXSourcesBuildPhase < Vendor::XCode::Object
4
-
5
- reference :files
6
-
7
- end
8
-
9
- end
@@ -1,7 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXTargetDependency < Vendor::XCode::Object
4
-
5
- end
6
-
7
- end
@@ -1,7 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class PBXVariantGroup < Vendor::XCode::Object
4
-
5
- end
6
-
7
- end
@@ -1,7 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class XCBuildConfiguration < Vendor::XCode::Object
4
-
5
- end
6
-
7
- end
@@ -1,9 +0,0 @@
1
- module Vendor::XCode::Objects
2
-
3
- class XCConfigurationList < Vendor::XCode::Object
4
-
5
- reference :build_configurations
6
-
7
- end
8
-
9
- end
@@ -1,211 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Vendor::XCode::Project do
4
-
5
- before :each do
6
- @project = Vendor::XCode::Project.new(File.join(PROJECT_RESOURCE_PATH, "ProjectWithSpecs/ProjectWithSpecs.xcodeproj"))
7
- end
8
-
9
- context "#initialize" do
10
-
11
- context "ProjectWithSpecs.xcodeproj" do
12
-
13
- it "should load all the objects" do
14
- @project.objects.length.should == 48
15
- end
16
-
17
- it "should load the object version" do
18
- @project.object_version.should == 46
19
- end
20
-
21
- it "should load the archive version" do
22
- @project.archive_version.should == 1
23
- end
24
-
25
- it "should populate the root object" do
26
- @project.root_object.should_not be_nil
27
- end
28
-
29
- end
30
-
31
- context "TabBarWithUnitTests.xcodeproj" do
32
-
33
- it "should parse and load all the objects" do
34
- project = Vendor::XCode::Project.new(File.join(PROJECT_RESOURCE_PATH, "TabBarWithUnitTests/TabBarWithUnitTests.xcodeproj"))
35
-
36
- project.objects.length.should == 74
37
- end
38
-
39
- end
40
-
41
- end
42
-
43
- context "#find_object" do
44
-
45
- it "should return the object mapped to the id" do
46
- @project.find_object('5378747F140109AE00D9B746').should == @project.root_object
47
- end
48
-
49
- end
50
-
51
- context "#find_target" do
52
-
53
- it "should return the target" do
54
- @project.find_target('Specs').should == @project.root_object.targets.first
55
- end
56
-
57
- it "should return nil if one cannot be found" do
58
- @project.find_target('Ruut').should be_nil
59
- end
60
-
61
- end
62
-
63
- context '#find_and_make_group' do
64
-
65
- context 'when finding an existing group' do
66
-
67
- it "should return the group" do
68
- @project.find_and_make_group("Specs/Supporting Files").should == @project.root_object.main_group.children.first.children.first
69
- end
70
-
71
- end
72
-
73
- context 'when creating a group' do
74
-
75
- before :each do
76
- @group = @project.find_and_make_group("Specs/Supporting Files/Something/Goes Inside/Here")
77
-
78
- @supporting_files_group = @project.root_object.main_group.children.first.children.first
79
- @something_group = @supporting_files_group.children.last
80
- @inside_group = @something_group.children.last
81
- @here_group = @inside_group.children.last
82
- end
83
-
84
- it 'should create it in the correct location' do
85
- @here_group.should_not be_nil
86
- end
87
-
88
- it 'should give the new groups the right names' do
89
- @something_group.name.should == "Something"
90
- @inside_group.name.should == "Goes Inside"
91
- @here_group.name.should == "Here"
92
- end
93
-
94
- it 'should give the new groups the correct source tree property' do
95
- @here_group.source_tree.should == "<group>"
96
- end
97
-
98
- it 'should give the new groups an ID' do
99
- @here_group.source_tree.should_not be_nil
100
- end
101
-
102
- it 'should give the new groups a valid ISA' do
103
- @here_group.isa.should == 'PBXGroup'
104
- end
105
-
106
- end
107
-
108
- end
109
-
110
- context '#add_file' do
111
-
112
- let(:first_file) { File.join(FILE_RESOURCE_PATH, "SecondViewController.h") }
113
- let(:second_file) { File.join(FILE_RESOURCE_PATH, "SecondViewController.m") }
114
-
115
- before :all do
116
- @temp_path = TempProject.create(File.join(PROJECT_RESOURCE_PATH, "ProjectWithSpecs"))
117
- @temp_project = Vendor::XCode::Project.new(File.join(@temp_path, "ProjectWithSpecs.xcodeproj"))
118
-
119
- @target = @temp_project.find_target("Specs")
120
-
121
- @first_file_added = @temp_project.add_file :targets => [ @target ], :file => first_file, :path => "Controllers/SecondViewController"
122
- @second_file_added = @temp_project.add_file :targets => [ @target ], :file => second_file, :path => "Controllers/SecondViewController"
123
- end
124
-
125
- it 'should add the file to the filesystem' do
126
- new_first_path = File.join(@temp_path, "Controllers", "SecondViewController", "SecondViewController.h")
127
- new_second_path = File.join(@temp_path, "Controllers", "SecondViewController", "SecondViewController.m")
128
-
129
- File.exists?(new_first_path).should be_true
130
- File.exists?(new_second_path).should be_true
131
- end
132
-
133
- it 'should add it as the correct file type' do
134
- @first_file_added.last_known_file_type.should == "sourcecode.c.h"
135
- @second_file_added.last_known_file_type.should == "sourcecode.c.objc"
136
- end
137
-
138
- it 'should add the files with the correct path' do
139
- @first_file_added.path.should == "SecondViewController.h"
140
- @second_file_added.path.should == "SecondViewController.m"
141
- end
142
-
143
- it 'should have the correct ISA' do
144
- @first_file_added.isa.should == "PBXFileReference"
145
- @second_file_added.isa.should == "PBXFileReference"
146
- end
147
-
148
- it 'should have an ID' do
149
- @first_file_added.id.should_not be_nil
150
- @second_file_added.id.should_not be_nil
151
- end
152
-
153
- it 'should add it to the correct group' do
154
- group = @temp_project.find_and_make_group("Controllers/SecondViewController")
155
-
156
- group.children[0].should == @first_file_added
157
- group.children[1].should == @second_file_added
158
- end
159
-
160
- it 'should still save' do
161
- @temp_project.save
162
- end
163
-
164
- it 'should add it to the build targets specified'
165
-
166
- context 'should raise an error if' do
167
-
168
- it 'there is no target set' do
169
- expect do
170
- @temp_project.add_file :file => "ASD", :path => "ASD"
171
- end.to raise_exception(StandardError, "Missing :targets option")
172
- end
173
-
174
- it 'there is no path set' do
175
- expect do
176
- @temp_project.add_file :targets => "Specs", :file => first_file
177
- end.to raise_exception(StandardError, "Missing :path option")
178
- end
179
-
180
- it 'there is no file set' do
181
- expect do
182
- @temp_project.add_file :targets => "Specs", :path => "ASD"
183
- end.to raise_exception(StandardError, "Missing :file option")
184
- end
185
-
186
- it "the file doesn't exist" do
187
- expect do
188
- @temp_project.add_file :targets => "Ruut", :file => "foo", :path => "Controllers/SecondViewController"
189
- end.to raise_exception(StandardError, "Could not find file `foo`")
190
- end
191
-
192
- end
193
-
194
- end
195
-
196
- context "#to_ascii_plist" do
197
-
198
- it "should convert it to the correct format" do
199
- # Reload the project from the filesystem
200
- @project.reload
201
-
202
- contents = File.readlines(File.join(PROJECT_RESOURCE_PATH, "ProjectWithSpecs/ProjectWithSpecs.xcodeproj", "project.pbxproj")).join("\n")
203
- original = Vendor::Plist.parse_ascii(contents)
204
- saved = Vendor::Plist.parse_ascii(@project.to_ascii_plist)
205
-
206
- original.should == saved
207
- end
208
-
209
- end
210
-
211
- end