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
@@ -0,0 +1,9 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXBuildFile < Vendor::XCode::Proxy::Base
4
+
5
+ reference :file_ref
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,8 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXContainerItemProxy < Vendor::XCode::Proxy::Base
4
+
5
+
6
+ end
7
+
8
+ end
@@ -0,0 +1,39 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXFileReference < Vendor::XCode::Proxy::Base
4
+
5
+ reference :file_ref
6
+
7
+ def file?
8
+ true
9
+ end
10
+
11
+ def full_path
12
+ parts = []
13
+ current = self
14
+
15
+ while current
16
+ parts.push current.path if current.respond_to?(:path) && !current.path.nil?
17
+ current = current.parent
18
+ end
19
+
20
+ parts.reverse.join("/")
21
+ end
22
+
23
+ def self.file_type_from_extension(extension)
24
+ case extension
25
+ when /.(png|jpg)/ then "image.#{$1}"
26
+ when ".h" then "sourcecode.c.h"
27
+ when ".m" then "sourcecode.c.objc"
28
+ when ".bundle" then "wrapper.plug-in"
29
+ when ".framework" then "wrapper.framework"
30
+ when ".a" then "archive.ar"
31
+ when ".strings" then "text.plist.strings"
32
+ when ".plist" then "text.plist.xml"
33
+ else "unknown"
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,9 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXFrameworksBuildPhase < Vendor::XCode::Proxy::Base
4
+
5
+ reference :files
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,35 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXGroup < Vendor::XCode::Proxy::Base
4
+
5
+ reference :children
6
+
7
+ def name
8
+ @attributes['name'] || @attributes['path']
9
+ end
10
+
11
+ def full_path
12
+ parts = []
13
+ current = self
14
+
15
+ while current
16
+ parts.push current.name
17
+ current = current.parent
18
+ end
19
+
20
+ parts.reverse.compact.join("/")
21
+ end
22
+
23
+ def group?
24
+ true
25
+ end
26
+
27
+ private
28
+
29
+ def after_initialize
30
+ children.each { |child| child.parent = self }
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -1,6 +1,6 @@
1
- module Vendor::XCode::Objects
1
+ module Vendor::XCode::Proxy
2
2
 
3
- class PBXNativeTarget < Vendor::XCode::Object
3
+ class PBXNativeTarget < Vendor::XCode::Proxy::Base
4
4
 
5
5
  reference :build_phases
6
6
  reference :product_reference
@@ -1,6 +1,6 @@
1
- module Vendor::XCode::Objects
1
+ module Vendor::XCode::Proxy
2
2
 
3
- class PBXProject < Vendor::XCode::Object
3
+ class PBXProject < Vendor::XCode::Proxy::Base
4
4
 
5
5
  reference :build_configuration_list
6
6
  reference :product_ref_group
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXResourcesBuildPhase < Vendor::XCode::Proxy::Base
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXShellScriptBuildPhase < Vendor::XCode::Proxy::Base
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,9 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXSourcesBuildPhase < Vendor::XCode::Proxy::Base
4
+
5
+ reference :files
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXTargetDependency < Vendor::XCode::Proxy::Base
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXVariantGroup < Vendor::XCode::Proxy::PBXGroup
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class XCBuildConfiguration < Vendor::XCode::Proxy::Base
4
+
5
+ end
6
+
7
+ end
@@ -0,0 +1,9 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class XCConfigurationList < Vendor::XCode::Proxy::Base
4
+
5
+ reference :build_configurations
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class XCVersionGroup < Vendor::XCode::Proxy::Base
4
+
5
+ end
6
+
7
+ end
File without changes
@@ -43,7 +43,7 @@ describe Vendor::CLI::Auth do
43
43
  it "should ask for their username and password" do
44
44
  STDIN.should_receive(:gets).once.ordered.and_return "keithpitt"
45
45
  STDIN.should_receive(:gets).once.ordered.and_return "password"
46
- Vendor::CLI::Auth.should_receive(:puts).once
46
+ Vendor.ui.should_receive(:warn).once
47
47
  Vendor::CLI::Auth.should_receive(:printf).twice
48
48
 
49
49
  Vendor::CLI::Auth.fetch_api_key.should == "secret"
@@ -5,7 +5,7 @@ describe Vendor::Config do
5
5
  context "#directory" do
6
6
 
7
7
  it "should return the development directory" do
8
- Vendor::Config.directory.should == File.expand_path(File.join(__FILE__, "..", "..", "..", "tmp", "config"))
8
+ Vendor::Config.directory.should == File.expand_path(File.join(Vendor.root, "..", "tmp", "config"))
9
9
  end
10
10
 
11
11
  end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vendor::Template do
4
+
5
+ let(:template) { File.join(Vendor.root, "vendor", "templates", "Vendorfile") }
6
+ let(:target) { File.join(File.expand_path(Dir.pwd), "Vendorfile") }
7
+ let(:contents) { File.read(template) }
8
+
9
+ context "#copy" do
10
+
11
+ it "should write a file to the current directory" do
12
+ file = mock('file')
13
+ File.should_receive(:open).with(target, "w").and_yield(file)
14
+ file.should_receive(:write).with(contents)
15
+
16
+ Vendor::Template.copy "Vendorfile"
17
+ end
18
+
19
+ it "should not copy if the file already exists" do
20
+ File.should_receive(:exist?).with(target).and_return(true)
21
+ File.should_not_receive(:open)
22
+
23
+ Vendor::Template.copy "Vendorfile"
24
+ end
25
+
26
+ end
27
+
28
+ context "#parse" do
29
+
30
+ it "should parse ERB" do
31
+ Vendor::Template.parse("This is <%= foo %>", :foo => "awesome!").should == "This is awesome!"
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vendor::VendorFile::DSL do
4
+
5
+ end
@@ -0,0 +1,148 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vendor::VendorFile::Library::Base do
4
+
5
+ let(:lib) { Vendor::VendorFile::Library::Base.new(:name => "ExampleLib") }
6
+
7
+ let(:temp_path) { TempProject.create(File.join(PROJECT_RESOURCE_PATH, "UtilityApplication")) }
8
+ let(:project) { Vendor::XCode::Project.new(File.join(temp_path, "UtilityApplication.xcodeproj")) }
9
+
10
+ it "should have a name attribute" do
11
+ lib.name = "lib"
12
+
13
+ lib.name.should == "lib"
14
+ end
15
+
16
+ it "should have a target attribute" do
17
+ lib.targets = "Specs"
18
+
19
+ lib.targets.should == [ "Specs" ]
20
+ end
21
+
22
+ describe "#install" do
23
+
24
+ context "with an existing installation" do
25
+
26
+ it "should remove the existing group from XCode"
27
+
28
+ it "should add the new files to the project"
29
+
30
+ end
31
+
32
+ context "with a fresh installation" do
33
+
34
+ it "should add the new files to the project"
35
+
36
+ end
37
+
38
+ end
39
+
40
+ describe "#cache_path" do
41
+
42
+ it "should return the location where the lib is to be stored" do
43
+ lib.cache_path.should == File.join(Vendor.library_path, "base", "ExampleLib")
44
+ end
45
+
46
+ end
47
+
48
+ describe "#files" do
49
+
50
+ let(:no_manifest_or_vendorspec) { Vendor::VendorFile::Library::Base.new(:name => "BingMapsIOS", :require => "MapControl") }
51
+ let(:with_manifest) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-Manifest") }
52
+ let(:with_vendorspec) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-Vendorspec") }
53
+
54
+ before :each do
55
+ Vendor.stub(:library_path).and_return CACHED_VENDOR_RESOURCE_PATH
56
+ end
57
+
58
+ context "with no manifest or vendorspec" do
59
+
60
+ let(:files) { no_manifest_or_vendorspec.files }
61
+ let(:names) { files.map { |file| File.basename(file) } }
62
+
63
+ it "should return the correct files" do
64
+ # This test is a little ugly, but meh, the Bing maps library has a good selection
65
+ # of file types to test (including a ".a" and a ".bundle")
66
+ ["BingMaps.h", "BMEntity.h", "BMGeometry.h", "BMMapView.h", "BMMarker.h",
67
+ "BMMarkerView.h", "BMPushpinView.h", "BMReverseGeocoder.h", "BMTypes.h",
68
+ "BMUserLocation.h", "BingMaps.Resources.bundle", "libBingMaps.a"].each do |file|
69
+ names.should include(file)
70
+ end
71
+ end
72
+
73
+ it "should return files in the correct location" do
74
+ path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/BingMapsIOS/MapControl/")
75
+ regex_path = /^#{path}.+$/
76
+
77
+ files.each do |file|
78
+ file.should =~ regex_path
79
+ end
80
+ end
81
+
82
+ it "should return files that exist" do
83
+ files.each do |file|
84
+ File.exist?(file).should be_true
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ context "with a vendorspec" do
91
+
92
+ let(:files) { with_vendorspec.files }
93
+ let(:names) { files.map { |file| File.basename(file) } }
94
+
95
+ it "should return the correct files" do
96
+ ["DKBenchmark.h", "DKBenchmark.m"].each do |file|
97
+ names.should include(file)
98
+ end
99
+ end
100
+
101
+ it "should return files in the correct location" do
102
+ path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/DKBenchmark-Vendorspec/")
103
+ regex_path = /^#{path}.+$/
104
+
105
+ files.each do |file|
106
+ file.should =~ regex_path
107
+ end
108
+ end
109
+
110
+ it "should return files that exist" do
111
+ files.each do |file|
112
+ File.exist?(file).should be_true
113
+ end
114
+ end
115
+
116
+ end
117
+
118
+ context "with a manifest" do
119
+
120
+ let(:files) { with_manifest.files }
121
+ let(:names) { files.map { |file| File.basename(file) } }
122
+
123
+ it "should return the correct files" do
124
+ ["DKBenchmark.h", "DKBenchmark.m"].each do |file|
125
+ names.should include(file)
126
+ end
127
+ end
128
+
129
+ it "should return files in the correct location" do
130
+ path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/DKBenchmark-Manifest/data/")
131
+ regex_path = /^#{path}.+$/
132
+
133
+ files.each do |file|
134
+ file.should =~ regex_path
135
+ end
136
+ end
137
+
138
+ it "should return files that exist" do
139
+ files.each do |file|
140
+ File.exist?(file).should be_true
141
+ end
142
+ end
143
+
144
+ end
145
+
146
+ end
147
+
148
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vendor::VendorFile::Library::Git do
4
+
5
+ it "should default the tag to 'master'" do
6
+ lib = Vendor::VendorFile::Library::Git.new
7
+
8
+ lib.tag.should == "master"
9
+ end
10
+
11
+ it "setting a branch should set the tag" do
12
+ lib = Vendor::VendorFile::Library::Git.new(:branch => "develop")
13
+
14
+ lib.tag.should == "develop"
15
+ end
16
+
17
+ it "setting a ref should set the tag" do
18
+ lib = Vendor::VendorFile::Library::Git.new(:ref => "3g34g34")
19
+
20
+ lib.tag.should == "3g34g34"
21
+ end
22
+
23
+ describe "#cache_path" do
24
+
25
+ it "should use a hash for the repo url, instead of the name of the lib" do
26
+ lib = Vendor::VendorFile::Library::Git.new(:git => "git@github.com:/foo/bar")
27
+
28
+ lib.cache_path.should == File.join(Vendor.library_path, "git", "a77462af23c7ce7d5599c5428e41a11b")
29
+ end
30
+
31
+ end
32
+
33
+ end