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
namespace :gem do
def gem_version
require 'lib/cocoapods'
require File.join(File.dirname(__FILE__), *%w[lib cocoapods])
Pod::VERSION
end
......@@ -55,8 +55,8 @@ namespace :gem do
desc "Install a gem version of the current code"
task :install => :build do
sh "sudo macgem install #{gem_filename}"
#sh "sudo macgem compile cocoapods"
sh "sudo gem install #{gem_filename}"
#sh "sudo gem compile cocoapods"
end
desc "Run all specs, build and install gem, commit version change, tag version change, and push everything"
......
......@@ -38,5 +38,3 @@ class Pathname
end
end
end
......@@ -55,8 +55,10 @@ module Pod
def install_dependencies!
build_specifications.each do |spec|
if spec.pod_destroot.exist?
puts "Using #{spec}" unless config.silent?
if spec.pod_destroot.exist? || spec.local?
message = "Using #{spec}"
message += " [LOCAL]" if spec.local?
puts message unless config.silent?
else
puts "Installing #{spec}" unless config.silent?
spec = spec.part_of_specification if spec.part_of_other_pod?
......
......@@ -152,6 +152,14 @@ module Pod
attr_accessor :defined_in_set
include Config::Mixin
def local?
!source[:local].nil?
end
def local_path
Pathname.new(File.expand_path(source[:local]))
end
def wrapper?
source_files.empty? && !subspecs.empty?
......@@ -195,6 +203,8 @@ module Pod
def pod_destroot
if part_of_other_pod?
part_of_specification.pod_destroot
elsif local?
local_path
else
config.project_pods_root + @name
end
......
......@@ -7,7 +7,7 @@ describe "Pod::Downloader" do
describe "for Git" do
extend SpecHelper::TemporaryDirectory
it "check's out a specific commit" do
downloader = Pod::Downloader.for_source(@dir,
:git => fixture('banana-lib'), :commit => '02467b074d4dc9f6a75b8cd3ab80d9bf37887b01'
......@@ -15,7 +15,7 @@ describe "Pod::Downloader" do
downloader.download
(@dir + 'README').read.strip.should == 'first commit'
end
it "check's out a specific tag" do
downloader = Pod::Downloader.for_source(@dir,
:git => fixture('banana-lib'), :tag => 'v1.0'
......@@ -23,7 +23,7 @@ describe "Pod::Downloader" do
downloader.download
(@dir + 'README').read.strip.should == 'v1.0'
end
it "removes the .git directory" do
downloader = Pod::Downloader.for_source(@dir,
:git => fixture('banana-lib'), :tag => 'v1.0'
......@@ -32,7 +32,7 @@ describe "Pod::Downloader" do
downloader.clean
(@dir + '.git').should.not.exist
end
it "removes the clean_paths files and directories" do
downloader = Pod::Downloader.for_source(@dir,
:git => fixture('banana-lib'), :tag => 'v1.0'
......@@ -42,10 +42,10 @@ describe "Pod::Downloader" do
(@dir + 'README').should.not.exist
end
end
describe "for Mercurial" do
extend SpecHelper::TemporaryDirectory
it "check's out a specific revision" do
downloader = Pod::Downloader.for_source(@dir,
:hg => fixture('mercurial-repo'), :revision => '46198bb3af96'
......@@ -53,7 +53,7 @@ describe "Pod::Downloader" do
downloader.download
(@dir + 'README').read.strip.should == 'first commit'
end
it "removes the .hg directory" do
downloader = Pod::Downloader.for_source(@dir,
:hg => fixture('mercurial-repo')
......@@ -62,7 +62,7 @@ describe "Pod::Downloader" do
downloader.clean
(@dir + '.hg').should.not.exist
end
it "removes the clean_paths files and directories" do
downloader = Pod::Downloader.for_source(@dir,
:hg => fixture('mercurial-repo')
......@@ -72,10 +72,10 @@ describe "Pod::Downloader" do
(@dir + 'README').should.not.exist
end
end
describe "for Subversion" do
extend SpecHelper::TemporaryDirectory
it "check's out a specific revision" do
downloader = Pod::Downloader.for_source(@dir,
:svn => "file://#{fixture('subversion-repo')}", :revision => '1'
......@@ -83,7 +83,7 @@ describe "Pod::Downloader" do
downloader.download
(@dir + 'README').read.strip.should == 'first commit'
end
it "check's out a specific tag" do
downloader = Pod::Downloader.for_source(@dir,
:svn => "file://#{fixture('subversion-repo')}/tags/tag-1"
......@@ -91,7 +91,7 @@ describe "Pod::Downloader" do
downloader.download
(@dir + 'README').read.strip.should == 'tag 1'
end
it "removes the .svn directories" do
downloader = Pod::Downloader.for_source(@dir,
:svn => "file://#{fixture('subversion-repo')}/trunk"
......@@ -100,7 +100,7 @@ describe "Pod::Downloader" do
downloader.clean
(@dir + '.svn').should.not.exist
end
it "removes the clean_paths files and directories" do
downloader = Pod::Downloader.for_source(@dir,
:svn => "file://#{fixture('subversion-repo')}/trunk"
......@@ -110,6 +110,5 @@ describe "Pod::Downloader" do
(@dir + 'README').should.not.exist
end
end
end
......@@ -340,3 +340,34 @@ describe "A Pod::Specification subspec" do
@spec.subspec_by_name('MainSpec/FirstSubSpec/SecondSubSpec').should == @spec.subspecs.first.subspecs.first
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