Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Install a Pod directly from its repo.

  • Loading branch information...
commit 906346aa4eaed0bb39fbcb4ef7565012d483cefd 1 parent fb7d853
@alloy alloy authored
View
3  .gitmodules
@@ -10,3 +10,6 @@
[submodule "spec/fixtures/spec-repos/master"]
path = spec/fixtures/spec-repos/master
url = git://github.com/alloy/cocoapods-specs.git
+[submodule "spec/fixtures/integration/sstoolkit"]
+ path = spec/fixtures/integration/sstoolkit
+ url = https://github.com/samsoffes/sstoolkit.git
View
11 lib/cocoapods/dependency.rb
@@ -44,6 +44,17 @@ def inline_podspec?
!@specification.nil?
end
+ def specification
+ @specification ||= begin
+ # This is an external podspec
+ pod_root = Config.instance.project_pods_root + @name
+ downloader = Downloader.for_source(pod_root, @external_spec_source)
+ downloader.download
+ file = pod_root + "#{@name}.podspec"
+ Specification.from_file(file)
+ end
+ end
+
# Taken from a newer version of RubyGems
unless public_method_defined?(:merge)
def merge other
View
6 lib/cocoapods/downloader.rb
@@ -25,10 +25,14 @@ def download
elsif @options[:commit]
download_commit
else
- raise "Either a tag or a commit has to be specified."
+ download_head
end
end
+ def download_head
+ git "clone '#{@url}' '#{@pod_root}'"
+ end
+
def download_tag
@pod_root.mkdir
Dir.chdir(@pod_root) do
View
6 lib/cocoapods/resolver.rb
@@ -23,7 +23,11 @@ def find_dependency_sets(specification, dependencies = nil)
end
def find_dependency_set(dependency)
- Source.search(dependency)
+ if dependency.external_podspec?
+ Specification::Set::External.new(dependency.specification)
+ else
+ Source.search(dependency)
+ end
end
def validate_platform!(set)
View
34 lib/cocoapods/specification/set.rb
@@ -81,6 +81,40 @@ def versions
Version.new(basename) if v.directory? && basename[0,1] != '.'
end.compact.sort.reverse
end
+
+ class External < Set
+ def initialize(specification)
+ @specification = specification
+ @required_by = []
+ end
+
+ def name
+ @specification.name
+ end
+
+ def required_by(specification)
+ before = @specification
+ super(specification)
+ ensure
+ @specification = before
+ end
+
+ def only_part_of_other_pod?
+ false
+ end
+
+ def specification_path
+ raise "specification_path"
+ end
+
+ def specification
+ @specification
+ end
+
+ def versions
+ [@specification.version]
+ end
+ end
end
end
end
1  spec/fixtures/integration/sstoolkit
@@ -0,0 +1 @@
+Subproject commit 2adcd0f81740d6b0cd4589af98790eee3bd1ae7b
View
29 spec/integration_spec.rb
@@ -38,8 +38,6 @@ def set.specification
config.silent = true
config.repos_dir = fixture('spec-repos')
config.project_pods_root = temporary_directory + 'Pods'
-
- FileUtils.cp_r(fixture('integration/.'), config.project_pods_root)
end
after do
@@ -52,6 +50,32 @@ def should_successfully_perform(command)
$?.should.be.success
end
+ # Lame way to run on one platform only
+ if platform == :ios
+ it "installs a Pod directly from its repo" do
+ url = fixture('integration/sstoolkit').to_s
+ podfile = Pod::Podfile.new do
+ self.platform :ios
+ dependency 'SSToolkit', :git => url, :commit => '2adcd0f81740d6b0cd4589af98790eee3bd1ae7b'
+ end
+
+ # Note that we are *not* using the stubbed SpecHelper::Installer subclass.
+ installer = Pod::Installer.new(podfile)
+ installer.install!
+
+ spec = Pod::Spec.from_file(config.project_pods_root + 'SSToolkit.podspec')
+ spec.version.to_s.should == '0.1.3'
+
+ Dir.chdir(config.project_pods_root + 'SSToolkit') do
+ `git config --get remote.origin.url`.strip.should == url
+ end
+ end
+ end
+
+ before do
+ FileUtils.cp_r(fixture('integration/.'), config.project_pods_root)
+ end
+
# TODO add a simple source file which uses the compiled lib to check that it really really works
it "should activate required pods and create a working static library xcode project" do
spec = Pod::Podfile.new do
@@ -220,4 +244,5 @@ def should_successfully_perform(command)
end
end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.