Commit faa726a3 authored by Fabio Pelosin's avatar Fabio Pelosin

Fixes for core changes.

parent 3618516a
......@@ -3,7 +3,8 @@ source "http://rubygems.org"
gemspec
group :development do
gem "cocoapods-core", :git => "git://github.com/CocoaPods/Core.git"
# gem "cocoapods-core", :git => "git://github.com/CocoaPods/Core.git"
gem "cocoapods-core", :path => "../Core"
gem "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git"
gem "mocha", "~> 0.11.4"
gem "bacon"
......
GIT
remote: git://github.com/CocoaPods/Core.git
revision: e41f3c851003589aaddde533dd6e90a81d095621
specs:
cocoapods-core (0.16.0.rc2)
activesupport (~> 3.2.6)
faraday (~> 0.8.1)
octokit (~> 1.7)
GIT
remote: git://github.com/CocoaPods/Xcodeproj.git
revision: d599d4ed17763aa5eb03382a17a6243e11beda2e
revision: fbb5c11844b99bd954b2945098502dde0641c311
specs:
xcodeproj (0.4.0)
activesupport (~> 3.2.6)
......@@ -40,6 +31,14 @@ PATH
rake (~> 0.9.4)
xcodeproj (~> 0.4.0)
PATH
remote: ../Core
specs:
cocoapods-core (0.16.0.rc2)
activesupport (~> 3.2.6)
faraday (~> 0.8.1)
octokit (~> 1.7)
GEM
remote: http://rubygems.org/
specs:
......@@ -69,12 +68,12 @@ GEM
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.1)
mocha (>= 0.9.8)
multi_json (1.3.7)
multi_json (1.4.0)
multipart-post (1.1.5)
octokit (1.18.0)
octokit (1.19.0)
addressable (~> 2.2)
faraday (~> 0.8)
faraday_middleware (~> 0.8)
faraday_middleware (~> 0.9)
hashie (~> 1.2)
multi_json (~> 1.3)
open4 (1.3.0)
......
......@@ -7,8 +7,8 @@ module Pod
end
class Command < CLAide::Command
autoload :ErrorReport, 'cocoapods/command/error_report'
autoload :DeepLinter, 'cocoapods/command/deep_linter'
autoload :ErrorReport, 'cocoapods/command/error_report'
autoload :AdvancedLinter, 'cocoapods/command/advanced_linter'
self.abstract_command = true
self.command = 'pod'
......
module Pod
class Command
class DeepLinter < Specification::Linter
# Extends the Linter from the Core to add additional which require the
# LocalPod and the Installer.
#
# In detail it checks that the file patterns defined by the user match
# actually do match at least a file and that the Pod builds, by installing
# it without integration and building the project with xcodebuild.
#
class AdvancedLinter
include Config::Mixin
# @param [Specification, Pathname, String] spec_or_path
# the Specification or the path of the `podspec` file to lint.
#
def initialize(spec_or_path)
@simple_linter = Specification::Linter.new(spec_or_path)
end
# @return [Specification] the specification to lint.
#
def spec
@simple_linter.spec
end
# @return [Pathname] the path of the `podspec` file where {#spec} is
# defined.
#
def file
@simple_linter.file
end
# @return [Specification::Linter] the linter instance from CocoaPods
# Core.
#
attr_reader :simple_linter
# Lints the specification adding a {Result} for any failed check to the
# {#results} list.
#
# @return [Bool] whether the specification passed validation.
#
def lint
super
# Show immediately which pod is being processed.
print " -> #{spec.name}\r" unless config.silent?
$stdout.flush
simple_linter.lint
unless quick
check_repo_path
spec.available_platforms.each do |platform|
UI.section "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed do
current_platform = platform
set_up_lint_environment
install_pod
build_pod
check_file_patterns
tear_down_lint_environment
# current_platform = platform
# set_up_lint_environment
# install_pod
# build_pod
# check_file_patterns
# tear_down_lint_environment
end
end
end
# This overwrites the previously printed text
UI.puts " -> ".send(color) << spec.name unless config.silent?
print_messages('ERROR', simple_linter.errors)
print_messages('WARN', simple_linter.warnings)
print_messages('NOTE', simple_linter.notes)
UI.puts unless config.silent?
errors.empty? && warnings.empty? && deprecations.empty?
end
# TODO
def result_type
:note
end
#-----------------------------------------------------------------------#
# @!group Configuration
# @return [Bool] whether the lint should skip the checks that requires
# the download or the build of the library.
......@@ -66,6 +110,12 @@ module Pod
@errors ||= results.select { |r| r.type == :note }
end
# TODO
def result_type
:note
end
#-----------------------------------------------------------------------#
private
......@@ -196,8 +246,7 @@ module Pod
# Parse the xcode build output to identify the lines which are relevant
# to the linter. It also removes the indentation and the temporary path.
#
# @param [String] output
# the output generated by the xcodebuild tool.
# @param [String] output the output generated by the xcodebuild tool.
#
# @return [Array<String>] the lines that are relevant to the linter.
#
......@@ -215,6 +264,13 @@ module Pod
"XCODEBUILD > " << new # Mark
end
end
#
#
def print_messages(type, messages)
return if config.silent?
messages.each {|msg| UI.puts " - #{type.ljust(5)} | #{msg}"}
end
end
end
end
......@@ -19,10 +19,10 @@ module Pod
end
def run_install_with_update(update)
sandbox = Sandbox.new(config.project_pods_root)
resolver = Resolver.new(config.podfile, config.lockfile, sandbox)
resolver.update_mode = update
Installer.new(resolver).install!
sandbox = Sandbox.new(config.project_pods_root)
installer = Installer.new(sandbox, config.podfile, config.lockfile)
installer.update_mode = update
installer.install!
end
end
......
......@@ -107,7 +107,7 @@ module Pod
invalid_count = 0
podspecs.each do |podspec|
linter = DeepLinter.new(podspec)
linter = AdvancedLinter.new(podspec)
linter.quick = true
linter.repo_path = dir
......
......@@ -84,16 +84,11 @@ module Pod
UI.puts
invalid_count = 0
podspecs_to_lint.each do |podspec|
linter = DeepLinter.new(podspec)
linter.quick = @quick
linter.local = @local
linter = AdvancedLinter.new(podspec)
linter.quick = @quick
linter.local = @local
linter.no_clean = @no_clean
# Show immediatly which pod is being processed.
print " -> #{linter.spec_name}\r" unless config.silent?
$stdout.flush
linter.lint
case linter.result_type
when :error
invalid_count += 1
......@@ -104,14 +99,6 @@ module Pod
else
color = :green
end
# This overwrites the previously printed text
UI.puts " -> ".send(color) << linter.spec_name unless config.silent?
print_messages('ERROR', linter.errors)
print_messages('WARN', linter.warnings)
print_messages('NOTE', linter.notes)
UI.puts unless config.silent?
end
count = podspecs_to_lint.count
......@@ -129,11 +116,6 @@ module Pod
# TODO some of the following methods can probably move to one of the subclasses.
private
def print_messages(type, messages)
return if config.silent?
messages.each {|msg| UI.puts " - #{type.ljust(5)} | #{msg}"}
end
def podspecs_to_lint
@podspecs_to_lint ||= begin
files = []
......
......@@ -72,25 +72,25 @@ module Pod
#
attr_reader :lockfile
# @return [Bool]
# whether the installer is in update mode. In update mode the contents of
# the Lockfile are not taken into account for deciding what Pods to
# install.
#
attr_reader :update_mode
# @param [Sandbox] sandbox @see sandbox
# @param [Podfile] podfile @see podfile
# @param [Lockfile] lockfile @see lockfile
# @param [Bool] update_mode @see update_mode
#
def initialize(sandbox, podfile, lockfile = nil, update_mode = false)
def initialize(sandbox, podfile, lockfile = nil)
@sandbox = sandbox
@podfile = podfile
@lockfile = lockfile
@update_mode = update_mode
end
# @return [Bool]
# whether the installer is in update mode. In update mode the contents of
# the Lockfile are not taken into account for deciding what Pods to
# install.
#
attr_accessor :update_mode
# Installs the Pods.
#
# The installation process of is mostly linear with few minor complications
......@@ -294,7 +294,7 @@ module Pod
#
def generate_locked_dependencies
@locked_dependencies = pods_unchanged_from_the_lockfile.map do |pod|
lockfile.dependency_for_installed_pod_named(pod)
lockfile.dependency_to_lock_pod_named(pod)
end
end
......@@ -608,7 +608,7 @@ module Pod
UI.message "- Running pre install hooks" do
local_pods_by_target.each do |target_definition, pods|
pods.each do |pod|
pod.top_specification.pre_install(pod, target_definition)
pod.top_specification.pre_install!(pod, target_definition)
end
end
@podfile.pre_install!(self)
......@@ -621,7 +621,7 @@ module Pod
# target installer to the spec post install hook.
target_installers.each do |target_installer|
specs_by_target[target_installer.target_definition].each do |spec|
spec.post_install(target_installer)
spec.post_install!(target_installer)
end
end
@podfile.post_install!(self)
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::DeepLinter do
describe Command::AdvancedLinter do
extend SpecHelper::TemporaryDirectory
def write_podspec(text, name = 'JSONKit.podspec')
......@@ -19,7 +19,7 @@ module Pod
it "respects quick mode" do
file = write_podspec(stub_podspec)
linter = Command::DeepLinter.new(file)
linter = Command::AdvancedLinter.new(file)
linter.expects(:peform_multiplatform_analysis).never
linter.expects(:install_pod).never
linter.expects(:xcodebuild_output_for_platfrom).never
......@@ -31,7 +31,7 @@ module Pod
unless skip_xcodebuild?
it "uses xcodebuild to generate notes and warnings" do
file = write_podspec(stub_podspec)
linter = Command::DeepLinter.new(file)
linter = Command::AdvancedLinter.new(file)
linter.lint
linter.result_type.should == :warning
linter.notes.join(' | ').should.include "JSONKit/JSONKit.m:1640:27: warning: equality comparison with extraneous parentheses"
......@@ -40,7 +40,7 @@ module Pod
it "checks for file patterns" do
file = write_podspec(stub_podspec(/s\.source_files = 'JSONKit\.\*'/, "s.source_files = 'JSONKit.*'\ns.resources = 'WRONG_FOLDER'"))
linter = Command::DeepLinter.new(file)
linter = Command::AdvancedLinter.new(file)
linter.stubs(:xcodebuild_output).returns([])
linter.quick = false
linter.lint
......@@ -50,7 +50,7 @@ module Pod
it "uses the deployment target of the specification" do
file = write_podspec(stub_podspec(/s.name *= 'JSONKit'/, "s.name = 'JSONKit'; s.platform = :ios, '5.0'"))
linter = Command::DeepLinter.new(file)
linter = Command::AdvancedLinter.new(file)
linter.quick = true
linter.lint
podfile = linter.podfile_from_spec
......
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