Permalink
Browse files

Install a library with a podspec from another source. Can be file, ht…

…tp, ftp.
  • Loading branch information...
1 parent 906346a commit 55d5c919fb30f8de7c1fab6c4b71d0884058ba6e @alloy committed Nov 9, 2011
Showing with 33 additions and 6 deletions.
  1. +14 −4 lib/cocoapods/dependency.rb
  2. +3 −2 lib/cocoapods/specification.rb
  3. +16 −0 spec/integration_spec.rb
@@ -48,10 +48,20 @@ 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)
+ 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 @@ def validate!
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.
View
@@ -70,6 +70,22 @@ def should_successfully_perform(command)
`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

0 comments on commit 55d5c91

Please sign in to comment.