Commit 24b0a272 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into dedicated-targets

* master:
  [ErrorReport] Fix issues search url
  Pods-resources.sh: Generate newlines between install_resource calls
  [Sandbox] Try to make an educated guess as to where the MacPorts prefix is.
  [Sandbox] Small cleanup.
  [Changelog] Add note about the path option and the sandbox [ci skip]
  [Command::Help] Show root help with 'pod help'
  [Specs] Use pretty bacon
  [Command] default to install
  [CHANGELOG] Add note about other package managers than Homebrew.
  [CHANGELOG] Cleanup last addition regarding sandbox.
  [CHANGELOG] Introduce the experimental sandbox feature.
  [Gemfile] Adopt local git repos feature of Bunlder
  [CopyResourcesScript] Fix permissions
  Update CHANGELOG.md
  [CopyResourcesScript] Restore compatiblity with Ruby 1.8.7
  [SpecHelper] Use Coveralls only in Ruby > 1.8
  [Gemspec] Bump json dep
  [SpecHelper] Don't require simplecov in Ruby 1.8.x
parents 806463e2 be7e5888
...@@ -6,6 +6,38 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -6,6 +6,38 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Enhancements ###### Enhancements
* Introduces an experimental sandbox feature.
[#939](https://github.com/CocoaPods/CocoaPods/issues/939)
Let’s face it, even though we have a great community that spends an amazing
amount of time on curating the specifications, the internet can be a hostile
place and the community is growing too large to take a naive approach any
longer.
As such, we have started leveraging OS X’s sandbox facilities to disallow
unsanctioned operations. This is still very experimental and therefore has to
be used explicitely, for now, but that does **not** mean we don’t want you to
start using it and **report issues**.
To use the sandbox, simply use the `sandbox-pod` command instead. E.g.:
$ sandbox-pod install
In case of issues, be sure to check `/var/log/system.log` for ‘deny’ messages.
For instance, here’s an example where the sandbox denies read access to `/`:
May 16 00:23:35 Khaos kernel[0]: Sandbox: ruby(98430) deny file-read-data /
**NOTE**: _The above example is actually one that we know of. We’re not sure
yet which process causes this, but there shouldn’t be a need for any process
to read data from the root path anyways._
**NOTE 2**: _At the moment the sandbox is not compatible with the `:path` option
when referencing Pods that are not stored within the directory of the Podfile._
* The naked `pod` command now defaults to `pod install`.
[#958](https://github.com/CocoaPods/CocoaPods/issues/958)
* Documentation generation has been removed from CocoaPods as it graduated * Documentation generation has been removed from CocoaPods as it graduated
to CocoaDocs. This decision was taken because CocoaDocs is a much better to CocoaDocs. This decision was taken because CocoaDocs is a much better
solution which doesn't clutter Xcode's docsets while still allowing solution which doesn't clutter Xcode's docsets while still allowing
...@@ -69,8 +101,8 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -69,8 +101,8 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Deprecations ###### Deprecations
* The `:local` flag in Podfile has been renamed to `:path` and has been * The `:local` flag in Podfile has been renamed to `:path` and the old syntax
deprecated. has been deprecated.
[#971](https://github.com/CocoaPods/CocoaPods/issues/971) [#971](https://github.com/CocoaPods/CocoaPods/issues/971)
###### Bug fixes ###### Bug fixes
......
...@@ -6,19 +6,16 @@ end ...@@ -6,19 +6,16 @@ end
gemspec gemspec
group :development do group :development do
if ENV['COCOA_PODS_DEPENDENCIES'] == 'local' # To develop the deps in tandem use the `LOCAL GIT REPOS` feature of Bundler.
gem 'cocoapods-core', :path => '../Core' gem 'cocoapods-core', :git => "https://github.com/CocoaPods/Core.git", :branch => 'master'
gem 'xcodeproj', :path => '../Xcodeproj' gem 'xcodeproj', :git => "https://github.com/CocoaPods/Xcodeproj.git", :branch => 'master'
gem 'cocoapods-downloader', :path => '../cocoapods-downloader' gem 'cocoapods-downloader', :git => "https://github.com/CocoaPods/cocoapods-downloader.git", :branch => 'master'
else gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master'
gem 'cocoapods-core', :git => "https://github.com/CocoaPods/Core.git", :branch => 'master'
gem 'xcodeproj', :git => "https://github.com/CocoaPods/Xcodeproj.git"
gem 'cocoapods-downloader', :git => "https://github.com/CocoaPods/cocoapods-downloader.git"
end
gem "mocha" gem "mocha"
gem "bacon" gem "bacon"
gem "mocha-on-bacon" gem "mocha-on-bacon"
gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master'
gem "rake" gem "rake"
gem 'coveralls', :require => false, :git => 'https://github.com/lemurheavy/coveralls-ruby.git' gem 'coveralls', :require => false, :git => 'https://github.com/lemurheavy/coveralls-ruby.git'
end end
......
...@@ -37,18 +37,20 @@ ruby_prefix = RbConfig::CONFIG['prefix'] ...@@ -37,18 +37,20 @@ ruby_prefix = RbConfig::CONFIG['prefix']
prefixes = ['/bin', '/usr/bin', '/usr/libexec'] prefixes = ['/bin', '/usr/bin', '/usr/libexec']
prefixes << `brew --prefix`.strip unless `which brew`.strip.empty? prefixes << `brew --prefix`.strip unless `which brew`.strip.empty?
# TODO add MacPorts. More? # From asking people, it seems MacPorts does not have a `prefix` command, like
# Homebrew does, so make an educated guess:
unless (port = `which port`.strip).empty?
prefixes << File.dirname(File.dirname(port))
end
developer_prefix = `xcode-select --print-path`.strip developer_prefix = `xcode-select --print-path`.strip
xcode_app_path = File.expand_path('../..', developer_prefix) xcode_app_path = File.expand_path('../..', developer_prefix)
require 'erb' require 'erb'
profile = ERB.new(DATA.read, 0, '>').result(TOPLEVEL_BINDING) profile = ERB.new(DATA.read, 0, '>').result(TOPLEVEL_BINDING)
puts profile #puts profile
command = ['/usr/bin/sandbox-exec', '-p', profile, pod_bin, *ARGV] command = ['/usr/bin/sandbox-exec', '-p', profile, pod_bin, *ARGV]
#puts command
exec *command exec *command
......
...@@ -36,7 +36,7 @@ Gem::Specification.new do |s| ...@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'octokit', '~> 1.7' s.add_runtime_dependency 'octokit', '~> 1.7'
s.add_runtime_dependency 'colored', '~> 1.2' s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4' s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'json', '~> 1.7.3' s.add_runtime_dependency 'json', '~> 1.8.0'
s.add_runtime_dependency 'open4', '~> 1.3.0' s.add_runtime_dependency 'open4', '~> 1.3.0'
s.add_runtime_dependency 'rake', '~> 10.0.0' s.add_runtime_dependency 'rake', '~> 10.0.0'
s.add_runtime_dependency 'activesupport', '~> 3.2.13' s.add_runtime_dependency 'activesupport', '~> 3.2.13'
......
...@@ -21,6 +21,7 @@ module Pod ...@@ -21,6 +21,7 @@ module Pod
require 'cocoapods/command/podfile_info' require 'cocoapods/command/podfile_info'
self.abstract_command = true self.abstract_command = true
self.default_subcommand = 'install'
self.command = 'pod' self.command = 'pod'
self.description = 'CocoaPods, the Objective-C library package manager.' self.description = 'CocoaPods, the Objective-C library package manager.'
......
...@@ -5,7 +5,7 @@ module Pod ...@@ -5,7 +5,7 @@ module Pod
self.arguments = '[COMMAND]' self.arguments = '[COMMAND]'
def initialize(argv) def initialize(argv)
@help_command = Pod::Command.parse(argv) unless argv.empty? @help_command = Pod::Command.parse(argv)
super super
end end
...@@ -16,7 +16,7 @@ module Pod ...@@ -16,7 +16,7 @@ module Pod
private private
def help_command def help_command
@help_command || self @help_command
end end
end end
end end
......
...@@ -2,8 +2,6 @@ module Pod ...@@ -2,8 +2,6 @@ module Pod
module Generator module Generator
class CopyResourcesScript class CopyResourcesScript
require 'fileutils'
# @return [Array<#to_s>] A list of files relative to the project pods # @return [Array<#to_s>] A list of files relative to the project pods
# root. # root.
# #
...@@ -33,7 +31,7 @@ module Pod ...@@ -33,7 +31,7 @@ module Pod
pathname.open('w') do |file| pathname.open('w') do |file|
file.puts(script) file.puts(script)
end end
FileUtils.chmod('+x', pathname.to_s) File.chmod(0755, pathname.to_s)
end end
private private
...@@ -72,7 +70,7 @@ module Pod ...@@ -72,7 +70,7 @@ module Pod
def script def script
script = install_resources_function script = install_resources_function
resources.each do |resource| resources.each do |resource|
script += "install_resource '#{resource}'" script += "install_resource '#{resource}'\n"
end end
script script
end end
......
...@@ -45,7 +45,7 @@ Repositories : #{repo_information.join("\n ")} ...@@ -45,7 +45,7 @@ Repositories : #{repo_information.join("\n ")}
#{'[!] Oh no, an error occurred.'.red} #{'[!] Oh no, an error occurred.'.red}
#{error_from_podfile(exception)} #{error_from_podfile(exception)}
#{'Search for existing github issues similar to yours:'.yellow} #{'Search for existing github issues similar to yours:'.yellow}
#{"https://github.com/CocoaPods/CocoaPods/issues/search?q=#{CGI.escape(exception.message)}"} #{"https://github.com/CocoaPods/CocoaPods/search?q=#{CGI.escape(exception.message)}&type=Issues"}
#{'If none exists, create a ticket, with the template displayed above, on:'.yellow} #{'If none exists, create a ticket, with the template displayed above, on:'.yellow}
https://github.com/CocoaPods/CocoaPods/issues/new https://github.com/CocoaPods/CocoaPods/issues/new
......
...@@ -47,8 +47,9 @@ require 'pathname' ...@@ -47,8 +47,9 @@ require 'pathname'
# #
ROOT = Pathname.new(File.expand_path('../../', __FILE__)) unless defined? ROOT ROOT = Pathname.new(File.expand_path('../../', __FILE__)) unless defined? ROOT
$:.unshift((ROOT + 'spec').to_s) require 'rubygems'
require 'spec_helper/bacon' require 'bundler/setup'
require 'pretty_bacon'
require 'colored' require 'colored'
require 'diffy' require 'diffy'
require 'Xcodeproj' # For Differ require 'Xcodeproj' # For Differ
......
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
if ENV['CI'] || ENV['GENERATE_COVERAGE'] if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("1.9")
require 'simplecov' if ENV['CI'] || ENV['GENERATE_COVERAGE']
require 'coveralls' require 'simplecov'
require 'coveralls'
if ENV['CI']
SimpleCov.formatter = Coveralls::SimpleCov::Formatter if ENV['CI']
elsif ENV['GENERATE_COVERAGE'] SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter elsif ENV['GENERATE_COVERAGE']
end SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
SimpleCov.start do end
add_filter "/spec_helper/" SimpleCov.start do
add_filter "/spec_helper/"
end
end end
end end
...@@ -23,6 +25,7 @@ require 'rubygems' ...@@ -23,6 +25,7 @@ require 'rubygems'
require 'bundler/setup' require 'bundler/setup'
require 'bacon' require 'bacon'
require 'mocha-on-bacon' require 'mocha-on-bacon'
require 'pretty_bacon'
require 'pathname' require 'pathname'
require "active_support/core_ext/string/strip" require "active_support/core_ext/string/strip"
...@@ -34,7 +37,6 @@ require 'cocoapods' ...@@ -34,7 +37,6 @@ require 'cocoapods'
require 'claide' require 'claide'
require 'awesome_print' require 'awesome_print'
require 'spec_helper/bacon' # Prettifies the bacon output and adds support for `xit`.
require 'spec_helper/command' # Allows to run Pod commands and returns their output. require 'spec_helper/command' # Allows to run Pod commands and returns their output.
require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed. require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed.
require 'spec_helper/temporary_repos' # Allows to create and modify temporary spec repositories. require 'spec_helper/temporary_repos' # Allows to create and modify temporary spec repositories.
......
# Encoding: utf-8
module Bacon
summary_at_exit
@needs_first_put = true
def self.color(color, string)
case color
when :red
"\e[31m#{string}\e[0m"
when :green
"\e[32m#{string}\e[0m"
when :yellow
"\e[33m#{string}\e[0m"
when :none
string
else
"\e[0m#{string}\e[0m"
end
end
#---------------------------------------------------------------------------#
# Overrides the SpecDoxzRtput to provide colored output by default
#
# Based on https://github.com/zen-cms/Zen-Core and subsequently modified
# which is available under the MIT License. Thanks YorickPeterse!
#
module SpecDoxOutput
def handle_specification(name)
if @needs_first_put
@needs_first_put = false
puts
end
@specs_depth = @specs_depth || 0
puts spaces + name
@specs_depth += 1
yield
@specs_depth -= 1
puts if @specs_depth.zero?
end
#:nodoc:
def handle_requirement(description, disabled = false)
start_time = Time.now.to_f
error = yield
elapsed_time = ((Time.now.to_f - start_time) * 1000).round
if !error.empty?
puts Bacon.color(:red, "#{spaces}- #{description} [FAILED]")
elsif disabled
puts Bacon.color(:yellow, "#{spaces}- #{description} [DISABLED]")
else
time_color = case elapsed_time
when 0..200
:none
when 200..500
:yellow
else
:red
end
puts Bacon.color(:green, "#{spaces}✓ ") + "#{description} " + Bacon.color(time_color, "(#{elapsed_time} ms)")
end
end
#:nodoc:
def handle_summary
print ErrorLog if Backtraces
unless Counter[:disabled].zero?
puts Bacon.color(:yellow, "#{Counter[:disabled]} disabled specifications\n")
end
puts "%d specifications (%d requirements), %d failures, %d errors" %
Counter.values_at(:specifications, :requirements, :failed, :errors)
end
#:nodoc:
def spaces
return ' ' * @specs_depth
end
end
#---------------------------------------------------------------------------#
# Overrides the TestUnitOutput to provide colored result output.
#
module TestUnitOutput
# Represents the specifications as `:`.
#
def handle_specification(name)
indicator = Bacon.color(nil, ':')
print indicator
@indicators||=''
@indicators << indicator
yield
end
# Represents the requirements as:
#
# - [.] successful
# - [E] error
# - [F] failure
# - [_] skipped
#
# After the first failure or error all the other requirements are skipped.
#
def handle_requirement(description, disabled = false)
if @first_error
indicator = Bacon.color(nil, '_')
else
error = yield
if !error.empty?
@first_error = true
m = error[0..0]
c = (m == "E" ? :red : :yellow)
indicator = Bacon.color(c, m)
elsif disabled
indicator = "D"
else
indicator = Bacon.color(nil, '.')
end
end
print indicator
@indicators||=''
@indicators << indicator
end
def handle_summary
first_error = ''
error_count = 0
ErrorLog.lines.each do |s|
error_count += 1 if s.include?('Error:') || s.include?('Informative')
first_error << s if error_count <= 1
end
first_error = first_error.gsub(Dir.pwd + '/', '')
first_error = first_error.gsub(/lib\//, Bacon.color(:yellow, 'lib') + '/')
first_error = first_error.gsub(/:([0-9]+):/, ':' + Bacon.color(:yellow, '\1') + ':')
puts "\n#{first_error}" if Backtraces
unless Counter[:disabled].zero?
puts Bacon.color(:yellow, "#{Counter[:disabled]} disabled specifications")
end
result = "%d specifications (%d requirements), %d failures, %d errors" %
Counter.values_at(:specifications, :requirements, :failed, :errors)
if Counter[:failed].zero?
puts Bacon.color(:green, result)
else
puts Bacon.color(:red, result)
end
end
end
#---------------------------------------------------------------------------#
module FilterBacktraces
def handle_summary
ErrorLog.replace(ErrorLog.split("\n").reject do |line|
line =~ %r{(gems/mocha|spec_helper|ruby_noexec_wrapper)}
end.join("\n").lstrip << "\n\n")
super
end
end
#---------------------------------------------------------------------------#
extend FilterBacktraces
class Context
# Add support for disabled specs
#
def xit(description, &block)
Counter[:disabled] += 1
Bacon.handle_requirement(description, true) {[]}
end
# Add support for running only focused specs
#
# @note The implementation is a hack because bacon evaluates Context#it
# immediately. Therefore this method is intended to be **temporary**.
#
# @example
#
# module BaconFocusedMode; end
#
# describe "A Context" do
# it "will *not* runt" do; end
# fit "will runt" do; end
# end
#
#
def fit(description, &block)
origina_it(description, &block)
end
# Add support for focused specs
#
alias :origina_it :it
def it(description, &block)
unless defined?(::BaconFocusedMode)
origina_it(description, &block)
end
end
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