Commit c2aa84f5 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #6161 from CocoaPods/seg-lint-404-errors

[Spec::Lint] Fail gracefully when downloading podspec fails
parents 42de87c8 b8512e5c
......@@ -24,6 +24,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dmitry Obukhov](https://github.com/stel)
[#6146](https://github.com/CocoaPods/CocoaPods/pull/6146)
* Fail gracefully when downloading a podspec in `pod spec lint` fails.
[Samuel Giddins](https://github.com/segiddins)
## 1.2.0.beta.1 (2016-10-28)
##### Enhancements
......@@ -100,7 +104,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
* None.
* Redefine FOUNDATION_EXPORT for C-only pods in umbrella header
* Redefine FOUNDATION_EXPORT for C-only pods in umbrella header.
[Chris Ballinger](https://github.com/chrisballinger)
[#6024](https://github.com/CocoaPods/CocoaPods/issues/6024)
......
# Don't let testing shortcuts get into master by accident,
# Don't let testing shortcuts get into master by accident,
# ensuring that we don't get green builds based on a subset of tests
(git.modified_files + git.added_files - %w(Dangerfile)).each do |file|
next unless File.file?(file)
......
......@@ -98,8 +98,12 @@ module Pod
require 'cocoapods/open-uri'
output_path = podspecs_tmp_dir + File.basename(path)
output_path.dirname.mkpath
open(path) do |io|
output_path.open('w') { |f| f << io.read }
begin
open(path) do |io|
output_path.open('w') { |f| f << io.read }
end
rescue => e
raise Informative, "Downloading a podspec from `#{path}` failed: #{e}"
end
files << output_path
elsif (pathname = Pathname.new(path)).directory?
......
Subproject commit 42df8cc1e28c11eabefb31197ed7792a9248fc28
Subproject commit c66e853111de92e569dfdbb82c12ff81b57e9abb
......@@ -193,7 +193,7 @@ module Pod
#-------------------------------------------------------------------------#
describe 'lint subcommand' do
describe Command::Spec::Lint do
it "complains if it can't find any spec to lint" do
Dir.chdir(temporary_directory) do
lambda { command('spec', 'lint').run }.should.raise Informative
......@@ -214,6 +214,12 @@ module Pod
end
end
it 'fails with an informative error when downloading the podspec 404s' do
WebMock.stub_request(:get, 'https://no.such.domain/404').
to_return(:status => 404, :body => '', :headers => {})
lambda { run_command('spec', 'lint', 'https://no.such.domain/404') }.should.raise Informative, /404/
end
before do
text = (fixture('spec-repos') + 'master/Specs/JSONKit/1.4/JSONKit.podspec.json').read
text.gsub!(/.*license.*/, '"license": { "file": "LICENSE" },')
......
......@@ -344,7 +344,7 @@ describe_cli 'pod' do
end
describe 'Lints a remote Pod' do
spec_url = 'https://github.com/CocoaPods/Specs/raw/master/Specs/A2DynamicDelegate/2.0.2/A2DynamicDelegate.podspec.json'
spec_url = 'https://github.com/CocoaPods/Specs/raw/2d939ca0abb4172b9ef087d784b43e0696109e7c/Specs/A2DynamicDelegate/2.0.2/A2DynamicDelegate.podspec.json'
behaves_like cli_spec 'spec_lint_remote',
"spec lint --quick --allow-warnings --silent #{spec_url}"
end
......
......@@ -44,6 +44,7 @@ require 'spec_helper/temporary_repos' # Allows to create and modify temporary sp
require 'spec_helper/temporary_cache' # Allows to create temporary cache directory.
require 'spec_helper/user_interface' # Redirects UI to UI.output & UI.warnings.
require 'spec_helper/pre_flight' # Cleans the temporary directory, the config & the UI.output before every test.
require 'spec_helper/webmock' # Cleans up mocks after each spec
#-----------------------------------------------------------------------------#
......
require File.expand_path('../../spec_helper', __FILE__)
require 'webmock'
module Bacon
class Context
module AfterWebMock
def after(&block)
super
WebMock.reset!
end
end
include AfterWebMock
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