Commit 09f57007 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #196 from CocoaPods/colors

Colors
parents 4f217528 663f6d43
source "http://rubygems.org"
gem "open4"
gem "colored"
group :development do
gem "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git"
......
......@@ -9,6 +9,7 @@ GEM
specs:
addressable (2.2.7)
bacon (1.1.0)
colored (1.2)
crack (0.3.1)
kicker (2.5.0)
rb-fsevent
......@@ -30,6 +31,7 @@ PLATFORMS
DEPENDENCIES
bacon
colored
kicker
mocha-on-bacon
open4
......
......@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'xcodeproj', '~> 0.1.0'
s.add_runtime_dependency 'popen4', '~> 0.1.2'
s.add_runtime_dependency 'colored', '~> 1.2'
s.add_development_dependency 'bacon', '~> 1.1'
## Make sure you can build the gem on older versions of RubyGems too:
......
require 'colored'
module Pod
class Command
autoload :ErrorReport, 'cocoapods/command/error_report'
......
......@@ -8,18 +8,8 @@ module Pod
class << self
def report(error)
return <<-EOS
Oh no, an error occurred. #{error_from_podfile(error)}
Search for existing github issues similar to yours:
https://github.com/CocoaPods/CocoaPods/issues/search?q=%22#{CGI.escape(error.message)}%22
If none exists, create a ticket, with the information in the below (markdown formatted) template, on:
https://github.com/CocoaPods/CocoaPods/issues/new
**Don't forget to anonymize any private data!**
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
### Report
......@@ -32,29 +22,41 @@ If none exists, create a ticket, with the information in the below (markdown for
### Stack
* Host version: #{host_information}
* Xcode version: #{xcode_information}
* Ruby version: #{RUBY_DESCRIPTION}
* Ruby lib dir: #{RbConfig::CONFIG['libdir']}
* RubyGems version: #{Gem::VERSION}
* CocoaPods version: #{Pod::VERSION}
* Specification repositories:
- #{repo_information.join("\n - ")}
```
CocoaPods : #{Pod::VERSION}
Ruby : #{RUBY_DESCRIPTION}
RubyGems : #{Gem::VERSION}
Host : #{host_information}
Xcode : #{xcode_information}
Ruby lib dir : #{RbConfig::CONFIG['libdir']}
Repositories : #{repo_information.join("\n ")}
```
### Podfile
```ruby
#{Config.instance.project_podfile.read if Config.instance.project_podfile}
#{Config.instance.project_podfile.read.strip if Config.instance.project_podfile}
```
### Error
```
#{error.message}
#{error.backtrace.join("\n ")}
#{error.backtrace.join("\n")}
```
#{'――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
#{'[!] Oh no, an error occurred.'.red}
#{error_from_podfile(error)}
#{'Search for existing github issues similar to yours:'.yellow}
#{"https://github.com/CocoaPods/CocoaPods/issues/search?q=#{CGI.escape(error.message)}"}
#{'If none exists, create a ticket, with the template displayed above, on:'.yellow}
https://github.com/CocoaPods/CocoaPods/issues/new
Don't forget to anonymize any private data!
EOS
end
......@@ -62,7 +64,7 @@ EOS
def error_from_podfile(error)
if error.message =~ /Podfile:(\d*)/
"It appears to have originated from your Podfile at line #{$1}."
"\nIt appears to have originated from your Podfile at line #{$1}.\n"
end
end
......
......@@ -40,6 +40,7 @@ module Pod
raise Informative, "The specified project `#{@projpath}' does not exist."
end
if @update_repo
puts "\nUpdating Spec Repositories\n".yellow if config.verbose?
Repo.new(ARGV.new(["update"])).run
end
Installer.new(podfile, @projpath).install!
......
......@@ -27,7 +27,7 @@ module Pod
if @list
puts set.name
else
puts "\e[32m--> #{set.name} (#{set.versions.reverse.join(", ")})\e[0m"
puts "--> #{set.name} (#{set.versions.reverse.join(", ")})".green
puts_wrapped_text(set.specification.summary)
spec = set.specification.part_of_other_pod? ? set.specification.part_of_specification : set.specification
......
......@@ -45,10 +45,11 @@ module Pod
def install_dependencies!
activated_specifications.map do |spec|
LocalPod.new(spec, sandbox).tap do |pod|
marker = config.verbose ? "\n-> ".green : ''
if pod.exists? || spec.local?
puts "Using #{pod}" unless config.silent?
puts marker + "Using #{pod}" unless config.silent?
else
puts "Installing #{spec}" unless config.silent?
puts marker + "Installing #{spec}".green unless config.silent?
downloader = Downloader.for_pod(pod)
downloader.download
......@@ -59,7 +60,7 @@ module Pod
end
if config.doc?
puts "Installing Documentation for #{spec}" if config.verbose?
puts "Installing Documentation for #{spec}".green if config.verbose?
Generator::Documentation.new(pod).generate(config.doc_install?)
end
end
......@@ -70,10 +71,13 @@ module Pod
def install!
@sandbox.prepare_for_install
puts "Installing dependencies of: #{@podfile.defined_in_file}" if config.verbose?
puts_title "Resolving dependencies of: #{@podfile.defined_in_file}"
specs_by_target
puts_title "Installing dependencies"
pods = install_dependencies!
puts "Generating support files" unless config.silent?
puts_title("Generating support files\n", false)
target_installers.each do |target_installer|
target_specs = activated_specifications_for_target(target_installer.target_definition)
pods_for_target = pods.select { |pod| target_specs.include?(pod.specification) }
......@@ -86,7 +90,7 @@ module Pod
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
run_post_install_hooks
puts "* Writing Xcode project file to `#{@sandbox.project_path}'" if config.verbose?
puts "* Writing Xcode project file to `#{@sandbox.project_path}'\n\n" if config.verbose?
project.save_as(@sandbox.project_path)
UserProjectIntegrator.new(@user_project_path, @podfile).integrate! if @user_project_path
......@@ -134,12 +138,12 @@ module Pod
end
end
def dependency_specifications_for_each_target_definition
@dependency_specifications_for_each_target_definition ||= @resolver.resolve
def specs_by_target
@specs_by_target ||= @resolver.resolve
end
def dependency_specifications
dependency_specifications_for_each_target_definition.values.flatten
specs_by_target.values.flatten
end
def activated_specifications
......@@ -151,11 +155,21 @@ module Pod
end
def activated_specifications_for_target(target_definition)
dependency_specifications_for_each_target_definition[target_definition]
specs_by_target[target_definition]
end
def download_only_specifications
dependency_specifications - activated_specifications
end
private
def puts_title(title, only_verbose = true)
if(config.verbose?)
puts "\n" + title.yellow
elsif(!config.silent? && !only_verbose)
puts title
end
end
end
end
......@@ -10,20 +10,19 @@ module Pod
@sandbox = sandbox
@cached_sets = {}
@cached_sources = Source::Aggregate.new
@log_indent = 1;
@log_indent = 0;
end
def resolve
@specs = {}
result = @podfile.target_definitions.values.inject({}) do |result, target_definition|
puts "\n--> Finding dependencies for target `#{target_definition.name}'" if config.verbose?
puts "\Resolving dependencies for target `#{target_definition.name}'".green if config.verbose?
@loaded_specs = []
find_dependency_sets(@podfile, target_definition.dependencies)
result[target_definition] = @specs.values_at(*@loaded_specs).sort_by(&:name)
result
end
puts if config.verbose?
# Specification doesn't need to know more about the context, so we assign
# the other specification, of which this pod is a part, to the spec.
......
......@@ -14,7 +14,7 @@ module Pod
def search(dependency)
all.map { |s| s.search(dependency) }.compact.first ||
raise(Informative, "Unable to find a pod named `#{dependency.name}'")
raise(Informative, "Unable to find a pod named `#{dependency.name}'".red)
end
def search_by_name(query, full_text_search)
......
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