Commit b6a8c517 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'samuelwford-issue-1042-keep-local-paths-abs'

* samuelwford-issue-1042-keep-local-paths-abs:
  clean up naming a little bit absolute path tracking
  preserve local pod paths specified as absolute or rooted to home
  return Pathname instead of string, remove obsolete comment
  working spec for abs root
  remove "was_absolute" tracking and simplify local pod handling to always use absolute paths
  try to get test wrapped around absolute path
  fix #1042 - keep absolute paths for local pods as is
parents 1f8aed42 658c90c0
......@@ -29,6 +29,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Kyle Fuller](https://github.com/kylef)
[#1815](https://github.com/CocoaPods/CocoaPods/issues/1815)
* Fix to keep absolute paths specified for local pods as is.
[Samuel Ford](https://github.com/samuelwford)
[#1042](https://github.com/CocoaPods/CocoaPods/issues/1042)
## 0.31.1
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.31.1...0.31.0)
[CocoaPods-Core](https://github.com/CocoaPods/Core/compare/0.31.1...0.31.0)
......
......@@ -352,7 +352,8 @@ module Pod
UI.titled_section("Fetching podspec for `#{name}` #{description}", { :verbose_prefix => "-> " }) do
podspec = podspec_path
store_podspec(sandbox, podspec)
sandbox.store_local_path(name, podspec.dirname)
path_is_absolute_or_rooted_to_home = declared_path.absolute? || declared_path.to_s.start_with?('~')
sandbox.store_local_path(name, podspec.dirname, path_is_absolute_or_rooted_to_home)
end
end
......@@ -368,10 +369,15 @@ module Pod
# @!group Helpers
# @return [Pathname] the path as declared in the podspec
#
def declared_path
Pathname.new params[:path] || params[:local]
end
# @return [Pathname] the path of the podspec.
#
def podspec_path
declared_path = (params[:path] || params[:local]).to_s
path_with_ext = File.extname(declared_path) == '.podspec' ? declared_path : "#{declared_path}/#{name}.podspec"
podfile_dir = File.dirname(podfile_path || '')
absolute_path = File.expand_path(path_with_ext, podfile_dir)
......
......@@ -296,9 +296,10 @@ module Pod
pod_names = pod_targets.map(&:pod_name).uniq
pod_names.each do |pod_name|
path = sandbox.pod_dir(pod_name)
local = sandbox.local?(pod_name)
@pods_project.add_pod_group(pod_name, path, local)
path = sandbox.pod_dir(pod_name)
was_absolute = sandbox.local_path_was_absolute?(pod_name)
@pods_project.add_pod_group(pod_name, path, local, was_absolute)
end
if config.podfile_path
......
......@@ -69,6 +69,7 @@ module Pod
@head_pods = []
@checkout_sources = {}
@development_pods = {}
@pods_with_absolute_path = []
end
# @return [Lockfile] the manifest which contains the information about the
......@@ -158,7 +159,17 @@ module Pod
root + root_name
end
end
# Returns true if the path as originally specified was absolute.
#
# @param [String] name
#
# @return [Bool] true if originally absolute
#
def local_path_was_absolute?(name)
@pods_with_absolute_path.include? name
end
# @return [Pathname] the directory where to store the documentation.
#
def documentation_dir
......@@ -338,11 +349,15 @@ module Pod
# @param [#to_s] path
# The local path where the Pod is stored.
#
# @param [Bool] was_absolute
# True if the specified local path was absolute.
#
# @return [void]
#
def store_local_path(name, path)
def store_local_path(name, path, was_absolute = false)
root_name = Specification.root_name(name)
development_pods[root_name] = path.to_s
@pods_with_absolute_path << root_name if was_absolute
end
# @return [Hash{String=>String}] The path of the Pods with a local source
......
......@@ -21,6 +21,16 @@ def generate_podfile(pods = ['JSONKit'])
end
end
# @return [Podfile]
#
def generate_local_podfile
podfile = Pod::Podfile.new do
platform :ios
xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pod 'SSToolkit', :path => SpecHelper.fixture('integration/sstoolkit')
end
end
#-----------------------------------------------------------------------------#
module Pod
......@@ -247,6 +257,15 @@ module Pod
@installer.pods_project.class.should == Pod::Project
end
it "preserves Pod paths specified as absolute or rooted to home" do
local_podfile = generate_local_podfile
local_installer = Installer.new(config.sandbox, local_podfile)
local_installer.send(:analyze)
local_installer.send(:prepare_pods_project)
group = local_installer.pods_project.group_for_spec('SSToolkit')
Pathname.new(group.path).should.be.absolute
end
it "adds the Podfile to the Pods project" do
config.stubs(:podfile_path).returns(Pathname.new('/Podfile'))
@installer.send(:prepare_pods_project)
......
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