Commit fdc3d19b authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into pod_update

* master:
  [Excutable] Fix for ruby 1.8.7.
  [CHANGELOG] Didn't realize that github already adds a separator line for each entry.
  [CHANGELOG] Update
  Add static libraries to root of project if no Frameworks group exists. #431
  Cleanup a little by using ActiveSupport convenience methods.
  CHANGELOG.md
  [Documentation] Use public headers if specified.
  [Downloader] raise when importan commands fail.
  [Git] Init submodules only if requested.
  [Rakefile] commit Gemfile.lock on release.
  [Changelog] Release 0.11.1.
  Release 0.11.1
  [Changelog] Update.
parents 0a244e6e 21bc6d45
## Master
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.11.1...master)
###### Enhancements
- The documentation is generated using the public headers if they are specified.
- In case of download failure, now the installation is aborted
the error message of the external command that failed is presented.
- Git submodules are initialized only if requested.
- Don’t impose a certain structure of the user’s project by raising if no ‘Frameworks’ group exists. [#431](https://github.com/CocoaPods/CocoaPods/pull/431)
## 0.11.1
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.11.0...0.11.1)
###### Bug fixes
- Fixed a crash related to subspecs without header files. [#449]
- Git submodules are loaded after the appropriate referenced is checked out and will be not loaded anymore in the cache. [#451]
- Fixed SVN support for the head version. [#432]
## 0.11.0 ## 0.11.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.10.0...master) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.10.0...0.11.0)
###### Enhancements ###### Enhancements
- Added support for public headers. [#440] - Added support for public headers. [#440]
- Added `pod repo lint`. [#423] - Added `pod repo lint`. [#423]
- Improved support for `:head` option and svn repositories. - Improved support for `:head` option and SVN repositories.
- When integrating Pods with a project without "Frameworks" group in root of the project, raise an informative message. [#431](https://github.com/CocoaPods/CocoaPods/pull/431) - When integrating Pods with a project without "Frameworks" group in root of the project, raise an informative message. [#431](https://github.com/CocoaPods/CocoaPods/pull/431)
- Dropped support for legacy `config.ios?` and `config.osx?` - Dropped support for legacy `config.ios?` and `config.osx?`
...@@ -15,6 +39,7 @@ ...@@ -15,6 +39,7 @@
- Version message now correctly terminates with a 0 exit status. - Version message now correctly terminates with a 0 exit status.
- Resolved an issue that lead to git error messages in the error report. - Resolved an issue that lead to git error messages in the error report.
## 0.10.0 ## 0.10.0
[CocoaPods](http://git.io/4i75YA) [CocoaPods](http://git.io/4i75YA)
...@@ -25,7 +50,6 @@ ...@@ -25,7 +50,6 @@
- Added line number information for errors generated in the Podfile. [#408](http://git.io/fWQvMg) - Added line number information for errors generated in the Podfile. [#408](http://git.io/fWQvMg)
- Pods stored in git repositories now initialize submodules. [#406](http://git.io/L9ssSw) - Pods stored in git repositories now initialize submodules. [#406](http://git.io/L9ssSw)
###### Bug fixes ###### Bug fixes
- Removed note about the post install hook form the linter. - Removed note about the post install hook form the linter.
...@@ -328,8 +352,6 @@ podspec, then update these method calls. ...@@ -328,8 +352,6 @@ podspec, then update these method calls.
* Added weak quoting to `ibtool` input paths. * Added weak quoting to `ibtool` input paths.
---------------------------------------
## 0.5.0 ## 0.5.0
No longer requires MacRuby. Runs on MRI 1.8.7 (OS X system version) and 1.9.3. No longer requires MacRuby. Runs on MRI 1.8.7 (OS X system version) and 1.9.3.
...@@ -337,15 +359,11 @@ No longer requires MacRuby. Runs on MRI 1.8.7 (OS X system version) and 1.9.3. ...@@ -337,15 +359,11 @@ No longer requires MacRuby. Runs on MRI 1.8.7 (OS X system version) and 1.9.3.
A full list of all the changes since 0.3.0 can be found [here][7]. A full list of all the changes since 0.3.0 can be found [here][7].
---------------------------------------
## 0.4.0 ## 0.4.0
Oops, accidentally skipped this version. Oops, accidentally skipped this version.
---------------------------------------
## 0.3.0 ## 0.3.0
### Multiple targets ### Multiple targets
......
...@@ -17,7 +17,7 @@ GIT ...@@ -17,7 +17,7 @@ GIT
PATH PATH
remote: . remote: .
specs: specs:
cocoapods (0.11.0) cocoapods (0.11.1)
activesupport (~> 3.2.6) activesupport (~> 3.2.6)
colored (~> 1.2) colored (~> 1.2)
escape (~> 0.0.4) escape (~> 0.0.4)
......
...@@ -145,7 +145,7 @@ namespace :gem do ...@@ -145,7 +145,7 @@ namespace :gem do
# silent_sh "rake examples:build" # silent_sh "rake examples:build"
# Then release # Then release
sh "git commit lib/cocoapods.rb -m 'Release #{gem_version}'" sh "git commit lib/cocoapods.rb Gemfile.lock -m 'Release #{gem_version}'"
sh "git tag -a #{gem_version} -m 'Release #{gem_version}'" sh "git tag -a #{gem_version} -m 'Release #{gem_version}'"
sh "git push origin master" sh "git push origin master"
sh "git push origin --tags" sh "git push origin --tags"
......
...@@ -13,7 +13,7 @@ unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new( ...@@ -13,7 +13,7 @@ unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(
end end
module Pod module Pod
VERSION = '0.11.0' VERSION = '0.11.1'
class PlainInformative < StandardError class PlainInformative < StandardError
end end
......
...@@ -14,6 +14,7 @@ module Pod ...@@ -14,6 +14,7 @@ module Pod
def download def download
create_cache unless cache_exist? create_cache unless cache_exist?
puts '-> Cloning git repo' if config.verbose? puts '-> Cloning git repo' if config.verbose?
if options[:tag] if options[:tag]
download_tag download_tag
elsif options[:branch] elsif options[:branch]
...@@ -23,6 +24,8 @@ module Pod ...@@ -23,6 +24,8 @@ module Pod
else else
download_head download_head
end end
Dir.chdir(target_path) { git! "submodule update --init" } if options[:submodules]
prune_cache prune_cache
end end
...@@ -30,7 +33,7 @@ module Pod ...@@ -30,7 +33,7 @@ module Pod
puts "-> Creating cache git repo (#{cache_path})" if config.verbose? puts "-> Creating cache git repo (#{cache_path})" if config.verbose?
cache_path.rmtree if cache_path.exist? cache_path.rmtree if cache_path.exist?
cache_path.mkpath cache_path.mkpath
git %Q|clone "#{url}" "#{cache_path}"| clone(url, cache_path)
end end
def prune_cache def prune_cache
...@@ -73,10 +76,9 @@ module Pod ...@@ -73,10 +76,9 @@ module Pod
def update_cache def update_cache
puts "-> Updating cache git repo (#{cache_path})" if config.verbose? puts "-> Updating cache git repo (#{cache_path})" if config.verbose?
Dir.chdir(cache_path) do Dir.chdir(cache_path) do
git "reset --hard HEAD" git! "reset --hard HEAD"
git "clean -d -x -f" git! "clean -d -x -f"
git "pull" git! "pull"
git "submodule update"
end end
end end
...@@ -104,42 +106,44 @@ module Pod ...@@ -104,42 +106,44 @@ module Pod
else else
create_cache create_cache
end end
git %Q|clone "#{clone_url}" "#{target_path}"|
Dir.chdir(target_path) { git "submodule update --init" } clone(clone_url, target_path)
Dir.chdir(target_path) { git! "submodule update --init" } if options[:submodules]
end end
def download_tag def download_tag
ensure_ref_exists(options[:tag]) ensure_ref_exists(options[:tag])
Dir.chdir(target_path) do Dir.chdir(target_path) do
git "init" git! "init"
git "remote add origin '#{clone_url}'" git! "remote add origin '#{clone_url}'"
git "fetch origin tags/#{options[:tag]}" git! "fetch origin tags/#{options[:tag]}"
git "reset --hard FETCH_HEAD" git! "reset --hard FETCH_HEAD"
git "checkout -b activated-pod-commit" git! "checkout -b activated-pod-commit"
git "submodule update --init"
end end
end end
def download_commit def download_commit
ensure_ref_exists(options[:commit]) ensure_ref_exists(options[:commit])
git %Q|clone "#{clone_url}" "#{target_path}"| clone(clone_url, target_path)
Dir.chdir(target_path) do Dir.chdir(target_path) do
git "checkout -b activated-pod-commit #{options[:commit]}" git! "checkout -b activated-pod-commit #{options[:commit]}"
git "submodule update --init"
end end
end end
def download_branch def download_branch
ensure_remote_branch_exists(options[:branch]) ensure_remote_branch_exists(options[:branch])
git %Q|clone "#{clone_url}" "#{target_path}"| clone(clone_url, target_path)
Dir.chdir(target_path) do Dir.chdir(target_path) do
git "remote add upstream '#{@url}'" # we need to add the original url, not the cache url git! "remote add upstream '#{@url}'" # we need to add the original url, not the cache url
git "fetch -q upstream" # refresh the branches git! "fetch -q upstream" # refresh the branches
git "checkout --track -b activated-pod-commit upstream/#{options[:branch]}" # create a new tracking branch git! "checkout --track -b activated-pod-commit upstream/#{options[:branch]}" # create a new tracking branch
git "submodule update --init"
puts "Just downloaded and checked out branch: #{options[:branch]} from upstream #{clone_url}" if config.verbose? puts "Just downloaded and checked out branch: #{options[:branch]} from upstream #{clone_url}" if config.verbose?
end end
end end
def clone(from, to)
git! %Q|clone "#{from}" "#{to}"|
end
end end
class GitHub < Git class GitHub < Git
......
...@@ -52,17 +52,17 @@ module Pod ...@@ -52,17 +52,17 @@ module Pod
end end
def download_file(full_filename) def download_file(full_filename)
curl "-L -o '#{full_filename}' '#{url}'" curl! "-L -o '#{full_filename}' '#{url}'"
end end
def extract_with_type(full_filename, type=:zip) def extract_with_type(full_filename, type=:zip)
case type case type
when :zip when :zip
unzip "'#{full_filename}' -d '#{target_path}'" unzip! "'#{full_filename}' -d '#{target_path}'"
when :tgz when :tgz
tar "xfz '#{full_filename}' -C '#{target_path}'" tar! "xfz '#{full_filename}' -C '#{target_path}'"
when :tar when :tar
tar "xf '#{full_filename}' -C '#{target_path}'" tar! "xf '#{full_filename}' -C '#{target_path}'"
else else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}" raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end end
......
...@@ -12,11 +12,11 @@ module Pod ...@@ -12,11 +12,11 @@ module Pod
end end
def download_head def download_head
hg "clone \"#{url}\" \"#{target_path}\"" hg! "clone \"#{url}\" \"#{target_path}\""
end end
def download_revision def download_revision
hg "clone \"#{url}\" --rev '#{options[:revision]}' \"#{target_path}\"" hg! "clone \"#{url}\" --rev '#{options[:revision]}' \"#{target_path}\""
end end
end end
end end
......
...@@ -4,11 +4,11 @@ module Pod ...@@ -4,11 +4,11 @@ module Pod
executable :svn executable :svn
def download def download
svn %|checkout "#{reference_url}" "#{target_path}"| svn! %|checkout "#{reference_url}" "#{target_path}"|
end end
def download_head def download_head
svn %|checkout "#{trunk_url}" "#{target_path}"| svn! %|checkout "#{trunk_url}" "#{target_path}"|
end end
def reference_url def reference_url
......
...@@ -20,7 +20,8 @@ module Pod ...@@ -20,7 +20,8 @@ module Pod
def executable(name) def executable(name)
bin = `which #{name}`.strip bin = `which #{name}`.strip
define_method(name) do |command| base_method = "base_" << name.to_s
define_method(base_method) do |command, should_raise|
if bin.empty? if bin.empty?
raise Informative, "Unable to locate the executable `#{name}'" raise Informative, "Unable to locate the executable `#{name}'"
end end
...@@ -33,9 +34,27 @@ module Pod ...@@ -33,9 +34,27 @@ module Pod
end end
status = Open4.spawn(full_command, :stdout => stdout, :stderr => stderr, :status => true) status = Open4.spawn(full_command, :stdout => stdout, :stderr => stderr, :status => true)
# TODO not sure that we should be silent in case of a failure. # TODO not sure that we should be silent in case of a failure.
puts (Config.instance.verbose? ? ' ' : '') << "[!] Failed: #{full_command}".red unless status.success? || Config.instance.silent?
stdout.join("\n") + stderr.join("\n") # TODO will this suffice? output = stdout.join("\n") + stderr.join("\n") # TODO will this suffice?
unless status.success?
if should_raise
raise Informative, "#{name} #{command}\n\n#{output}"
else
puts (Config.instance.verbose? ? ' ' : '') << "[!] Failed: #{full_command}".red unless Config.instance.silent?
end
end
output
end
define_method(name) do |command|
send(base_method, command, false)
end
define_method(name.to_s + "!") do |command|
send(base_method, command, true)
end end
private name private name
end end
end end
......
...@@ -42,7 +42,7 @@ module Pod ...@@ -42,7 +42,7 @@ module Pod
end end
def files def files
@pod.all_specs_public_header_files.map{ |f| f.relative_path_from(@pod.root).to_s } @pod.documentation_headers.map{ |f| f.relative_path_from(@pod.root).to_s }
end end
def index_file def index_file
......
require 'xcodeproj/workspace' require 'xcodeproj/workspace'
require 'xcodeproj/project' require 'xcodeproj/project'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/array/conversions'
module Pod module Pod
class Installer class Installer
...@@ -69,10 +72,8 @@ module Pod ...@@ -69,10 +72,8 @@ module Pod
return if targets.empty? return if targets.empty?
unless Config.instance.silent? unless Config.instance.silent?
# TODO let's just use ActiveSupport. puts "-> Integrating `#{@target_definition.lib_name}' into #{'target'.pluralize(targets.size)} " \
plural = targets.size > 1 "`#{targets.map(&:name).to_sentence}' of Xcode project `#{user_project_path.basename}'.".green
puts "-> Integrating `#{@target_definition.lib_name}' into target#{'s' if plural} " \
"`#{targets.map(&:name).join(', ')}' of Xcode project `#{user_project_path.basename}'.".green
end end
add_xcconfig_base_configuration add_xcconfig_base_configuration
...@@ -141,10 +142,8 @@ module Pod ...@@ -141,10 +142,8 @@ module Pod
end end
def add_pods_library def add_pods_library
framework_group = user_project.group("Frameworks") group = user_project.group("Frameworks") || user_project.main_group
raise Informative, "Cannot add pod library to project. Please check if the project have a 'Frameworks' group in the root of the project." unless framework_group pods_library = group.files.new_static_library(@target_definition.label)
pods_library = framework_group.files.new_static_library(@target_definition.label)
targets.each do |target| targets.each do |target|
target.frameworks_build_phases.each { |build_phase| build_phase << pods_library } target.frameworks_build_phases.each { |build_phase| build_phase << pods_library }
end end
......
...@@ -318,27 +318,35 @@ module Pod ...@@ -318,27 +318,35 @@ module Pod
end end
# Computes the paths of all the public headers of the pod including every # Computes the paths of all the public headers of the pod including every
# subspec. For this reason the pod must not be cleaned before calling it. # subspec (activated or not).
# For this reason the pod must not be cleaned when calling this command.
# #
# This method is used by {Generator::Documentation}. # This method is used by {Generator::Documentation}.
# #
# @raise [Informative] If the pod was cleaned. # @raise [Informative] If the pod was cleaned.
# #
# @todo Merge with #221
#
# @return [Array<Pathname>] The path of all the public headers of the pod. # @return [Array<Pathname>] The path of all the public headers of the pod.
# #
def all_specs_public_header_files def documentation_headers
if @cleaned if @cleaned
raise Informative, "The pod is cleaned and cannot compute the " \ raise Informative, "The pod is cleaned and cannot compute the " \
"header files, as some might have been deleted." "header files, as some might have been deleted."
end end
all_specs = [ top_specification ] + top_specification.subspecs specs = [top_specification] + top_specification.recursive_subspecs
options = {:glob => '*.{h}'} source_files = paths_by_spec(:source_files, { :glob => '*.{h}'}, specs)
files = paths_by_spec(:source_files, options, all_specs).values.flatten public_headers = paths_by_spec(:public_header_files,{ :glob => '*.{h}'}, specs)
headers = files.select { |f| f.extname == '.h' }
headers result = []
specs.each do |spec|
if (public_h = public_headers[spec]) && !public_h.empty?
result += public_h
elsif (source_f = source_files[spec]) && !source_f.empty?
build_h = source_f.select { |f| f.extname == '.h' }
result += build_h unless build_h.empty?
end
end
result
end end
# @!group Target integration # @!group Target integration
......
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Downloader::Git do
extend SpecHelper::TemporaryDirectory
before do
@pod = LocalPod.new(fixture_spec('banana-lib/BananaLib.podspec'), temporary_sandbox, Platform.ios)
end
it "check's out a specific commit" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
)
downloader = Downloader.for_pod(@pod)
downloader.download
(@pod.root + 'README').read.strip.should == 'first commit'
end
it "check's out a specific branch" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :branch => 'topicbranch'
)
downloader = Downloader.for_pod(@pod)
downloader.download
(@pod.root + 'README').read.strip.should == 'topicbranch'
end
it "check's out a specific tag" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'v1.0'
)
downloader = Downloader.for_pod(@pod)
downloader.download
(@pod.root + 'README').read.strip.should == 'v1.0'
end
it "doesn't updates submodules by default" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => '6cc9afc'
)
downloader = Downloader.for_pod(@pod)
downloader.download
(@pod.root + 'README').read.strip.should == 'post v1.0'
(@pod.root + 'libPusher/README.md').should.not.exist?
end
it "initializes submodules when checking out a specific commit" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => '6cc9afc', :submodules => true
)
downloader = Downloader.for_pod(@pod)
downloader.download
(@pod.root + 'README').read.strip.should == 'post v1.0'
(@pod.root + 'libPusher/README.md').read.strip.should.match /^libPusher/
end
it "initializes submodules when checking out a specific tag" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'v1.1', :submodules => true
)
downloader = Downloader.for_pod(@pod)
downloader.download
(@pod.root + 'README').read.strip.should == 'post v1.0'
(@pod.root + 'libPusher/README.md').read.strip.should.match /^libPusher/
end
it "prepares the cache if it does not exist" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
)
downloader = Downloader.for_pod(@pod)
downloader.cache_path.rmtree if downloader.cache_path.exist?
downloader.expects(:create_cache).once
downloader.stubs(:download_commit)
downloader.download
end
it "prepares the cache if it does not exist when the HEAD is requested explicitly" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib')
)
downloader = Downloader.for_pod(@pod)
downloader.cache_path.rmtree if downloader.cache_path.exist?
downloader.expects(:create_cache).once
downloader.stubs(:clone)
downloader.download_head
end
it "removes the oldest repo if the caches is too big" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
)
original_chace_size = Downloader::Git::MAX_CACHE_SIZE
Downloader::Git.__send__(:remove_const,'MAX_CACHE_SIZE')
Downloader::Git::MAX_CACHE_SIZE = 0
downloader = Downloader.for_pod(@pod)
downloader.stubs(:cache_dir).returns(temporary_directory)
downloader.download
downloader.cache_path.should.not.exist?
Downloader::Git.__send__(:remove_const,'MAX_CACHE_SIZE')
Downloader::Git::MAX_CACHE_SIZE = original_chace_size
end
it "raises if it can't find the url" do
@pod.top_specification.stubs(:source).returns(
:git => 'find_me_if_you_can'
)
downloader = Downloader.for_pod(@pod)
lambda { downloader.download }.should.raise Informative
end
it "raises if it can't find a commit" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'aaaaaa'
)
downloader = Downloader.for_pod(@pod)
lambda { downloader.download }.should.raise Informative
end
it "raises if it can't find a tag" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'aaaaaa'
)
downloader = Downloader.for_pod(@pod)
lambda { downloader.download }.should.raise Informative
end
it "does not raise if it can find the reference" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
)
downloader = Downloader.for_pod(@pod)
lambda { downloader.download }.should.not.raise
end
it "returns the cache directory as the clone url" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
)
downloader = Downloader.for_pod(@pod)
downloader.clone_url.to_s.should.match /Library\/Caches\/CocoaPods\/Git/
end
it "updates the cache if the HEAD is requested" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib')
)
downloader = Downloader.for_pod(@pod)
downloader.expects(:update_cache).once
downloader.download
end
it "updates the cache if the ref is not available" do
# create the origin repo and the cache
tmp_repo_path = temporary_directory + 'banana-lib-source'
`git clone #{fixture('banana-lib')} #{tmp_repo_path}`
@pod.top_specification.stubs(:source).returns(
:git => tmp_repo_path, :commit => 'fd56054'
)
downloader = Downloader.for_pod(@pod)
downloader.download
# make a new commit in the origin
commit = ''
Dir.chdir(tmp_repo_path) do
`touch test.txt`
`git add test.txt`
`git commit -m 'test'`
commit = `git rev-parse HEAD`.chomp
end
# require the new commit
pod = LocalPod.new(fixture_spec('banana-lib/BananaLib.podspec'), temporary_sandbox, Platform.ios)
pod.top_specification.stubs(:source).returns(
:git => tmp_repo_path, :commit => commit
)
downloader = Downloader.for_pod(pod)
downloader.download
(pod.root + 'test.txt').should.exist?
end
it "doesn't update the cache if the ref is available" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
)
downloader = Downloader.for_pod(@pod)
downloader.download
@pod.root.rmtree
downloader.expects(:update_cache).never
downloader.download
end
end
describe "for GitHub repositories, with :download_only set to true" do
extend SpecHelper::TemporaryDirectory
before do
@pod = LocalPod.new(fixture_spec('banana-lib/BananaLib.podspec'), temporary_sandbox, Platform.ios)
end
it "downloads HEAD with no other options specified" do
@pod.top_specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :download_only => true
)
downloader = Downloader.for_pod(@pod)
VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }
# deliberately keep this assertion as loose as possible for now
(@pod.root + 'README.md').readlines[0].should =~ /libPusher/
end
it "downloads a specific tag when specified" do
@pod.top_specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :tag => 'v1.1', :download_only => true
)
downloader = Downloader.for_pod(@pod)
VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }
# deliberately keep this assertion as loose as possible for now
(@pod.root + 'libPusher.podspec').readlines.grep(/1.1/).should.not.be.empty
end
it "downloads a specific branch when specified" do
@pod.top_specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :branch => 'gh-pages', :download_only => true
)
downloader = Downloader.for_pod(@pod)
VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }
# deliberately keep this assertion as loose as possible for now
(@pod.root + 'index.html').readlines.grep(/libPusher Documentation/).should.not.be.empty
end
it "downloads a specific commit when specified" do
@pod.top_specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :commit => 'eca89998d5', :download_only => true
)
downloader = Downloader.for_pod(@pod)
VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }
# deliberately keep this assertion as loose as possible for now
(@pod.root + 'README.md').readlines[0].should =~ /PusherTouch/
end
end
end
This diff is collapsed.
...@@ -3,6 +3,12 @@ require File.expand_path('../../spec_helper', __FILE__) ...@@ -3,6 +3,12 @@ require File.expand_path('../../spec_helper', __FILE__)
describe Pod::Installer::UserProjectIntegrator do describe Pod::Installer::UserProjectIntegrator do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
def integrate!
@integrator = Pod::Installer::UserProjectIntegrator.new(@podfile)
@integrator.integrate!
@sample_project = Xcodeproj::Project.new(@sample_project_path)
end
before do before do
config.silent = true config.silent = true
@sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject') @sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
...@@ -23,12 +29,26 @@ describe Pod::Installer::UserProjectIntegrator do ...@@ -23,12 +29,26 @@ describe Pod::Installer::UserProjectIntegrator do
end end
end end
@integrator = Pod::Installer::UserProjectIntegrator.new(@podfile)
@integrator.integrate!
@sample_project = Xcodeproj::Project.new(@sample_project_path) @sample_project = Xcodeproj::Project.new(@sample_project_path)
end end
it 'adds references to the Pods static libraries to the root of the project if the Frameworks group does not exist' do
@sample_project.group('Frameworks').destroy
@sample_project.save_as(@sample_project_path)
integrate!
@sample_project.main_group.files.where(:name => "libPods.a").should.not == nil
@sample_project.main_group.files.where(:name => "libPods-test_runner.a").should.not == nil
end
before do
integrate!
end
it 'adds references to the Pods static libraries to the Frameworks group' do
@sample_project.group('Frameworks').files.where(:name => "libPods.a").should.not == nil
@sample_project.group('Frameworks').files.where(:name => "libPods-test_runner.a").should.not == nil
end
it 'creates a workspace with a name matching the project' do it 'creates a workspace with a name matching the project' do
workspace_path = @sample_project_path.dirname + "SampleProject.xcworkspace" workspace_path = @sample_project_path.dirname + "SampleProject.xcworkspace"
workspace_path.should.exist workspace_path.should.exist
...@@ -54,11 +74,6 @@ describe Pod::Installer::UserProjectIntegrator do ...@@ -54,11 +74,6 @@ describe Pod::Installer::UserProjectIntegrator do
end end
end end
it 'adds references to the Pods static libraries' do
@sample_project.files.where(:name => "libPods.a").should.not == nil
@sample_project.files.where(:name => "libPods-test_runner.a").should.not == nil
end
it 'adds the libPods static library to the "Link binary with libraries" build phase of each target' do it 'adds the libPods static library to the "Link binary with libraries" build phase of each target' do
@podfile.target_definitions.each do |_, definition| @podfile.target_definitions.each do |_, definition|
target = @sample_project.targets.where(:name => definition.link_with.first) target = @sample_project.targets.where(:name => definition.link_with.first)
......
...@@ -35,8 +35,6 @@ describe Pod::Generator::Documentation do ...@@ -35,8 +35,6 @@ describe Pod::Generator::Documentation do
'--keep-intermediate-files', '--keep-intermediate-files',
'--exit-threshold', '2', '--exit-threshold', '2',
'--index-desc', 'README', '--index-desc', 'README',
# TODO We need to either make this a hash so that options can be merged
# or not use any defaults in case an options are specified.
'--project-company', 'Banana Corp', '--project-company', 'Banana Corp',
'--company-id', 'com.banana' '--company-id', 'com.banana'
] ]
......
...@@ -11,7 +11,7 @@ describe Pod::LocalPod do ...@@ -11,7 +11,7 @@ describe Pod::LocalPod do
copy_fixture_to_pod('banana-lib', @pod) copy_fixture_to_pod('banana-lib', @pod)
end end
it 'returns the Pod root directory path' do it "returns the Pod root directory path" do
@pod.root.should == @sandbox.root + 'BananaLib' @pod.root.should == @sandbox.root + 'BananaLib'
end end
...@@ -25,20 +25,20 @@ describe Pod::LocalPod do ...@@ -25,20 +25,20 @@ describe Pod::LocalPod do
Pathname(@pod.root + "foo").should.exist Pathname(@pod.root + "foo").should.exist
end end
it 'can delete itself' do it "can delete itself" do
@pod.create @pod.create
@pod.implode @pod.implode
@pod.root.should.not.exist @pod.root.should.not.exist
end end
it 'returns an expanded list of source files, relative to the sandbox root' do it "returns an expanded list of source files, relative to the sandbox root" do
@pod.relative_source_files.sort.should == [ @pod.relative_source_files.sort.should == [
Pathname.new("BananaLib/Classes/Banana.m"), Pathname.new("BananaLib/Classes/Banana.m"),
Pathname.new("BananaLib/Classes/Banana.h") Pathname.new("BananaLib/Classes/Banana.h")
].sort ].sort
end end
it 'returns the source files groupped by specification' do it "returns the source files groupped by specification" do
files = @pod.source_files_by_spec[@pod.specifications.first].sort files = @pod.source_files_by_spec[@pod.specifications.first].sort
files.should == [ files.should == [
@pod.root + "Classes/Banana.m", @pod.root + "Classes/Banana.m",
...@@ -46,16 +46,16 @@ describe Pod::LocalPod do ...@@ -46,16 +46,16 @@ describe Pod::LocalPod do
].sort ].sort
end end
it 'returns a list of header files' do it "returns a list of header files" do
@pod.relative_header_files.should == [Pathname.new("BananaLib/Classes/Banana.h")] @pod.relative_header_files.should == [Pathname.new("BananaLib/Classes/Banana.h")]
end end
it 'returns a list of header files by specification' do it "returns a list of header files by specification" do
files = @pod.header_files_by_spec[@pod.specifications.first].sort files = @pod.header_files_by_spec[@pod.specifications.first].sort
files.should == [ @pod.root + "Classes/Banana.h" ] files.should == [ @pod.root + "Classes/Banana.h" ]
end end
it 'returns an expanded list the files to clean' do it "returns an expanded list the files to clean" do
clean_paths = @pod.clean_paths.map { |p| p.to_s.gsub(/.*Pods\/BananaLib/,'') } clean_paths = @pod.clean_paths.map { |p| p.to_s.gsub(/.*Pods\/BananaLib/,'') }
clean_paths.should.include "/.git/config" clean_paths.should.include "/.git/config"
# * There are some hidden files on Travis # * There are some hidden files on Travis
...@@ -64,7 +64,7 @@ describe Pod::LocalPod do ...@@ -64,7 +64,7 @@ describe Pod::LocalPod do
clean_files_without_hidden.should == %W[ /sub-dir /sub-dir/sub-dir-2 /sub-dir/sub-dir-2/somefile.txt ] clean_files_without_hidden.should == %W[ /sub-dir /sub-dir/sub-dir-2 /sub-dir/sub-dir-2/somefile.txt ]
end end
it 'returns an expanded list of resources, relative to the sandbox root' do it "returns an expanded list of resources, relative to the sandbox root" do
@pod.relative_resource_files.should == [Pathname.new("BananaLib/Resources/logo-sidebar.png")] @pod.relative_resource_files.should == [Pathname.new("BananaLib/Resources/logo-sidebar.png")]
end end
...@@ -244,12 +244,19 @@ describe Pod::LocalPod do ...@@ -244,12 +244,19 @@ describe Pod::LocalPod do
assert_array_equals(expected, computed) assert_array_equals(expected, computed)
end end
it "resolves the header files of **every** subspec" do it "resolves the documentation header files including not activated subspecs" do
computed = @pod.all_specs_public_header_files.map { |p| p.relative_path_from(@pod.root).to_s } subspecs = fixture_spec('chameleon/Chameleon.podspec').subspecs
spec = subspecs[0]
spec.stubs(:public_header_files).returns("UIKit/Classes/*Kit.h")
@pod = Pod::LocalPod.new(spec, @sandbox, Pod::Platform.new(:osx))
# Note we only activated UIKit but all the specs need to be resolved
computed = @pod.documentation_headers.map { |p| p.relative_path_from(@pod.root).to_s }
# The Following headers are private:
# UIKit/Classes/UIView.h
# UIKit/Classes/UIWindow.h
expected = %w[ expected = %w[
UIKit/Classes/UIKit.h UIKit/Classes/UIKit.h
UIKit/Classes/UIView.h
UIKit/Classes/UIWindow.h
StoreKit/Classes/SKPayment.h StoreKit/Classes/SKPayment.h
StoreKit/Classes/StoreKit.h StoreKit/Classes/StoreKit.h
MessageUI/Classes/MessageUI.h MessageUI/Classes/MessageUI.h
......
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