Commit 9a715213 authored by Jeremy Slater's avatar Jeremy Slater

Merge branch 'master' into dedicated-targets

parents 5bd2bf76 c82eb037
......@@ -3,7 +3,10 @@ env:
# This is what 10.8.x comes with and we want to support that.
- RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem update --system && sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
- RVM_RUBY_VERSION=1.9.3 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 && curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
before_install: source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
before_install:
- source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
- sudo chown -R $USER /usr/local
- brew install mercurial
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
script: bundle exec rake spec:ci
notifications:
......
......@@ -46,5 +46,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.specification_version = 3 if s.respond_to? :specification_version
end
......@@ -17,10 +17,13 @@ module Pod
elsif params.key?(:svn) then SvnSource
elsif params.key?(:hg) then MercurialSource
elsif params.key?(:podspec) then PodspecSource
elsif params.key?(:local) ||
params.key?(:path) then LocalSource
elsif params.key?(:path) then PathSource
end
if params.key?(:local)
klass = PathSource
UI.warn "The `:local` option of the Podfile has been renamed to `:path` and is deprecated." \
end
UI.warn "Using :local in a Podfile is depricated. Please use :path instead." if params.key?(:local)
if klass
klass.new(name, params, podfile_path)
......@@ -288,7 +291,7 @@ module Pod
# @!group Helpers
# @return [String] The uri of the podspec appending the name of the file
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
#
# @note If the declared path is expanded only if the represents a path
......@@ -314,7 +317,7 @@ module Pod
#
# Works with the {LocalPod::LocalSourcedPod} class.
#
class LocalSource < AbstractExternalSource
class PathSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
......@@ -329,7 +332,7 @@ module Pod
# @see AbstractExternalSource#description
#
def description
"from `#{params[:local]}`"
"from `#{params[:path] || params[:local]}`"
end
#--------------------------------------#
......@@ -341,7 +344,7 @@ module Pod
# @return [Pathname] the path of the podspec.
#
def podspec_path
declared_path = params[:local].to_s
declared_path = (params[:path] || params[:local]).to_s
path_with_ext = File.extname(declared_path) == '.podspec' ? declared_path : "#{declared_path}/#{name}.podspec"
podfile_dir = File.dirname(podfile_path || '')
absolute_path = File.expand_path(path_with_ext, podfile_dir)
......
......@@ -389,7 +389,7 @@ module Pod
executed = false
libraries_using_spec(spec).each do |lib|
lib_representation = library_rep(lib)
executed ||= run_spec_pre_install_hook(spec, lib_representation)
executed |= run_spec_pre_install_hook(spec, lib_representation)
end
UI.message "- #{spec.name}" if executed
end
......@@ -448,7 +448,7 @@ module Pod
executed = false
libraries_using_spec(spec).each do |lib|
lib_representation = library_rep(lib)
executed ||= run_spec_post_install_hook(spec, lib_representation)
executed |= run_spec_post_install_hook(spec, lib_representation)
end
UI.message "- #{spec.name}" if executed
end
......
......@@ -247,7 +247,7 @@ module Pod
pods_to_fetch = result.podfile_state.added + result.podfile_state.changed
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? }
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? }
end
unless deps_to_fetch.empty?
......
......@@ -320,6 +320,8 @@ module Pod
# @return [Hash{String=>String}] The path of the Pods with a local source
# grouped by their name.
#
# @todo Rename (e.g. `pods_with_local_path`)
#
attr_reader :local_pods
# Checks if a Pod is locally sourced?
......
......@@ -106,7 +106,7 @@ module Pod
# @return [Bool] whether the validation should be performed against the root of
# the podspec instead to its original source.
#
# @note Uses the `:local` option of the Podfile.
# @note Uses the `:path` option of the Podfile.
#
attr_writer :local
def local?; @local; end
......
# Set up coverage analysis
#-----------------------------------------------------------------------------#
if ENV['CI'] || ENV['GENERATE_COVERAGE']
require 'simplecov'
# require 'coveralls'
require 'coveralls'
if ENV['CI']
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
......@@ -15,6 +16,13 @@ if ENV['CI'] || ENV['GENERATE_COVERAGE']
end
end
# TODO: Coverall loads colorize which interferes with colored making certain
# specs fail. This should be removed once Coverall is fixed.
#
# https://github.com/lemurheavy/coveralls-ruby/issues/14
#
require 'colored'
# Set up
#-----------------------------------------------------------------------------#
......
......@@ -8,11 +8,13 @@ module Pod
svn = Dependency.new("Reachability", :svn => nil)
podspec = Dependency.new("Reachability", :podspec => nil)
local = Dependency.new("Reachability", :local => nil)
path = Dependency.new("Reachability", :path => nil)
ExternalSources.from_dependency(git, nil).class.should == ExternalSources::GitSource
ExternalSources.from_dependency(svn, nil).class.should == ExternalSources::SvnSource
ExternalSources.from_dependency(podspec, nil).class.should == ExternalSources::PodspecSource
ExternalSources.from_dependency(local, nil).class.should == ExternalSources::LocalSource
ExternalSources.from_dependency(local, nil).class.should == ExternalSources::PathSource
ExternalSources.from_dependency(path, nil).class.should == ExternalSources::PathSource
end
end
......@@ -202,11 +204,11 @@ module Pod
#---------------------------------------------------------------------------#
describe ExternalSources::LocalSource do
describe ExternalSources::PathSource do
before do
podspec_path = fixture('integration/Reachability/Reachability.podspec')
dependency = Dependency.new("Reachability", :local => fixture('integration/Reachability'))
dependency = Dependency.new("Reachability", :path => fixture('integration/Reachability'))
podfile_path = fixture('integration/Podfile')
@external_source = ExternalSources.from_dependency(dependency, podfile_path)
end
......@@ -217,6 +219,15 @@ module Pod
path.should.exist?
end
it "creates a copy of the podspec [Deprecated local option]" do
dependency = Dependency.new("Reachability", :local => fixture('integration/Reachability'))
podfile_path = fixture('integration/Podfile')
external_source = ExternalSources.from_dependency(dependency, podfile_path)
external_source.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@external_source.description.should.match %r|from `.*integration/Reachability`|
end
......@@ -231,33 +242,33 @@ module Pod
describe "Helpers" do
it "handles absolute paths" do
@external_source.stubs(:params).returns(:local => fixture('integration/Reachability'))
@external_source.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @external_source.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles paths when there is no podfile path" do
@external_source.stubs(:podfile_path).returns(nil)
@external_source.stubs(:params).returns(:local => fixture('integration/Reachability'))
@external_source.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @external_source.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles relative paths" do
@external_source.stubs(:params).returns(:local => 'Reachability')
@external_source.stubs(:params).returns(:path => 'Reachability')
path = @external_source.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "expands the tilde" do
@external_source.stubs(:params).returns(:local => '~/Reachability')
@external_source.stubs(:params).returns(:path => '~/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
path = @external_source.send(:podspec_path)
path.should == Pathname(ENV['HOME']) + 'Reachability/Reachability.podspec'
end
it "raises if the podspec cannot be found" do
@external_source.stubs(:params).returns(:local => temporary_directory)
@external_source.stubs(:params).returns(:path => temporary_directory)
e = lambda { @external_source.send(:podspec_path) }.should.raise Informative
e.message.should.match /No podspec found/
end
......
......@@ -383,6 +383,29 @@ module Pod
@installer.send(:run_post_install_hooks)
end
it "calls the hooks in the specs for each target" do
library_ios = Library.new(nil)
library_osx = Library.new(nil)
library_ios.specs = [@spec]
library_osx.specs = [@spec]
library_ios.stubs(:name).returns('label')
library_osx.stubs(:name).returns('label')
library_ios_rep = stub()
library_osx_rep = stub()
@installer.stubs(:libraries).returns([library_ios, library_osx])
@installer.stubs(:installer_rep).returns(stub())
@installer.stubs(:library_rep).with(library_ios).returns(library_ios_rep)
@installer.stubs(:library_rep).with(library_osx).returns(library_osx_rep)
@installer.podfile.expects(:pre_install!)
@spec.expects(:post_install!).with(library_ios_rep)
@spec.expects(:post_install!).with(library_osx_rep)
@installer.send(:run_pre_install_hooks)
@installer.send(:run_post_install_hooks)
end
it "returns the hook representation of the installer" do
rep = @installer.send(:installer_rep)
rep.sandbox_root.should == @installer.sandbox.root
......
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