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
[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
- Added support for public headers. [#440]
- 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)
- Dropped support for legacy `config.ios?` and `config.osx?`
......@@ -15,6 +39,7 @@
- Version message now correctly terminates with a 0 exit status.
- Resolved an issue that lead to git error messages in the error report.
## 0.10.0
[CocoaPods](http://git.io/4i75YA)
......@@ -25,7 +50,6 @@
- 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)
###### Bug fixes
- Removed note about the post install hook form the linter.
......@@ -222,7 +246,7 @@ class ::Pod::Generator::Acknowledgements
end
```
You can even go one step further and customise the text on a per target basis by
You can even go one step further and customise the text on a per target basis by
checking against the target name, like this:
```ruby
......@@ -328,8 +352,6 @@ podspec, then update these method calls.
* Added weak quoting to `ibtool` input paths.
---------------------------------------
## 0.5.0
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].
---------------------------------------
## 0.4.0
Oops, accidentally skipped this version.
---------------------------------------
## 0.3.0
### Multiple targets
......
......@@ -17,7 +17,7 @@ GIT
PATH
remote: .
specs:
cocoapods (0.11.0)
cocoapods (0.11.1)
activesupport (~> 3.2.6)
colored (~> 1.2)
escape (~> 0.0.4)
......
......@@ -145,7 +145,7 @@ namespace :gem do
# silent_sh "rake examples:build"
# 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 push origin master"
sh "git push origin --tags"
......
......@@ -13,7 +13,7 @@ unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(
end
module Pod
VERSION = '0.11.0'
VERSION = '0.11.1'
class PlainInformative < StandardError
end
......
......@@ -14,6 +14,7 @@ module Pod
def download
create_cache unless cache_exist?
puts '-> Cloning git repo' if config.verbose?
if options[:tag]
download_tag
elsif options[:branch]
......@@ -23,6 +24,8 @@ module Pod
else
download_head
end
Dir.chdir(target_path) { git! "submodule update --init" } if options[:submodules]
prune_cache
end
......@@ -30,7 +33,7 @@ module Pod
puts "-> Creating cache git repo (#{cache_path})" if config.verbose?
cache_path.rmtree if cache_path.exist?
cache_path.mkpath
git %Q|clone "#{url}" "#{cache_path}"|
clone(url, cache_path)
end
def prune_cache
......@@ -73,10 +76,9 @@ module Pod
def update_cache
puts "-> Updating cache git repo (#{cache_path})" if config.verbose?
Dir.chdir(cache_path) do
git "reset --hard HEAD"
git "clean -d -x -f"
git "pull"
git "submodule update"
git! "reset --hard HEAD"
git! "clean -d -x -f"
git! "pull"
end
end
......@@ -104,42 +106,44 @@ module Pod
else
create_cache
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
def download_tag
ensure_ref_exists(options[:tag])
Dir.chdir(target_path) do
git "init"
git "remote add origin '#{clone_url}'"
git "fetch origin tags/#{options[:tag]}"
git "reset --hard FETCH_HEAD"
git "checkout -b activated-pod-commit"
git "submodule update --init"
git! "init"
git! "remote add origin '#{clone_url}'"
git! "fetch origin tags/#{options[:tag]}"
git! "reset --hard FETCH_HEAD"
git! "checkout -b activated-pod-commit"
end
end
def download_commit
ensure_ref_exists(options[:commit])
git %Q|clone "#{clone_url}" "#{target_path}"|
clone(clone_url, target_path)
Dir.chdir(target_path) do
git "checkout -b activated-pod-commit #{options[:commit]}"
git "submodule update --init"
git! "checkout -b activated-pod-commit #{options[:commit]}"
end
end
def download_branch
ensure_remote_branch_exists(options[:branch])
git %Q|clone "#{clone_url}" "#{target_path}"|
clone(clone_url, target_path)
Dir.chdir(target_path) do
git "remote add upstream '#{@url}'" # we need to add the original url, not the cache url
git "fetch -q upstream" # refresh the branches
git "checkout --track -b activated-pod-commit upstream/#{options[:branch]}" # create a new tracking branch
git "submodule update --init"
git! "remote add upstream '#{@url}'" # we need to add the original url, not the cache url
git! "fetch -q upstream" # refresh the branches
git! "checkout --track -b activated-pod-commit upstream/#{options[:branch]}" # create a new tracking branch
puts "Just downloaded and checked out branch: #{options[:branch]} from upstream #{clone_url}" if config.verbose?
end
end
def clone(from, to)
git! %Q|clone "#{from}" "#{to}"|
end
end
class GitHub < Git
......
......@@ -52,17 +52,17 @@ module Pod
end
def download_file(full_filename)
curl "-L -o '#{full_filename}' '#{url}'"
curl! "-L -o '#{full_filename}' '#{url}'"
end
def extract_with_type(full_filename, type=:zip)
case type
when :zip
unzip "'#{full_filename}' -d '#{target_path}'"
unzip! "'#{full_filename}' -d '#{target_path}'"
when :tgz
tar "xfz '#{full_filename}' -C '#{target_path}'"
tar! "xfz '#{full_filename}' -C '#{target_path}'"
when :tar
tar "xf '#{full_filename}' -C '#{target_path}'"
tar! "xf '#{full_filename}' -C '#{target_path}'"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
......
......@@ -12,11 +12,11 @@ module Pod
end
def download_head
hg "clone \"#{url}\" \"#{target_path}\""
hg! "clone \"#{url}\" \"#{target_path}\""
end
def download_revision
hg "clone \"#{url}\" --rev '#{options[:revision]}' \"#{target_path}\""
hg! "clone \"#{url}\" --rev '#{options[:revision]}' \"#{target_path}\""
end
end
end
......
......@@ -4,11 +4,11 @@ module Pod
executable :svn
def download
svn %|checkout "#{reference_url}" "#{target_path}"|
svn! %|checkout "#{reference_url}" "#{target_path}"|
end
def download_head
svn %|checkout "#{trunk_url}" "#{target_path}"|
svn! %|checkout "#{trunk_url}" "#{target_path}"|
end
def reference_url
......
......@@ -20,7 +20,8 @@ module Pod
def executable(name)
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?
raise Informative, "Unable to locate the executable `#{name}'"
end
......@@ -33,9 +34,27 @@ module Pod
end
status = Open4.spawn(full_command, :stdout => stdout, :stderr => stderr, :status => true)
# 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
private name
end
end
......
......@@ -42,7 +42,7 @@ module Pod
end
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
def index_file
......
require 'xcodeproj/workspace'
require 'xcodeproj/project'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/array/conversions'
module Pod
class Installer
......@@ -69,10 +72,8 @@ module Pod
return if targets.empty?
unless Config.instance.silent?
# TODO let's just use ActiveSupport.
plural = targets.size > 1
puts "-> Integrating `#{@target_definition.lib_name}' into target#{'s' if plural} " \
"`#{targets.map(&:name).join(', ')}' of Xcode project `#{user_project_path.basename}'.".green
puts "-> Integrating `#{@target_definition.lib_name}' into #{'target'.pluralize(targets.size)} " \
"`#{targets.map(&:name).to_sentence}' of Xcode project `#{user_project_path.basename}'.".green
end
add_xcconfig_base_configuration
......@@ -141,10 +142,8 @@ module Pod
end
def add_pods_library
framework_group = user_project.group("Frameworks")
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 = framework_group.files.new_static_library(@target_definition.label)
group = user_project.group("Frameworks") || user_project.main_group
pods_library = group.files.new_static_library(@target_definition.label)
targets.each do |target|
target.frameworks_build_phases.each { |build_phase| build_phase << pods_library }
end
......
......@@ -318,27 +318,35 @@ module Pod
end
# 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}.
#
# @raise [Informative] If the pod was cleaned.
#
# @todo Merge with #221
#
# @return [Array<Pathname>] The path of all the public headers of the pod.
#
def all_specs_public_header_files
def documentation_headers
if @cleaned
raise Informative, "The pod is cleaned and cannot compute the " \
"header files, as some might have been deleted."
end
all_specs = [ top_specification ] + top_specification.subspecs
options = {:glob => '*.{h}'}
files = paths_by_spec(:source_files, options, all_specs).values.flatten
headers = files.select { |f| f.extname == '.h' }
headers
specs = [top_specification] + top_specification.recursive_subspecs
source_files = paths_by_spec(:source_files, { :glob => '*.{h}'}, specs)
public_headers = paths_by_spec(:public_header_files,{ :glob => '*.{h}'}, specs)
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
# @!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__)
describe Pod::Installer::UserProjectIntegrator do
extend SpecHelper::TemporaryDirectory
def integrate!
@integrator = Pod::Installer::UserProjectIntegrator.new(@podfile)
@integrator.integrate!
@sample_project = Xcodeproj::Project.new(@sample_project_path)
end
before do
config.silent = true
@sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
......@@ -23,12 +29,26 @@ describe Pod::Installer::UserProjectIntegrator do
end
end
@integrator = Pod::Installer::UserProjectIntegrator.new(@podfile)
@integrator.integrate!
@sample_project = Xcodeproj::Project.new(@sample_project_path)
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
workspace_path = @sample_project_path.dirname + "SampleProject.xcworkspace"
workspace_path.should.exist
......@@ -54,11 +74,6 @@ describe Pod::Installer::UserProjectIntegrator do
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
@podfile.target_definitions.each do |_, definition|
target = @sample_project.targets.where(:name => definition.link_with.first)
......
......@@ -35,8 +35,6 @@ describe Pod::Generator::Documentation do
'--keep-intermediate-files',
'--exit-threshold', '2',
'--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',
'--company-id', 'com.banana'
]
......
......@@ -11,7 +11,7 @@ describe Pod::LocalPod do
copy_fixture_to_pod('banana-lib', @pod)
end
it 'returns the Pod root directory path' do
it "returns the Pod root directory path" do
@pod.root.should == @sandbox.root + 'BananaLib'
end
......@@ -25,20 +25,20 @@ describe Pod::LocalPod do
Pathname(@pod.root + "foo").should.exist
end
it 'can delete itself' do
it "can delete itself" do
@pod.create
@pod.implode
@pod.root.should.not.exist
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 == [
Pathname.new("BananaLib/Classes/Banana.m"),
Pathname.new("BananaLib/Classes/Banana.h")
].sort
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.should == [
@pod.root + "Classes/Banana.m",
......@@ -46,16 +46,16 @@ describe Pod::LocalPod do
].sort
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")]
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.should == [ @pod.root + "Classes/Banana.h" ]
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.should.include "/.git/config"
# * There are some hidden files on Travis
......@@ -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 ]
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")]
end
......@@ -244,12 +244,19 @@ describe Pod::LocalPod do
assert_array_equals(expected, computed)
end
it "resolves the header files of **every** subspec" do
computed = @pod.all_specs_public_header_files.map { |p| p.relative_path_from(@pod.root).to_s }
it "resolves the documentation header files including not activated subspecs" do
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[
UIKit/Classes/UIKit.h
UIKit/Classes/UIView.h
UIKit/Classes/UIWindow.h
StoreKit/Classes/SKPayment.h
StoreKit/Classes/StoreKit.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