Commit 1eb4ed92 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into b0.15.0

* master:
  [Gemspec] Depend on Octokit 1.x and bundle update.
  [Dependency] Always copy the podspec of external sources to `Local Podspecs`

Conflicts:
	CHANGELOG.md
parents 01bc7727 829a3741
......@@ -7,6 +7,18 @@
- Support for `header_mappings_dir` attribute in subspecs.
- Refactored UI.
## Master
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0.rc2...master)
###### Bug fixes
- In certain conditions the spec of an external would have been overridden
by the spec in the root of a Pod.
[#489](https://github.com/CocoaPods/CocoaPods/issues/489)
- CocoaPods now uses a recent version of Octokit.
[#490](https://github.com/CocoaPods/CocoaPods/issues/490)
## 0.14.0.rc2
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0.rc1...0.14.0.rc2)
......@@ -14,8 +26,11 @@
###### Bug fixes
- Fix incorrect name for Pods from external sources with preferred subspecs.
[#485](https://github.com/CocoaPods/CocoaPods/issues/485)
- Prevent duplication of Pod with a local source and mutliple activated specs.
[#485](https://github.com/CocoaPods/CocoaPods/issues/485)
- Fixed the `uninitialized constant Pod::Lockfile::Digest` error.
[#484](https://github.com/CocoaPods/CocoaPods/issues/484)
## 0.14.0.rc1
......
......@@ -23,7 +23,7 @@ PATH
escape (~> 0.0.4)
faraday (~> 0.8.1)
json (~> 1.7.3)
octokit (~> 1.7.0)
octokit (~> 1.7)
open4 (~> 1.3.0)
rake (~> 0.9.0)
xcodeproj (>= 0.3.0)
......@@ -48,7 +48,7 @@ GEM
ffi (1.1.5)
github-markup (0.7.4)
hashie (1.2.0)
i18n (0.6.0)
i18n (0.6.1)
json (1.7.5)
listen (0.4.7)
rb-fchange (~> 0.0.5)
......@@ -62,7 +62,7 @@ GEM
mocha (>= 0.9.8)
multi_json (1.3.6)
multipart-post (1.1.5)
octokit (1.7.0)
octokit (1.11.0)
addressable (~> 2.2)
faraday (~> 0.8)
faraday_middleware (~> 0.8)
......@@ -80,8 +80,8 @@ GEM
rb-inotify (0.8.8)
ffi (>= 0.5.0)
redcarpet (2.1.1)
slop (3.3.2)
terminal-notifier (1.3.0)
slop (3.3.3)
terminal-notifier (1.4.2)
vcr (2.2.4)
webmock (1.8.9)
addressable (>= 2.2.7)
......
......@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
s.require_paths = %w{ lib }
s.add_runtime_dependency 'faraday', '~> 0.8.1'
s.add_runtime_dependency 'octokit', '~> 1.7.0'
s.add_runtime_dependency 'octokit', '~> 1.7'
s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4'
......
......@@ -165,12 +165,26 @@ module Pod
end
def specification_from_external(sandbox, platform)
copy_external_source_into_sandbox(sandbox, platform)
podspec = copy_external_source_into_sandbox(sandbox, platform)
spec = specification_from_local(sandbox, platform)
raise Informative, "No podspec found for `#{name}' in #{description}" unless spec
spec
end
# Can store from a pathname or a string
#
def store_podspec(sandbox, podspec)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath
if podspec.is_a?(String)
raise Informative, "No podspec found for `#{name}' in `#{description}'" unless podspec.include?('Spec.new')
output_path.open('w') { |f| f.puts(podspec) }
else
raise Informative, "No podspec found for `#{name}' in `#{description}'" unless podspec.exist?
FileUtils.copy(podspec, output_path)
end
end
def ==(other)
return if other.nil?
name == other.name && params == other.params
......@@ -184,6 +198,7 @@ module Pod
target.rmtree if target.exist?
downloader = Downloader.for_target(sandbox.root + name, @params)
downloader.download
store_podspec(sandbox, target + "#{name}.podspec")
if local_pod = sandbox.installed_pod_named(name, platform)
local_pod.downloaded = true
end
......@@ -201,14 +216,10 @@ module Pod
# can be http, file, etc
class PodspecSource < AbstractExternalSource
def copy_external_source_into_sandbox(sandbox, _)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath
puts "-> Fetching podspec for `#{name}' from: #{@params[:podspec]}" unless config.silent?
path = @params[:podspec]
path = Pathname.new(path).expand_path if path.start_with?("~")
open(path) do |io|
output_path.open('w') { |f| f << io.read }
end
open(path) { |io| store_podspec(sandbox, io.read) }
end
def description
......@@ -224,9 +235,7 @@ module Pod
end
def copy_external_source_into_sandbox(sandbox, _)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath
FileUtils.copy(pod_spec_path, output_path)
store_podspec(sandbox, pod_spec_path)
end
def specification_from_local(sandbox, platform)
......
......@@ -55,11 +55,8 @@ module Pod
end
def podspec_for_name(name)
if spec_path = Dir[root + "#{name}/*.podspec"].first
Pathname.new(spec_path)
elsif spec_path = Dir[root + "Local Podspecs/#{name}.podspec"].first
Pathname.new(spec_path)
end
path = root + "Local Podspecs/#{name}.podspec"
path.exist? ? path : nil
end
end
......
......@@ -89,17 +89,35 @@ module Pod
end
end
describe Dependency::ExternalSources::GitSource do
describe Dependency::ExternalSources do
before do
@dependency = Dependency.new("cocoapods", :git => "git://github.com/cocoapods/cocoapods")
@sandbox = temporary_sandbox
end
it "marks a LocalPod as downloaded if it's from GitSource" do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
@sandbox.installed_pod_named('Reachability', Platform.ios).downloaded.should.be.true
end
it "marks a LocalPod as downloaded if it's downloaded" do
Downloader.stubs(:for_target).returns(stub_everything)
it "creates a copy of the podspec (GitSource)" do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
path = @sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "creates a copy of the podspec (PodspecSource)" do
dependency = Dependency.new("Reachability", :podspec => fixture('integration/Reachability/Reachability.podspec').to_s)
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
path = @sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
pod = mock('LocaPod', :downloaded= => true)
sandbox = stub('Sandbox', :root => temporary_sandbox.root, :installed_pod_named => pod)
@dependency.external_source.copy_external_source_into_sandbox(sandbox, Platform.ios)
it "creates a copy of the podspec (LocalSource)" do
dependency = Dependency.new("Reachability", :local => fixture('integration/Reachability'))
dependency.external_source.copy_external_source_into_sandbox(@sandbox, Platform.ios)
path = @sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
end
end
......
......@@ -81,11 +81,6 @@ describe Pod::Sandbox do
@sandbox.build_headers.root.should.not.exist
end
it "returns the path to a spec file in the root of the pod's dir" do
FileUtils.cp_r(fixture('banana-lib'), @sandbox.root + 'BananaLib')
@sandbox.podspec_for_name('BananaLib').should == @sandbox.root + 'BananaLib/BananaLib.podspec'
end
it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib') + 'BananaLib.podspec', @sandbox.root + 'Local Podspecs')
......@@ -93,13 +88,16 @@ describe Pod::Sandbox do
end
it "returns a LocalPod for a spec file in the sandbox" do
FileUtils.cp_r(fixture('banana-lib'), @sandbox.root + 'BananaLib')
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib') + 'BananaLib.podspec', @sandbox.root + 'Local Podspecs')
pod = @sandbox.installed_pod_named('BananaLib', Pod::Platform.ios)
pod.should.be.instance_of Pod::LocalPod
pod.top_specification.name.should == 'BananaLib'
end
it "returns a LocalPod for a spec instance which source is expected to be in the sandbox" do
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib') + 'BananaLib.podspec', @sandbox.root + 'Local Podspecs')
spec = Pod::Specification.from_file(fixture('banana-lib') + 'BananaLib.podspec')
pod = @sandbox.local_pod_for_spec(spec, Pod::Platform.ios)
pod.should.be.instance_of Pod::LocalPod
......@@ -107,8 +105,9 @@ describe Pod::Sandbox do
end
it "always returns the same cached LocalPod instance for the same spec and platform" do
FileUtils.cp_r(fixture('banana-lib'), @sandbox.root + 'BananaLib')
spec = Pod::Specification.from_file(@sandbox.root + 'BananaLib/BananaLib.podspec')
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib') + 'BananaLib.podspec', @sandbox.root + 'Local Podspecs')
spec = Pod::Specification.from_file(@sandbox.root + 'Local Podspecs/BananaLib.podspec')
pod = @sandbox.installed_pod_named('BananaLib', Pod::Platform.ios)
@sandbox.installed_pod_named('BananaLib', Pod::Platform.ios).should.eql pod
......
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