Commit 7ada0b22 authored by Steffen Matthischke's avatar Steffen Matthischke

Merge remote-tracking branch 'origin/master' into number_prefix_preprocessor_definitions

parents 73622564 238457a7
......@@ -3,7 +3,12 @@ os:
language: ruby
cache: bundler
rvm:
# OS X 10.9.5-10.10.0 (2.0.0-p481)
- system
# OS X 10.9.3-10.9.4
- 2.0.0-p451
# OS X 10.9.0-10.9.2
- 2.0.0-p247
before_install:
# There is a bug in travis. When using system ruby, bundler is not
......
......@@ -4,12 +4,63 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
## Master
##### Enhacements
##### Breaking
* Support of older versions of Ruby has been dropped and CocoaPods now depends
on Ruby 2.0.0 or greater. This is due to the release of Xcode 6.0 which has
dropped support for OS X 10.8 which results in the minimum version of
Ruby pre-installed on OS X is now 2.0.0.
If you are using a custom installation of Ruby which is older than 2.0.0, you
will need to update. Or even better, migrate to system Ruby.
[Kyle Fuller](https://github.com/kylef)
* Attempts to resolve circular dependencies will now raise an exception.
[Samuel Giddins](https://github.com/segiddins)
[Molinillo#6](https://github.com/CocoaPods/Molinillo/issues/6)
##### Enhancements
* The `pod push` has been removed as it has been deprecated in favour of `pod
repo push` in CocoaPods 0.33.
[Fabio Pelosin](https://github.com/fabiopelosin)
* Refactorings in preparation to framework support, which could break usages
of the Hooks-API.
[Marius Rackwitz](https://github.com/mrackwitz)
[#2461](https://github.com/CocoaPods/CocoaPods/issues/2461)
* The `Resolver` has been completely rewritten to use
[Molinillo](https://github.com/CocoaPods/Molinillo), an iterative dependency
resolution algorithm that automatically resolves version conflicts.
The order in which dependencies are declared in the `Podfile` no longer has
any effect on the resolution process.
[Samuel Giddins](https://github.com/segiddins)
[#978](https://github.com/CocoaPods/CocoaPods/issues/978)
[#2002](https://github.com/CocoaPods/CocoaPods/issues/2002)
* Implicit dependencies are now locked, so simply running `pod install` will not
cause them to be updated when they shouldn't be.
[Samuel Giddins](https://github.com/segiddins)
[#2318](https://github.com/CocoaPods/CocoaPods/issues/2318)
[#2506](https://github.com/CocoaPods/CocoaPods/issues/2506)
* Pre-release versions are only considered in the resolution process when there
are dependencies that explicitly reference pre-release requirements.
[Samuel Giddins](https://github.com/segiddins)
[#1489](https://github.com/CocoaPods/CocoaPods/issues/1489)
* Only setup the master specs repo if required.
[Daniel Tomlinson](https://github.com/DanielTomlinson)
[#2562](https://github.com/CocoaPods/CocoaPods/issues/2562)
##### Bug Fixes
* Do not try to clone spec-repos in `/`.
[Eloy Durán](https://github.com/alloy)
[#2723](https://github.com/CocoaPods/CocoaPods/issues/2723)
## 0.34.4
......@@ -89,7 +140,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
* Allow the `Validator` to only use specific sources.
Allows customizable source for `pod spec lint` and `pod lib lint`,
with both defaulting to `master`.
with both defaulting to `master`.
[Samuel Giddins](https://github.com/segiddins)
[#2543](https://github.com/CocoaPods/CocoaPods/issues/2543)
[cocoapods-trunk#28](https://github.com/CocoaPods/cocoapods-trunk/issues/28)
......
......@@ -18,6 +18,7 @@ group :development do
cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'xcodeproj', 'Xcodeproj'
cp_gem 'molinillo', 'Molinillo'
gem 'bacon'
gem 'mocha'
......@@ -28,15 +29,7 @@ group :development do
# Integration tests
gem 'diffy'
gem 'clintegracon'
if RUBY_VERSION >= '1.9.3'
gem 'rubocop'
end
if RUBY_PLATFORM.include?('darwin')
# Make Xcodeproj faster
gem 'libxml-ruby'
end
gem 'rubocop'
end
group :debugging do
......@@ -44,12 +37,6 @@ group :debugging do
gem 'kicker'
gem 'awesome_print'
gem 'pry'
gem 'ruby-prof'
end
group :ruby_1_8_7 do
# Lock the current lowest requirement for ActiveSupport 3 to ensure we don't
# re-introduce https://github.com/CocoaPods/CocoaPods/issues/1950
gem 'i18n', '0.6.4'
gem 'mime-types', '< 2.0'
gem 'activesupport', '< 4'
end
......@@ -7,22 +7,28 @@ GIT
GIT
remote: https://github.com/CocoaPods/Core.git
revision: ce564c47d0b499d004c156857ac6e6d8b74024ae
revision: 4eb2c2ea287e517e633d75bfd29b829e1a6097ae
branch: master
specs:
cocoapods-core (0.34.4)
activesupport (>= 3.2.15)
fuzzy_match (~> 2.0.4)
json_pure (~> 1.8)
nap (~> 0.8.0)
GIT
remote: https://github.com/CocoaPods/Molinillo.git
revision: e86cec392a75c577f2c803d8cc87debe41a9bdbe
branch: master
specs:
molinillo (0.1.0)
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 5a02e64a775536287ff786e26aa83303bfd6996f
revision: 06ef7697aa8eefa9e779fa6b33dd311cf3ec1f95
branch: master
specs:
xcodeproj (0.19.4)
activesupport (~> 3.0)
xcodeproj (0.20.0)
activesupport (>= 3)
colored (~> 1.2)
GIT
......@@ -42,7 +48,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: aee318675961e0666af80a67596497de62b68c2e
revision: 418085ebd393426cc6ab16e646ae0663921dbe81
branch: master
specs:
cocoapods-trunk (0.3.1)
......@@ -61,7 +67,7 @@ PATH
remote: .
specs:
cocoapods (0.34.4)
activesupport (>= 3.2.15, < 4)
activesupport (>= 3.2.15)
claide (~> 0.7.0)
cocoapods-core (= 0.34.4)
cocoapods-downloader (~> 0.7.2)
......@@ -70,17 +76,20 @@ PATH
cocoapods-try (~> 0.4.1)
colored (~> 1.2)
escape (~> 0.0.4)
json_pure (~> 1.8)
molinillo (~> 0.1.0)
nap (~> 0.8)
open4 (~> 1.3)
xcodeproj (~> 0.19.4)
xcodeproj (~> 0.20.0)
GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.19)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
activesupport (4.1.6)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
ast (2.0.0)
astrolabe (1.3.0)
......@@ -98,24 +107,23 @@ GEM
escape (0.0.4)
ffi (1.9.6)
fuzzy_match (2.0.4)
i18n (0.6.4)
i18n (0.6.11)
json (1.8.1)
json_pure (1.8.1)
kicker (3.0.0)
listen (~> 1.3.0)
notify (~> 0.5.2)
libxml-ruby (2.7.0)
listen (1.3.1)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
minitest (5.4.2)
mocha (1.1.0)
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.2)
mocha (>= 0.13.0)
multi_json (1.10.1)
nap (0.8.0)
netrc (0.7.8)
notify (0.5.2)
......@@ -143,10 +151,14 @@ GEM
powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-prof (0.15.2)
ruby-progressbar (1.6.0)
safe_yaml (1.0.4)
slop (3.6.0)
webmock (1.19.0)
thread_safe (0.3.4)
tzinfo (1.2.2)
thread_safe (~> 0.1)
webmock (1.20.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
......@@ -154,7 +166,6 @@ PLATFORMS
ruby
DEPENDENCIES
activesupport (< 4)
awesome_print
bacon
bundler (~> 1.3)
......@@ -167,16 +178,15 @@ DEPENDENCIES
cocoapods-trunk!
cocoapods-try!
diffy
i18n (= 0.6.4)
kicker
libxml-ruby
mime-types (< 2.0)
mocha
mocha-on-bacon
molinillo!
prettybacon
pry
rake
rb-fsevent
rubocop
ruby-prof
webmock
xcodeproj!
#!/usr/bin/env ruby
if RUBY_VERSION > '1.8.7' && Encoding.default_external != Encoding::UTF_8
if Encoding.default_external != Encoding::UTF_8
puts "\e[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding."
if ENV['TRAVIS']
puts <<-DOC
......@@ -30,4 +30,22 @@ end
STDOUT.sync = true if ENV['CP_STDOUT_SYNC'] == 'TRUE'
require 'cocoapods'
Pod::Command.run(ARGV)
if profile_filename = ENV['PROFILE']
require 'ruby-prof'
reporter = case (profile_extname = File.extname(profile_filename))
when '.txt'
RubyProf::FlatPrinterWithLineNumbers
when '.html'
RubyProf::GraphHtmlPrinter
when '.callgrind'
RubyProf::CallTreePrinter
else
raise "Unknown profiler format indicated by extension: #{profile_extname}"
end
File.open(profile_filename, 'w') do |io|
reporter.new(RubyProf.profile { Pod::Command.run(ARGV) }).print(io)
end
else
Pod::Command.run(ARGV)
end
......@@ -29,17 +29,17 @@ Gem::Specification.new do |s|
# Link with the version of CocoaPods-Core
s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}"
s.add_runtime_dependency 'claide', '~> 0.7.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.19.4'
s.add_runtime_dependency 'xcodeproj', '~> 0.20.0'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.7.2'
s.add_runtime_dependency 'cocoapods-plugins', '~> 0.3.1'
s.add_runtime_dependency 'cocoapods-try', '~> 0.4.1'
s.add_runtime_dependency 'cocoapods-trunk', '~> 0.3.1'
s.add_runtime_dependency 'molinillo', '~> 0.1.0'
s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'json_pure', '~> 1.8'
s.add_runtime_dependency 'open4', '~> 1.3'
s.add_runtime_dependency 'activesupport', '>= 3.2.15', '< 4'
s.add_runtime_dependency 'activesupport', '>= 3.2.15'
s.add_runtime_dependency 'nap', '~> 0.8'
s.add_development_dependency 'bundler', '~> 1.3'
......@@ -49,6 +49,6 @@ Gem::Specification.new do |s|
## Make sure you can build the gem on older versions of RubyGems too:
s.rubygems_version = "1.6.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.required_ruby_version = '>= 1.8.7'
s.required_ruby_version = '>= 2.0.0'
s.specification_version = 3 if s.respond_to? :specification_version
end
......@@ -56,6 +56,7 @@ module Pod
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
autoload :DummySource, 'cocoapods/generator/dummy_source'
autoload :Header, 'cocoapods/generator/header'
autoload :PrefixHeader, 'cocoapods/generator/prefix_header'
autoload :TargetEnvironmentHeader, 'cocoapods/generator/target_environment_header'
autoload :XCConfig, 'cocoapods/generator/xcconfig'
......
require 'colored'
require 'claide'
require 'molinillo/errors'
module Molinillo
class ResolverError
include CLAide::InformativeError
end
end
module Pod
class PlainInformative
......@@ -32,14 +39,6 @@ module Pod
].concat(super)
end
def self.parse(argv)
command = super
unless SourcesManager.master_repo_functional? || command.is_a?(Setup) || command.is_a?(Repo::Add) || ENV['SKIP_SETUP']
Setup.new(CLAide::ARGV.new([])).run
end
command
end
def self.run(argv)
help! 'You cannot run CocoaPods as root.' if Process.uid == 0
verify_git_version!
......@@ -84,6 +83,16 @@ module Pod
end
end
# Ensure that the master spec repo exists
#
# @return [void]
#
def ensure_master_spec_repo_exists!
unless SourcesManager.master_repo_functional?
Setup.new(CLAide::ARGV.new([])).run
end
end
#-------------------------------------------------------------------------#
include Config::Mixin
......
......@@ -48,6 +48,7 @@ module Pod
end
def run
ensure_master_spec_repo_exists!
if @web
web_search
else
......
......@@ -6,7 +6,6 @@ module Pod
end
def save_as(path)
require 'xcodeproj/ext'
Xcodeproj.write_plist(plist, path)
end
......@@ -64,20 +63,15 @@ module Pod
# !@group Private methods
# Returns the sanitized text with UTF-8 eliminating invalid characters if
# Ruby version >=1.9 else will return the text.
# Returns the sanitized text with UTF-8 invalid characters eliminated.
#
# @param [String] text
# the text we want to sanitize.
#
# @return [String] The sanitized text if Ruby >=1.9 else text.
# @return [String] The sanitized UTF-8 text.
#
def sanitize_encoding(text)
if RUBY_VERSION >= '1.9'
text.encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')
else
text
end
text.encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')
end
#-----------------------------------------------------------------------#
......
module Pod
module Generator
# Generates a header file.
#
# According to the platform the header imports `UIKit/UIKit.h` or
# `Cocoa/Cocoa.h`.
#
class Header
# @return [Symbol] the platform for which the prefix header will be
# generated.
#
attr_reader :platform
# @return [Array<String>] The list of the headers to import.
#
attr_reader :imports
# @param [Symbol] platform
# @see platform
#
def initialize(platform)
@platform = platform
@imports = []
end
# Generates the contents of the header according to the platform.
#
# @note If the platform is iOS an import call to `UIKit/UIKit.h` is
# added to the top of the prefix header. For OS X `Cocoa/Cocoa.h`
# is imported.
#
# @return [String]
#
def generate
result = ""
result << generate_platform_import_header
result << "\n"
imports.each do |import|
result << %|#import "#{import}"\n|
end
result
end
# Generates and saves the header to the given path.
#
# @param [Pathname] path
# The path where the header should be stored.
#
# @return [void]
#
def save_as(path)
path.open('w') { |header| header.write(generate) }
end
#-----------------------------------------------------------------------#
protected
# Generates the contents of the header according to the platform.
#
# @note If the platform is iOS an import call to `UIKit/UIKit.h` is
# added to the top of the header. For OS X `Cocoa/Cocoa.h` is
# imported.
#
# @return [String]
#
def generate_platform_import_header
"#import #{platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}\n"
end
end
end
end
......@@ -6,38 +6,26 @@ module Pod
# According to the platform the prefix header imports `UIKit/UIKit.h` or
# `Cocoa/Cocoa.h`.
#
class PrefixHeader
class PrefixHeader < Header
# @return [Array<FileAccessor>] The file accessors for which to generate
# the prefix header.
#
attr_reader :file_accessors
# @return [Platform] the platform for which the prefix header will be
# generated.
# @param [Array<FileAccessor>] file_accessors
# @see file_accessors
#
attr_reader :platform
# @return [Array<String>] The list of the headers to import (with
# quotes).
#
attr_reader :imports
# @param [Platform] platform @see platform
# @param [Array<LocalPod>] consumers @see consumers
# @param [Platform] platform
# @see platform
#
def initialize(file_accessors, platform)
@file_accessors = file_accessors
@platform = platform
@imports = []
super platform
end
# Generates the contents of the prefix header according to the platform
# and the pods.
#
# @note If the platform is iOS an import call to `UIKit/UIKit.h` is
# added to the top of the prefix header. For OS X `Cocoa/Cocoa.h`
# is imported.
#
# @note Only unique prefix_header_contents are added to the prefix
# header.
#
......@@ -48,20 +36,12 @@ module Pod
# file_accessor.prefix_header.
#
def generate
result = "#ifdef __OBJC__\n"
result << "#import #{platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}\n"
result << "#endif\n"
imports.each do |import|
result << %(\n#import "#{import}")
end
result = super
unique_prefix_header_contents = file_accessors.map do |file_accessor|
file_accessor.spec_consumer.prefix_header_contents
end.compact.uniq
result << "\n"
unique_prefix_header_contents.each do |prefix_header_contents|
result << prefix_header_contents
result << "\n"
......@@ -75,15 +55,16 @@ module Pod
result
end
# Generates and saves the prefix header to the given path.
#
# @param [Pathname] path
# the path where the prefix header should be stored.
protected
# Generates the contents of the header according to the platform.
#
# @return [void]
# @return [String]
#
def save_as(path)
path.open('w') { |header| header.write(generate) }
def generate_platform_import_header
result = "#ifdef __OBJC__\n"
result << super
result << "#endif\n"
end
end
end
......
......@@ -69,7 +69,7 @@ module Pod
# process.
#
def target
library.target
library.native_target
end
#-----------------------------------------------------------------------#
......
......@@ -418,7 +418,7 @@ module Pod
pod_targets.sort_by(&:name).each do |pod_target|
pod_target.file_accessors.each do |file_accessor|
file_accessor.spec_consumer.frameworks.each do |framework|
pod_target.target.add_system_framework(framework)
pod_target.native_target.add_system_framework(framework)
end
end
end
......@@ -428,7 +428,7 @@ module Pod
def set_target_dependencies
aggregate_targets.each do |aggregate_target|
aggregate_target.pod_targets.each do |pod_target|
aggregate_target.target.add_dependency(pod_target.target)
aggregate_target.native_target.add_dependency(pod_target.native_target)
pod_target.dependencies.each do |dep|
unless dep == pod_target.pod_name
......@@ -437,7 +437,7 @@ module Pod
unless pod_dependency_target
puts "[BUG] DEP: #{dep}"
end
pod_target.target.add_dependency(pod_dependency_target.target)
pod_target.native_target.add_dependency(pod_dependency_target.native_target)
end
end
end
......
......@@ -8,6 +8,8 @@ module Pod
autoload :SandboxAnalyzer, 'cocoapods/installer/analyzer/sandbox_analyzer'
autoload :LockingDependencyAnalyzer, 'cocoapods/installer/analyzer/locking_dependency_analyzer'
# @return [Sandbox] The sandbox where the Pods should be installed.
#
attr_reader :sandbox
......@@ -149,17 +151,13 @@ module Pod
pods_state = nil
UI.section 'Finding Podfile changes' do
pods_by_state = lockfile.detect_changes_with_podfile(podfile)
pods_by_state.dup.each do |state, full_names|
pods = full_names.map { |fn| Specification.root_name(fn) }.uniq
pods_by_state[state] = pods
end
pods_state = SpecsState.new(pods_by_state)
pods_state.print
end
pods_state
else
state = SpecsState.new
state.added.concat(podfile.dependencies.map(&:root_name).uniq)
state.added.concat(podfile.dependencies.map(&:name).uniq)
state
end
end
......@@ -231,21 +229,17 @@ module Pod
# is in update mode, to prevent it from upgrading the Pods that weren't
# changed in the {Podfile}.
#
# @return [Array<Dependency>] the dependencies generate by the lockfile
# that prevent the resolver to update a Pod.
# @return [Molinillo::DependencyGraph<Dependency>] the dependencies
# generated by the lockfile that prevent the resolver to update
# a Pod.
#
def generate_version_locking_dependencies
if update_mode == :all
[]
if update_mode == :all || !lockfile
LockingDependencyAnalyzer.unlocked_dependency_graph
else
locking_pods = result.podfile_state.unchanged
if update_mode == :selected
# If selected Pods should been updated, filter them out of the list
locking_pods = locking_pods.select { |pod| !update[:pods].include?(pod) }
end
locking_pods.map do |pod|
lockfile.dependencies_to_lock_pod_named(pod)
end.flatten
pods_to_update = result.podfile_state.changed + result.podfile_state.deleted
pods_to_update += update[:pods] if update_mode == :selected
LockingDependencyAnalyzer.generate_version_locking_dependencies(lockfile, pods_to_update)
end
end
......@@ -281,9 +275,9 @@ module Pod
if update_mode == :selected
pods_to_fetch += update[:pods]
end
deps_to_fetch = deps_with_external_source.select { |dep| pods_to_fetch.include?(dep.root_name) }
deps_to_fetch_if_needed = deps_with_external_source.select { |dep| result.podfile_state.unchanged.include?(dep.root_name) }
deps_to_fetch += deps_to_fetch_if_needed.select { |dep| sandbox.specification(dep.root_name).nil? || !dep.external_source[:local].nil? || !dep.external_source[:path].nil? || !sandbox.pod_dir(dep.root_name).directory? }
deps_to_fetch = deps_with_external_source.select { |dep| pods_to_fetch.include?(dep.name) }
deps_to_fetch_if_needed = deps_with_external_source.select { |dep| result.podfile_state.unchanged.include?(dep.name) }
deps_to_fetch += deps_to_fetch_if_needed.select { |dep| sandbox.specification(dep.name).nil? || !dep.external_source[:local].nil? || !dep.external_source[:path].nil? || !sandbox.pod_dir(dep.name).directory? }
end
unless deps_to_fetch.empty?
......@@ -352,7 +346,7 @@ module Pod
# @!group Analysis internal products
# @return [Array<Dependency>] the dependencies generate by the lockfile
# @return [Molinillo::DependencyGraph<Dependency>] the dependencies generated by the lockfile
# that prevent the resolver to update a Pod.
#
attr_reader :locked_dependencies
......@@ -604,7 +598,7 @@ module Pod
#
class SpecsState
# @param [Hash{Symbol=>String}] pods_by_state
# The **root** name of the pods grouped by their state
# The name of the pods grouped by their state
# (`:added`, `:removed`, `:changed` or `:unchanged`).
#
def initialize(pods_by_state = nil)
......@@ -656,12 +650,9 @@ module Pod
# @param [Symbol]
# the state of the Pod.
#
# @raise If there is an attempt to add the name of a subspec.
#
# @return [void]
#
def add_name(name, state)
raise '[Bug] Attempt to add subspec to the pods state' if name.include?('/')
send(state) << name
end
end
......
require 'molinillo/dependency_graph'
module Pod
class Installer
class Analyzer
# Generates dependencies that require the specific version of the Pods
# that haven't changed in the {Lockfile}.
module LockingDependencyAnalyzer
# Generates dependencies that require the specific version of the Pods
# that haven't changed in the {Lockfile}.
#
# These dependencies are passed to the {Resolver}, unless the installer
# is in update mode, to prevent it from upgrading the Pods that weren't
# changed in the {Podfile}.
#
# @return [Molinillo::DependencyGraph<Dependency>] the dependencies
# generated by the lockfile that prevent the resolver to update
# a Pod.
#
def self.generate_version_locking_dependencies(lockfile, pods_to_update)
dependency_graph = Molinillo::DependencyGraph.new
if lockfile
explicit_dependencies = lockfile.to_hash['DEPENDENCIES'] || []
explicit_dependencies.each do |string|
dependency = Dependency.new(string)
dependency_graph.add_root_vertex(dependency.name, nil)
end
pods = lockfile.to_hash['PODS'] || []
pods.each do |pod|
add_to_dependency_graph(pod, [], dependency_graph)
end
pods_to_update.each { |u| dependency_graph.detach_vertex_named(u) }
end
dependency_graph
end
# Generates a completely 'unlocked' dependency graph.
#
# @return [Molinillo::DependencyGraph<Dependency>] an empty dependency
# graph
#
def self.unlocked_dependency_graph
Molinillo::DependencyGraph.new
end
private
def self.add_child_vertex_to_graph(dependency_string, parents, dependency_graph)
dependency = Dependency.from_string(dependency_string)
dependency_graph.add_child_vertex(dependency.name, parents.empty? ? dependency : nil, parents, nil)
dependency
end
def self.add_to_dependency_graph(object, parents, dependency_graph)
case object
when String
add_child_vertex_to_graph(object, parents, dependency_graph)
when Hash
object.each do |key, value|
dependency = add_child_vertex_to_graph(key, parents, dependency_graph)
value.each { |v| add_to_dependency_graph(v, [dependency.name], dependency_graph) }
end
end
end
end
end
end
end
......@@ -8,7 +8,7 @@ module Pod
#
attr_reader :sandbox
# @return [Array<Library>] The libraries of the installation.
# @return [Array<PodTarget>] The libraries of the installation.
#
attr_reader :libraries
......@@ -17,7 +17,7 @@ module Pod
attr_reader :pods_project
# @param [Sandbox] sandbox @see sandbox
# @param [Array<Library>] libraries @see libraries
# @param [Array<PodTarget>] libraries @see libraries
# @param [Project] libraries @see libraries
#
def initialize(sandbox, libraries, pods_project)
......@@ -167,11 +167,12 @@ module Pod
# Computes the destination sub-directory in the sandbox
#
# @param [Pathname] headers_sandbox
# The sandbox where the headers links should be stored for this
# The sandbox where the header links should be stored for this
# Pod.
#
# @param [Specification::Consumer] consumer
# The consumer for which the headers need to be linked.
# @param [Sandbox::FileAccessor] file_accessor
# The consumer file accessor for which the headers need to be
# linked.
#
# @param [Array<Pathname>] headers
# The absolute paths of the headers which need to be mapped.
......
......@@ -10,16 +10,16 @@ module Pod
#
attr_reader :sandbox
# @return [Library] The library whose target needs to be generated.
# @return [Target] The library whose target needs to be generated.
#
attr_reader :library
attr_reader :target
# @param [Project] project @see project
# @param [Library] library @see library
# @param [Target] target @see target
#
def initialize(sandbox, library)
def initialize(sandbox, target)
@sandbox = sandbox
@library = library
@target = target
end
private
......@@ -36,31 +36,31 @@ module Pod
# @return [void]
#
def add_target
name = library.label
platform = library.platform.name
deployment_target = library.platform.deployment_target.to_s
@target = project.new_target(:static_library, name, platform, deployment_target)
name = target.label
platform = target.platform.name
deployment_target = target.platform.deployment_target.to_s
@native_target = project.new_target(:static_library, name, platform, deployment_target)
library.user_build_configurations.each do |bc_name, type|
configuration = @target.add_build_configuration(bc_name, type)
target.user_build_configurations.each do |bc_name, type|
configuration = @native_target.add_build_configuration(bc_name, type)
end
settings = { 'OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '' }
if library.archs
settings['ARCHS'] = library.archs
if target.archs
settings['ARCHS'] = target.archs
end
@target.build_configurations.each do |configuration|
@native_target.build_configurations.each do |configuration|
configuration.build_settings.merge!(settings)
end
library.target = @target
target.native_target = @native_target
end
# Creates the directory where to store the support files of the target.
#
def create_support_files_dir
library.support_files_dir.mkdir
target.support_files_dir.mkdir
end
# Generates a dummy source file for each target so libraries that contain
......@@ -69,11 +69,11 @@ module Pod
# @return [void]
#
def create_dummy_source
path = library.dummy_source_path
generator = Generator::DummySource.new(library.label)
path = target.dummy_source_path
generator = Generator::DummySource.new(target.label)
generator.save_as(path)
file_reference = add_file_to_support_group(path)
target.source_build_phase.add_file_reference(file_reference)
native_target.source_build_phase.add_file_reference(file_reference)
end
# @return [PBXNativeTarget] the target generated by the installation
......@@ -81,7 +81,7 @@ module Pod
#
# @note Generated by the {#add_target} step.
#
attr_reader :target
attr_reader :native_target
private
......@@ -98,7 +98,7 @@ module Pod
# @return [TargetDefinition] the target definition of the library.
#
def target_definition
library.target_definition
target.target_definition
end
# @return [PBXGroup] the group where the file references to the support
......
......@@ -9,7 +9,7 @@ module Pod
# @return [void]
#
def install!
UI.message "- Installing target `#{library.name}` #{library.platform}" do
UI.message "- Installing target `#{target.name}` #{target.platform}" do
add_target
create_support_files_dir
create_suport_files_group
......@@ -33,8 +33,8 @@ module Pod
#
def create_suport_files_group
parent = project.support_files_group
name = library.name
dir = library.support_files_dir
name = target.name
dir = target.support_files_dir
@support_files_group = parent.new_group(name, dir)
end
......@@ -43,11 +43,11 @@ module Pod
# @return [void]
#
def create_xcconfig_file
target.build_configurations.each do |configuration|
path = library.xcconfig_path(configuration.name)
gen = Generator::XCConfig::AggregateXCConfig.new(library, configuration.name)
native_target.build_configurations.each do |configuration|
path = target.xcconfig_path(configuration.name)
gen = Generator::XCConfig::AggregateXCConfig.new(target, configuration.name)
gen.save_as(path)
library.xcconfigs[configuration.name] = gen.xcconfig
target.xcconfigs[configuration.name] = gen.xcconfig
xcconfig_file_ref = add_file_to_support_group(path)
configuration.base_configuration_reference = xcconfig_file_ref
end
......@@ -57,8 +57,8 @@ module Pod
# pods and the installed specifications of a pod.
#
def create_target_environment_header
path = library.target_environment_header_path
generator = Generator::TargetEnvironmentHeader.new(library.specs_by_build_configuration)
path = target.target_environment_header_path
generator = Generator::TargetEnvironmentHeader.new(target.specs_by_build_configuration)
generator.save_as(path)
add_file_to_support_group(path)
end
......@@ -66,15 +66,15 @@ module Pod
# Generates the bridge support metadata if requested by the {Podfile}.
#
# @note The bridge support metadata is added to the resources of the
# library because it is needed for environments interpreted at
# target because it is needed for environments interpreted at
# runtime.
#
# @return [void]
#
def create_bridge_support_file
if target_definition.podfile.generate_bridge_support?
path = library.bridge_support_path
headers = target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
path = target.bridge_support_path
headers = native_target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
generator = Generator::BridgeSupport.new(headers)
generator.save_as(path)
add_file_to_support_group(path)
......@@ -91,15 +91,15 @@ module Pod
# @return [void]
#
def create_copy_resources_script
path = library.copy_resources_script_path
file_accessors = library.pod_targets.map(&:file_accessors).flatten
path = target.copy_resources_script_path
file_accessors = target.pod_targets.map(&:file_accessors).flatten
resource_paths = file_accessors.map { |accessor| accessor.resources.flatten.map { |res| res.relative_path_from(project.path.dirname) } }.flatten
resource_bundles = file_accessors.map { |accessor| accessor.resource_bundles.keys.map { |name| "${BUILT_PRODUCTS_DIR}/#{name}.bundle" } }.flatten
resources = []
resources.concat(resource_paths)
resources.concat(resource_bundles)
resources << bridge_support_file if bridge_support_file
generator = Generator::CopyResourcesScript.new(resources, library.platform)
generator = Generator::CopyResourcesScript.new(resources, target.platform)
generator.save_as(path)
add_file_to_support_group(path)
end
......@@ -109,10 +109,10 @@ module Pod
# @return [void]
#
def create_acknowledgements
basepath = library.acknowledgements_basepath
basepath = target.acknowledgements_basepath
Generator::Acknowledgements.generators.each do |generator_class|
path = generator_class.path_from_basepath(basepath)
file_accessors = library.pod_targets.map(&:file_accessors).flatten
file_accessors = target.pod_targets.map(&:file_accessors).flatten
generator = generator_class.new(file_accessors)
generator.save_as(path)
add_file_to_support_group(path)
......
......@@ -9,7 +9,7 @@ module Pod
# @return [void]
#
def install!
UI.message "- Installing target `#{library.name}` #{library.platform}" do
UI.message "- Installing target `#{target.name}` #{target.platform}" do
add_target
create_support_files_dir
add_files_to_build_phases
......@@ -33,15 +33,15 @@ module Pod
# @return [void]
#
def add_files_to_build_phases
library.file_accessors.each do |file_accessor|
target.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer
flags = compiler_flags_for_consumer(consumer)
all_source_files = file_accessor.source_files
regular_source_files = all_source_files.reject { |sf| sf.extname == '.d' }
regular_file_refs = regular_source_files.map { |sf| project.reference_for_path(sf) }
target.add_file_references(regular_file_refs, flags)
native_target.add_file_references(regular_file_refs, flags)
other_file_refs = (all_source_files - regular_source_files).map { |sf| project.reference_for_path(sf) }
target.add_file_references(other_file_refs, nil)
native_target.add_file_references(other_file_refs, nil)
end
end
......@@ -53,22 +53,22 @@ module Pod
# @return [void]
#
def add_resources_bundle_targets
library.file_accessors.each do |file_accessor|
target.file_accessors.each do |file_accessor|
file_accessor.resource_bundles.each do |bundle_name, paths|
# Add a dependency on an existing Resource Bundle target if possible
if bundle_target = project.targets.find { |target| target.name == bundle_name }
target.add_dependency(bundle_target)
native_target.add_dependency(bundle_target)
next
end
file_references = paths.map { |sf| project.reference_for_path(sf) }
bundle_target = project.new_resources_bundle(bundle_name, file_accessor.spec_consumer.platform_name)
bundle_target.add_resources(file_references)
library.user_build_configurations.each do |bc_name, type|
target.user_build_configurations.each do |bc_name, type|
bundle_target.add_build_configuration(bc_name, type)
end
target.add_dependency(bundle_target)
native_target.add_dependency(bundle_target)
end
end
end
......@@ -78,17 +78,17 @@ module Pod
# @return [void]
#
def create_xcconfig_file
path = library.xcconfig_path
public_gen = Generator::XCConfig::PublicPodXCConfig.new(library)
path = target.xcconfig_path
public_gen = Generator::XCConfig::PublicPodXCConfig.new(target)
public_gen.save_as(path)
add_file_to_support_group(path)
path = library.xcconfig_private_path
private_gen = Generator::XCConfig::PrivatePodXCConfig.new(library, public_gen.xcconfig)
path = target.xcconfig_private_path
private_gen = Generator::XCConfig::PrivatePodXCConfig.new(target, public_gen.xcconfig)
private_gen.save_as(path)
xcconfig_file_ref = add_file_to_support_group(path)
target.build_configurations.each do |c|
native_target.build_configurations.each do |c|
c.base_configuration_reference = xcconfig_file_ref
end
end
......@@ -100,13 +100,13 @@ module Pod
# @return [void]
#
def create_prefix_header
path = library.prefix_header_path
generator = Generator::PrefixHeader.new(library.file_accessors, library.platform)
generator.imports << library.target_environment_header_path.basename
path = target.prefix_header_path
generator = Generator::PrefixHeader.new(target.file_accessors, target.platform)
generator.imports << target.target_environment_header_path.basename
generator.save_as(path)
add_file_to_support_group(path)
target.build_configurations.each do |c|
native_target.build_configurations.each do |c|
relative_path = path.relative_path_from(project.path.dirname)
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
end
......@@ -176,8 +176,8 @@ module Pod
# @return [PBXFileReference] the file reference of the added file.
#
def add_file_to_support_group(path)
pod_name = library.pod_name
dir = library.support_files_dir
pod_name = target.pod_name
dir = target.support_files_dir
group = project.pod_support_files_group(pod_name, dir)
group.new_file(path)
end
......
This diff is collapsed.
module Pod
class Specification
class Set
class LazySpecification < BasicObject
attr_reader :name, :version, :source
def initialize(name, version, source)
@name = name
@version = version
@source = source
end
def method_missing(method, *args, &block)
specification.send(method, *args, &block)
end
def subspec_by_name(name = nil, raise_if_missing = true)
if !name || name == self.name
self
else
specification.subspec_by_name(name, raise_if_missing)
end
end
def specification
@specification ||= source.specification(name, version)
end
end
class External
def all_specifications
[specification]
end
end
def all_specifications
@all_specifications ||= begin
sources_by_version = {}
versions_by_source.each do |source, versions|
versions.each { |v| (sources_by_version[v] ||= []) << source }
sources_by_version
end
duplicate_versions = sources_by_version.select { |_version, sources| sources.count > 1 }
duplicate_versions.each do |version, sources|
UI.warn "Found multiple specifications for `#{name} (#{version})`:\n" +
sources.
map { |s| s.specification_path(name, version) }.
map { |v| "- #{v}" }.join("\n")
end
versions_by_source.map do |source, versions|
versions.map { |version| LazySpecification.new(name, version, source) }
end.flatten
end
end
end
end
end
......@@ -219,6 +219,7 @@ module Pod
# @return [Nil] if the podspec is not stored.
#
def specification_path(name)
name = Specification.root_name(name)
path = specifications_root + "#{name}.podspec"
if path.exist?
path
......@@ -378,7 +379,7 @@ module Pod
end
# @return [Hash{String=>String}] The path of the Pods with a local source
# grouped by their name.
# grouped by their root name.
#
# @todo Rename (e.g. `pods_with_local_path`)
#
......
......@@ -9,6 +9,13 @@ module Pod
class FileAccessor
HEADER_EXTENSIONS = Xcodeproj::Constants::HEADER_FILES_EXTENSIONS
GLOB_PATTERNS = {
:readme => 'readme{*,.*}'.freeze,
:license => 'licen{c,s}e{*,.*}'.freeze,
:source_files => '*.{h,hpp,hh,m,mm,c,cpp}'.freeze,
:public_header_files => "*{#{HEADER_EXTENSIONS.join(',')}}".freeze,
}.freeze
# @return [Sandbox::PathList] the directory where the source of the Pod
# is located.
#
......@@ -149,7 +156,7 @@ module Pod
# @return [Pathname] The path of the auto-detected README file.
#
def readme
path_list.glob(%w( readme{*,.*} )).first
path_list.glob([GLOB_PATTERNS[:readme]]).first
end
# @return [Pathname] The path of the license file as indicated in the
......@@ -159,7 +166,7 @@ module Pod
if spec_consumer.spec.root.license[:file]
path_list.root + spec_consumer.spec.root.license[:file]
else
path_list.glob(%w( licen{c,s}e{*,.*} )).first
path_list.glob([GLOB_PATTERNS[:license]]).first
end
end
......@@ -182,27 +189,12 @@ module Pod
file_patterns = spec_consumer.send(attribute)
options = {
:exclude_patterns => spec_consumer.exclude_files,
:dir_pattern => glob_for_attribute(attribute),
:dir_pattern => GLOB_PATTERNS[attribute],
:include_dirs => include_dirs,
}
expanded_paths(file_patterns, options)
end
# Returns the pattern to use to glob a directory for an attribute.
#
# @param [Symbol] attribute
# the name of the attribute
#
# @return [String] the glob pattern.
#
def glob_for_attribute(attrbute)
globs = {
:source_files => '*.{h,hpp,hh,m,mm,c,cpp}'.freeze,
:public_header_files => "*.{#{ HEADER_EXTENSIONS * ',' }}".freeze,
}
globs[attrbute]
end
# Matches the given patterns to the file present in the root of the path
# list.
#
......
......@@ -433,16 +433,16 @@ module Pod
end
case url.to_s.downcase
when %r{github.com(:|/)cocoapods/specs}
when %r{github.com[:/]+cocoapods/specs}
base = 'master'
when %r{github.com(:|/)(.+)/(.+)}
base = Regexp.last_match[2]
when %r{github.com[:/]+(.+)/(.+)}
base = Regexp.last_match[1]
when %r{^\S+@(\S+)[:/]+(.+)$}
host, path = Regexp.last_match.captures
base = base_from_host_and_path[host, path]
when URI.regexp
url = URI(url.downcase)
base = base_from_host_and_path[url.host, url.path]
when %r{^\S+@(\S+)[:/](.+)$}
host, path = Regexp.last_match.captures
base = base_from_host_and_path[host, path]
else
base = url.to_s.downcase
end
......
......@@ -52,7 +52,7 @@ module Pod
# @return [PBXNativeTarget] the target generated in the Pods project for
# this library.
#
attr_accessor :target
attr_accessor :native_target
# @return [Platform] the platform for this library.
#
......
......@@ -57,8 +57,8 @@ module Pod
# depends.
#
def dependencies
specs.map do |spec|
spec.consumer(platform).dependencies.map { |dep| Specification.root_name(dep.name) }
spec_consumers.map do |consumer|
consumer.dependencies.map { |dep| Specification.root_name(dep.name) }
end.flatten
end
......
......@@ -192,7 +192,7 @@ module Pod
#
def perform_linting
linter.lint
@results.concat(linter.results)
@results.concat(linter.results.to_a)
end
# Perform analysis for a given spec (or subspec)
......@@ -401,7 +401,7 @@ module Pod
# Specialized Result to support subspecs aggregation
#
class Result < Specification::Linter::Result
class Result < Specification::Linter::Results::Result
def initialize(type, message)
super(type, message)
@subspecs = []
......
Subproject commit ae87cdaa7f0c96ad246ddd804a08bc4260018548
Subproject commit c05bd4dfaba58359a376a8bdee56ef4743d23aba
Subproject commit b0f4e85738f1f911e32e2914b39e9acdce7c7ed9
Subproject commit b6e1c2429964b4e47b344958572930e15ffbbcea
......@@ -226,13 +226,13 @@ module Pod
it 'cats the given podspec' do
lambda { command('spec', 'cat', 'AFNetworking').run }.should.not.raise
UI.output.should.include fixture('spec-repos/master/Specs/AFNetworking/2.3.1/AFNetworking.podspec.json').read
UI.output.should.include fixture('spec-repos/master/Specs/AFNetworking/2.4.1/AFNetworking.podspec.json').read
end
it 'cats the first podspec from all podspecs' do
UI.next_input = "1\n"
run_command('spec', 'cat', '--show-all', 'AFNetworking')
UI.output.should.include fixture('spec-repos/master/Specs/AFNetworking/2.3.1/AFNetworking.podspec.json').read
UI.output.should.include fixture('spec-repos/master/Specs/AFNetworking/2.4.1/AFNetworking.podspec.json').read
end
end
......@@ -292,7 +292,7 @@ module Pod
it 'returns the path of the specification with the given name' do
path = @sut.send(:get_path_of_spec, 'AFNetworking')
path.should == fixture('spec-repos') + 'master/Specs/AFNetworking/2.3.1/AFNetworking.podspec.json'
path.should == fixture('spec-repos') + 'master/Specs/AFNetworking/2.4.1/AFNetworking.podspec.json'
end
end
......
......@@ -48,7 +48,7 @@ module Pod
output = UI.output
output.should.include? 'Author: Robbie Hanson'
output.should.include? 'License: BSD'
output.should.include? 'Platform: iOS - OS X'
output.should.include? 'Platform: iOS 5.0 - OS X 10.7'
output.should.include? 'Watchers: 318'
output.should.include? 'Forks: 42'
output.should.include? 'Pushed: more than a year ago'
......
......@@ -66,15 +66,10 @@ CLIntegracon.configure do |c|
# Register special handling for YAML files
paths = [%r{Podfile\.lock}, %r{Manifest\.lock$}, %r{xcodeproj\.yaml$}]
c.has_special_handling_for(*paths) do |path|
if RUBY_VERSION < '1.9'
nil # CP is not sorting array derived from hashes whose order is
# undefined in 1.8.7
else
# Remove CocoaPods version
yaml = File.open(path) { |f| YAML.load(f) }
yaml.delete('COCOAPODS')
YAML.dump(yaml)
end
# Remove CocoaPods version
yaml = File.open(path) { |f| YAML.load(f) }
yaml.delete('COCOAPODS')
YAML.dump(yaml)
end
# So we don't need to compare them directly
......
......@@ -27,16 +27,14 @@ describe Pod::Generator::Plist do
}
end
if RUBY_VERSION >= '1.9'
it 'returns a correctly sanitized license hash for each pod' do
license_text = 'Copyright © 2013–2014 Boris Bügling'
@generator.stubs(:license_text).returns(license_text)
@generator.hash_for_spec(@spec).should == {
:Type => 'PSGroupSpecifier',
:Title => 'POD_NAME',
:FooterText => license_text,
}
end
it 'returns a correctly sanitized license hash for each pod' do
license_text = 'Copyright © 2013–2014 Boris Bügling'
@generator.stubs(:license_text).returns(license_text)
@generator.hash_for_spec(@spec).should == {
:Type => 'PSGroupSpecifier',
:Title => 'POD_NAME',
:FooterText => license_text,
}
end
it 'returns nil for a pod with no license text' do
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Header = Generator::Header do
before do
@gen = Header.new(Pod::Platform.ios)
end
it 'includes the imports' do
@gen.imports << 'header.h'
@gen.generate.should == <<-EOS.strip_heredoc
#import <UIKit/UIKit.h>
#import "header.h"
EOS
end
it 'imports UIKit in iOS platforms' do
@gen.stubs(:platform).returns(Pod::Platform.ios)
@gen.generate.should.include?('#import <UIKit/UIKit.h>')
end
it 'imports Cocoa for OS X platforms' do
@gen.stubs(:platform).returns(Pod::Platform.osx)
@gen.generate.should.include?('#import <Cocoa/Cocoa.h>')
end
it 'writes the header file to the disk' do
path = temporary_directory + 'Test.h'
@gen.save_as(path)
path.read.should == <<-EOS.strip_heredoc
#import <UIKit/UIKit.h>
EOS
end
end
end
......@@ -80,16 +80,6 @@ module Pod
EOS
end
it 'imports UIKit in iOS platforms' do
@gen.stubs(:platform).returns(Pod::Platform.ios)
@gen.generate.should.include?('#import <UIKit/UIKit.h>')
end
it 'imports Cocoa for OS X platforms' do
@gen.stubs(:platform).returns(Pod::Platform.osx)
@gen.generate.should.include?('#import <Cocoa/Cocoa.h>')
end
it 'writes the prefix header file to the disk' do
path = temporary_directory + 'Test.pch'
@gen.save_as(path)
......
......@@ -64,7 +64,7 @@ module Pod
it 'returns the native target' do
target = stub
@lib.target = target
@lib.native_target = target
@rep.target.should == target
end
......
......@@ -13,7 +13,7 @@ def create_analyzer
end
hash = {}
hash['PODS'] = ['JSONKit (1.4)', 'NUI (0.2.0)', 'SVPullToRefresh (0.4)']
hash['PODS'] = ['JSONKit (1.5pre)', 'NUI (0.2.0)', 'SVPullToRefresh (0.4)']
hash['DEPENDENCIES'] = %w(JSONKit NUI SVPullToRefresh)
hash['SPEC CHECKSUMS'] = {}
hash['COCOAPODS'] = Pod::VERSION
......@@ -52,10 +52,10 @@ module Pod
it 'computes the state of the Podfile respect to the Lockfile' do
state = @analyzer.analyze.podfile_state
state.added.should == %w(AFNetworking libextobjc)
state.changed.should == ['JSONKit']
state.unchanged.should == ['SVPullToRefresh']
state.deleted.should == ['NUI']
state.added.should == %w(AFNetworking libextobjc/EXTKeyPathCoding)
state.changed.should == %w()
state.unchanged.should == %w(JSONKit SVPullToRefresh)
state.deleted.should == %w(NUI)
end
#--------------------------------------#
......@@ -131,13 +131,35 @@ module Pod
it 'locks the version of the dependencies which did not change in the Podfile' do
@analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:to_s).should == ['SVPullToRefresh (= 0.4)']
@analyzer.send(:locked_dependencies).map(&:payload).map(&:to_s).
should == ['JSONKit (= 1.5pre)', 'SVPullToRefresh (= 0.4)']
end
it 'does not lock the dependencies in update mode' do
@analyzer.update = true
@analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:to_s).should == []
@analyzer.send(:locked_dependencies).to_a.map(&:payload).should == []
end
#--------------------------------------#
it 'takes into account locked implicit dependencies' do
podfile = Podfile.new do
platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject'
pod 'ARAnalytics/Mixpanel'
end
hash = {}
hash['PODS'] = ['ARAnalytics/CoreIOS (2.8.0)', {'ARAnalytics/Mixpanel (2.8.0)' => ['ARAnlytics/CoreIOS', 'Mixpanel']}, 'Mixpanel (2.5.1)']
hash['DEPENDENCIES'] = %w(ARAnalytics/Mixpanel)
hash['SPEC CHECKSUMS'] = {}
hash['COCOAPODS'] = Pod::VERSION
lockfile = Pod::Lockfile.new(hash)
analyzer = Installer::Analyzer.new(config.sandbox, podfile, lockfile)
analyzer.analyze.specifications.
find { |s| s.name == 'Mixpanel' }.
version.to_s.should == '2.5.1'
end
#--------------------------------------#
......
......@@ -109,7 +109,7 @@ module Pod
it 'does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default' do
@installer.install!
@installer.library.target.build_configurations.each do |config|
@installer.target.native_target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'].should.be.nil
end
end
......@@ -166,7 +166,7 @@ module Pod
it 'creates a dummy source to ensure the creation of a single base library' do
@installer.install!
build_files = @installer.library.target.source_build_phase.files
build_files = @installer.target.native_target.source_build_phase.files
build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') }
build_file.should.be.not.nil
build_file.file_ref.path.should == 'Pods-dummy.m'
......
......@@ -88,7 +88,7 @@ module Pod
it 'does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default' do
@installer.install!
@installer.library.target.build_configurations.each do |config|
@installer.target.native_target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'].should.be.nil
end
end
......@@ -97,7 +97,7 @@ module Pod
it 'adds the source files of each pod to the target of the Pod library' do
@installer.install!
names = @installer.library.target.source_build_phase.files.map { |bf| bf.file_ref.display_name }
names = @installer.target.native_target.source_build_phase.files.map { |bf| bf.file_ref.display_name }
names.should.include('Banana.m')
end
......@@ -142,7 +142,7 @@ module Pod
it 'creates a dummy source to ensure the compilation of libraries with only categories' do
@installer.install!
build_files = @installer.library.target.source_build_phase.files
build_files = @installer.target.native_target.source_build_phase.files
build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' }
build_file.should.be.not.nil
build_file.file_ref.path.should == 'Pods-BananaLib-dummy.m'
......@@ -158,10 +158,10 @@ module Pod
end
it 'flags should not be added to dtrace files' do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.target.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.install!
dtrace_files = @installer.library.target.source_build_phase.files.reject do|sf|
dtrace_files = @installer.target.native_target.source_build_phase.files.reject do |sf|
!(File.extname(sf.file_ref.path) == '.d')
end
dtrace_files.each do |dt|
......@@ -170,7 +170,7 @@ module Pod
end
it 'adds -w per pod if target definition inhibits warnings for that pod' do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.target.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-w')
......@@ -182,7 +182,7 @@ module Pod
end
it 'adds -Xanalyzer -analyzer-disable-checker per pod' do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.target.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-Xanalyzer -analyzer-disable-checker')
......
......@@ -32,7 +32,7 @@ module Pod
it 'adds the architectures to the custom build configurations of the user target' do
@pod_target.archs = '$(ARCHS_STANDARD_64_BIT)'
@installer.send(:add_target)
@installer.send(:target).resolved_build_setting('ARCHS').should == {
@installer.send(:native_target).resolved_build_setting('ARCHS').should == {
'Release' => '$(ARCHS_STANDARD_64_BIT)',
'Debug' => '$(ARCHS_STANDARD_64_BIT)',
'AppStore' => '$(ARCHS_STANDARD_64_BIT)',
......@@ -42,8 +42,8 @@ module Pod
it 'always clears the OTHER_LDFLAGS and OTHER_LIBTOOLFLAGS, because these lib targets do not ever need any' do
@installer.send(:add_target)
@installer.send(:target).resolved_build_setting('OTHER_LDFLAGS').values.uniq.should == ['']
@installer.send(:target).resolved_build_setting('OTHER_LIBTOOLFLAGS').values.uniq.should == ['']
@installer.send(:native_target).resolved_build_setting('OTHER_LDFLAGS').values.uniq.should == ['']
@installer.send(:native_target).resolved_build_setting('OTHER_LIBTOOLFLAGS').values.uniq.should == ['']
end
end
......
......@@ -18,12 +18,12 @@ module Pod
end
config.sandbox.project = Project.new(config.sandbox.project_path)
Xcodeproj::Project.new(config.sandbox.project_path).save
@library = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox)
@library.client_root = sample_project_path.dirname
@library.user_project_path = sample_project_path
@library.user_target_uuids = ['A346496C14F9BE9A0080D870']
@target = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox)
@target.client_root = sample_project_path.dirname
@target.user_project_path = sample_project_path
@target.user_target_uuids = ['A346496C14F9BE9A0080D870']
empty_library = AggregateTarget.new(@podfile.target_definitions[:empty], config.sandbox)
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@library, empty_library])
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target, empty_library])
end
#-----------------------------------------------------------------------#
......@@ -59,10 +59,10 @@ module Pod
UI.warnings = ''
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1'] })
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@library.stubs(:user_targets).returns([user_target])
@target.stubs(:user_targets).returns([user_target])
@library.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@library])
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target])
@integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides)
......@@ -74,10 +74,10 @@ module Pod
UI.warnings = ''
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '${inherited}'] })
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@library.stubs(:user_targets).returns([user_target])
@target.stubs(:user_targets).returns([user_target])
@library.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@library])
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target])
@integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides)
......@@ -88,10 +88,10 @@ module Pod
UI.warnings = ''
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '$(inherited)'] })
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@library.stubs(:user_targets).returns([user_target])
@target.stubs(:user_targets).returns([user_target])
@library.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@library])
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target])
@integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides)
......
This diff is collapsed.
......@@ -74,7 +74,7 @@ module Pod
]
end
it 'filters the private headers form the public headers' do
it 'filters the private headers from the public headers' do
@spec_consumer.stubs(:public_header_files).returns([])
@spec_consumer.stubs(:private_header_files).returns(['**/*Private*'])
@accessor.public_headers.sort.should == [
......
......@@ -12,7 +12,7 @@ module Pod
@header_dir.root.should == temporary_directory + 'Sandbox/Headers/Public'
end
it "can add namespaced headers to it's header path using symlinks and return the relative path" do
it "can add namespaced headers to its header path using symlinks and return the relative path" do
FileUtils.mkdir_p(@sandbox.root + 'ExampleLib/')
namespace_path = Pathname.new('ExampleLib')
relative_header_paths = [
......
......@@ -114,6 +114,11 @@ module Pod
Pathname.any_instance.stubs(:exist?).
returns(false).then.returns(true)
SourcesManager.send(:name_for_url, url).should == 'master'
url = 'git@github.com:/CocoaPods/Specs.git'
Pathname.any_instance.stubs(:exist?).
returns(false).then.returns(true)
SourcesManager.send(:name_for_url, url).should == 'master'
end
it 'uses the organization name for github.com URLs' do
......@@ -128,9 +133,17 @@ module Pod
end
it 'supports scp-style URLs' do
url = 'git@git-host.com:specs.git'
SourcesManager.send(:name_for_url, url).
should == 'git-host-specs'
url = 'git@git-host.com/specs.git'
SourcesManager.send(:name_for_url, url).
should == 'git-host-specs'
url = 'git@git-host.com:/specs.git'
SourcesManager.send(:name_for_url, url).
should == 'git-host-specs'
end
it 'supports ssh URLs with an aliased hostname' do
......@@ -138,13 +151,13 @@ module Pod
SourcesManager.send(:name_for_url, url).
should == 'companyalias-pod-specs'
end
it 'supports file URLs' do
url = 'file:///Users/kurrytran/pod-specs'
SourcesManager.send(:name_for_url, url).
should == 'users-kurrytran-pod-specs'
end
it 'uses the repo name if no parent directory' do
url = 'file:///pod-specs'
SourcesManager.send(:name_for_url, url).
......
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