vendor 0.0.4 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/CHANGELOG.md +22 -0
  2. data/Gemfile.lock +9 -1
  3. data/Guardfile +12 -0
  4. data/LICENSE +2 -0
  5. data/Readme.markdown +39 -23
  6. data/TODO.md +26 -0
  7. data/VERSION +1 -0
  8. data/lib/vendor.rb +6 -0
  9. data/lib/vendor/api.rb +61 -7
  10. data/lib/vendor/cli/app.rb +4 -4
  11. data/lib/vendor/cli/console.rb +7 -0
  12. data/lib/vendor/spec.rb +98 -0
  13. data/lib/vendor/templates/Vendorfile +3 -1
  14. data/lib/vendor/templates/vendorspec +15 -10
  15. data/lib/vendor/vendor_file.rb +5 -4
  16. data/lib/vendor/vendor_file/dependency_graph.rb +135 -0
  17. data/lib/vendor/vendor_file/dsl.rb +2 -0
  18. data/lib/vendor/vendor_file/library/base.rb +178 -29
  19. data/lib/vendor/vendor_file/library/git.rb +5 -1
  20. data/lib/vendor/vendor_file/library/local.rb +11 -1
  21. data/lib/vendor/vendor_file/library/remote.rb +134 -2
  22. data/lib/vendor/vendor_file/loader.rb +13 -11
  23. data/lib/vendor/vendor_spec/builder.rb +4 -7
  24. data/lib/vendor/version.rb +172 -1
  25. data/lib/vendor/xcode/project.rb +213 -4
  26. data/lib/vendor/xcode/proxy.rb +1 -0
  27. data/lib/vendor/xcode/proxy/pbx_frameworks_build_phase.rb +6 -0
  28. data/lib/vendor/xcode/proxy/pbx_reference_proxy.rb +7 -0
  29. data/lib/vendor/xcode/proxy/pbx_resources_build_phase.rb +8 -0
  30. data/lib/vendor/xcode/proxy/pbx_shell_script_build_phase.rb +8 -0
  31. data/lib/vendor/xcode/proxy/pbx_sources_build_phase.rb +6 -0
  32. data/spec/lib/vendor/api_spec.rb +54 -0
  33. data/spec/lib/vendor/spec_spec.rb +121 -0
  34. data/spec/lib/vendor/vendor_file/dependency_graph_spec.rb +129 -0
  35. data/spec/lib/vendor/vendor_file/library/base_spec.rb +174 -14
  36. data/spec/lib/vendor/vendor_file/library/remote_spec.rb +154 -4
  37. data/spec/lib/vendor/vendor_file/loader_spec.rb +4 -2
  38. data/spec/lib/vendor/vendor_spec/builder_spec.rb +2 -2
  39. data/spec/lib/vendor/version_spec.rb +168 -0
  40. data/spec/lib/vendor/xcode/project_spec.rb +175 -4
  41. data/spec/lib/vendor_spec.rb +15 -0
  42. data/spec/spec_helper.rb +3 -2
  43. data/spec/support/api_stubs.rb +57 -0
  44. data/spec/support/resources/cache/base/{DKBenchmark-Manifest → DKBenchmark-0.1-Manifest}/data/DKBenchmark.h +0 -0
  45. data/spec/support/resources/cache/base/{DKBenchmark-Manifest → DKBenchmark-0.1-Manifest}/data/DKBenchmark.m +0 -0
  46. data/spec/support/resources/cache/base/DKBenchmark-0.1-Manifest/vendor.json +1 -0
  47. data/spec/support/resources/cache/base/{DKBenchmark-Vendorspec → DKBenchmark-0.1-Nothing}/DKBenchmark.h +0 -0
  48. data/spec/support/resources/cache/base/{DKBenchmark-Vendorspec → DKBenchmark-0.1-Nothing}/DKBenchmark.m +0 -0
  49. data/spec/support/resources/cache/base/DKBenchmark-0.1-Nothing/DKBenchmark.vendorspec +16 -0
  50. data/spec/support/resources/cache/base/DKBenchmark-0.1-Vendorspec/DKBenchmark.h +18 -0
  51. data/spec/support/resources/cache/base/DKBenchmark-0.1-Vendorspec/DKBenchmark.m +73 -0
  52. data/spec/support/resources/cache/base/DKBenchmark-0.1-Vendorspec/DKBenchmark.vendorspec +24 -0
  53. data/spec/support/resources/projects/MultipleTargets/MultipleTargets.xcodeproj/project.pbxproj +624 -0
  54. data/spec/support/resources/projects/RestKitProject/RestKitProject.xcodeproj/project.pbxproj +479 -0
  55. data/spec/support/resources/projects/UtilityApplication/UtilityApplication.xcodeproj/project.pbxproj +16 -7
  56. data/spec/support/resources/vendors/DKBenchmark/DKBenchmark.vendorspec +24 -8
  57. data/spec/support/resources/vendors/DKBenchmarkUnsafe/DKBenchmark.vendorspec +17 -8
  58. data/vendor.gemspec +4 -2
  59. metadata +93 -39
  60. data/lib/vendor/vendor_spec/dsl.rb +0 -39
  61. data/lib/vendor/vendor_spec/loader.rb +0 -23
  62. data/spec/lib/vendor/vendor_spec/dsl_spec.rb +0 -67
  63. data/spec/lib/vendor/vendor_spec/loader_spec.rb +0 -41
  64. data/spec/support/resources/cache/base/DKBenchmark-Manifest/vendor.json +0 -1
  65. data/spec/support/resources/cache/base/DKBenchmark-Vendorspec/DKBenchmark.vendorspec +0 -11
@@ -17,6 +17,7 @@ module Vendor
17
17
  autoload :PBXTargetDependency, "vendor/xcode/proxy/pbx_target_dependency"
18
18
  autoload :PBXVariantGroup, "vendor/xcode/proxy/pbx_variant_group"
19
19
  autoload :PBXShellScriptBuildPhase, "vendor/xcode/proxy/pbx_shell_script_build_phase"
20
+ autoload :PBXReferenceProxy, "vendor/xcode/proxy/pbx_reference_proxy"
20
21
  autoload :XCBuildConfiguration, "vendor/xcode/proxy/xc_build_configuration"
21
22
  autoload :XCConfigurationList, "vendor/xcode/proxy/xc_configuration_list"
22
23
  autoload :XCVersionGroup, "vendor/xcode/proxy/xc_version_group"
@@ -4,6 +4,12 @@ module Vendor::XCode::Proxy
4
4
 
5
5
  reference :files
6
6
 
7
+ private
8
+
9
+ def after_initialize
10
+ files.each { |child| child.parent = self }
11
+ end
12
+
7
13
  end
8
14
 
9
15
  end
@@ -0,0 +1,7 @@
1
+ module Vendor::XCode::Proxy
2
+
3
+ class PBXReferenceProxy < Vendor::XCode::Proxy::Base
4
+
5
+ end
6
+
7
+ end
@@ -2,6 +2,14 @@ module Vendor::XCode::Proxy
2
2
 
3
3
  class PBXResourcesBuildPhase < Vendor::XCode::Proxy::Base
4
4
 
5
+ reference :files
6
+
7
+ private
8
+
9
+ def after_initialize
10
+ files.each { |child| child.parent = self }
11
+ end
12
+
5
13
  end
6
14
 
7
15
  end
@@ -2,6 +2,14 @@ module Vendor::XCode::Proxy
2
2
 
3
3
  class PBXShellScriptBuildPhase < Vendor::XCode::Proxy::Base
4
4
 
5
+ reference :files
6
+
7
+ private
8
+
9
+ def after_initialize
10
+ files.each { |child| child.parent = self }
11
+ end
12
+
5
13
  end
6
14
 
7
15
  end
@@ -4,6 +4,12 @@ module Vendor::XCode::Proxy
4
4
 
5
5
  reference :files
6
6
 
7
+ private
8
+
9
+ def after_initialize
10
+ files.each { |child| child.parent = self }
11
+ end
12
+
7
13
  end
8
14
 
9
15
  end
@@ -22,4 +22,58 @@ describe Vendor::API do
22
22
 
23
23
  end
24
24
 
25
+ context "#meta" do
26
+
27
+ it "should download information about the vendor in JSON format" do
28
+ json = Vendor::API.meta("DKBenchmark")
29
+
30
+ json["name"].should == "DKBenchmark"
31
+ json["description"].should == "Easy benchmarking in Objective-C using blocks"
32
+ json["release"].should == "0.2"
33
+ json["versions"].first[0].should == "0.3.alpha1"
34
+ end
35
+
36
+ it "should download information with vendors that had odd names" do
37
+ json = Vendor::API.meta("DKBenchmark!! With Some Crazy #Number Name!")
38
+
39
+ json["name"].should == "DKBenchmark!! With Some Crazy #Number Name!"
40
+ end
41
+
42
+ it "should raise an error if the server returns a non 200" do
43
+ expect do
44
+ Vendor::API.meta("WithAnError")
45
+ end.should raise_error(Vendor::API::Error, "Could not complete request. Server returned a status code of 500")
46
+ end
47
+
48
+ it "should raise an error if the vendor cannot be found" do
49
+ expect do
50
+ Vendor::API.meta("DoesNotExist")
51
+ end.should raise_error(Vendor::API::Error, "Could not find a valid vendor 'DoesNotExist'")
52
+ end
53
+
54
+ end
55
+
56
+ context "#download" do
57
+
58
+ it "should return a file with the downloaded contents" do
59
+ file = Vendor::API.download("DKBenchmark", "0.1")
60
+
61
+ file.should be_kind_of(File)
62
+ File.read(file.path).should == File.read(File.join(PACKAGED_VENDOR_PATH, "DKBenchmark-0.1.vendor"))
63
+ end
64
+
65
+ it "should raise an error if the server returns a non 200" do
66
+ expect do
67
+ Vendor::API.download("LibWithError", "0.1")
68
+ end.should raise_error(Vendor::API::Error, "Could not complete request. Server returned a status code of 500")
69
+ end
70
+
71
+ it "should raise an error if the vendor cannot be found" do
72
+ expect do
73
+ Vendor::API.download("DKBenchmark", "0.does.not.exist")
74
+ end.should raise_error(Vendor::API::Error, "Could not find a valid version for 'DKBenchmark' that matches '0.does.not.exist'")
75
+ end
76
+
77
+ end
78
+
25
79
  end
@@ -0,0 +1,121 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vendor::Spec do
4
+
5
+ let! (:spec) { Vendor::Spec.new }
6
+
7
+ context "#load" do
8
+
9
+ let(:spec_file) { File.join(VENDOR_RESOURCE_PATH, "DKBenchmark", "DKBenchmark.vendorspec") }
10
+
11
+ it "should return the loaded spec" do
12
+ Vendor::Spec.load(spec_file).should be_kind_of(Vendor::Spec)
13
+ end
14
+
15
+ it "should switch back in and out of the current directory using Dir.chdir while evaling the spec" do
16
+ current_dir = Dir.pwd
17
+ Dir.should_receive(:chdir).with(File.join(VENDOR_RESOURCE_PATH, "DKBenchmark")).ordered
18
+ Dir.should_receive(:chdir).with(current_dir).ordered
19
+
20
+ Vendor::Spec.load(spec_file).should be_kind_of(Vendor::Spec)
21
+ end
22
+
23
+ end
24
+
25
+ context '#validate' do
26
+
27
+ before :each do
28
+ spec.name = "Vendor"
29
+ spec.files = "Something"
30
+ spec.email = "foo@bar.com"
31
+ spec.version = "0.1"
32
+ end
33
+
34
+ it 'should thorw an error if no name is defined' do
35
+ expect do
36
+ spec.name = nil
37
+ spec.validate!
38
+ end.should raise_error("Specification is missing the `name` option")
39
+ end
40
+
41
+ it 'should thorw an error if no email is defined' do
42
+ expect do
43
+ spec.email = nil
44
+ spec.validate!
45
+ end.should raise_error("Specification is missing the `email` option")
46
+ end
47
+
48
+ it 'should thorw an error if no version is defined' do
49
+ expect do
50
+ spec.version = nil
51
+ spec.validate!
52
+ end.should raise_error("Specification is missing the `version` option")
53
+ end
54
+
55
+ it 'should thorw an error if no files are defined' do
56
+ expect do
57
+ spec.files = nil
58
+ spec.validate!
59
+ end.should raise_error("Specification is missing the `files` option")
60
+ end
61
+
62
+ end
63
+
64
+ context "#framework" do
65
+
66
+ it "should add the framework to the frameworks property" do
67
+ spec.framework "Foundation.framework"
68
+
69
+ spec.frameworks.should == [ "Foundation.framework" ]
70
+ end
71
+
72
+ end
73
+
74
+ context "#build_setting" do
75
+
76
+ it "should set a build setting" do
77
+ spec.build_setting "SOMETHING", "else"
78
+
79
+ spec.build_settings.should == [ [ "SOMETHING", "else" ] ]
80
+ end
81
+
82
+ it "should allow you to remap names with a symbol" do
83
+ spec.build_setting :other_linker_flags, "-ObjC"
84
+
85
+ spec.build_settings.should == [ [ "OTHER_LDFLAGS", "-ObjC" ] ]
86
+ end
87
+
88
+ it "should raise an error if a mapping for the symbol doesn't exist" do
89
+ expect do
90
+ spec.build_setting :blah, "-ObjC"
91
+ end.should raise_error(StandardError)
92
+ end
93
+
94
+ it "should turn the value to YES if you pass true" do
95
+ spec.build_setting :other_linker_flags, true
96
+ spec.build_setting :other_linker_flags, false
97
+
98
+ spec.build_settings.should == [ [ "OTHER_LDFLAGS", "YES" ], [ "OTHER_LDFLAGS", "NO" ] ]
99
+ end
100
+
101
+ end
102
+
103
+ context '#to_json' do
104
+
105
+ it 'should return the vendor spec as a JSON string' do
106
+ spec.name = "foo"
107
+ spec.framework "Foundation.framework"
108
+ spec.build_setting :other_linker_flags, true
109
+ spec.dependency "JSONKit", "0.5"
110
+
111
+ json = JSON.parse(spec.to_json)
112
+
113
+ json["name"].should == "foo"
114
+ json["dependencies"].should == [ [ "JSONKit", "0.5" ] ]
115
+ json["frameworks"].should == [ "Foundation.framework" ]
116
+ json["build_settings"].should == [ [ "OTHER_LDFLAGS", "YES" ] ]
117
+ end
118
+
119
+ end
120
+
121
+ end
@@ -0,0 +1,129 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vendor::VendorFile::DependencyGraph do
4
+
5
+ let(:graph) { Vendor::VendorFile::DependencyGraph.new }
6
+
7
+ let(:asihttprequest) { Vendor::VendorFile::Library::Remote.new(:name => "ASIHTTPRequest", :version => "0.5") }
8
+ let(:dksupport) { Vendor::VendorFile::Library::Local.new(:name => "DKSupport", :version => "0.2") }
9
+ let(:dkapirequest) { Vendor::VendorFile::Library::Remote.new(:name => "DKAPIRequest", :version => "0.3") }
10
+ let(:dkcoredata) { Vendor::VendorFile::Library::Remote.new(:name => "DKCoreData", :version => "~> 1.5") }
11
+ let(:dkcoredata_local) { Vendor::VendorFile::Library::Local.new(:name => "DKCoreData", :version => "1.5.3") }
12
+ let(:dkrest) { Vendor::VendorFile::Library::Remote.new(:name => "DKRest", :version => "~> 0.1") }
13
+ let(:versionless_git) { Vendor::VendorFile::Library::Git.new(:name => "VersionlessGit") }
14
+ let(:versionless_local) { Vendor::VendorFile::Library::Local.new(:name => "VersionlessLocal") }
15
+
16
+ let(:dkbenchmark1) { Vendor::VendorFile::Library::Remote.new(:name => "DKBenchmark", :version => "~> 0.1") }
17
+ let(:dkbenchmark2) { Vendor::VendorFile::Library::Remote.new(:name => "DKBenchmark", :version => "<= 0.1") }
18
+ let(:dkbenchmark3) { Vendor::VendorFile::Library::Remote.new(:name => "DKBenchmark", :version => "<= 0.0.1") }
19
+
20
+ before :each do
21
+ asihttprequest.parent = dkapirequest
22
+ asihttprequest.stub!(:dependencies).and_return([ dkapirequest, dkbenchmark1 ])
23
+ dksupport.stub!(:dependencies).and_return([ dkapirequest ])
24
+ dkapirequest.stub!(:dependencies).and_return([ asihttprequest, dkbenchmark2 ])
25
+ dkcoredata.stub!(:dependencies).and_return([ dksupport, dkbenchmark3 ])
26
+ dkrest.stub!(:dependencies).and_return([ dksupport, dkapirequest, dkcoredata ])
27
+ dkcoredata_local.stub!(:dependencies).and_return([ ])
28
+ versionless_git.stub!(:dependencies).and_return([ ])
29
+ versionless_local.stub!(:dependencies).and_return([ ])
30
+ dkbenchmark1.stub!(:dependencies).and_return([ ])
31
+ dkbenchmark2.stub!(:dependencies).and_return([ ])
32
+ dkbenchmark3.stub!(:dependencies).and_return([ ])
33
+ end
34
+
35
+ context 'with a valid graph' do
36
+
37
+ before :each do
38
+ graph.libraries = [ dkrest, versionless_local, versionless_git, dkcoredata_local ]
39
+ end
40
+
41
+ context "#version_conflicts?" do
42
+
43
+ it "should return false" do
44
+ graph.version_conflicts?.should be_false
45
+ end
46
+
47
+ it "should poplate the list libraries_to_install property" do
48
+ graph.libraries_to_install.should be_nil
49
+ graph.version_conflicts?
50
+
51
+ libraries_to_install = graph.libraries_to_install
52
+
53
+ libraries_to_install.first[0].name.should == "ASIHTTPRequest"
54
+ libraries_to_install.first[0].version.should == "0.5"
55
+ libraries_to_install.first[1].should == [ :all ]
56
+
57
+ all = libraries_to_install.map { |x| x[0].name }
58
+ all.should == ["ASIHTTPRequest", "DKAPIRequest", "DKBenchmark", "DKCoreData", "DKRest", "DKSupport", "VersionlessGit", "VersionlessLocal"]
59
+ end
60
+
61
+ end
62
+
63
+ context "#dependency_graph" do
64
+
65
+ before :each do
66
+ @graph, @map = graph.dependency_graph
67
+ end
68
+
69
+ it "should return a graph" do
70
+ @graph.should == [
71
+ ["DKRest ~> 0.1", [
72
+ ["DKSupport 0.2", [
73
+ ["DKAPIRequest 0.3", [
74
+ ["ASIHTTPRequest 0.5", [
75
+ ["DKBenchmark ~> 0.1", []]
76
+ ]
77
+ ],
78
+ ["DKBenchmark <= 0.1", []]
79
+ ]]
80
+ ]],
81
+ ["DKCoreData ~> 1.5", [
82
+ ["DKBenchmark <= 0.0.1", []]
83
+ ]]
84
+ ]],
85
+ ["VersionlessLocal", []],
86
+ ["VersionlessGit", []],
87
+ ["DKCoreData 1.5.3", []],
88
+ ]
89
+ end
90
+
91
+ it "should return a map" do
92
+ @map.keys.sort.should == ["ASIHTTPRequest", "DKAPIRequest", "DKBenchmark", "DKCoreData", "DKRest", "DKSupport", "VersionlessGit", "VersionlessLocal"]
93
+ end
94
+
95
+ it "should return each version present in the map" do
96
+ @map["ASIHTTPRequest"].map(&:version).should == [ "0.5" ]
97
+ @map["DKAPIRequest"].map(&:version).should == [ "0.3" ]
98
+ @map["DKCoreData"].map(&:version).should == [ "1.5", "1.5.3" ]
99
+ @map["DKRest"].map(&:version).should == [ "0.1" ]
100
+ @map["DKSupport"].map(&:version).should == [ "0.2" ]
101
+ end
102
+
103
+ end
104
+
105
+ end
106
+
107
+ context 'with an invalid graph' do
108
+
109
+ let(:new_asihttprequest) { Vendor::VendorFile::Library::Remote.new(:name => "ASIHTTPRequest", :version => "0.6") }
110
+
111
+ before :each do
112
+ new_asihttprequest.stub!(:dependencies).and_return([ dkapirequest ])
113
+
114
+ graph.libraries = [ dkrest, new_asihttprequest ]
115
+ end
116
+
117
+ it "should raise an error and exit" do
118
+ Vendor.ui.should_receive(:error).with("Multiple versions detected for ASIHTTPRequest (0.6, 0.5)").once.ordered
119
+ Vendor.ui.should_receive(:error).with(" ASIHTTPRequest 0.5 is required by DKAPIRequest 0.3").once.ordered
120
+ Vendor.ui.should_receive(:error).with(" ASIHTTPRequest 0.6 is required in the Vendorfile").once.ordered
121
+
122
+ expect do
123
+ graph.version_conflicts?
124
+ end.should raise_error(SystemExit)
125
+ end
126
+
127
+ end
128
+
129
+ end
@@ -2,14 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe Vendor::VendorFile::Library::Base do
4
4
 
5
- let(:lib) { Vendor::VendorFile::Library::Base.new(:name => "ExampleLib") }
5
+ let(:temp_path) { TempProject.create(File.join(PROJECT_RESOURCE_PATH, "MultipleTargets")) }
6
+ let(:project) { Vendor::XCode::Project.new(File.join(temp_path, "MultipleTargets.xcodeproj")) }
6
7
 
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")) }
8
+ let(:lib) { Vendor::VendorFile::Library::Base.new(:name => "ExampleLib") }
9
9
 
10
- let(:lib_with_no_manifest_or_vendorspec) { Vendor::VendorFile::Library::Base.new(:name => "BingMapsIOS", :require => "MapControl") }
11
- let(:lib_with_manifest) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-Manifest") }
12
- let(:lib_with_vendorspec) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-Vendorspec") }
10
+ let(:lib_with_no_manifest_or_vendorspec) { Vendor::VendorFile::Library::Base.new(:name => "BingMapsIOS", :require => "MapControl", :target => "MultipleTargets") }
11
+ let(:lib_with_manifest) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-0.1-Manifest", :targets => [ "MultipleTargets", "Specs" ]) }
12
+ let(:lib_with_vendorspec) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-0.1-Vendorspec", :target => "MultipleTargets") }
13
+ let(:lib_with_nothing) { Vendor::VendorFile::Library::Base.new(:name => "DKBenchmark-0.1-Nothing", :target => "MultipleTargets") }
13
14
 
14
15
  it "should have a name attribute" do
15
16
  lib.name = "lib"
@@ -27,24 +28,24 @@ describe Vendor::VendorFile::Library::Base do
27
28
 
28
29
  before :each do
29
30
  Vendor.stub(:library_path).and_return CACHED_VENDOR_RESOURCE_PATH
30
-
31
- lib_with_manifest.install project
32
31
  end
33
32
 
34
33
  context "with an existing installation" do
35
34
 
36
35
  before :each do
36
+ lib_with_manifest.install project
37
+
37
38
  # Install it again
38
39
  lib_with_manifest.install project
39
40
  end
40
41
 
41
42
  it "should add the group to the project" do
42
- group = project.find_group("Vendor/DKBenchmark-Manifest")
43
+ group = project.find_group("Vendor/DKBenchmark-0.1-Manifest")
43
44
  group.should_not be_nil
44
45
  end
45
46
 
46
47
  it "should add the files to the project" do
47
- children = project.find_group("Vendor/DKBenchmark-Manifest").children
48
+ children = project.find_group("Vendor/DKBenchmark-0.1-Manifest").children
48
49
  children.length.should == 2
49
50
  end
50
51
 
@@ -52,13 +53,18 @@ describe Vendor::VendorFile::Library::Base do
52
53
 
53
54
  context "with a fresh installation" do
54
55
 
56
+ before :each do
57
+ # Install it again
58
+ lib_with_manifest.install project
59
+ end
60
+
55
61
  it "should add the group to the project" do
56
- group = project.find_group("Vendor/DKBenchmark-Manifest")
62
+ group = project.find_group("Vendor/DKBenchmark-0.1-Manifest")
57
63
  group.should_not be_nil
58
64
  end
59
65
 
60
66
  it "should add the files to the project" do
61
- children = project.find_group("Vendor/DKBenchmark-Manifest").children
67
+ children = project.find_group("Vendor/DKBenchmark-0.1-Manifest").children
62
68
  children.length.should == 2
63
69
  end
64
70
 
@@ -74,6 +80,160 @@ describe Vendor::VendorFile::Library::Base do
74
80
 
75
81
  end
76
82
 
83
+ describe "#dependencies" do
84
+
85
+ before :each do
86
+ Vendor.stub(:library_path).and_return CACHED_VENDOR_RESOURCE_PATH
87
+ end
88
+
89
+ context "with no manifest or vendorspec" do
90
+
91
+ it "should return no dependencies" do
92
+ lib_with_no_manifest_or_vendorspec.dependencies.should be_empty
93
+ end
94
+
95
+ end
96
+
97
+ context "with a vendorspec" do
98
+
99
+ let(:dependencies) { lib_with_vendorspec.dependencies }
100
+
101
+ it "should return the correct dependencies" do
102
+ dependencies[0].name.should == "JSONKit"
103
+ dependencies[0].version.should == "0.5"
104
+ dependencies[0].parent.should == lib_with_vendorspec
105
+ dependencies[0].targets.should == [ "MultipleTargets" ]
106
+
107
+ dependencies[1].name.should == "ASIHTTPRequest"
108
+ dependencies[1].equality.should == "~>"
109
+ dependencies[1].version.should == "4.2"
110
+ dependencies[1].targets.should == [ "MultipleTargets" ]
111
+
112
+ dependencies[2].name.should == "AFINetworking"
113
+ dependencies[2].equality.should == "<="
114
+ dependencies[2].version.should == "2.5.a"
115
+ dependencies[2].parent.should == lib_with_vendorspec
116
+ dependencies[2].targets.should == [ "MultipleTargets" ]
117
+ end
118
+
119
+ end
120
+
121
+ context "with a manifest" do
122
+
123
+ let(:dependencies) { lib_with_manifest.dependencies }
124
+
125
+ it "should return the correct dependencies" do
126
+ dependencies[0].name.should == "JSONKit"
127
+ dependencies[0].version.should == "0.3"
128
+ dependencies[0].parent.should == lib_with_manifest
129
+ dependencies[0].targets.should == [ "MultipleTargets", "Specs" ]
130
+
131
+ dependencies[1].name.should == "ASIHTTPRequest"
132
+ dependencies[1].equality.should == "~>"
133
+ dependencies[1].version.should == "4.3"
134
+ dependencies[1].parent.should == lib_with_manifest
135
+ dependencies[1].targets.should == [ "MultipleTargets", "Specs" ]
136
+
137
+ dependencies[2].name.should == "AFINetworking"
138
+ dependencies[2].equality.should == "<="
139
+ dependencies[2].version.should == "2.5.b"
140
+ dependencies[2].parent.should == lib_with_manifest
141
+ dependencies[2].targets.should == [ "MultipleTargets", "Specs" ]
142
+
143
+ end
144
+
145
+ end
146
+
147
+ context "with no dependencies" do
148
+
149
+ it "should return an empty array" do
150
+ lib_with_nothing.dependencies.should == []
151
+ end
152
+
153
+ end
154
+
155
+ end
156
+
157
+ describe "#frameworks" do
158
+
159
+ before :each do
160
+ Vendor.stub(:library_path).and_return CACHED_VENDOR_RESOURCE_PATH
161
+ end
162
+
163
+ context "with no manifest or vendorspec" do
164
+
165
+ it "should have no frameworks" do
166
+ lib_with_no_manifest_or_vendorspec.frameworks.should be_empty
167
+ end
168
+
169
+ end
170
+
171
+ context "with a vendorspec" do
172
+
173
+ it "should have frameworks" do
174
+ lib_with_vendorspec.frameworks.should == [ "Foundation.framework" ]
175
+ end
176
+
177
+ end
178
+
179
+ context "with a manifest" do
180
+
181
+ it "should have frameworks" do
182
+ lib_with_manifest.frameworks.should == [ "CoreData.framework" ]
183
+ end
184
+
185
+ end
186
+
187
+ context "with no frameworks" do
188
+
189
+ it "should return an empty array" do
190
+ lib_with_nothing.frameworks.should == []
191
+ end
192
+
193
+ end
194
+
195
+ end
196
+
197
+ describe "#build_settings" do
198
+
199
+ before :each do
200
+ Vendor.stub(:library_path).and_return CACHED_VENDOR_RESOURCE_PATH
201
+ end
202
+
203
+ context "with no manifest or vendorspec" do
204
+
205
+ it "should have no build_settings" do
206
+ lib_with_no_manifest_or_vendorspec.build_settings.should be_empty
207
+ end
208
+
209
+ end
210
+
211
+ context "with a vendorspec" do
212
+
213
+ it "should have build_settings" do
214
+ lib_with_vendorspec.build_settings.should == [ [ "OTHER_LDFLAGS", "-ObjC" ] ]
215
+ end
216
+
217
+ end
218
+
219
+ context "with a manifest" do
220
+
221
+ it "should have build_settings" do
222
+ lib_with_manifest.build_settings.should == [ [ "CLANG_WARN_OBJCPP_ARC_ABI", "NO" ] ]
223
+ end
224
+
225
+ end
226
+
227
+ context "with no build settings" do
228
+
229
+ it "should return an empty array" do
230
+ lib_with_nothing.build_settings.should == []
231
+ end
232
+
233
+ end
234
+
235
+ end
236
+
77
237
  describe "#files" do
78
238
 
79
239
  before :each do
@@ -124,7 +284,7 @@ describe Vendor::VendorFile::Library::Base do
124
284
  end
125
285
 
126
286
  it "should return files in the correct location" do
127
- path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/DKBenchmark-Vendorspec/")
287
+ path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/DKBenchmark-0.1-Vendorspec/")
128
288
  regex_path = /^#{path}.+$/
129
289
 
130
290
  files.each do |file|
@@ -152,7 +312,7 @@ describe Vendor::VendorFile::Library::Base do
152
312
  end
153
313
 
154
314
  it "should return files in the correct location" do
155
- path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/DKBenchmark-Manifest/data/")
315
+ path = File.join(CACHED_VENDOR_RESOURCE_PATH, "base/DKBenchmark-0.1-Manifest/data/")
156
316
  regex_path = /^#{path}.+$/
157
317
 
158
318
  files.each do |file|