Commit 55d5c919 authored by Eloy Duran's avatar Eloy Duran

Install a library with a podspec from another source. Can be file, http, ftp.

parent 906346aa
......@@ -48,10 +48,20 @@ module Pod
@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)
spec = nil
if @external_spec_source[:podspec]
Config.instance.project_pods_root.mkdir
spec = Config.instance.project_pods_root + "#{@name}.podspec"
# can be http, file, etc
require 'open-uri'
open(@external_spec_source[:podspec]) do |io|
spec.open('w') { |f| f << io.read }
end
else
Downloader.for_source(pod_root, @external_spec_source).download
spec = pod_root + "#{@name}.podspec"
end
Specification.from_file(spec)
end
end
......
......@@ -287,8 +287,9 @@ module Pod
def install!
puts "==> Installing: #{self}" unless config.silent?
config.project_pods_root.mkpath
require 'fileutils'
FileUtils.cp(defined_in_file, config.project_pods_root)
unless (config.project_pods_root + defined_in_file.basename).exist?
FileUtils.cp(defined_in_file, config.project_pods_root)
end
# In case this spec is part of another pod's source, we need to dowload
# the other pod's source.
......
......@@ -70,6 +70,22 @@ else
`git config --get remote.origin.url`.strip.should == url
end
end
it "installs a library with a podspec outside of the repo" do
podfile = Pod::Podfile.new do
self.platform :ios
# TODO use a local file instead of http?
dependency 'Reachability', :podspec => 'https://raw.github.com/gist/1349824/3ec6aa60c19113573fc48eac19d0fafd6a69e033/Reachability.podspec'
end
installer = SpecHelper::Installer.new(podfile)
installer.install!
spec = Pod::Spec.from_file(config.project_pods_root + 'Reachability.podspec')
spec.version.to_s.should == '1.2.3'
(config.project_pods_root + 'ASIHTTPRequest').should.exist
end
end
before do
......
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