Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Repo::Lint] Update for CocoaPods-Core changes

  • Loading branch information...
commit 7a148635d3fb58ace822fe44ed4144d14733e61d 1 parent b910097
@fabiopelosin fabiopelosin authored
View
4 Gemfile
@@ -6,11 +6,11 @@ end
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 "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git"
gem "cocoapods-downloader", :git => "git://github.com/CocoaPods/cocoapods-downloader"
- # gem "cocoapods-core", :path => "../Core"
+ gem "cocoapods-core", :path => "../Core"
# gem "xcodeproj", :path => "../Xcodeproj"
# gem "cocoapods-downloader", :path => "../cocoapods-downloader"
View
62 lib/cocoapods/command/repo.rb
@@ -100,54 +100,32 @@ def run
dirs.each do |dir|
SourcesManager.check_version_information(dir)
UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow
- podspecs = Pathname.glob( dir + '**/*.podspec')
- invalid_count = 0
-
- messages_by_type = {}
- podspecs.each do |podspec|
- # print "\033[K -> #{podspec.relative_path_from(dir)}\r" unless config.silent?
- validator = Validator.new(podspec)
- validator.quick = true
- validator.repo_path = dir
- validator.only_errors = @only_errors
- validator.disable_ui_output = true
-
- validator.validate
- invalid_count += 1 if validator.result_type == :error
- unless validator.validated?
- if @only_errors
- results = validator.results.select { |r| r.type.to_s == "error" }
- else
- results = validator.results
- end
- sorted_results = results.sort_by { |r| [r.type.to_s, r.message] }
- sorted_results.each do |result|
- name = validator.spec ? validator.spec.name : podspec.relative_path_from(dir)
- version = validator.spec ? validator.spec.version : 'unknown'
- messages_by_type[result.type] ||= {}
- messages_by_type[result.type][result.message] ||= {}
- messages_by_type[result.type][result.message][name] ||= []
- messages_by_type[result.type][result.message][name] << version
- end
- end
- end
- # print "\033[K" unless config.silent?
- messages_by_type.each do |type, names_by_message|
- names_by_message.each do |message, versions_by_names|
- color = type == :error ? :red : :yellow
- UI.puts "[#{type}] #{message}".send(color)
- versions_by_names.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
- UI.puts
- end
+ validator = Source::HealthReporter.new(dir)
+ validator.pre_check do |name, version|
+ UI.print '.'
+ end
+ report = validator.analyze
+ UI.puts
+ UI.puts
+
+ report.pods_by_warning.each do |message, versions_by_name|
+ UI.puts "-> #{message}".yellow
+ versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
+ UI.puts
end
- UI.puts "Analyzed #{podspecs.count} podspecs files.\n\n"
+ report.pods_by_error.each do |message, versions_by_name|
+ UI.puts "-> #{message}".red
+ versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
+ UI.puts
+ end
- if invalid_count == 0
+ UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
+ if report.pods_by_error.count.zero?
UI.puts "All the specs passed validation.".green << "\n\n"
else
- raise Informative, "#{invalid_count} podspecs failed validation."
+ raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
end
end
end
View
84 lib/cocoapods/user_interface.rb
@@ -142,35 +142,6 @@ def notice(message)
puts("\n[!] #{message}".green)
end
- # Stores important warning to the user optionally followed by actions
- # that the user should take. To print them use #{print_warnings}
- #
- # @param [String] message The message to print.
- # @param [Array] actions The actions that the user should take.
- #
- # return [void]
- #
- def warn(message, actions = [], verbose_only = false)
- warnings << { :message => message, :actions => actions, :verbose_only => verbose_only }
- end
-
- # Prints the stored warnings. This method is intended to be called at the
- # end of the execution of the binary.
- #
- # @return [void]
- #
- def print_warnings
- STDOUT.flush
- warnings.each do |warning|
- next if warning[:verbose_only] && !config.verbose?
- STDERR.puts("\n[!] #{warning[:message]}".yellow)
- warning[:actions].each do |action|
- indented = wrap_string(action, " - ")
- puts(indented)
- end
- end
- end
-
# Returns a string containing relative location of a path from the Podfile.
# The returned path is quoted. If the argument is nit it returns the
# empty string.
@@ -226,14 +197,6 @@ def labeled(label, value)
end
end
- # @!group Basic printing
-
- # Prints a message unless config is silent.
- #
- def puts(message = '')
- super(message) unless config.silent?
- end
-
# Prints a message respecting the current indentation level and
# wrapping it to the terminal width if necessary.
#
@@ -242,9 +205,56 @@ def puts_indented(message = '')
puts(indented)
end
+ # Prints the stored warnings. This method is intended to be called at the
+ # end of the execution of the binary.
+ #
+ # @return [void]
+ #
+ def print_warnings
+ STDOUT.flush
+ warnings.each do |warning|
+ next if warning[:verbose_only] && !config.verbose?
+ STDERR.puts("\n[!] #{warning[:message]}".yellow)
+ warning[:actions].each do |action|
+ indented = wrap_string(action, " - ")
+ puts(indented)
+ end
+ end
+ end
+
+ public
+
+ # @!group Basic methods
+ #-----------------------------------------------------------------------#
+
+ # prints a message followed by a new line unless config is silent.
+ #
+ def puts(message = '')
+ STDOUT.puts(message) unless config.silent?
+ end
+
+ # prints a message followed by a new line unless config is silent.
+ #
+ def print(message)
+ STDOUT.print(message) unless config.silent?
+ end
+
+ # Stores important warning to the user optionally followed by actions
+ # that the user should take. To print them use {#print_warnings}.
+ #
+ # @param [String] message The message to print.
+ # @param [Array] actions The actions that the user should take.
+ #
+ # return [void]
+ #
+ def warn(message, actions = [], verbose_only = false)
+ warnings << { :message => message, :actions => actions, :verbose_only => verbose_only }
+ end
+
private
# @!group Helpers
+ #-----------------------------------------------------------------------#
# @return [String] Wraps a string taking into account the width of the
# terminal and an option indent. Adapted from
View
2  spec/functional/command/inter_process_communication_spec.rb
@@ -76,7 +76,7 @@ module Pod
out.should.match /target_definitions:/
out.should.match /platform: ios/
out.should.match /- SSZipArchive:/
- out.should.end_with?("\n\r")
+ out.should.end_with?("\n\r\n")
end
end
View
8 spec/spec_helper/user_interface.rb
@@ -15,11 +15,15 @@ class << self
attr_accessor :warnings
def puts(message = '')
- @output << "#{message}"
+ @output << "#{message}\n"
end
def warn(message = '', actions = [])
- @warnings << "#{message}"
+ @warnings << "#{message}\n"
+ end
+
+ def print(message)
+ @output << message
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.