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.
- data/.gitignore +1 -0
- data/Gemfile.lock +2 -4
- data/LICENSE +20 -0
- data/Readme.markdown +91 -10
- data/bin/vendor +5 -53
- data/lib/vendor.rb +37 -26
- data/lib/vendor/api.rb +1 -1
- data/lib/vendor/cli.rb +3 -15
- data/lib/vendor/cli/app.rb +140 -0
- data/lib/vendor/cli/auth.rb +6 -4
- data/lib/vendor/cli/console.rb +25 -0
- data/lib/vendor/extensions/string.rb +1 -1
- data/lib/vendor/template.rb +55 -0
- data/lib/vendor/templates/Vendorfile +3 -0
- data/lib/vendor/templates/vendorspec +15 -0
- data/lib/vendor/ui.rb +62 -0
- data/lib/vendor/vendor_file.rb +12 -0
- data/lib/vendor/vendor_file/dsl.rb +54 -0
- data/lib/vendor/vendor_file/library.rb +16 -0
- data/lib/vendor/vendor_file/library/base.rb +95 -0
- data/lib/vendor/vendor_file/library/git.rb +71 -0
- data/lib/vendor/vendor_file/library/local.rb +22 -0
- data/lib/vendor/vendor_file/library/remote.rb +18 -0
- data/lib/vendor/vendor_file/loader.rb +36 -0
- data/lib/vendor/vendor_file/source.rb +21 -0
- data/lib/vendor/vendor_spec.rb +11 -0
- data/lib/vendor/vendor_spec/builder.rb +10 -3
- data/lib/vendor/version.rb +1 -1
- data/lib/vendor/xcode.rb +10 -0
- data/lib/vendor/xcode/project.rb +132 -19
- data/lib/vendor/xcode/proxy.rb +28 -0
- data/lib/vendor/xcode/{object.rb → proxy/base.rb} +52 -25
- data/lib/vendor/xcode/proxy/pbx_build_file.rb +9 -0
- data/lib/vendor/xcode/proxy/pbx_container_item_proxy.rb +8 -0
- data/lib/vendor/xcode/proxy/pbx_file_reference.rb +39 -0
- data/lib/vendor/xcode/proxy/pbx_frameworks_build_phase.rb +9 -0
- data/lib/vendor/xcode/proxy/pbx_group.rb +35 -0
- data/lib/vendor/xcode/{objects → proxy}/pbx_native_target.rb +2 -2
- data/lib/vendor/xcode/{objects → proxy}/pbx_project.rb +2 -2
- data/lib/vendor/xcode/proxy/pbx_resources_build_phase.rb +7 -0
- data/lib/vendor/xcode/proxy/pbx_shell_script_build_phase.rb +7 -0
- data/lib/vendor/xcode/proxy/pbx_sources_build_phase.rb +9 -0
- data/lib/vendor/xcode/proxy/pbx_target_dependency.rb +7 -0
- data/lib/vendor/xcode/proxy/pbx_variant_group.rb +7 -0
- data/lib/vendor/xcode/proxy/xc_build_configuration.rb +7 -0
- data/lib/vendor/xcode/proxy/xc_configuration_list.rb +9 -0
- data/lib/vendor/xcode/proxy/xc_version_group.rb +7 -0
- data/spec/{vendor → lib/vendor}/api_spec.rb +0 -0
- data/spec/{vendor → lib/vendor}/cli/auth_spec.rb +1 -1
- data/spec/{vendor → lib/vendor}/config_spec.rb +1 -1
- data/spec/lib/vendor/template_spec.rb +36 -0
- data/spec/lib/vendor/vendor_file/dsl_spec.rb +5 -0
- data/spec/lib/vendor/vendor_file/library/base_spec.rb +148 -0
- data/spec/lib/vendor/vendor_file/library/git_spec.rb +33 -0
- data/spec/lib/vendor/vendor_file/library/local_spec.rb +19 -0
- data/spec/lib/vendor/vendor_file/library/remote_spec.rb +13 -0
- data/spec/lib/vendor/vendor_file/loader_spec.rb +102 -0
- data/spec/lib/vendor/vendor_file/source_spec.rb +17 -0
- data/spec/{vendor → lib/vendor}/vendor_spec/builder_spec.rb +0 -0
- data/spec/{vendor → lib/vendor}/vendor_spec/dsl_spec.rb +0 -0
- data/spec/{vendor → lib/vendor}/vendor_spec/loader_spec.rb +1 -1
- data/spec/lib/vendor/xcode/project_spec.rb +400 -0
- data/spec/{vendor/xcode/object_spec.rb → lib/vendor/xcode/proxy/base_spec.rb} +15 -3
- data/spec/lib/vendor/xcode/proxy/pbx_file_reference_spec.rb +25 -0
- data/spec/lib/vendor/xcode/proxy/pbx_group_spec.rb +27 -0
- data/spec/{vendor/xcode/objects → lib/vendor/xcode/proxy}/pbx_project_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -3
- data/spec/support/api_stubs.rb +4 -3
- data/spec/support/resources/Vendorfile +22 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/BICoreDataCache.mom +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/BMMapCalloutView.nib +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/Info.plist +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/bingmaps_logo.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/bingmaps_logo@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_selected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_selected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/blue_unselected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/callout_white.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/callout_white@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_selected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_selected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/green_unselected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/mapConfiguration.plist +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/me_dot_128.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/networkDefaults.plist +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_selected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_selected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/orange_unselected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_selected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_selected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/purple_unselected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_selected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_selected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/red_unselected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/shadow.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/shadow@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_selected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_selected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected_comp.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps.Resources.bundle/yellow_unselected_comp@2x.png +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMEntity.h +34 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMGeometry.h +67 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMMapView.h +159 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMMarker.h +41 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMMarkerView.h +47 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMPushpinView.h +31 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMReverseGeocoder.h +63 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMTypes.h +25 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BMUserLocation.h +26 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/BingMaps/BingMaps.h +210 -0
- data/spec/support/resources/cache/base/BingMapsIOS/MapControl/libBingMaps.a +0 -0
- data/spec/support/resources/cache/base/BingMapsIOS/README.html +8 -0
- data/spec/support/resources/cache/base/DKBenchmark-Manifest/data/DKBenchmark.h +18 -0
- data/spec/support/resources/cache/base/DKBenchmark-Manifest/data/DKBenchmark.m +73 -0
- data/spec/support/resources/cache/base/DKBenchmark-Manifest/vendor.json +1 -0
- data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.h +18 -0
- data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.m +73 -0
- data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.vendorspec +11 -0
- data/spec/support/resources/projects/TabBarWithUnitTests/TabBarWithUnitTests.xcodeproj/project.pbxproj +10 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication.xcodeproj/project.pbxproj +288 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAAppDelegate.h +15 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAAppDelegate.m +60 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAFlipsideViewController.h +23 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAFlipsideViewController.m +69 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAMainViewController.h +13 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UAMainViewController.m +75 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UtilityApplication-Info.plist +42 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/UtilityApplication-Prefix.pch +14 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/en.lproj/InfoPlist.strings +2 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/en.lproj/MainStoryboard.storyboard +90 -0
- data/spec/support/resources/projects/UtilityApplication/UtilityApplication/main.m +18 -0
- data/spec/support/resources/{files → source}/SecondViewController.h +0 -0
- data/spec/support/resources/{files → source}/SecondViewController.m +0 -0
- data/vendor.gemspec +0 -1
- metadata +254 -74
- data/LICENCE +0 -19
- data/lib/vendor/xcode/objects/pbx_build_file.rb +0 -9
- data/lib/vendor/xcode/objects/pbx_container_item_proxy.rb +0 -8
- data/lib/vendor/xcode/objects/pbx_file_reference.rb +0 -21
- data/lib/vendor/xcode/objects/pbx_frameworks_build_phase.rb +0 -9
- data/lib/vendor/xcode/objects/pbx_group.rb +0 -13
- data/lib/vendor/xcode/objects/pbx_resources_build_phase.rb +0 -7
- data/lib/vendor/xcode/objects/pbx_shell_script_build_phase.rb +0 -7
- data/lib/vendor/xcode/objects/pbx_sources_build_phase.rb +0 -9
- data/lib/vendor/xcode/objects/pbx_target_dependency.rb +0 -7
- data/lib/vendor/xcode/objects/pbx_variant_group.rb +0 -7
- data/lib/vendor/xcode/objects/xc_build_configuration.rb +0 -7
- data/lib/vendor/xcode/objects/xc_configuration_list.rb +0 -9
- data/spec/vendor/xcode/project_spec.rb +0 -211
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Vendor::VendorFile::Library::Local do
|
|
4
|
+
|
|
5
|
+
let(:lib) { Vendor::VendorFile::Library::Local.new(:path => "~/Development/something") }
|
|
6
|
+
|
|
7
|
+
it "should have a path attribute" do
|
|
8
|
+
lib.path.should == "~/Development/something"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe "#cache_path" do
|
|
12
|
+
|
|
13
|
+
it "should return the path expanded" do
|
|
14
|
+
lib.cache_path.should == File.expand_path("~/Development/something")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Vendor::VendorFile::Loader do
|
|
4
|
+
|
|
5
|
+
let (:loader) { Vendor::VendorFile::Loader.new }
|
|
6
|
+
|
|
7
|
+
context "#initialize" do
|
|
8
|
+
|
|
9
|
+
it "should create a dsl" do
|
|
10
|
+
loader.dsl.should be_kind_of(Vendor::VendorFile::DSL)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context "#load" do
|
|
16
|
+
|
|
17
|
+
before :all do
|
|
18
|
+
loader.load File.join(RESOURCE_PATH, "Vendorfile")
|
|
19
|
+
|
|
20
|
+
@sources = loader.dsl.sources
|
|
21
|
+
@libs = loader.dsl.libraries
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should load all the sources" do
|
|
25
|
+
@sources.map(&:uri).should == [ "http://vendorforge.com", "http://vendorage.com" ]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should load all the libraries" do
|
|
29
|
+
@libs.count.should == 13
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should load remote librarires" do
|
|
33
|
+
@libs[0].name.should == "Lib"
|
|
34
|
+
@libs[0].version.should be_nil
|
|
35
|
+
@libs[0].should be_kind_of(Vendor::VendorFile::Library::Remote)
|
|
36
|
+
|
|
37
|
+
@libs[1].name.should == "LibWithVersion"
|
|
38
|
+
@libs[1].version.should == "4.1"
|
|
39
|
+
@libs[1].should be_kind_of(Vendor::VendorFile::Library::Remote)
|
|
40
|
+
|
|
41
|
+
@libs[2].name.should == "LibWithGreaterThanVersion"
|
|
42
|
+
@libs[2].version.should == ">=1.0"
|
|
43
|
+
@libs[2].should be_kind_of(Vendor::VendorFile::Library::Remote)
|
|
44
|
+
|
|
45
|
+
@libs[3].name.should == "LibWithApproxVersionAndTarget"
|
|
46
|
+
@libs[3].version.should == "~>1.0"
|
|
47
|
+
@libs[3].targets.should == [ "something" ]
|
|
48
|
+
@libs[3].should be_kind_of(Vendor::VendorFile::Library::Remote)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should load all the git libraries" do
|
|
52
|
+
@libs[4].name.should == "LibWithGit"
|
|
53
|
+
@libs[4].uri.should == "https://github.com/keithpitt/vendor.git"
|
|
54
|
+
@libs[4].tag.should == "master"
|
|
55
|
+
@libs[4].require.should == "Some/Folder"
|
|
56
|
+
@libs[4].should be_kind_of(Vendor::VendorFile::Library::Git)
|
|
57
|
+
|
|
58
|
+
@libs[5].name.should == "LibWithGitAndBranch"
|
|
59
|
+
@libs[5].uri.should == "https://github.com/keithpitt/vendor.git"
|
|
60
|
+
@libs[5].tag.should == "1.4"
|
|
61
|
+
@libs[5].should be_kind_of(Vendor::VendorFile::Library::Git)
|
|
62
|
+
|
|
63
|
+
@libs[6].name.should == "LibWithGitAndTag"
|
|
64
|
+
@libs[6].uri.should == "https://github.com/keithpitt/vendor.git"
|
|
65
|
+
@libs[6].tag.should == "v0.13.4"
|
|
66
|
+
@libs[6].should be_kind_of(Vendor::VendorFile::Library::Git)
|
|
67
|
+
|
|
68
|
+
@libs[7].name.should == "LibWithGitAndRef"
|
|
69
|
+
@libs[7].uri.should == "https://github.com/keithpitt/vendor.git"
|
|
70
|
+
@libs[7].tag.should == "some-ref"
|
|
71
|
+
@libs[7].should be_kind_of(Vendor::VendorFile::Library::Git)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "should load all the local libraries" do
|
|
75
|
+
@libs[8].name.should == "LibWithPath"
|
|
76
|
+
@libs[8].path.should == "~/Development/Library/Path"
|
|
77
|
+
@libs[8].should be_kind_of(Vendor::VendorFile::Library::Local)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should load all the libraries with a specific target" do
|
|
81
|
+
@libs[9].name.should == "LibWithSpecificTarget"
|
|
82
|
+
@libs[9].version.should be_nil
|
|
83
|
+
@libs[9].targets.should == [ "UISpecs" ]
|
|
84
|
+
|
|
85
|
+
@libs[10].name.should == "LibWithMultipleTarget"
|
|
86
|
+
@libs[10].version.should be_nil
|
|
87
|
+
@libs[10].targets.should == [ "Specs", "UISpecs" ]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "should load all libraries within a target" do
|
|
91
|
+
@libs[11].name.should == "SpecLib1"
|
|
92
|
+
@libs[11].version.should be_nil
|
|
93
|
+
@libs[11].targets.should == [ "Specs", "UISpecs" ]
|
|
94
|
+
|
|
95
|
+
@libs[12].name.should == "SpecLib2"
|
|
96
|
+
@libs[12].version.should be_nil
|
|
97
|
+
@libs[12].targets.should == [ "Specs", "UISpecs" ]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Vendor::VendorFile::Source do
|
|
4
|
+
|
|
5
|
+
it "should allow you to set a uri via a string" do
|
|
6
|
+
source = Vendor::VendorFile::Source.new("http://google.com")
|
|
7
|
+
|
|
8
|
+
source.uri.should == "http://google.com"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should allow you to set a uri via a symbol" do
|
|
12
|
+
source = Vendor::VendorFile::Source.new(:vendorforge)
|
|
13
|
+
|
|
14
|
+
source.uri.should == "http://vendorforge.com"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,400 @@
|
|
|
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
|
+
it "should not be dirty" do
|
|
30
|
+
@project.dirty?.should be_false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "TabBarWithUnitTests.xcodeproj" do
|
|
36
|
+
|
|
37
|
+
it "should parse and load all the objects" do
|
|
38
|
+
project = Vendor::XCode::Project.new(File.join(PROJECT_RESOURCE_PATH, "TabBarWithUnitTests/TabBarWithUnitTests.xcodeproj"))
|
|
39
|
+
|
|
40
|
+
project.objects.length.should == 78
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context "#name" do
|
|
48
|
+
|
|
49
|
+
it "should have the correct project name" do
|
|
50
|
+
@project.name.should == "ProjectWithSpecs"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context "#find_object" do
|
|
56
|
+
|
|
57
|
+
it "should return the object mapped to the id" do
|
|
58
|
+
@project.find_object('5378747F140109AE00D9B746').should == @project.root_object
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context "#find_target" do
|
|
64
|
+
|
|
65
|
+
it "should return the target" do
|
|
66
|
+
@project.find_target('Specs').should == @project.root_object.targets.first
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "should return nil if one cannot be found" do
|
|
70
|
+
@project.find_target('Ruut').should be_nil
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
context "#find_group" do
|
|
76
|
+
|
|
77
|
+
context 'when finding an existing group' do
|
|
78
|
+
|
|
79
|
+
it "should return the group" do
|
|
80
|
+
@project.find_group("Specs/Supporting Files").should == @project.root_object.main_group.children.first.children.first
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
context "when looking for a group that doens't exist" do
|
|
86
|
+
|
|
87
|
+
it "should return nil" do
|
|
88
|
+
@project.find_group("Does/Not/Exist").should == nil
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
context '#create_group' do
|
|
96
|
+
|
|
97
|
+
context 'when finding an existing group' do
|
|
98
|
+
|
|
99
|
+
it "should return the group" do
|
|
100
|
+
@project.create_group("Specs/Supporting Files").should == @project.root_object.main_group.children.first.children.first
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
context 'when creating a group' do
|
|
106
|
+
|
|
107
|
+
before :each do
|
|
108
|
+
@group = @project.create_group("Specs/Supporting Files/Something/Goes Inside/Here")
|
|
109
|
+
|
|
110
|
+
@supporting_files_group = @project.root_object.main_group.children.first.children.first
|
|
111
|
+
@something_group = @supporting_files_group.children.last
|
|
112
|
+
@inside_group = @something_group.children.last
|
|
113
|
+
@here_group = @inside_group.children.last
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it "should mark the project as dirty" do
|
|
117
|
+
@project.dirty.should be_true
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'should create it in the correct location' do
|
|
121
|
+
@here_group.should_not be_nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'should give the new groups the right names' do
|
|
125
|
+
@something_group.name.should == "Something"
|
|
126
|
+
@inside_group.name.should == "Goes Inside"
|
|
127
|
+
@here_group.name.should == "Here"
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
it 'should give the new groups the correct source tree property' do
|
|
131
|
+
@here_group.source_tree.should == "<group>"
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'should give the new groups an ID' do
|
|
135
|
+
@here_group.source_tree.should_not be_nil
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
it 'should give the new groups a valid ISA' do
|
|
139
|
+
@here_group.isa.should == 'PBXGroup'
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
context "#remove_group" do
|
|
147
|
+
|
|
148
|
+
before :each do
|
|
149
|
+
@temp_path = TempProject.create(File.join(PROJECT_RESOURCE_PATH, "UtilityApplication"))
|
|
150
|
+
@temp_project = Vendor::XCode::Project.new(File.join(@temp_path, "UtilityApplication.xcodeproj"))
|
|
151
|
+
|
|
152
|
+
@group = @temp_project.find_group("UtilityApplication/Supporting Files")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
context "removing an existing group" do
|
|
156
|
+
|
|
157
|
+
it "should mark the project as dirty" do
|
|
158
|
+
remove_group
|
|
159
|
+
|
|
160
|
+
@temp_project.dirty.should be_true
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it "should return true" do
|
|
164
|
+
remove_group.should be_true
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
it "should remove the group" do
|
|
168
|
+
remove_group
|
|
169
|
+
|
|
170
|
+
@temp_project.find_group("UtilityApplication/Supporting Files").should be_nil
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
it "should remove the children from the group" do
|
|
174
|
+
remove_group
|
|
175
|
+
|
|
176
|
+
@temp_project.find_group("UtilityApplication").children.map(&:id).should_not include(@group.id)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it "should remove the files from the file system" do
|
|
180
|
+
file = File.join(@temp_path, "UtilityApplication", "main.m")
|
|
181
|
+
File.exist?(file).should be_true
|
|
182
|
+
|
|
183
|
+
remove_group
|
|
184
|
+
File.exist?(file).should be_false
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
it "should remove the files from the build targets"
|
|
188
|
+
|
|
189
|
+
private
|
|
190
|
+
|
|
191
|
+
def remove_group
|
|
192
|
+
@temp_project.remove_group("UtilityApplication/Supporting Files")
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
context "removing a group that doesn't exist" do
|
|
198
|
+
|
|
199
|
+
subject { @temp_project.remove_group("Doest/Not/Exist") }
|
|
200
|
+
|
|
201
|
+
it "should return false" do
|
|
202
|
+
subject.should be_false
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
context "#remove_file"
|
|
210
|
+
|
|
211
|
+
context '#add_file' do
|
|
212
|
+
|
|
213
|
+
let(:first_file) { File.join(SOURCE_RESOURCE_PATH, "SecondViewController.h") }
|
|
214
|
+
let(:second_file) { File.join(SOURCE_RESOURCE_PATH, "SecondViewController.m") }
|
|
215
|
+
|
|
216
|
+
before :each do
|
|
217
|
+
@temp_path = TempProject.create(File.join(PROJECT_RESOURCE_PATH, "ProjectWithSpecs"))
|
|
218
|
+
@temp_project = Vendor::XCode::Project.new(File.join(@temp_path, "ProjectWithSpecs.xcodeproj"))
|
|
219
|
+
|
|
220
|
+
@target = @temp_project.find_target("Specs")
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
context "with a source tree of :group" do
|
|
224
|
+
|
|
225
|
+
before :each do
|
|
226
|
+
@first_file_added = @temp_project.add_file :targets => [ @target ], :file => first_file,
|
|
227
|
+
:path => "Controllers/SecondViewController", :source_tree => :group
|
|
228
|
+
@second_file_added = @temp_project.add_file :targets => [ @target ], :file => second_file,
|
|
229
|
+
:path => "Controllers/SecondViewController", :source_tree => :group
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
it "should mark the project as dirty" do
|
|
233
|
+
@temp_project.dirty.should be_true
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
it 'should add the file to the filesystem' do
|
|
237
|
+
new_first_path = File.join(@temp_path, "Controllers", "SecondViewController", "SecondViewController.h")
|
|
238
|
+
new_second_path = File.join(@temp_path, "Controllers", "SecondViewController", "SecondViewController.m")
|
|
239
|
+
|
|
240
|
+
File.exists?(new_first_path).should be_true
|
|
241
|
+
File.exists?(new_second_path).should be_true
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
it 'should add it as the correct file type' do
|
|
245
|
+
@first_file_added.last_known_file_type.should == "sourcecode.c.h"
|
|
246
|
+
@second_file_added.last_known_file_type.should == "sourcecode.c.objc"
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
it 'should add the files with the correct path' do
|
|
250
|
+
@first_file_added.path.should == "SecondViewController.h"
|
|
251
|
+
@second_file_added.path.should == "SecondViewController.m"
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
it 'should have the correct ISA' do
|
|
255
|
+
@first_file_added.isa.should == "PBXFileReference"
|
|
256
|
+
@second_file_added.isa.should == "PBXFileReference"
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
it 'should have an ID' do
|
|
260
|
+
@first_file_added.id.should_not be_nil
|
|
261
|
+
@second_file_added.id.should_not be_nil
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
it 'should add it to the correct group' do
|
|
265
|
+
group = @temp_project.create_group("Controllers/SecondViewController")
|
|
266
|
+
|
|
267
|
+
group.children[0].should == @first_file_added
|
|
268
|
+
group.children[1].should == @second_file_added
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
it 'should still save' do
|
|
272
|
+
@temp_project.save
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
it 'should add it to the build targets specified'
|
|
276
|
+
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
context "with a source tree of :absoulte" do
|
|
280
|
+
|
|
281
|
+
before :each do
|
|
282
|
+
@first_file_added = @temp_project.add_file :targets => [ @target ], :file => first_file,
|
|
283
|
+
:path => "Controllers/SecondViewController", :source_tree => :absolute
|
|
284
|
+
@second_file_added = @temp_project.add_file :targets => [ @target ], :file => second_file,
|
|
285
|
+
:path => "Controllers/SecondViewController", :source_tree => :absolute
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
it "should mark the project as dirty" do
|
|
289
|
+
@temp_project.dirty.should be_true
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
it 'should add it as the correct file type' do
|
|
293
|
+
@first_file_added.last_known_file_type.should == "sourcecode.c.h"
|
|
294
|
+
@second_file_added.last_known_file_type.should == "sourcecode.c.objc"
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
it 'should add the files with the correct path' do
|
|
299
|
+
@first_file_added.path.should == first_file
|
|
300
|
+
@second_file_added.path.should == second_file
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
it 'should add the files with the correct names' do
|
|
304
|
+
@first_file_added.name.should == "SecondViewController.h"
|
|
305
|
+
@second_file_added.name.should == "SecondViewController.m"
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
it 'should have the correct ISA' do
|
|
309
|
+
@first_file_added.isa.should == "PBXFileReference"
|
|
310
|
+
@second_file_added.isa.should == "PBXFileReference"
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
it 'should have an ID' do
|
|
314
|
+
@first_file_added.id.should_not be_nil
|
|
315
|
+
@second_file_added.id.should_not be_nil
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
it 'should add it to the correct group' do
|
|
319
|
+
group = @temp_project.create_group("Controllers/SecondViewController")
|
|
320
|
+
|
|
321
|
+
group.children[0].should == @first_file_added
|
|
322
|
+
group.children[1].should == @second_file_added
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
it 'should still save' do
|
|
326
|
+
@temp_project.save
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
it 'should add it to the build targets specified'
|
|
330
|
+
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
context 'should raise an error if' do
|
|
334
|
+
|
|
335
|
+
it 'there is no path set' do
|
|
336
|
+
expect do
|
|
337
|
+
@temp_project.add_file :targets => "Specs", :file => first_file
|
|
338
|
+
end.to raise_exception(StandardError, "Missing :path option")
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
it 'there is no file set' do
|
|
342
|
+
expect do
|
|
343
|
+
@temp_project.add_file :targets => "Specs", :path => "ASD"
|
|
344
|
+
end.to raise_exception(StandardError, "Missing :file option")
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
it "the file doesn't exist" do
|
|
348
|
+
expect do
|
|
349
|
+
@temp_project.add_file :targets => "Ruut", :file => "foo",
|
|
350
|
+
:path => "Controllers/SecondViewController", :source_tree => :group
|
|
351
|
+
end.to raise_exception(StandardError, "Could not find file `foo`")
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
it "you don't pass a source tree option" do
|
|
355
|
+
expect do
|
|
356
|
+
@temp_project.add_file :targets => "Specs", :path => "ASD", :file => "foo"
|
|
357
|
+
end.to raise_exception(StandardError, "Missing :source_tree option")
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
it "the source tree option is invalid" do
|
|
361
|
+
expect do
|
|
362
|
+
@temp_project.add_file :targets => "Specs", :path => "ASD",
|
|
363
|
+
:file => first_file, :source_tree => :foo
|
|
364
|
+
end.to raise_exception(StandardError, "Invalid :source_tree option `foo`")
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
context "#valid?" do
|
|
372
|
+
|
|
373
|
+
it "should return true the plist format is valid" do
|
|
374
|
+
@project.valid?.should be_true
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
it "should raise an error if there is an invalid format" do
|
|
378
|
+
@project.should_receive(:to_ascii_plist).and_return { "asd; { f5him" }
|
|
379
|
+
|
|
380
|
+
@project.valid?.should be_false
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
context "#to_ascii_plist" do
|
|
386
|
+
|
|
387
|
+
it "should convert it to the correct format" do
|
|
388
|
+
# Reload the project from the filesystem
|
|
389
|
+
@project.reload
|
|
390
|
+
|
|
391
|
+
contents = File.readlines(File.join(PROJECT_RESOURCE_PATH, "ProjectWithSpecs/ProjectWithSpecs.xcodeproj", "project.pbxproj")).join("\n")
|
|
392
|
+
original = Vendor::Plist.parse_ascii(contents)
|
|
393
|
+
saved = Vendor::Plist.parse_ascii(@project.to_ascii_plist)
|
|
394
|
+
|
|
395
|
+
original.should == saved
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
end
|