Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

+ begin of integration spec

  • Loading branch information...
commit 5b5abd6ca3d6db906b252229bf91b2e2bc6952f1 1 parent 064b1e0
@alloy alloy authored
View
9 .gitmodules
@@ -0,0 +1,9 @@
+[submodule "spec/fixtures/integration/ASIHTTPRequest"]
+ path = spec/fixtures/integration/ASIHTTPRequest
+ url = https://github.com/pokeb/asi-http-request.git
+[submodule "spec/fixtures/integration/SSZipArchive"]
+ path = spec/fixtures/integration/SSZipArchive
+ url = https://github.com/samsoffes/ssziparchive.git
+[submodule "spec/fixtures/integration/JSONKit"]
+ path = spec/fixtures/integration/JSONKit
+ url = https://github.com/johnezang/JSONKit.git
View
4 lib/cocoa_pods/config.rb
@@ -10,7 +10,7 @@ def self.instance=(instance)
@instance = instance
end
- attr_accessor :repos_dir, :clean, :verbose, :silent
+ attr_accessor :repos_dir, :project_pods_root, :clean, :verbose, :silent
alias_method :clean?, :clean
alias_method :verbose?, :verbose
alias_method :silent?, :silent
@@ -27,7 +27,7 @@ def project_root
end
def project_pods_root
- project_root + 'Pods'
+ @project_pods_root ||= project_root + 'Pods'
end
def project_podfile
View
2  lib/cocoa_pods/installer.rb
@@ -2,6 +2,8 @@ module Pod
# TODO the static library needs an extra xcconfig which sets the values from issue #1.
# Or we could edit the project.pbxproj file, but that seems like more work...
class Installer
+ include Config::Mixin
+
def initialize(top_level_specification, pods_root)
@top_level_specification, @pods_root = top_level_specification, pods_root
end
View
2  lib/cocoa_pods/source.rb
@@ -1,7 +1,7 @@
module Pod
class Source
def self.all
- @sources ||= Config.instance.repos_dir.children.map { |repo| new(repo) }
+ @sources ||= Config.instance.repos_dir.children.select(&:directory?).map { |repo| new(repo) }
end
def self.search(dependency)
1  spec/fixtures/integration/ASIHTTPRequest
@@ -0,0 +1 @@
+Subproject commit 90e5fbce17d66e5341f105c1eb26133a01686838
1  spec/fixtures/integration/JSONKit
@@ -0,0 +1 @@
+Subproject commit c2146ffeb10d92bfa1537d2033a3235825d1b261
1  spec/fixtures/integration/SSZipArchive
@@ -0,0 +1 @@
+Subproject commit 65a8282c0b5a6f84bc6266d73bbe7475ef75659d
View
68 spec/integration_spec.rb
@@ -0,0 +1,68 @@
+require File.expand_path('../spec_helper', __FILE__)
+
+module SpecHelper
+ class Installer < Pod::Installer
+ # Here we override the `source' of the pod specifications to point to the integration fixtures.
+ def dependent_specification_sets
+ @dependent_specification_sets ||= super
+ @dependent_specification_sets.each do |set|
+ def set.specification
+ spec = super
+ unless spec.part_of_other_pod?
+ source = spec.read(:source)
+ source[:git] = SpecHelper.fixture("integration/#{spec.read(:name)}").to_s
+ spec.source(source)
+ end
+ spec
+ end
+ end
+ @dependent_specification_sets
+ end
+ end
+end
+
+unless SpecHelper.fixture('integration/ASIHTTPRequest').exist?
+ puts "[!] You must init/update the git submodules for the integration spec to work, skipping."
+else
+ describe "A full (integration spec) installation" do
+ extend SpecHelper::TemporaryDirectory
+
+ before do
+ Pod::Source.reset!
+ Pod::Spec::Set.reset!
+ fixture('spec-repos/master') # ensure the archive is unpacked
+ config.project_pods_root = SpecHelper.temporary_directory + 'Pods'
+ config.repos_dir = fixture('spec-repos')
+ end
+
+ after do
+ config.project_pods_root = nil
+ config.repos_dir = SpecHelper.tmp_repos_path
+ end
+
+ it "should work" do
+ spec = Pod::Spec.new do
+ dependency 'ASIWebPageRequest', '< 1.8.1'
+ dependency 'JSONKit', '>= 1.0'
+ dependency 'SSZipArchive', '< 2'
+ end
+ installer = SpecHelper::Installer.new(spec, SpecHelper.temporary_directory)
+ installer.install!
+ (config.project_pods_root + 'Reachability.podspec').should.exist
+ (config.project_pods_root + 'ASIHTTPRequest.podspec').should.exist
+ (config.project_pods_root + 'ASIWebPageRequest.podspec').should.exist
+ (config.project_pods_root + 'JSONKit.podspec').should.exist
+ (config.project_pods_root + 'SSZipArchive.podspec').should.exist
+ end
+
+ it "does not activate pods that are only part of other pods" do
+ spec = Pod::Spec.new do
+ dependency 'Reachability'
+ end
+ installer = SpecHelper::Installer.new(spec, SpecHelper.temporary_directory)
+ installer.install!
+ (config.project_pods_root + 'Reachability.podspec').should.exist
+ (config.project_pods_root + 'ASIHTTPRequest.podspec').should.not.exist
+ end
+ end
+end
View
2  spec/spec_helper/temporary_directory.rb
@@ -16,7 +16,7 @@ def setup_temporary_directory
end
def teardown_temporary_directory
- temporary_directory.rmtree
+ temporary_directory.rmtree if temporary_directory.exist?
end
def self.extended(base)
Please sign in to comment.
Something went wrong with that request. Please try again.