Commit 579c1a73 authored by Luke Redpath's avatar Luke Redpath

Allow specifications to have a local source that exists outside the Pods root (and doesn't

need downloading or copying).
parent 2ae6ddfb
...@@ -40,7 +40,7 @@ end ...@@ -40,7 +40,7 @@ end
namespace :gem do namespace :gem do
def gem_version def gem_version
require 'lib/cocoapods' require File.join(File.dirname(__FILE__), *%w[lib cocoapods])
Pod::VERSION Pod::VERSION
end end
...@@ -55,8 +55,8 @@ namespace :gem do ...@@ -55,8 +55,8 @@ namespace :gem do
desc "Install a gem version of the current code" desc "Install a gem version of the current code"
task :install => :build do task :install => :build do
sh "sudo macgem install #{gem_filename}" sh "sudo gem install #{gem_filename}"
#sh "sudo macgem compile cocoapods" #sh "sudo gem compile cocoapods"
end end
desc "Run all specs, build and install gem, commit version change, tag version change, and push everything" desc "Run all specs, build and install gem, commit version change, tag version change, and push everything"
......
...@@ -38,5 +38,3 @@ class Pathname ...@@ -38,5 +38,3 @@ class Pathname
end end
end end
end end
...@@ -55,8 +55,10 @@ module Pod ...@@ -55,8 +55,10 @@ module Pod
def install_dependencies! def install_dependencies!
build_specifications.each do |spec| build_specifications.each do |spec|
if spec.pod_destroot.exist? if spec.pod_destroot.exist? || spec.local?
puts "Using #{spec}" unless config.silent? message = "Using #{spec}"
message += " [LOCAL]" if spec.local?
puts message unless config.silent?
else else
puts "Installing #{spec}" unless config.silent? puts "Installing #{spec}" unless config.silent?
spec = spec.part_of_specification if spec.part_of_other_pod? spec = spec.part_of_specification if spec.part_of_other_pod?
......
...@@ -153,6 +153,14 @@ module Pod ...@@ -153,6 +153,14 @@ module Pod
include Config::Mixin include Config::Mixin
def local?
!source[:local].nil?
end
def local_path
Pathname.new(File.expand_path(source[:local]))
end
def wrapper? def wrapper?
source_files.empty? && !subspecs.empty? source_files.empty? && !subspecs.empty?
end end
...@@ -195,6 +203,8 @@ module Pod ...@@ -195,6 +203,8 @@ module Pod
def pod_destroot def pod_destroot
if part_of_other_pod? if part_of_other_pod?
part_of_specification.pod_destroot part_of_specification.pod_destroot
elsif local?
local_path
else else
config.project_pods_root + @name config.project_pods_root + @name
end end
......
...@@ -110,6 +110,5 @@ describe "Pod::Downloader" do ...@@ -110,6 +110,5 @@ describe "Pod::Downloader" do
(@dir + 'README').should.not.exist (@dir + 'README').should.not.exist
end end
end end
end end
...@@ -340,3 +340,34 @@ describe "A Pod::Specification subspec" do ...@@ -340,3 +340,34 @@ describe "A Pod::Specification subspec" do
@spec.subspec_by_name('MainSpec/FirstSubSpec/SecondSubSpec').should == @spec.subspecs.first.subspecs.first @spec.subspec_by_name('MainSpec/FirstSubSpec/SecondSubSpec').should == @spec.subspecs.first.subspecs.first
end end
end end
describe "A Pod::Specification with :local source" do
before do
@spec = Pod::Spec.new do |s|
s.name = 'MainSpec'
s.source = { :local => fixture("integration/JSONKit") }
s.source_files = "."
end
end
it "is marked as local" do
@spec.should.be.local
end
it "it returns the expanded local path" do
@spec.local_path.should == fixture("integration/JSONKit")
end
it "returns the list of files that the source_files pattern expand to within the local path" do
files = fixture("integration/JSONKit").glob('**/*.{h,m}')
files = files.map { |file| file.relative_path_from(config.project_pods_root) }
@spec.expanded_source_files.sort.should == files.sort
end
it "returns the list of headers that the source_files pattern expand to within the local path" do
files = fixture("integration/JSONKit").glob('**/*.{h}')
files = files.map { |file| file.relative_path_from(config.project_pods_root) }
@spec.header_files.sort.should == files.sort
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