Commit 906346aa authored by Eloy Duran's avatar Eloy Duran

Install a Pod directly from its repo.

parent fb7d8537
...@@ -10,3 +10,6 @@ ...@@ -10,3 +10,6 @@
[submodule "spec/fixtures/spec-repos/master"] [submodule "spec/fixtures/spec-repos/master"]
path = spec/fixtures/spec-repos/master path = spec/fixtures/spec-repos/master
url = git://github.com/alloy/cocoapods-specs.git 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
...@@ -44,6 +44,17 @@ module Pod ...@@ -44,6 +44,17 @@ module Pod
!@specification.nil? !@specification.nil?
end 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 # Taken from a newer version of RubyGems
unless public_method_defined?(:merge) unless public_method_defined?(:merge)
def merge other def merge other
......
...@@ -25,10 +25,14 @@ module Pod ...@@ -25,10 +25,14 @@ module Pod
elsif @options[:commit] elsif @options[:commit]
download_commit download_commit
else else
raise "Either a tag or a commit has to be specified." download_head
end end
end end
def download_head
git "clone '#{@url}' '#{@pod_root}'"
end
def download_tag def download_tag
@pod_root.mkdir @pod_root.mkdir
Dir.chdir(@pod_root) do Dir.chdir(@pod_root) do
......
...@@ -23,8 +23,12 @@ module Pod ...@@ -23,8 +23,12 @@ module Pod
end end
def find_dependency_set(dependency) def find_dependency_set(dependency)
if dependency.external_podspec?
Specification::Set::External.new(dependency.specification)
else
Source.search(dependency) Source.search(dependency)
end end
end
def validate_platform!(set) def validate_platform!(set)
spec = set.specification spec = set.specification
......
...@@ -81,6 +81,40 @@ module Pod ...@@ -81,6 +81,40 @@ module Pod
Version.new(basename) if v.directory? && basename[0,1] != '.' Version.new(basename) if v.directory? && basename[0,1] != '.'
end.compact.sort.reverse end.compact.sort.reverse
end 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 end
end end
Subproject commit 2adcd0f81740d6b0cd4589af98790eee3bd1ae7b
...@@ -38,8 +38,6 @@ else ...@@ -38,8 +38,6 @@ else
config.silent = true config.silent = true
config.repos_dir = fixture('spec-repos') config.repos_dir = fixture('spec-repos')
config.project_pods_root = temporary_directory + 'Pods' config.project_pods_root = temporary_directory + 'Pods'
FileUtils.cp_r(fixture('integration/.'), config.project_pods_root)
end end
after do after do
...@@ -52,6 +50,32 @@ else ...@@ -52,6 +50,32 @@ else
$?.should.be.success $?.should.be.success
end 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 # 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 it "should activate required pods and create a working static library xcode project" do
spec = Pod::Podfile.new do spec = Pod::Podfile.new do
...@@ -220,4 +244,5 @@ else ...@@ -220,4 +244,5 @@ else
end end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment