Commit 93caccd2 authored by Robert Zuber's avatar Robert Zuber

Merge branch 'master' of github.com:CocoaPods/CocoaPods into command-list-added-pod-versions

parents 160b1b3f 621a85fb
language: objective-c language: objective-c
env: env:
# This is what 10.8.x comes with and we want to support that. # 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=system NOEXEC_DISABLE=1 XCODEPROJ_BUILD=1 BUNDLE_WITHOUT='debugging:documentation' RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
- RVM_RUBY_VERSION=1.9.3-p392 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 - RVM_RUBY_VERSION=2.0.0-p247 NOEXEC_DISABLE=1 XCODEPROJ_BUILD=1 BUNDLE_WITHOUT='debugging:documentation' RUBY_VERSION_SPECIFIC='sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
before_install: before_install:
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
# - sh -c 'if [ "$RVM_RUBY_VERSION" != "system" ]; then rvm install $RVM_RUBY_VERSION --without-tcl --without-tk; fi'
- source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION - source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
- brew update && brew install bzr
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir] install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
script: bundle exec rake spec:ci script: bundle exec rake spec:ci
notifications: notifications:
......
...@@ -3,9 +3,75 @@ ...@@ -3,9 +3,75 @@
To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides/installing_cocoapods.html). To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides/installing_cocoapods.html).
## Master ## Master
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.30.0...master)
[CocoaPods-Core](https://github.com/CocoaPods/Core/compare/0.30.0...master)
##### Enhancements
##### Bug Fixes
* Fix for when using s.version as the :tag for a git repository in a Podspec
[Joel Parsons](https://github.com/joelparsons)
[#1721](https://github.com/CocoaPods/CocoaPods/issues/1721)
[Core#72](https://github.com/CocoaPods/Core/pull/72)
## 0.30.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.29.0...0.30.0)
###### Enhancements
* Radically reduce first run pod setup bandwidth by creating a shallow clone of
the ‘master’ repo by default. Use the `--no-shallow` option to perform a full
clone instead.
[Jeff Verkoeyen](https://github.com/jverkoey)
[#1803](https://github.com/CocoaPods/CocoaPods/pull/1803)
* Improves the error message when searching with an invalid regular expression.
[Kyle Fuller](https://github.com/kylef)
* Improves `pod init` to save Xcode project file in Podfile when one was supplied.
[Kyle Fuller](https://github.com/kylef)
* Adds functionality to specify a template URL for the `pod lib create` command.
[Piet Brauer](https://github.com/pietbrauer)
###### Bug Fixes
* Fixes a bug with `pod repo remove` silently handling permission errors.
[Kyle Fuller](https://github.com/kylef)
[#1778](https://github.com/CocoaPods/CocoaPods/issues/1778)
* `pod push` now properly checks that the repo has changed before attempting
to commit. This only affected pods with special characters (such as `+`) in
their names.
[Gordon Fontenot](https://github.com/gfontenot)
[#1739](https://github.com/CocoaPods/CocoaPods/pull/1739)
## 0.29.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0)
[CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.28.0...0.29.0)
[cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader/compare/0.2.0...0.3.0)
###### Breaking
* The command `podfile_info` is now a plugin offered by CocoaPods.
As a result, the command has been removed from CocoaPods.
[Joshua Kalpin](https://github.com/Kapin)
[#1589](https://github.com/CocoaPods/CocoaPods/issues/1589)
* JSON has been adopted as the format to store specifications. As a result
the `pod ipc spec` command returns a JSON representation and the YAML
specifications are not supported anymore. JSON specifications adopt the
`.podspec.json` extension.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1568](https://github.com/CocoaPods/CocoaPods/pull/1568)
###### Enhancements ###### Enhancements
* Introduced `pod try` the easiest way to test the example project of a pod.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1568](https://github.com/CocoaPods/CocoaPods/pull/1568)
* Pod headers are now provided to the user target as a system * Pod headers are now provided to the user target as a system
header. This means that any warnings in a Pod's code will show header. This means that any warnings in a Pod's code will show
under its target in Xcode's build navigator, and never under the under its target in Xcode's build navigator, and never under the
...@@ -13,10 +79,39 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -13,10 +79,39 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Swizzlr](https://github.com/swizzlr) [Swizzlr](https://github.com/swizzlr)
[#1596](https://github.com/CocoaPods/CocoaPods/pull/1596) [#1596](https://github.com/CocoaPods/CocoaPods/pull/1596)
* Support LZMA2 compressed tarballs in the downloader * Support LZMA2 compressed tarballs in the downloader.
[Kyle Fuller](https://github.com/kylef) [Kyle Fuller](https://github.com/kylef)
[cocoapods-downloader#5](https://github.com/CocoaPods/cocoapods-downloader/pull/5) [cocoapods-downloader#5](https://github.com/CocoaPods/cocoapods-downloader/pull/5)
* Add Bazaar support for installing directly from a repo.
[Fred McCann](https://github.com/fmccann)
[#1632](https://github.com/CocoaPods/CocoaPods/pull/1632)
* The `pod search <query>` command now supports regular expressions
for the query parameter when searching using the option `--full`.
[Florian Hanke](https://github.com/floere)
[#1643](https://github.com/CocoaPods/CocoaPods/pull/1643)
* Pod lib lint now accepts multiple podspecs in the same folder.
[kra Larivain/OpenTable](https://github.com/opentable)
[#1635](https://github.com/CocoaPods/CocoaPods/pull/1635)
* The `pod push` command will now silently test the upcoming CocoaPods trunk
service. The service is only tested when pushing to the master repo and the
test doesn't affect the normal workflow.
[Fabio Pelosin](https://github.com/irrationalfab)
* The `pod search <query>` command now supports searching on cocoapods.org
when searching using the option `--web`. Options `--ios` and `--osx` are
fully supported.
[Florian Hanke](https://github.com/floere)
[#1643](https://github.com/CocoaPods/CocoaPods/pull/1682)
* The `pod search <query>` command now supports multiword queries when using
the `--web` option.
[Florian Hanke](https://github.com/floere)
[#1643](https://github.com/CocoaPods/CocoaPods/pull/1682)
###### Bug Fixes ###### Bug Fixes
* Fixed a bug which resulted in `pod lib lint` not being able to find the * Fixed a bug which resulted in `pod lib lint` not being able to find the
...@@ -26,16 +121,56 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -26,16 +121,56 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
* Fixed the developer frameworks search paths so that * Fixed the developer frameworks search paths so that
`$(SDKROOT)/Developer/Library/Frameworks` is used for iOS and `$(SDKROOT)/Developer/Library/Frameworks` is used for iOS and
`$(DEVELOPER_LIBRARY_DIR)/Frameworks` is used for OS X `$(DEVELOPER_LIBRARY_DIR)/Frameworks` is used for OS X.
[Kevin Wales](https://github.com/kwales) [Kevin Wales](https://github.com/kwales)
[#1562](https://github.com/CocoaPods/pull/1562) [#1562](https://github.com/CocoaPods/CocoaPods/pull/1562)
* When updating the pod repos, repositories with unreachable remotes * When updating the pod repos, repositories with unreachable remotes
are now ignored. This fixes an issue with certain private repositories. are now ignored. This fixes an issue with certain private repositories.
[Joshua Kalpin](https://github.com/Kapin) [Joshua Kalpin](https://github.com/Kapin)
[#1595](https://github.com/CocoaPods/CocoaPods/pull/1595) [#1595](https://github.com/CocoaPods/CocoaPods/pull/1595)
[#1571](https://github.com/CocoaPods/CocoaPods/issues/1571) [#1571](https://github.com/CocoaPods/CocoaPods/issues/1571)
* The linter will now display an error if a Pod's name contains whitespace.
[Joshua Kalpin](https://github.com/Kapin)
[Core#39](https://github.com/CocoaPods/Core/pull/39)
[#1610](https://github.com/CocoaPods/CocoaPods/issues/1610)
* Having the silent flag enabled in the config will no longer cause issues
with `pod search`. In addition, the flag `--silent` is no longer supported
for the command.
[Joshua Kalpin](https://github.com/Kapin)
[#1627](https://github.com/CocoaPods/CocoaPods/pull/1627)
* The linter will now display an error if a framework ends with `.framework`
(i.e. `QuartzCore.framework`).
[Joshua Kalpin](https://github.com/Kapin)
[#1331](https://github.com/CocoaPods/CocoaPods/issues/1336)
[Core#45](https://github.com/CocoaPods/Core/pull/45)
* The linter will now display an error if a library ends with `.a` or `.dylib`
(i.e. `z.dylib`). It will also display an error if it begins with `lib`
(i.e. `libxml`).
[Joshua Kalpin](https://github.com/Kapin)
[Core#44](https://github.com/CocoaPods/Core/issues/44)
* The ARCHS build setting can come back as an array when more than one
architecture is specified.
[Carson McDonald](https://github.com/carsonmcdonald)
[#1628](https://github.com/CocoaPods/CocoaPods/issues/1628)
* Fixed all issues caused by `/tmp` being a symlink to `/private/tmp`.
This affected mostly `pod lib lint`, causing it to fail when the
Pod used `prefix_header_*` or when the pod headers imported headers
using the namespaced syntax (e.g. `#import <MyPod/Header.h>`).
[kra Larivain/OpenTable](https://github.com/opentable)
[#1514](https://github.com/CocoaPods/CocoaPods/pull/1514)
* Fixed an incorrect path being used in the example app Podfile generated by
`pod lib create`.
[Eloy Durán](https://github.com/alloy)
[cocoapods-try#5](https://github.com/CocoaPods/cocoapods-try/issues/5)
## 0.28.0 ## 0.28.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.27.1...0.28.0) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.27.1...0.28.0)
......
# Do’s and Don’ts # Do’s and Don’ts
* **Search the solutions in the [troubleshooting guide](http://guides.cocoapods.org/using/troubleshooting.html).** Or any of the many other [guides](http://guides.cocoapods.org).
* **Search tickets before you file a new one.** Add to tickets if you have new information about the issue. * **Search tickets before you file a new one.** Add to tickets if you have new information about the issue.
* **Only file tickets about the CocoaPods tool itself.** This includes [CocoaPods](https://github.com/CocoaPods/CocoaPods/issues), * **Only file tickets about the CocoaPods tool itself.** This includes [CocoaPods](https://github.com/CocoaPods/CocoaPods/issues),
[CocoaPods/Core](https://github.com/CocoaPods/Core/issues), and [Xcodeproj](https://github.com/CocoaPods/Xcodeproj/issues). [CocoaPods/Core](https://github.com/CocoaPods/Core/issues), and [Xcodeproj](https://github.com/CocoaPods/Xcodeproj/issues).
...@@ -29,7 +30,7 @@ $ xcodeproj project-diff ...@@ -29,7 +30,7 @@ $ xcodeproj project-diff
If you are familiar with Ruby, making a pull request with a failing test case If you are familiar with Ruby, making a pull request with a failing test case
can speed up the resolution of the bug. If the issue is more complex you can can speed up the resolution of the bug. If the issue is more complex you can
add an [integration test](https://github.com/CocoaPods/CocoaPods/tree/master/spec/integration) add an [integration test](https://github.com/CocoaPods/cocoapods-integration-specs/)
which doesn't require any ruby knowledge. which doesn't require any ruby knowledge.
...@@ -38,11 +39,38 @@ which doesn't require any ruby knowledge. ...@@ -38,11 +39,38 @@ which doesn't require any ruby knowledge.
Please try to be precise about the proposed outcome of the feature and how it Please try to be precise about the proposed outcome of the feature and how it
would related to existing features. would related to existing features.
From the [CocoaPods blog](http://blog.cocoapods.org/CocoaPods-0.28/):
> Fighting feature creep in CocoaPods is not easy. We hear about a lot of great ideas and many of them don't make the cut as they would not be useful for at least 80% of our users.
Should you require a feature isn't suited for mainstream users, consider suggesting a [CocoaPods plugin](http://blog.cocoapods.org/CocoaPods-0.28/) instead.
## Pull Requests ## Pull Requests
We **love** pull requests and if a contribution is significant we tend to offer We **love** pull requests and if a contribution is significant we tend to offer
push access. push access.
All contributions will be licenced under the MIT license. All contributions _will_ be licenced under the MIT license.
Code/comments should adhere to the following rules:
* Names should be descriptive and concise.
* Use two spaces and no tabs.
* All changes require test coverage to ensure it does not break during refactor
work. (There are a few exceptions to this, which can be recognized by there
not being any coverage for similar code.)
* All enhancements and bug fixes need to be documented in the CHANGELOG.
* When writing comments, use properly constructed sentences, including
punctuation.
* When documenting APIs and/or source code, don't make assumptions or make
implications about race, gender, religion, political orientation or anything
else that isn't relevant to the project.
* Remember that source code usually gets written once and read often: ensure
the reader doesn't have to make guesses. Make sure that the purpose and inner
logic are either obvious to a reasonably skilled professional, or add a
comment that explains it.
* The message of the commit should be prefixed by the name of the file which is
the main focus of the patch enclosed by square brackets (.e.g. `[Installer]
install pods`).
...@@ -12,12 +12,16 @@ group :development do ...@@ -12,12 +12,16 @@ group :development do
gem 'xcodeproj', :git => "https://github.com/CocoaPods/Xcodeproj.git", :branch => 'master' gem 'xcodeproj', :git => "https://github.com/CocoaPods/Xcodeproj.git", :branch => 'master'
gem 'cocoapods-downloader', :git => "https://github.com/CocoaPods/cocoapods-downloader.git", :branch => 'master' gem 'cocoapods-downloader', :git => "https://github.com/CocoaPods/cocoapods-downloader.git", :branch => 'master'
gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master' gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master'
gem 'cocoapods-try', :git => 'https://github.com/CocoaPods/cocoapods-try.git', :branch => 'master'
gem "mocha" gem "mocha"
gem "bacon" gem "bacon"
gem "mocha-on-bacon" gem "mocha-on-bacon"
gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master' gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master'
gem "rake" gem 'rake', '~> 10.1.0' # Ruby 1.8.7
# For the integration tests
gem "diffy"
gem 'mime-types', '< 2' # v2 is 1.9.x only gem 'mime-types', '< 2' # v2 is 1.9.x only
gem 'coveralls', :require => false gem 'coveralls', :require => false
...@@ -27,12 +31,15 @@ group :development do ...@@ -27,12 +31,15 @@ group :development do
end end
group :debugging do group :debugging do
# Only while we test the trunk app.
gem 'cocoapods-trunk', :git => "https://github.com/alloy/cocoapods-trunk.git"
gem "rb-fsevent" gem "rb-fsevent"
gem "kicker", :git => "https://github.com/alloy/kicker.git", :branch => "master" gem "kicker", :git => "https://github.com/alloy/kicker.git", :branch => "master"
gem "awesome_print" gem "awesome_print"
gem "pry" gem "pry"
gem "diffy" # The released gem leads to stack too deep when profiling a full run.
gem "ruby-prof" gem "ruby-prof", :git => "https://github.com/ruby-prof/ruby-prof.git"
end end
group :documentation do group :documentation do
......
GIT GIT
remote: https://github.com/CocoaPods/CLAide.git remote: https://github.com/CocoaPods/CLAide.git
revision: b662b54098aa6ba5832c2382342cc363111bb3e6 revision: d14c7622e87fb19e3158656b2a459c284fbe4015
branch: master branch: master
specs: specs:
claide (0.4.0) claide (0.5.0)
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 16b15ee5d783653ba2ccac8735abd49c039ca4d3 revision: 76c726cb88ec60dc64c62e2a87b1845319e84569
branch: master branch: master
specs: specs:
cocoapods-core (0.28.0) cocoapods-core (0.30.0)
activesupport (>= 3.2.15, < 4) activesupport (>= 3.2.15, < 4)
fuzzy_match (~> 2.0.4) fuzzy_match (~> 2.0.4)
json (~> 1.8) json_pure (~> 1.8)
nap (~> 0.5) nap (~> 0.5)
GIT GIT
remote: https://github.com/CocoaPods/Xcodeproj.git remote: https://github.com/CocoaPods/Xcodeproj.git
revision: ceae7a7be45e760830ee95a7b4481bdab6df149d revision: 4cc95f412d47fe8b31c5619c6705070b7849663f
branch: master branch: master
specs: specs:
xcodeproj (0.14.1) xcodeproj (0.15.3)
activesupport (~> 3.0) activesupport (~> 3.0)
colored (~> 1.2) colored (~> 1.2)
rake
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: b3a95be1468bd6d8a46a82a027460965581e2c21 revision: d064235f1ddc2823cb5f5f1d32f51f36e719051a
branch: master branch: master
specs: specs:
cocoapods-downloader (0.2.0) cocoapods-downloader (0.4.0)
GIT
remote: https://github.com/CocoaPods/cocoapods-try.git
revision: 0dff2c697f487bf1b3b3ecf21deefa99020b948e
branch: master
specs:
cocoapods-try (0.2.0)
GIT
remote: https://github.com/alloy/cocoapods-trunk.git
revision: febc522b4e462bacd013a48adb704c769586bd7e
specs:
cocoapods-trunk (0.0.1)
json (~> 1.8)
nap (>= 0.6)
netrc
GIT GIT
remote: https://github.com/alloy/kicker.git remote: https://github.com/alloy/kicker.git
revision: 56d7bc857278cc00900d37ef0cf2167cf606b57c revision: 87b0047202c0320d4ef62e1f1a4b2cbdefadf008
branch: master branch: master
specs: specs:
kicker (2.6.1) kicker (3.0.0)
listen (~> 1.1.0) listen (~> 1.3.0)
notify (~> 0.5.2)
GIT GIT
remote: https://github.com/irrationalfab/PrettyBacon.git remote: https://github.com/irrationalfab/PrettyBacon.git
revision: 926c214ade1ec1cbc9544d603e36f15a780f7e68 revision: eaf7e6c786fd5ccc6fb88e943bf7c5e6c27569a3
branch: master branch: master
specs: specs:
prettybacon (0.0.1) prettybacon (0.0.1)
bacon (~> 1.2) bacon (~> 1.2)
GIT
remote: https://github.com/ruby-prof/ruby-prof.git
revision: b56c1268ba001f5eb55f940ca1c83bc6b83a9752
specs:
ruby-prof (0.14.2)
PATH PATH
remote: . remote: .
specs: specs:
cocoapods (0.28.0) cocoapods (0.30.0)
activesupport (>= 3.2.15, < 4) activesupport (>= 3.2.15, < 4)
claide (~> 0.4.0) claide (~> 0.5.0)
cocoapods-core (= 0.28.0) cocoapods-core (= 0.30.0)
cocoapods-downloader (~> 0.2.0) cocoapods-downloader (~> 0.4.0)
cocoapods-try (~> 0.2.0)
colored (~> 1.2) colored (~> 1.2)
escape (~> 0.0.4) escape (~> 0.0.4)
json_pure (~> 1.8) json_pure (~> 1.8)
nap (~> 0.5)
open4 (~> 1.3) open4 (~> 1.3)
xcodeproj (~> 0.14.1) xcodeproj (~> 0.15.0)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
activesupport (3.2.15) activesupport (3.2.17)
i18n (~> 0.6, >= 0.6.4) i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0) multi_json (~> 1.0)
awesome_print (1.2.0) awesome_print (1.2.0)
...@@ -79,61 +103,60 @@ GEM ...@@ -79,61 +103,60 @@ GEM
simplecov (>= 0.7) simplecov (>= 0.7)
term-ansicolor term-ansicolor
thor thor
diffy (3.0.1) diffy (3.0.3)
docile (1.1.0) docile (1.1.3)
escape (0.0.4) escape (0.0.4)
ffi (1.9.3) ffi (1.9.3)
fuzzy_match (2.0.4) fuzzy_match (2.0.4)
github-markup (0.7.5) github-markup (1.1.0)
i18n (0.6.5) i18n (0.6.9)
json (1.8.1) json (1.8.1)
json_pure (1.8.1) json_pure (1.8.1)
listen (1.1.6) listen (1.3.1)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
rb-kqueue (>= 0.2) rb-kqueue (>= 0.2)
lockfile (2.1.0) metaclass (0.0.4)
metaclass (0.0.1)
method_source (0.8.2) method_source (0.8.2)
mime-types (1.25) mime-types (1.25.1)
mocha (0.14.0) mocha (1.0.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
mocha-on-bacon (0.2.2) mocha-on-bacon (0.2.2)
mocha (>= 0.13.0) mocha (>= 0.13.0)
multi_json (1.8.2) multi_json (1.9.2)
nap (0.5.1) nap (0.6.0)
open4 (1.3.0) netrc (0.7.7)
posix-spawn (0.3.6) notify (0.5.2)
pry (0.9.12.3) open4 (1.3.3)
posix-spawn (0.3.8)
pry (0.9.12.6)
coderay (~> 1.0) coderay (~> 1.0)
method_source (~> 0.8) method_source (~> 0.8)
slop (~> 3.4) slop (~> 3.4)
pygments.rb (0.5.4) pygments.rb (0.5.4)
posix-spawn (~> 0.3.6) posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0) yajl-ruby (~> 1.1.0)
rake (10.1.0) rake (10.1.1)
rb-fsevent (0.9.3) rb-fsevent (0.9.4)
rb-inotify (0.9.2) rb-inotify (0.9.3)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rb-kqueue (0.2.0) rb-kqueue (0.2.2)
ffi (>= 0.5.0) ffi (>= 0.5.0)
redcarpet (2.3.0) redcarpet (2.3.0)
rest-client (1.6.7) rest-client (1.6.7)
mime-types (>= 1.16) mime-types (>= 1.16)
ruby-prof (0.13.0) simplecov (0.8.2)
simplecov (0.8.1)
docile (~> 1.1.0) docile (~> 1.1.0)
lockfile (>= 2.1.0)
multi_json multi_json
simplecov-html (~> 0.8.0) simplecov-html (~> 0.8.0)
simplecov-html (0.8.0) simplecov-html (0.8.0)
slop (3.4.6) slop (3.5.0)
term-ansicolor (1.2.2) term-ansicolor (1.3.0)
tins (~> 0.8) tins (~> 1.0)
thor (0.18.1) thor (0.19.1)
tins (0.13.1) tins (1.0.1)
yajl-ruby (1.1.0) yajl-ruby (1.1.0)
yard (0.8.7.3) yard (0.8.7.4)
PLATFORMS PLATFORMS
ruby ruby
...@@ -145,6 +168,8 @@ DEPENDENCIES ...@@ -145,6 +168,8 @@ DEPENDENCIES
cocoapods! cocoapods!
cocoapods-core! cocoapods-core!
cocoapods-downloader! cocoapods-downloader!
cocoapods-trunk!
cocoapods-try!
coveralls coveralls
diffy diffy
github-markup github-markup
...@@ -155,10 +180,10 @@ DEPENDENCIES ...@@ -155,10 +180,10 @@ DEPENDENCIES
prettybacon! prettybacon!
pry pry
pygments.rb pygments.rb
rake rake (~> 10.1.0)
rb-fsevent rb-fsevent
redcarpet (< 3.0.0) redcarpet (< 3.0.0)
ruby-prof ruby-prof!
simplecov simplecov
xcodeproj! xcodeproj!
yard yard
This project is licensed under the MIT license. This project is licensed under the MIT license.
Copyright (c) 2011 - 2012 Eloy Durán <eloy.de.enige@gmail.com> Copyright (c) 2011 - 2013 Eloy Durán <eloy.de.enige@gmail.com>
Copyright (c) 2012 Fabio Pelosin <fabiopelosin@gmail.com> Copyright (c) 2012 - 2013 Fabio Pelosin <fabiopelosin@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
# CocoaPods ![CocoaPods Logo](https://raw.github.com/CocoaPods/shared_resources/master/assets/cocoapods-banner-readme.png)
### the Objective-C dependency manager ### CocoaPods: The Objective-C dependency manager
[![Build Status](https://travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](https://travis-ci.org/CocoaPods/CocoaPods) [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg)](https://travis-ci.org/CocoaPods/CocoaPods)
[![Gem Version](https://badge.fury.io/rb/cocoapods.png)](http://badge.fury.io/rb/cocoapods) [![Gem Version](http://img.shields.io/gem/v/cocoapods.svg)](http://badge.fury.io/rb/cocoapods)
[![Code Climate](https://codeclimate.com/github/CocoaPods/CocoaPods.png)](https://codeclimate.com/github/CocoaPods/CocoaPods) [![Code Climate](http://img.shields.io/codeclimate/github/CocoaPods/CocoaPods.svg)](https://codeclimate.com/github/CocoaPods/CocoaPods)
CocoaPods manages dependencies for your Xcode project. CocoaPods manages dependencies for your Xcode projects.
You specify the dependencies for your project in one easy text file. CocoaPods You specify the dependencies for your project in one easy text file. CocoaPods
resolves dependencies between libraries, fetches source code for the resolves dependencies between libraries, fetches source code for the
...@@ -17,10 +17,8 @@ Ultimately, the goal is to improve discoverability of, and engagement in, third ...@@ -17,10 +17,8 @@ Ultimately, the goal is to improve discoverability of, and engagement in, third
party open-source libraries, by creating a more centralized ecosystem. party open-source libraries, by creating a more centralized ecosystem.
Installing and updating CocoaPods is very easy. Don't miss the [Installation Installing and updating CocoaPods is very easy. Don't miss the [Installation
guide](http://docs.cocoapods.org/guides/installing_cocoapods.html) and the guide](http://guides.cocoapods.org/using/getting-started.html#installation) and the
[Getting started guide](http://docs.cocoapods.org/guides/getting_started.html). [Getting started guide](http://guides.cocoapods.org/using/getting-started.html).
See the [NSScreencast](https://twitter.com/NSScreencast) episode about [using
CocoaPods](http://nsscreencast.com/episodes/5-cocoapods) for a quick overview.
## Sponsors ## Sponsors
...@@ -52,10 +50,10 @@ CocoaPods is composed by the following projects: ...@@ -52,10 +50,10 @@ CocoaPods is composed by the following projects:
| Status | Project | Description | Info | | Status | Project | Description | Info |
| :----- | :------ | :--- | :--- | | :----- | :------ | :--- | :--- |
| [![Build Status](https://secure.travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [docs](http://docs.cocoapods.org/cocoapods) | [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [docs](http://docs.cocoapods.org/cocoapods)
| [![Build Status](https://secure.travis-ci.org/CocoaPods/Core.png?branch=master)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core) | [![Build Status](http://img.shields.io/travis/CocoaPods/Core/master.svg)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core)
| [![Build Status](https://secure.travis-ci.org/CocoaPods/cocoapods-downloader.png?branch=master)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html) | [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-downloader/master.svg)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html)
| [![Build Status](https://travis-ci.org/CocoaPods/Xcodeproj.png?branch=master)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html) | [![Build Status](http://img.shields.io/travis/CocoaPods/Xcodeproj/master.svg)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html)
| [![Build Status](https://travis-ci.org/CocoaPods/CLAide.png?branch=master)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html) | [![Build Status](http://img.shields.io/travis/CocoaPods/CLAide/master.svg)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html)
| [![Build Status](https://secure.travis-ci.org/CocoaPods/Specs.png?branch=master)](http://travis-ci.org/CocoaPods/Specs) | [Master Repo ](https://github.com/CocoaPods/Specs) | Master repository of specifications. | [guide](http://docs.cocoapods.org/guides/contributing_to_the_master_repo.html) | [![Build Status](http://img.shields.io/travis/CocoaPods/Specs/master.svg)](http://travis-ci.org/CocoaPods/Specs) | [Master Repo ](https://github.com/CocoaPods/Specs) | Master repository of specifications. | [guide](http://docs.cocoapods.org/guides/contributing_to_the_master_repo.html)
def execute_command(command) task :build do
if ENV['VERBOSE'] title "Building the gem"
sh(command)
else
output = `#{command} 2>&1`
raise output unless $?.success?
end
end end
require "bundler/gem_tasks"
# Bootstrap task
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
namespace :gem do desc "Initializes your working copy to run the specs"
task :bootstrap, :use_bundle_dir? do |t, args|
title "Environment bootstrap"
def gem_version puts "Updating submodules"
require File.expand_path('../lib/cocoapods/gem_version.rb', __FILE__) execute_command "git submodule update --init --recursive"
Pod::VERSION
end
def gem_filename require 'rbconfig'
"cocoapods-#{gem_version}.gem" if RbConfig::CONFIG['prefix'] == '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr'
# Workaround Apple's mess. See https://github.com/CocoaPods/Xcodeproj/issues/137
#
# TODO This is not as correct as actually fixing the issue, figure out if we
# can override these build flags:
#
# ENV['DLDFLAGS'] = '-undefined dynamic_lookup -multiply_defined suppress'
ENV['ARCHFLAGS'] = '-Wno-error=unused-command-line-argument-hard-error-in-future'
end end
#--------------------------------------# puts "Installing gems"
if args[:use_bundle_dir?]
desc "Build a gem for the current version" execute_command "env XCODEPROJ_BUILD=1 bundle install --path ./travis_bundle_dir"
task :build do else
sh "gem build cocoapods.gemspec" execute_command "env XCODEPROJ_BUILD=1 bundle install"
end end
#--------------------------------------# puts "Checking for hg and bzr..."
if `which hg`.strip.empty?
desc "Install a gem version of the current code" puts "Please install Mercurial: `brew install hg`"
task :install => :build do
sh "gem install #{gem_filename}"
end end
#--------------------------------------# if `which bzr`.strip.empty?
puts "Please install Bazaar: `brew install bzr`"
def silent_sh(command)
output = `#{command} 2>&1`
unless $?.success?
puts output
exit 1
end
output
end end
end
desc "Run all specs, build and install gem, commit version change, tag version change, and push everything" # Post release
task :release do #-----------------------------------------------------------------------------#
unless ENV['SKIP_CHECKS']
if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'master'
$stderr.puts "[!] You need to be on the `master' branch in order to be able to do a release."
exit 1
end
if `git tag`.strip.split("\n").include?(gem_version)
$stderr.puts "[!] A tag for version `#{gem_version}' already exists. Change the version in lib/cocoapods/gem_version.rb"
silent_sh "open lib/cocoapods/gem_version.rb"
exit 1
end
diff_lines = `git diff --name-only`.strip.split("\n")
diff_lines.delete('CHANGELOG.md')
diff_lines.delete('Gemfile.lock')
if diff_lines.size == 0
$stderr.puts "[!] Change the version number yourself in lib/cocoapods/gem_version.rb"
exit 1
end
if diff_lines != ['lib/cocoapods/gem_version.rb']
$stderr.puts "[!] Only change the version number in a release commit!"
exit 1
end
puts "You are about to release `#{gem_version}', is that correct? [y/n]"
exit if $stdin.gets.strip.downcase != 'y'
end
require 'date'
# First check if the required gems have been pushed
gem_spec = eval(File.read(File.expand_path('../cocoapods.gemspec', __FILE__)))
gem_names = ['xcodeproj', 'cocoapods-core', 'cocoapods-downloader', 'claide']
gem_names.each do |gem_name|
gem = gem_spec.dependencies.find { |d| d.name == gem_name }
required_version = gem.requirement.requirements.first.last.to_s
puts "* Checking if #{gem_name} #{required_version} exists on the gem host"
search_result = silent_sh("gem search --all --pre --remote #{gem_name}")
remote_versions = search_result.match(/#{gem_name} \((.*)\)/m)[1].split(', ')
unless remote_versions.include?(required_version)
$stderr.puts "[!] The #{gem_name} version `#{required_version}' required by " \
"this version of CocoaPods does not exist on the gem host. " \
"Either push that first, or fix the version requirement."
exit 1
end
end
# Ensure that the branches are up to date with the remote desc "Updates the last know version of CocoaPods in the specs repo"
task :post_release do
title "Updating last known version in Specs repo"
specs_branch = 'master'
Dir.chdir('../Specs') do
puts Dir.pwd
sh "git checkout #{specs_branch}"
sh "git pull" sh "git pull"
puts "* Updating Bundle" yaml_file = 'CocoaPods-version.yml'
silent_sh('bundle update') unless File.exist?(yaml_file)
$stderr.puts "[!] Unable to find #{yaml_file}!"
unless ENV['SKIP_SPECS'] exit 1
puts "* Running specs"
silent_sh('rake spec:all')
end end
require 'yaml'
tmp = File.expand_path('../tmp', __FILE__) cocoapods_version = YAML.load_file(yaml_file)
tmp_gems = File.join(tmp, 'gems') cocoapods_version['last'] = gem_version
File.open(yaml_file, "w") do |f|
Rake::Task['gem:build'].invoke f.write(cocoapods_version.to_yaml)
puts "* Testing gem installation (tmp/gems)"
silent_sh "rm -rf '#{tmp}'"
silent_sh "gem install --install-dir='#{tmp_gems}' #{gem_filename}"
# Then release
sh "git commit lib/cocoapods/gem_version.rb CHANGELOG.md 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"
sh "gem push #{gem_filename}"
# Update the last version in CocoaPods-version.yml
puts "* Updating last known version in Specs repo"
specs_branch = 'master'
Dir.chdir('../Specs') do
puts Dir.pwd
sh "git checkout #{specs_branch}"
sh "git pull"
yaml_file = 'CocoaPods-version.yml'
unless File.exist?(yaml_file)
$stderr.puts "[!] Unable to find #{yaml_file}!"
exit 1
end
require 'yaml'
cocoapods_version = YAML.load_file(yaml_file)
cocoapods_version['last'] = gem_version
File.open(yaml_file, "w") do |f|
f.write(cocoapods_version.to_yaml)
end
sh "git commit #{yaml_file} -m 'CocoaPods release #{gem_version}'"
sh "git push"
end end
sh "git commit #{yaml_file} -m 'CocoaPods release #{gem_version}'"
sh "git push"
end end
end end
# Spec
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
namespace :spec do namespace :spec do
...@@ -219,9 +139,6 @@ namespace :spec do ...@@ -219,9 +139,6 @@ namespace :spec do
Rake::Task['examples:build'].invoke Rake::Task['examples:build'].invoke
end end
# Travis
#--------------------------------------#
#
# The integration 2 tests and the examples use the normal CocoaPods setup. # The integration 2 tests and the examples use the normal CocoaPods setup.
# #
desc "Run all specs and build all examples" desc "Run all specs and build all examples"
...@@ -242,8 +159,6 @@ namespace :spec do ...@@ -242,8 +159,6 @@ namespace :spec do
Rake::Task['examples:build'].invoke Rake::Task['examples:build'].invoke
end end
#--------------------------------------#
desc "Rebuild all the fixture tarballs" desc "Rebuild all the fixture tarballs"
task :rebuild_fixture_tarballs do task :rebuild_fixture_tarballs do
tarballs = FileList['spec/fixtures/**/*.tar.gz'] tarballs = FileList['spec/fixtures/**/*.tar.gz']
...@@ -253,8 +168,6 @@ namespace :spec do ...@@ -253,8 +168,6 @@ namespace :spec do
end end
end end
#--------------------------------------#
desc "Unpacks all the fixture tarballs" desc "Unpacks all the fixture tarballs"
task :unpack_fixture_tarballs do task :unpack_fixture_tarballs do
tarballs = FileList['spec/fixtures/**/*.tar.gz'] tarballs = FileList['spec/fixtures/**/*.tar.gz']
...@@ -266,15 +179,11 @@ namespace :spec do ...@@ -266,15 +179,11 @@ namespace :spec do
end end
end end
#--------------------------------------#
desc "Removes the stored VCR fixture" desc "Removes the stored VCR fixture"
task :clean_vcr do task :clean_vcr do
sh "rm -f spec/fixtures/vcr/tarballs.yml" sh "rm -f spec/fixtures/vcr/tarballs.yml"
end end
#--------------------------------------#
desc "Rebuilds integration fixtures" desc "Rebuilds integration fixtures"
task :rebuild_integration_fixtures do task :rebuild_integration_fixtures do
title 'Running Integration tests' title 'Running Integration tests'
...@@ -302,11 +211,10 @@ namespace :spec do ...@@ -302,11 +211,10 @@ namespace :spec do
puts "Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule" puts "Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule"
end end
#--------------------------------------#
task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"] task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"]
end end
# Examples
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
task :examples => "examples:build" task :examples => "examples:build"
...@@ -324,13 +232,14 @@ namespace :examples do ...@@ -324,13 +232,14 @@ namespace :examples do
end end
end end
#--------------------------------------#
desc "Build all examples" desc "Build all examples"
task :build do task :build do
Dir.chdir("examples/AFNetworking Example") do Dir.chdir("examples/AFNetworking Example") do
puts "Installing Pods" puts "Installing Pods"
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod' # pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
# TODO: The sandbox is blocking local git repos making bundler crash
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod'
execute_command "rm -rf Pods" execute_command "rm -rf Pods"
execute_command "#{pod_command} install --verbose --no-repo-update" execute_command "#{pod_command} install --verbose --no-repo-update"
...@@ -347,29 +256,8 @@ namespace :examples do ...@@ -347,29 +256,8 @@ namespace :examples do
sdk = Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last sdk = Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last
execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -sdk #{sdk}" execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -sdk #{sdk}"
end end
end end
end end
#--------------------------------------#
end
#-----------------------------------------------------------------------------#
desc "Initializes your working copy to run the specs"
task :bootstrap, :use_bundle_dir? do |t, args|
title "Environment bootstrap"
puts "Updating submodules"
execute_command "git submodule update --init --recursive"
puts "Installing gems"
if args[:use_bundle_dir?]
execute_command "bundle install --path ./travis_bundle_dir"
else
execute_command "bundle install"
end
end end
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
...@@ -379,9 +267,22 @@ task :spec => 'spec:all' ...@@ -379,9 +267,22 @@ task :spec => 'spec:all'
task :default => :spec task :default => :spec
# Helpers
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# group helpers def execute_command(command)
if ENV['VERBOSE']
sh(command)
else
output = `#{command} 2>&1`
raise output unless $?.success?
end
end
def gem_version
require File.expand_path('../lib/cocoapods/gem_version.rb', __FILE__)
Pod::VERSION
end
def title(title) def title(title)
cyan_title = "\033[0;36m#{title}\033[0m" cyan_title = "\033[0;36m#{title}\033[0m"
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
if RUBY_VERSION > '1.8.7' && Encoding.default_external != Encoding::UTF_8 if RUBY_VERSION > '1.8.7' && Encoding.default_external != Encoding::UTF_8
puts <<-DOC puts "\e[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding."
\e[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding. if ENV["TRAVIS"]
puts <<-DOC
Consider adding the following settings to .travis.yml
before_script:
- export LANG=en_US.UTF-8\e[0m\n
DOC
else
puts <<-DOC
See https://github.com/CocoaPods/guides.cocoapods.org/issues/26 for See https://github.com/CocoaPods/guides.cocoapods.org/issues/26 for
possible solutions.\e[0m\n possible solutions.\e[0m\n
DOC DOC
end
end end
if $PROGRAM_NAME == __FILE__ && !ENV['COCOAPODS_NO_BUNDLER'] if $PROGRAM_NAME == __FILE__ && !ENV['COCOAPODS_NO_BUNDLER']
......
...@@ -28,15 +28,17 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA ...@@ -28,15 +28,17 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA
# Link with the version of CocoaPods-Core # Link with the version of CocoaPods-Core
s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}" s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}"
s.add_runtime_dependency 'claide', '~> 0.4.0' s.add_runtime_dependency 'claide', '~> 0.5.0'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.2.0' s.add_runtime_dependency 'cocoapods-downloader', '~> 0.4.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.14.1' s.add_runtime_dependency 'xcodeproj', '~> 0.15.0'
s.add_runtime_dependency 'cocoapods-try', '~> 0.2.0'
s.add_runtime_dependency 'colored', '~> 1.2' s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4' s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'json_pure', '~> 1.8' s.add_runtime_dependency 'json_pure', '~> 1.8'
s.add_runtime_dependency 'open4', '~> 1.3' s.add_runtime_dependency 'open4', '~> 1.3'
s.add_runtime_dependency 'activesupport', '>= 3.2.15', '< 4' s.add_runtime_dependency 'activesupport', '>= 3.2.15', '< 4'
s.add_runtime_dependency 'nap', '~> 0.5'
s.add_development_dependency 'bacon', '~> 1.1' s.add_development_dependency 'bacon', '~> 1.1'
......
...@@ -298,7 +298,6 @@ ...@@ -298,7 +298,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = E74E8E7AFD3F4DCF9FEAB5B4 /* Pods-AFNetworking Example.xcconfig */; baseConfigurationReference = E74E8E7AFD3F4DCF9FEAB5B4 /* Pods-AFNetworking Example.xcconfig */;
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = "AFNetworking Example.entitlements";
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
...@@ -313,7 +312,6 @@ ...@@ -313,7 +312,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = E74E8E7AFD3F4DCF9FEAB5B4 /* Pods-AFNetworking Example.xcconfig */; baseConfigurationReference = E74E8E7AFD3F4DCF9FEAB5B4 /* Pods-AFNetworking Example.xcconfig */;
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = "AFNetworking Example.entitlements";
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
......
require 'rubygems' require 'rubygems'
require 'xcodeproj' require 'xcodeproj'
# It is very likely that we'll need these and as some of those paths will atm
# result in a I18n deprecation warning, we load those here now so that we can
# get rid of that warning.
require 'active_support/core_ext/string/strip'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/array/conversions'
# TODO check what this actually does by the time we're going to add support for
# other locales.
I18n.enforce_available_locales = false
module Pod module Pod
require 'pathname' require 'pathname'
...@@ -55,3 +65,24 @@ if ENV['COCOA_PODS_ENV'] == 'development' ...@@ -55,3 +65,24 @@ if ENV['COCOA_PODS_ENV'] == 'development'
# require 'awesome_print' # require 'awesome_print'
# require 'pry' # require 'pry'
end end
# TODO remove for CocoaPods 0.31
#
module Pod
class Specification
def pre_install(&block)
UI.warn "[#{self}] The pre install hook of the specification " \
"DSL has been deprecated, use the `resource_bundles` or the " \
"`prepare_command` attributes."
UI.puts "[#{self}] The pre_install hook will be removed in the next release".red
@pre_install_callback = block
end
def post_install(&block)
UI.warn "[#{self}] The post install hook of the specification " \
"DSL has been deprecated, use the `resource_bundles` or the " \
"`prepare_command` attributes."
UI.puts "[#{self}] The post_install hook will be removed in the next release".red
@post_install_callback = block
end
end
end
...@@ -13,7 +13,6 @@ module Pod ...@@ -13,7 +13,6 @@ module Pod
require 'cocoapods/command/lib' require 'cocoapods/command/lib'
require 'cocoapods/command/list' require 'cocoapods/command/list'
require 'cocoapods/command/outdated' require 'cocoapods/command/outdated'
require 'cocoapods/command/podfile_info'
require 'cocoapods/command/project' require 'cocoapods/command/project'
require 'cocoapods/command/push' require 'cocoapods/command/push'
require 'cocoapods/command/repo' require 'cocoapods/command/repo'
...@@ -46,8 +45,8 @@ module Pod ...@@ -46,8 +45,8 @@ module Pod
def self.run(argv) def self.run(argv)
argv = CLAide::ARGV.new(argv) argv = CLAide::ARGV.new(argv)
if argv.flag?('version') if argv.flag?('version')
puts VERSION UI.puts VERSION
exit!(0) exit 0
end end
super(argv) super(argv)
UI.print_warnings UI.print_warnings
...@@ -81,7 +80,7 @@ module Pod ...@@ -81,7 +80,7 @@ module Pod
super super
config.silent = argv.flag?('silent', config.silent) config.silent = argv.flag?('silent', config.silent)
config.verbose = self.verbose? unless self.verbose.nil? config.verbose = self.verbose? unless self.verbose.nil?
unless self.colorize_output? unless self.ansi_output?
String.send(:define_method, :colorize) { |string , _| string } String.send(:define_method, :colorize) { |string , _| string }
end end
end end
......
...@@ -31,12 +31,13 @@ module Pod ...@@ -31,12 +31,13 @@ module Pod
raise Informative, "Existing Podfile found in directory" unless config.podfile.nil? raise Informative, "Existing Podfile found in directory" unless config.podfile.nil?
if @project_path if @project_path
help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
project_path = @project_path
else else
raise Informative, "No xcode project found, please specify one" unless @project_paths.length > 0 raise Informative, "No xcode project found, please specify one" unless @project_paths.length > 0
raise Informative, "Multiple xcode projects found, please specify one" unless @project_paths.length == 1 raise Informative, "Multiple xcode projects found, please specify one" unless @project_paths.length == 1
@project_path = @project_paths.first project_path = @project_paths.first
end end
@xcode_project = Xcodeproj::Project.open(@project_path) @xcode_project = Xcodeproj::Project.open(project_path)
end end
def run def run
...@@ -51,7 +52,9 @@ module Pod ...@@ -51,7 +52,9 @@ module Pod
# @return [String] the text of the Podfile for the provided project # @return [String] the text of the Podfile for the provided project
# #
def podfile_template(project) def podfile_template(project)
podfile = <<-PLATFORM.strip_heredoc podfile = ''
podfile << "xcodeproj '#{@project_path}'\n\n" if @project_path
podfile << <<-PLATFORM.strip_heredoc
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, "6.0" # platform :ios, "6.0"
PLATFORM PLATFORM
......
...@@ -13,8 +13,8 @@ module Pod ...@@ -13,8 +13,8 @@ module Pod
class Spec < IPC class Spec < IPC
self.summary = 'Converts a podspec to YAML.' self.summary = 'Converts a podspec to JSON.'
self.description = 'Converts a podspec to YAML and prints it to STDOUT.' self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
self.arguments = 'PATH' self.arguments = 'PATH'
def initialize(argv) def initialize(argv)
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
def run def run
spec = Specification.from_file(@path) spec = Specification.from_file(@path)
output_pipe.puts spec.to_yaml output_pipe.puts spec.to_json
end end
end end
......
...@@ -10,13 +10,15 @@ module Pod ...@@ -10,13 +10,15 @@ module Pod
self.summary = 'Creates a new Pod' self.summary = 'Creates a new Pod'
self.description = <<-DESC self.description = <<-DESC
Creates a new Pod with the given name from the template in the working directory. Creates a scaffold for the development of a new Pod according to the CocoaPods best practices.
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one.
DESC DESC
self.arguments = '[NAME]' self.arguments = 'NAME [TEMPLATE_URL]'
def initialize(argv) def initialize(argv)
@name = argv.shift_argument @name = argv.shift_argument
@template_url = argv.shift_argument
super super
end end
...@@ -44,6 +46,7 @@ module Pod ...@@ -44,6 +46,7 @@ module Pod
TEMPLATE_REPO = "https://github.com/CocoaPods/pod-template.git" TEMPLATE_REPO = "https://github.com/CocoaPods/pod-template.git"
TEMPLATE_INFO_URL = "https://github.com/CocoaPods/pod-template" TEMPLATE_INFO_URL = "https://github.com/CocoaPods/pod-template"
CREATE_NEW_POD_INFO_URL = "http://guides.cocoapods.org/making/making-a-cocoapod"
# Clones the template from the remote in the working directory using # Clones the template from the remote in the working directory using
# the name of the Pod. # the name of the Pod.
...@@ -52,7 +55,7 @@ module Pod ...@@ -52,7 +55,7 @@ module Pod
# #
def clone_template def clone_template
UI.section("Creating `#{@name}` Pod") do UI.section("Creating `#{@name}` Pod") do
git!"clone '#{TEMPLATE_REPO}' #{@name}" git!"clone '#{template_repo_url}' #{@name}"
end end
end end
...@@ -73,9 +76,17 @@ module Pod ...@@ -73,9 +76,17 @@ module Pod
# @return [void] # @return [void]
# #
def print_info def print_info
UI.puts "\nTo learn more about the template see `#{TEMPLATE_INFO_URL}`." UI.puts "\nTo learn more about the template see `#{template_repo_url}`."
UI.puts "To learn more about creating a new pod, see `#{CREATE_NEW_POD_INFO_URL}`."
end end
# Checks if a template URL is given else returns the TEMPLATE_REPO URL
#
# @return String
#
def template_repo_url
@template_url || TEMPLATE_REPO
end
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
...@@ -90,13 +101,18 @@ module Pod ...@@ -90,13 +101,18 @@ module Pod
def self.options def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"], [ ["--quick", "Lint skips checks that would require to download and build the spec"],
["--only-errors", "Lint validates even if warnings are present"], ["--only-errors", "Lint validates even if warnings are present"],
["--subspec=NAME","Lint validates only the given subspec"],
["--no-subspecs", "Lint skips validation of subspecs"],
["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super) ["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super)
end end
def initialize(argv) def initialize(argv)
@quick = argv.flag?('quick') @quick = argv.flag?('quick')
@only_errors = argv.flag?('only-errors') @only_errors = argv.flag?('only-errors')
@clean = argv.flag?('clean', true) @clean = argv.flag?('clean', true)
@subspecs = argv.flag?('subspecs', true)
@only_subspec = argv.option('subspec')
@podspecs_paths = argv.arguments!
super super
end end
...@@ -106,27 +122,31 @@ module Pod ...@@ -106,27 +122,31 @@ module Pod
def run def run
UI.puts UI.puts
validator = Validator.new(podspec_to_lint) podspecs_to_lint.each do |podspec|
validator.local = true
validator.quick = @quick validator = Validator.new(podspec)
validator.no_clean = !@clean validator.local = true
validator.only_errors = @only_errors validator.quick = @quick
validator.validate validator.no_clean = !@clean
validator.only_errors = @only_errors
unless @clean validator.no_subspecs = !@subspecs || @only_subspec
UI.puts "Pods project available at `#{validator.validation_dir}/Pods/Pods.xcodeproj` for inspection." validator.only_subspec = @only_subspec
UI.puts validator.validate
end
unless @clean
if validator.validated? UI.puts "Pods project available at `#{validator.validation_dir}/Pods/Pods.xcodeproj` for inspection."
UI.puts "#{validator.spec.name} passed validation.".green UI.puts
else end
message = "#{validator.spec.name} did not pass validation." if validator.validated?
if @clean UI.puts "#{validator.spec.name} passed validation.".green
message << "\nYou can use the `--no-clean` option to inspect " \ else
"any issue." message = "#{validator.spec.name} did not pass validation."
if @clean
message << "\nYou can use the `--no-clean` option to inspect " \
"any issue."
end
raise Informative, message
end end
raise Informative, message
end end
end end
...@@ -142,11 +162,14 @@ module Pod ...@@ -142,11 +162,14 @@ module Pod
# @raise If no podspec is found. # @raise If no podspec is found.
# @raise If multiple podspecs are found. # @raise If multiple podspecs are found.
# #
def podspec_to_lint def podspecs_to_lint
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}') if !@podspecs_paths.empty? then
raise Informative, "Unable to find a podspec in the working directory" if podspecs.count.zero? Array(@podspecs_paths)
raise Informative, "Multiple podspecs detected in the working directory" if podspecs.count > 1 else
podspecs.first podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}')
raise Informative, "Unable to find a podspec in the working directory" if podspecs.count.zero?
podspecs
end
end end
end end
......
module Pod
class Command
class PodfileInfo < Command
self.summary = 'Shows information on installed Pods.'
self.description = <<-DESC
Shows information on installed Pods in current Project.
If optional `PODFILE_PATH` provided, the info will be shown for
that specific Podfile
DESC
self.arguments = '[PODFILE_PATH]'
def self.options
[
["--all", "Show information about all Pods with dependencies that are used in a project"],
["--md", "Output information in Markdown format"]
].concat(super)
end
def initialize(argv)
@info_all = argv.flag?('all')
@info_in_md = argv.flag?('md')
@info_license = argv.flag?('license')
@podfile_path = argv.shift_argument
super
end
def run
use_podfile = (@podfile_path || !config.lockfile)
if !use_podfile
UI.puts "Using lockfile" if config.verbose?
verify_lockfile_exists!
lockfile = config.lockfile
pods = lockfile.pod_names
if @info_all
deps = lockfile.dependencies.map{|d| d.name}
pods = (deps + pods).uniq
end
elsif @podfile_path
podfile = Pod::Podfile.from_file(@podfile_path)
pods = pods_from_podfile(podfile)
else
verify_podfile_exists!
podfile = config.podfile
pods = pods_from_podfile(podfile)
end
UI.puts "\nPods used:\n".yellow unless @info_in_md
pods_info(pods, @info_in_md)
end
def pods_from_podfile(podfile)
pods = []
podfile.root_target_definitions.each {|e| h = e.to_hash; pods << h['dependencies'] if h['dependencies']}
pods.flatten!
pods.collect! {|pod| (pod.is_a?(Hash)) ? pod.keys.first : pod}
end
def pods_info_hash(pods, keys=[:name, :homepage, :summary, :license])
pods_info = []
pods.each do |pod|
spec = (Pod::SourcesManager.search_by_name(pod).first rescue nil)
if spec
info = {}
keys.each { |k| info[k] = spec.specification.send(k) }
pods_info << info
else
end
end
pods_info
end
def pods_info(pods, in_md=false)
pods = pods_info_hash(pods, [:name, :homepage, :summary, :license])
pods.each do |pod|
if in_md
UI.puts "* [#{pod[:name]}](#{pod[:homepage]}) [#{pod[:license][:type]}] - #{pod[:summary]}"
else
UI.puts "- #{pod[:name]} [#{pod[:license][:type]}]".green
UI.puts " #{pod[:summary]}\n\n"
end
end
end
end
end
end
...@@ -122,7 +122,7 @@ module Pod ...@@ -122,7 +122,7 @@ module Pod
FileUtils.cp(spec_file, output_path) FileUtils.cp(spec_file, output_path)
Dir.chdir(repo_dir) do Dir.chdir(repo_dir) do
# only commit if modified # only commit if modified
if git!("status --porcelain 2>&1") =~ /#{spec.name}/ if git!("status --porcelain 2>&1").include?(spec.name)
UI.puts " - #{message}" UI.puts " - #{message}"
git!("add #{spec.name}") git!("add #{spec.name}")
git!("commit --no-verify -m '#{message}'") git!("commit --no-verify -m '#{message}'")
......
...@@ -19,7 +19,14 @@ module Pod ...@@ -19,7 +19,14 @@ module Pod
self.arguments = 'NAME URL [BRANCH]' self.arguments = 'NAME URL [BRANCH]'
def self.options
[
["--shallow", "Create a shallow clone (fast clone, but no push capabilities)"],
].concat(super)
end
def initialize(argv) def initialize(argv)
@shallow = argv.flag?('shallow', false)
@name, @url, @branch = argv.shift_argument, argv.shift_argument, argv.shift_argument @name, @url, @branch = argv.shift_argument, argv.shift_argument, argv.shift_argument
super super
end end
...@@ -32,9 +39,14 @@ module Pod ...@@ -32,9 +39,14 @@ module Pod
end end
def run def run
UI.section("Cloning spec repo `#{@name}` from `#{@url}`#{" (branch `#{@branch}`)" if @branch}") do prefix = @shallow ? 'Creating shallow clone of' : 'Cloning'
UI.section("#{prefix} spec repo `#{@name}` from `#{@url}`#{" (branch `#{@branch}`)" if @branch}") do
config.repos_dir.mkpath config.repos_dir.mkpath
Dir.chdir(config.repos_dir) { git!("clone '#{@url}' #{@name}") } Dir.chdir(config.repos_dir) do
command = "clone '#{@url}' #{@name}"
command << ' --depth=1' if @shallow
git!(command)
end
Dir.chdir(dir) { git!("checkout #{@branch}") } if @branch Dir.chdir(dir) { git!("checkout #{@branch}") } if @branch
SourcesManager.check_version_information(dir) SourcesManager.check_version_information(dir)
end end
...@@ -151,6 +163,8 @@ module Pod ...@@ -151,6 +163,8 @@ module Pod
super super
help! 'Deleting a repo needs a `NAME`.' unless @name help! 'Deleting a repo needs a `NAME`.' unless @name
help! "repo #{@name} does not exist" unless File.directory?(dir) help! "repo #{@name} does not exist" unless File.directory?(dir)
help! "You do not have permission to delete the #{@name} repository." \
"Perhaps try prefixing this command with sudo." unless File.writable?(dir)
end end
def run def run
......
...@@ -9,15 +9,16 @@ module Pod ...@@ -9,15 +9,16 @@ module Pod
description of the pods. description of the pods.
DESC DESC
self.arguments = '[QUERY]' self.arguments = 'QUERY'
def self.options def self.options
[ [
["--full", "Search by name, summary, and description"], ["--full", "Search by name, summary, and description"],
["--stats", "Show additional stats (like GitHub watchers and forks)"], ["--stats", "Show additional stats (like GitHub watchers and forks)"],
["--ios", "Restricts the search to Pods supported on iOS"], ["--ios", "Restricts the search to Pods supported on iOS"],
["--osx", "Restricts the search to Pods supported on OS X"] ["--osx", "Restricts the search to Pods supported on OS X"],
].concat(super) ["--web", "Searches on cocoapods.org"]
].concat(super.reject { |option, _| option == '--silent' })
end end
def initialize(argv) def initialize(argv)
...@@ -25,17 +26,49 @@ module Pod ...@@ -25,17 +26,49 @@ module Pod
@stats = argv.flag?('stats') @stats = argv.flag?('stats')
@supported_on_ios = argv.flag?('ios') @supported_on_ios = argv.flag?('ios')
@supported_on_osx = argv.flag?('osx') @supported_on_osx = argv.flag?('osx')
@query = argv.shift_argument @web = argv.flag?('web')
@query = argv.arguments! unless argv.arguments.empty?
config.silent = false
super super
end end
def validate! def validate!
super super
help! "A search query is required." unless @query help! "A search query is required." unless @query
unless @web
begin
/#{@query.join(' ').strip}/
rescue RegexpError
help! "A valid regular expression is required."
end
end
end end
def run def run
sets = SourcesManager.search_by_name(@query.strip, @full_text_search) if @web
web_search
else
local_search
end
end
extend Executable
executable :open
def web_search
query_parameter = [
('on:osx' if @supported_on_osx),
('on:ios' if @supported_on_ios),
@query
].compact.flatten.join(' ')
url = "http://cocoapods.org/?q=#{CGI.escape(query_parameter).gsub("+", "%20")}"
UI.puts("Opening #{url}")
open!(url)
end
def local_search
sets = SourcesManager.search_by_name(@query.join(' ').strip, @full_text_search)
if @supported_on_ios if @supported_on_ios
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:ios) } sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
end end
...@@ -56,6 +89,7 @@ module Pod ...@@ -56,6 +89,7 @@ module Pod
end end
end end
end end
end end
end end
end end
...@@ -15,14 +15,18 @@ module Pod ...@@ -15,14 +15,18 @@ module Pod
DESC DESC
def self.options def self.options
[["--push", "Use this option to enable push access once granted"]].concat(super) [
["--no-shallow", "Clone full history so push will work"],
["--push", "Use this option to enable push access once granted"],
].concat(super)
end end
extend Executable extend Executable
executable :git executable :git
def initialize(argv) def initialize(argv)
@push_option = argv.flag?('push') @push_option = argv.flag?('push')
@shallow = argv.flag?('shallow', !@push_option)
super super
end end
...@@ -77,7 +81,9 @@ module Pod ...@@ -77,7 +81,9 @@ module Pod
# @return [void] # @return [void]
# #
def add_master_repo def add_master_repo
@command ||= Repo::Add.parse(['master', url, 'master']).run cmd = ['master', url, 'master']
cmd << '--shallow' if @shallow
Repo::Add.parse(cmd).run
end end
# Updates the master repo against the remote. # Updates the master repo against the remote.
...@@ -109,7 +115,7 @@ module Pod ...@@ -109,7 +115,7 @@ module Pod
# be enabled. # be enabled.
# #
def url def url
(push?) ? read_write_url : read_only_url push? ? read_write_url : read_only_url
end end
# @return [String] the read only url of the master repo. # @return [String] the read only url of the master repo.
......
...@@ -61,13 +61,17 @@ module Pod ...@@ -61,13 +61,17 @@ module Pod
def self.options def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"], [ ["--quick", "Lint skips checks that would require to download and build the spec"],
["--only-errors", "Lint validates even if warnings are present"], ["--only-errors", "Lint validates even if warnings are present"],
["--subspec=NAME","Lint validates only the given subspec"],
["--no-subspecs", "Lint skips validation of subspecs"],
["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super) ["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super)
end end
def initialize(argv) def initialize(argv)
@quick = argv.flag?('quick') @quick = argv.flag?('quick')
@only_errors = argv.flag?('only-errors') @only_errors = argv.flag?('only-errors')
@clean = argv.flag?('clean', true) @clean = argv.flag?('clean', true)
@subspecs = argv.flag?('subspecs', true)
@only_subspec = argv.option('subspec')
@podspecs_paths = argv.arguments! @podspecs_paths = argv.arguments!
super super
end end
...@@ -80,6 +84,8 @@ module Pod ...@@ -80,6 +84,8 @@ module Pod
validator.quick = @quick validator.quick = @quick
validator.no_clean = !@clean validator.no_clean = !@clean
validator.only_errors = @only_errors validator.only_errors = @only_errors
validator.no_subspecs = !@subspecs || @only_subspec
validator.only_subspec = @only_subspec
validator.validate validator.validate
invalid_count += 1 unless validator.validated? invalid_count += 1 unless validator.validated?
...@@ -129,7 +135,7 @@ module Pod ...@@ -129,7 +135,7 @@ module Pod
end end
def podspecs_tmp_dir def podspecs_tmp_dir
Pathname.new('/tmp/CocoaPods/Lint_podspec') Pathname.new(File.join(Pathname.new('/tmp').realpath, '/CocoaPods/Lint_podspec'))
end end
end end
...@@ -201,7 +207,7 @@ module Pod ...@@ -201,7 +207,7 @@ module Pod
get_path_of_spec(@spec) get_path_of_spec(@spec)
end end
UI.puts File.open(filepath).read UI.puts File.read(filepath)
end end
end end
...@@ -294,10 +300,10 @@ module Pod ...@@ -294,10 +300,10 @@ module Pod
UI.puts "#{ index + 1 }: #{ item }" UI.puts "#{ index + 1 }: #{ item }"
end end
print message UI.puts message
index = STDIN.gets.chomp.to_i - 1 index = UI.gets.chomp.to_i - 1
if index < 0 || index > array.count if index < 0 || index > array.count - 1
raise Informative, "#{ index + 1 } is invalid [1-#{ array.count }]" raise Informative, "#{ index + 1 } is invalid [1-#{ array.count }]"
else else
index index
...@@ -364,16 +370,21 @@ module Pod ...@@ -364,16 +370,21 @@ module Pod
def spec_and_source_from_set(set) def spec_and_source_from_set(set)
sources = set.sources sources = set.sources
best_source = sources.first best_source = best_version = nil
best_version = best_source.versions(set.name).first
sources.each do |source| sources.each do |source|
version = source.versions(set.name).first versions = source.versions(set.name)
if version > best_version versions.each do |version|
if !best_version or version > best_version
best_source = source best_source = source
best_version = version best_version = version
end
end end
end end
if !best_source or !best_version
raise Informative, "Unable to locate highest known specification for `#{ set.name }'"
end
return best_source.specification(set.name, best_version), best_source return best_source.specification(set.name, best_version), best_source
end end
...@@ -479,21 +490,24 @@ Pod::Spec.new do |s| ...@@ -479,21 +490,24 @@ Pod::Spec.new do |s|
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
# #
s.license = 'MIT (example)' s.license = "MIT (example)"
# s.license = { :type => 'MIT', :file => 'FILE_LICENSE' } # s.license = { :type => "MIT", :file => "FILE_LICENSE" }
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# #
# Specify the authors of the library, with email addresses. Email addresses # Specify the authors of the library, with email addresses. Email addresses
# of the authors by using the SCM log. E.g. $ git log. If no email can be # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# found CocoaPods accept just the names. # accepts just a name if you'd rather not provide an email address.
# #
# Specify a social_media_url where others can refer to, for example a twitter
s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" } # profile URL.
# s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}", "other author" => "email@address.com" } #
# s.author = '#{data[:author_name]}', 'other author'
s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" }
# Or just: s.author = "#{data[:author_name]}"
# s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" }
# s.social_media_url = "http://twitter.com/#{data[:author_name]}"
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# #
...@@ -502,17 +516,17 @@ Pod::Spec.new do |s| ...@@ -502,17 +516,17 @@ Pod::Spec.new do |s|
# #
# s.platform = :ios # s.platform = :ios
# s.platform = :ios, '5.0' # s.platform = :ios, "5.0"
# When using multiple platforms # When using multiple platforms
# s.ios.deployment_target = '5.0' # s.ios.deployment_target = "5.0"
# s.osx.deployment_target = '10.7' # s.osx.deployment_target = "10.7"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# #
# Specify the location from where the source should be retrieved. # Specify the location from where the source should be retrieved.
# Supports git, hg, svn and HTTP. # Supports git, hg, bzr, svn and HTTP.
# #
s.source = { :git => "#{data[:source_url]}", #{data[:ref_type]} => "#{data[:ref]}" } s.source = { :git => "#{data[:source_url]}", #{data[:ref_type]} => "#{data[:ref]}" }
...@@ -526,10 +540,10 @@ Pod::Spec.new do |s| ...@@ -526,10 +540,10 @@ Pod::Spec.new do |s|
# Not including the public_header_files will make all headers public. # Not including the public_header_files will make all headers public.
# #
s.source_files = 'Classes', 'Classes/**/*.{h,m}' s.source_files = "Classes", "Classes/**/*.{h,m}"
s.exclude_files = 'Classes/Exclude' s.exclude_files = "Classes/Exclude"
# s.public_header_files = 'Classes/**/*.h' # s.public_header_files = "Classes/**/*.h"
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
...@@ -552,11 +566,11 @@ Pod::Spec.new do |s| ...@@ -552,11 +566,11 @@ Pod::Spec.new do |s|
# the lib prefix of their name. # the lib prefix of their name.
# #
# s.framework = 'SomeFramework' # s.framework = "SomeFramework"
# s.frameworks = 'SomeFramework', 'AnotherFramework' # s.frameworks = "SomeFramework", "AnotherFramework"
# s.library = 'iconv' # s.library = "iconv"
# s.libraries = 'iconv', 'xml2' # s.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
...@@ -567,8 +581,8 @@ Pod::Spec.new do |s| ...@@ -567,8 +581,8 @@ Pod::Spec.new do |s|
# s.requires_arc = true # s.requires_arc = true
# s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' } # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency 'JSONKit', '~> 1.4' # s.dependency "JSONKit", "~> 1.4"
end end
SPEC SPEC
......
...@@ -16,6 +16,7 @@ module Pod ...@@ -16,6 +16,7 @@ module Pod
klass = if params.key?(:git) then GitSource klass = if params.key?(:git) then GitSource
elsif params.key?(:svn) then SvnSource elsif params.key?(:svn) then SvnSource
elsif params.key?(:hg) then MercurialSource elsif params.key?(:hg) then MercurialSource
elsif params.key?(:bzr) then BazaarSource
elsif params.key?(:podspec) then PodspecSource elsif params.key?(:podspec) then PodspecSource
elsif params.key?(:path) then PathSource elsif params.key?(:path) then PathSource
end end
...@@ -261,6 +262,35 @@ module Pod ...@@ -261,6 +262,35 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# Provides support for fetching a specification file from a Bazaar
# source remote.
#
# Supports all the options of the downloader (is similar to the git key of
# `source` attribute of a specification).
#
# @note The podspec must be in the root of the repository and should have a
# name matching the one of the dependency.
#
class BazaarSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
pre_download(sandbox)
end
# @see AbstractExternalSource#description
#
def description
"from `#{params[:bzr]}`".tap do |description|
description << ", tag `#{params[:tag]}`" if params[:tag]
description << ", revision `#{params[:revision]}`" if params[:revision]
end
end
end
#-------------------------------------------------------------------------#
# Provides support for fetching a specification file from an URL. Can be # Provides support for fetching a specification file from an URL. Can be
# http, file, etc. # http, file, etc.
# #
...@@ -348,7 +378,7 @@ module Pod ...@@ -348,7 +378,7 @@ module Pod
pathname = Pathname.new(absolute_path) pathname = Pathname.new(absolute_path)
unless pathname.exist? unless pathname.exist?
raise Informative, "No podspec found for `#{name}` in `#{params[:local]}`" raise Informative, "No podspec found for `#{name}` in `#{declared_path}`"
end end
pathname pathname
end end
......
module Pod module Pod
# The version of the cocoapods command line tool. # The version of the cocoapods command line tool.
# #
VERSION = '0.28.0' unless defined? Pod::VERSION VERSION = '0.30.0' unless defined? Pod::VERSION
end end
require 'active_support/core_ext/string/inflections'
module Pod module Pod
# The Installer is responsible of taking a Podfile and transform it in the # The Installer is responsible of taking a Podfile and transform it in the
...@@ -155,15 +157,15 @@ module Pod ...@@ -155,15 +157,15 @@ module Pod
# @return [void] # @return [void]
# #
# @note The warning about the version of the Lockfile doesn't uses the # @note The warning about the version of the Lockfile doesn't use the
# `UI.warn` method because it prints the output only at the end # `UI.warn` method because it prints the output only at the end
# of the installation. At that time CocoaPods could have crashed. # of the installation. At that time CocoaPods could have crashed.
# #
def analyze def analyze
if lockfile && lockfile.cocoapods_version > Version.new(VERSION) if lockfile && lockfile.cocoapods_version > Version.new(VERSION)
STDERR.puts '[!] The version of CocoaPods used to generate the lockfile is '\ STDERR.puts '[!] The version of CocoaPods used to generate the lockfile is '\
'higher that the one of the current executable. Incompatibility ' \ 'higher than the version of the current executable. Incompatibility ' \
'issues might arise.'.yellow 'issues may arise.'.yellow
end end
analyzer = Analyzer.new(sandbox, podfile, lockfile) analyzer = Analyzer.new(sandbox, podfile, lockfile)
......
...@@ -461,7 +461,8 @@ module Pod ...@@ -461,7 +461,8 @@ module Pod
def compute_archs_for_target_definition(target_definition, user_targets) def compute_archs_for_target_definition(target_definition, user_targets)
archs = [] archs = []
user_targets.each do |target| user_targets.each do |target|
archs << target.common_resolved_build_setting('ARCHS') target_archs = target.common_resolved_build_setting('ARCHS')
archs.concat(Array(target_archs))
end end
archs = archs.compact.uniq.sort archs = archs.compact.uniq.sort
......
...@@ -15,7 +15,6 @@ module Pod ...@@ -15,7 +15,6 @@ module Pod
add_target add_target
add_files_to_build_phases add_files_to_build_phases
add_resources_bundle_targets add_resources_bundle_targets
# create_suport_files_group
create_xcconfig_file create_xcconfig_file
create_prefix_header create_prefix_header
create_dummy_source create_dummy_source
......
require 'active_support' require 'active_support/core_ext/string/inflections'
module Pod module Pod
class Installer class Installer
......
...@@ -61,16 +61,17 @@ module Pod ...@@ -61,16 +61,17 @@ module Pod
def search_by_name(query, full_text_search = false) def search_by_name(query, full_text_search = false)
if full_text_search if full_text_search
set_names = [] set_names = []
query_regexp = /#{query}/i
updated_search_index.each do |name, set_data| updated_search_index.each do |name, set_data|
text = name.dup texts = [name]
if full_text_search if full_text_search
text << set_data['authors'].to_s if set_data['authors'] texts << set_data['authors'].to_s if set_data['authors']
text << set_data['summary'] if set_data['summary'] texts << set_data['summary'] if set_data['summary']
text << set_data['description'] if set_data['description'] texts << set_data['description'] if set_data['description']
end end
set_names << name if text.downcase.include?(query.downcase) set_names << name unless texts.grep(query_regexp).empty?
end end
sets = set_names.sort.map { |name| aggregate.represenative_set(name) } sets = set_names.sort.map { |name| aggregate.representative_set(name) }
else else
sets = aggregate.search_by_name(query, false) sets = aggregate.search_by_name(query, false)
end end
...@@ -142,19 +143,19 @@ module Pod ...@@ -142,19 +143,19 @@ module Pod
if source_name if source_name
specified_source = aggregate.all.find { |s| s.name == source_name } specified_source = aggregate.all.find { |s| s.name == source_name }
raise Informative, "Unable to find the `#{source_name}` repo." unless specified_source raise Informative, "Unable to find the `#{source_name}` repo." unless specified_source
raise Informative, "The `#{source_name}` repo is not a git repo." unless git_repo?(specified_source.repo) raise Informative, "The `#{source_name}` repo is not a git repo." unless git_repo?(specified_source.data_provider.repo)
sources = [specified_source] sources = [specified_source]
else else
sources = aggregate.all.select { |source| git_repo?(source.repo) && git_remote_reachable?(source.repo) } sources = aggregate.all.select { |source| git_repo?(source.data_provider.repo) && git_remote_reachable?(source.data_provider.repo) }
end end
sources.each do |source| sources.each do |source|
UI.section "Updating spec repo `#{source.name}`" do UI.section "Updating spec repo `#{source.name}`" do
Dir.chdir(source.repo) do Dir.chdir(source.data_provider.repo) do
output = git!("pull") output = git!("pull")
UI.puts output if show_output && !config.verbose? UI.puts output if show_output && !config.verbose?
end end
check_version_information(source.repo) check_version_information(source.data_provider.repo)
end end
end end
end end
...@@ -205,7 +206,8 @@ module Pod ...@@ -205,7 +206,8 @@ module Pod
end end
if config.new_version_message? && cocoapods_update?(versions) if config.new_version_message? && cocoapods_update?(versions)
UI.puts "\nCocoaPods #{versions['last']} is available.\n".green UI.puts "\nCocoaPods #{versions['last']} is available.\n" \
"To update use: [sudo] gem install cocoapods\n".green
end end
end end
......
...@@ -242,6 +242,12 @@ module Pod ...@@ -242,6 +242,12 @@ module Pod
STDOUT.print(message) unless config.silent? STDOUT.print(message) unless config.silent?
end end
# gets input from $stdin
#
def gets
$stdin.gets
end
# Stores important warning to the user optionally followed by actions # Stores important warning to the user optionally followed by actions
# that the user should take. To print them use {#print_warnings}. # that the user should take. To print them use {#print_warnings}.
# #
......
...@@ -87,7 +87,8 @@ EOS ...@@ -87,7 +87,8 @@ EOS
def repo_information def repo_information
SourcesManager.all.map do |source| SourcesManager.all.map do |source|
repo = source.repo next unless source.type == 'file system'
repo = source.data_provider.repo
Dir.chdir(repo) do Dir.chdir(repo) do
url = `git config --get remote.origin.url 2>&1`.strip url = `git config --get remote.origin.url 2>&1`.strip
sha = `git rev-parse HEAD 2>&1`.strip sha = `git rev-parse HEAD 2>&1`.strip
......
...@@ -46,7 +46,7 @@ module Pod ...@@ -46,7 +46,7 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# Lints the specification adding a {Specification::Linter::Result} for any # Lints the specification adding a {Result} for any
# failed check to the {#results} list. # failed check to the {#results} list.
# #
# @note This method shows immediately which pod is being processed and # @note This method shows immediately which pod is being processed and
...@@ -56,13 +56,21 @@ module Pod ...@@ -56,13 +56,21 @@ module Pod
# #
def validate def validate
@results = [] @results = []
UI.print " -> #{spec ? spec.name : file.basename}\r" unless config.silent?
# Replace default spec with a subspec if asked for
a_spec = spec
if spec && @only_subspec
a_spec = spec.subspec_by_name(@only_subspec)
@subspec_name = a_spec.name
end
UI.print " -> #{a_spec ? a_spec.name : file.basename}\r" unless config.silent?
$stdout.flush $stdout.flush
perform_linting perform_linting
perform_extensive_analysis if spec && !quick perform_extensive_analysis(a_spec) if a_spec && !quick
UI.puts " -> ".send(result_color) << (spec ? spec.to_s : file.basename.to_s) UI.puts " -> ".send(result_color) << (a_spec ? a_spec.to_s : file.basename.to_s)
print_results print_results
validated? validated?
end end
...@@ -79,12 +87,22 @@ module Pod ...@@ -79,12 +87,22 @@ module Pod
platform_message = "[OSX] " platform_message = "[OSX] "
end end
subspecs_message = ""
if result.is_a?(Result)
subspecs = result.subspecs.uniq
if subspecs.count > 2
subspecs_message = "[" + subspecs[0..2].join(', ') + ", and more...] "
elsif subspecs.count > 0
subspecs_message = "[" + subspecs.join(',') + "] "
end
end
case result.type case result.type
when :error then type = "ERROR" when :error then type = "ERROR"
when :warning then type = "WARN" when :warning then type = "WARN"
when :note then type = "NOTE" when :note then type = "NOTE"
else raise "#{result.type}" end else raise "#{result.type}" end
UI.puts " - #{type.ljust(5)} | #{platform_message}#{result.message}" UI.puts " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.message}"
end end
UI.puts UI.puts
end end
...@@ -116,6 +134,14 @@ module Pod ...@@ -116,6 +134,14 @@ module Pod
# #
attr_accessor :only_errors attr_accessor :only_errors
# @return [String] name of the subspec to check, if nil all subspecs are checked.
#
attr_accessor :only_subspec
# @return [Bool] Whether the validator should validate all subspecs
#
attr_accessor :no_subspecs
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# !@group Lint results # !@group Lint results
...@@ -151,7 +177,7 @@ module Pod ...@@ -151,7 +177,7 @@ module Pod
# @return [Pathname] the temporary directory used by the linter. # @return [Pathname] the temporary directory used by the linter.
# #
def validation_dir def validation_dir
Pathname.new('/tmp/CocoaPods/Lint') Pathname.new(File.join(Pathname.new('/tmp').realpath,'CocoaPods/Lint'))
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -167,9 +193,9 @@ module Pod ...@@ -167,9 +193,9 @@ module Pod
@results.concat(linter.results) @results.concat(linter.results)
end end
# Perform analysis for a given spec (or subspec)
# #
# def perform_extensive_analysis(spec)
def perform_extensive_analysis
spec.available_platforms.each do |platform| spec.available_platforms.each do |platform|
UI.message "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed UI.message "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed
@consumer = spec.consumer(platform) @consumer = spec.consumer(platform)
...@@ -179,9 +205,20 @@ module Pod ...@@ -179,9 +205,20 @@ module Pod
check_file_patterns check_file_patterns
tear_down_validation_environment tear_down_validation_environment
end end
perform_extensive_subspec_analysis(spec) unless @no_subspecs
end
# Recurively perform the extensive analysis on all subspecs
#
def perform_extensive_subspec_analysis(spec)
spec.subspecs.each do |subspec|
@subspec_name = subspec.name
perform_extensive_analysis(subspec)
end
end end
attr_accessor :consumer attr_accessor :consumer
attr_accessor :subspec_name
def setup_validation_environment def setup_validation_environment
validation_dir.rmtree if validation_dir.exist? validation_dir.rmtree if validation_dir.exist?
...@@ -283,10 +320,24 @@ module Pod ...@@ -283,10 +320,24 @@ module Pod
def add_result(type, message) def add_result(type, message)
result = results.find { |r| r.type == type && r.message == message } result = results.find { |r| r.type == type && r.message == message }
unless result unless result
result = Specification::Linter::Result.new(type, message) result = Result.new(type, message)
results << result results << result
end end
result.platforms << consumer.platform_name if consumer result.platforms << consumer.platform_name if consumer
result.subspecs << subspec_name if subspec_name && !result.subspecs.include?(subspec_name)
end
# Specialized Result to support subspecs aggregation
#
class Result < Specification::Linter::Result
def initialize(type, message)
super(type, message)
@subspecs = []
end
attr_reader :subspecs
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -302,7 +353,7 @@ module Pod ...@@ -302,7 +353,7 @@ module Pod
# in local mode. # in local mode.
# #
def podfile_from_spec(platform_name, deployment_target) def podfile_from_spec(platform_name, deployment_target)
name = spec.name name = subspec_name ? subspec_name : spec.name
podspec = file.realpath podspec = file.realpath
local = local? local = local?
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
...@@ -341,9 +392,10 @@ module Pod ...@@ -341,9 +392,10 @@ module Pod
end end
# @return [String] Executes xcodebuild in the current working directory and # @return [String] Executes xcodebuild in the current working directory and
# returns its output (bot STDOUT and STDERR). # returns its output (both STDOUT and STDERR).
# #
def xcodebuild def xcodebuild
UI.puts 'xcodebuild clean build -target Pods' if config.verbose?
`xcodebuild clean build -target Pods 2>&1` `xcodebuild clean build -target Pods 2>&1`
end end
......
Subproject commit e6127aca6fb1a7387afaa25d38f1caf3640c0876 Subproject commit 27a44d7c15b58e8fa431ae774f13d348ad315721
This is a Bazaar control directory.
Do not change any files in this directory.
See http://bazaar.canonical.com/ for more information about Bazaar.
Bazaar-NG meta directory, format 1
Bazaar Branch Format 7 (needs bzr 1.6)
2 fred@sharpnoodles.com-20131030202140-gg5dfrrtaotfxlrh
Bazaar Working Tree Format 6 (bzr 1.14)
Bazaar repository format 2a (needs bzr 1.16 or later)
B+Tree Graph Index 2
node_ref_lists=1
key_elements=1
len=1
row_lengths=1
xQ
;0޺tK-R4n?'oCwK;l-W.6l
"ǰ^c:BMF@,B
\ No newline at end of file
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
B+Tree Graph Index 2
node_ref_lists=1
key_elements=2
len=3
row_lengths=1
xM0@a֜ Lg ԅ71P,ȏ-+M W'ܦ5CH>xi& ("ükA boax{oļ#PB][а^IR`2
4i,FE;;t
"tJ57sL :*7}v e
\ No newline at end of file
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=1
row_lengths=1
x PLZ
8'@8x0ы&V|6Hcr7eyhZCbr"&s?-
\ No newline at end of file
B+Tree Graph Index 2
node_ref_lists=0
key_elements=1
len=0
row_lengths=
Pod::Spec.new do |s|
s.name = "BazaarSource"
s.version = "0.0.1"
s.summary = "A short description of BazaarSource."
s.homepage = "http://EXAMPLE/BazaarSource"
s.license = 'MIT (example)'
s.author = { "Fred McCann" => "fred@sharpnoodles.com" }
s.source = { :git => "http://EXAMPLE/BazaarSource.git", :tag => "0.0.1" }
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
end
...@@ -122,5 +122,27 @@ module Pod ...@@ -122,5 +122,27 @@ module Pod
end end
end end
it "saves xcode project file in Podfile if one was supplied" do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'test1.xcodeproj').save
Xcodeproj::Project.new(temporary_directory + 'Project.xcodeproj').save
run_command('init', 'Project.xcodeproj')
target_definition = config.podfile.target_definitions.values.first
target_definition.user_project_path.should == 'Project.xcodeproj'
end
end
it "doesn't save xcode project file in Podfile if one wasn't supplied" do
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new(temporary_directory + 'Project.xcodeproj').save
run_command('init')
target_definition = config.podfile.target_definitions.values.first
target_definition.user_project_path.should == nil
end
end
end end
end end
...@@ -13,12 +13,11 @@ module Pod ...@@ -13,12 +13,11 @@ module Pod
describe Command::IPC::Spec do describe Command::IPC::Spec do
it "converts a podspec to yaml and prints it to STDOUT" do it "converts a podspec to JSON and prints it to STDOUT" do
out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec')) out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec'))
out.should.include('---') out.should.match /"name":"BananaLib"/
out.should.match /name: BananaLib/ out.should.match /"version":"1.0"/
out.should.match /version: .1\.0./ out.should.match /"description":"Full of chunky bananas."/
out.should.match /description: Full of chunky bananas./
end end
end end
...@@ -41,7 +40,7 @@ module Pod ...@@ -41,7 +40,7 @@ module Pod
describe Command::IPC::List do describe Command::IPC::List do
it "converts a podspec to yaml and prints it to STDOUT" do it "prints a list of podspecs in the yaml format and prints it to STDOUT" do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
set = Specification.new('BananaLib') set = Specification.new('BananaLib')
set.stubs(:specification).returns(spec) set.stubs(:specification).returns(spec)
......
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
require 'xcodeproj'
module Pod module Pod
describe Command::Lib::Create do describe Command::Lib::Create do
it "complains if wrong parameters" do it "complains if wrong parameters" do
...@@ -12,5 +10,89 @@ module Pod ...@@ -12,5 +10,89 @@ module Pod
lambda { run_command('lib', 'create', 'Pod Name With Spaces') }.should.raise CLAide::Help lambda { run_command('lib', 'create', 'Pod Name With Spaces') }.should.raise CLAide::Help
end end
end end
end
describe Command::Lib::Lint do
it "lints the current working directory" do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
end
end
it "lints a single spec in the current working directory" do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', 'Reachability.podspec', '--quick', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
end
end
it "fails to lint a broken spec file and cleans up" do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') { |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
}
tmp_validator = Validator.new('Broken.podspec')
lint_path = tmp_validator.validation_dir
lambda { run_command('lib', 'lint', 'Broken.podspec') }.should.raise Pod::Informative
UI.output.should.include "Missing required attribute"
lint_path.exist?.should == false
end
end
it "fails to lint a broken spec file and leaves lint directory" do
Dir.chdir(temporary_directory) do
open(temporary_directory + 'Broken.podspec', 'w') { |f|
f << 'Pod::Spec.new do |spec|'
f << "spec.name = 'Broken'"
f << 'end'
}
lambda { run_command('lib', 'lint', 'Broken.podspec', '--no-clean') }.should.raise Pod::Informative
UI.output.should.include "Pods project available at"
UI.output.should.include "Missing required attribute"
lint_dir = UI.output[/.*Pods project available at `(.*)` for inspection./,1]
Pathname.new(lint_dir).exist?.should == true
end
end
end
describe Command::Lib do
it "should create a new dir for the newly created pod" do
run_command('lib', 'create', 'TestPod')
Dir.chdir(temporary_directory) do
Pathname.new(temporary_directory + 'TestPod').exist?.should == true
end
end
it "should show link to new pod guide after creation" do
output = run_command('lib', 'create', 'TestPod')
output.should.include? 'http://guides.cocoapods.org/making/making-a-cocoapod'
end
before do
Command::Lib::Create.any_instance.stubs(:configure_template)
Command::Lib::Create.any_instance.stubs(:git!)
end
it "should use the given template URL" do
template_url = 'https://github.com/custom/template.git'
Command::Lib::Create.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
sut = run_command('lib', 'create', 'TestPod', template_url)
end
it "should use the default URL if no template URL is given" do
template_url = 'https://github.com/CocoaPods/pod-template.git'
Command::Lib::Create.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
run_command('lib', 'create', 'TestPod')
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::PodfileInfo do
extend SpecHelper::TemporaryRepos
before do
@test_source = Source.new(fixture('spec-repos/test_repo'))
Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
SourcesManager.updated_search_index = nil
end
it "tells the user pods info from Podfile" do
file = temporary_directory + 'Podfile'
text = <<-PODFILE
platform :ios
pod 'BananaLib'
pod 'JSONKit'
PODFILE
File.open(file, 'w') {|f| f.write(text) }
Dir.chdir(temporary_directory) do
output = run_command('podfile-info')
output.should.include? '- BananaLib'
output.should.include? 'Chunky bananas!'
output.should.include? '- JSONKit'
output.should.include? 'A Very High Performance Objective-C JSON Library.'
end
end
end
end
...@@ -49,7 +49,7 @@ module Pod ...@@ -49,7 +49,7 @@ module Pod
`git remote add origin #{@upstream}` `git remote add origin #{@upstream}`
`git remote -v` `git remote -v`
`git fetch -q` `git fetch -q`
`git branch --set-upstream master origin/master` `git branch --set-upstream-to=origin/master master`
end end
# prepare the spec # prepare the spec
......
...@@ -2,7 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__) ...@@ -2,7 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Command::Repo do describe Command::Repo do
describe "In general" do describe Command::Repo::Update do
extend SpecHelper::Command extend SpecHelper::Command
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -18,15 +18,44 @@ module Pod ...@@ -18,15 +18,44 @@ module Pod
`git remote add origin #{upstream}` `git remote add origin #{upstream}`
`git remote -v` `git remote -v`
`git fetch -q` `git fetch -q`
`git branch --set-upstream master origin/master` `git branch --set-upstream-to=origin/master master`
end end
lambda { command('repo', 'update').run }.should.not.raise lambda { command('repo', 'update').run }.should.not.raise
end end
it "updates a spec-repo" do
repo1 = repo_make('repo1')
repo2 = repo_clone('repo1', 'repo2')
repo_make_readme_change(repo1, 'Updated')
Dir.chdir(repo1) {`git commit -a -m "Update"`}
run_command('repo', 'update', 'repo2')
(repo2 + 'README').read.should.include 'Updated'
end
end
describe Command::Repo::Lint do
extend SpecHelper::Command
extend SpecHelper::TemporaryRepos
before do
set_up_test_repo
config.repos_dir = SpecHelper.tmp_repos_path
end
it "lints a repository" do it "lints a repository" do
repo = fixture('spec-repos/test_repo').to_s repo = fixture('spec-repos/test_repo').to_s
lambda { run_command('repo', 'lint', repo) }.should.not.raise lambda { run_command('repo', 'lint', repo) }.should.not.raise
end end
end
describe Command::Repo::Add do
extend SpecHelper::Command
extend SpecHelper::TemporaryRepos
before do
set_up_test_repo
config.repos_dir = SpecHelper.tmp_repos_path
end
it "adds a spec-repo" do it "adds a spec-repo" do
run_command('repo', 'add', 'private', test_repo_path) run_command('repo', 'add', 'private', test_repo_path)
...@@ -46,13 +75,41 @@ module Pod ...@@ -46,13 +75,41 @@ module Pod
Dir.chdir(repo2.dir) { `git symbolic-ref HEAD` }.should.include? 'my-branch' Dir.chdir(repo2.dir) { `git symbolic-ref HEAD` }.should.include? 'my-branch'
end end
it "updates a spec-repo" do it "adds a spec-repo by creating a shallow clone" do
repo1 = repo_make('repo1') Dir.chdir(test_repo_path) do
repo2 = repo_clone('repo1', 'repo2') `echo 'touch' > touch && git add touch && git commit -m 'updated'`
repo_make_readme_change(repo1, 'Updated') end
Dir.chdir(repo1) {`git commit -a -m "Update"`} # Need to use file:// to test local use of --depth=1
run_command('repo', 'update', 'repo2') run_command('repo', 'add', 'private', '--shallow', "file://#{test_repo_path}")
(repo2 + 'README').read.should.include 'Updated' Dir.chdir(config.repos_dir + 'private') do
`git log --pretty=oneline`.strip.split("\n").size.should == 1
end
end
end
describe Command::Repo::Remove do
extend SpecHelper::Command
extend SpecHelper::TemporaryRepos
before do
set_up_test_repo
config.repos_dir = SpecHelper.tmp_repos_path
end
it "complains when a repository name is missing" do
lambda { run_command('repo', 'remove') }.should.raise CLAide::Help
end
it "complains if the repository doesn't exist" do
lambda { run_command('repo', 'remove', 'nonexistant') }.should.raise CLAide::Help
end
it "complains if we do not have permission" do
File.stubs(:writable?).returns(false)
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
lambda { run_command('repo', 'remove', upstream) }.should.raise CLAide::Help
FileUtils.rm_rf(upstream)
end end
it "removes a spec-repo" do it "removes a spec-repo" do
......
...@@ -18,7 +18,6 @@ module Pod ...@@ -18,7 +18,6 @@ module Pod
it "complains for wrong parameters" do it "complains for wrong parameters" do
lambda { run_command('search') }.should.raise CLAide::Help lambda { run_command('search') }.should.raise CLAide::Help
lambda { run_command('search', 'too', 'many') }.should.raise CLAide::Help
lambda { run_command('search', 'too', '--wrong') }.should.raise CLAide::Help lambda { run_command('search', 'too', '--wrong') }.should.raise CLAide::Help
lambda { run_command('search', '--wrong') }.should.raise CLAide::Help lambda { run_command('search', '--wrong') }.should.raise CLAide::Help
end end
...@@ -45,5 +44,54 @@ module Pod ...@@ -45,5 +44,54 @@ module Pod
output = run_command('search', 'BananaLib', '--osx') output = run_command('search', 'BananaLib', '--osx')
output.should.not.include? 'BananaLib' output.should.not.include? 'BananaLib'
end end
it "outputs with the silent parameter" do
output = run_command('search', 'BananaLib', '--silent')
output.should.include? 'BananaLib'
end
it "shows a friendly message when locally searching with invalid regex" do
lambda { run_command('search', '+') }.should.raise CLAide::Help
end
describe "option --web" do
extend SpecHelper::TemporaryRepos
it "searches with invalid regex" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "should url encode search queries" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString%2BCCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "searches the web via the open! command" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=bananalib')
run_command('search', '--web', 'bananalib')
end
it "includes option --osx correctly" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20bananalib')
run_command('search', '--web', '--osx', 'bananalib')
end
it "includes option --ios correctly" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aios%20bananalib')
run_command('search', '--web', '--ios', 'bananalib')
end
it "does not matter in which order the ios/osx options are set" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20on%3Aios%20bananalib')
run_command('search', '--web', '--ios', '--osx', 'bananalib')
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=on%3Aosx%20on%3Aios%20bananalib')
run_command('search', '--web', '--osx', '--ios', 'bananalib')
end
end
end end
end end
...@@ -39,6 +39,40 @@ module Pod ...@@ -39,6 +39,40 @@ module Pod
url.should == test_repo_path.to_s url.should == test_repo_path.to_s
end end
it "creates a shallow clone of the `master` repo by default" do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
# Need to use file:// to test local use of --depth=1
Command::Setup.any_instance.stubs(:read_only_url).returns("file://#{test_repo_path}")
run_command('setup')
Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should == 1
end
end
it "creates a full clone of the `master` repo if requested" do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
run_command('setup', '--no-shallow')
Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should > 1
end
end
it "creates a full clone of the `master` repo when push access is requested" do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
# Need to use file:// to test local use of --depth=1
Command::Setup.any_instance.stubs(:read_write_url).returns("file://#{test_repo_path}")
cmd = run_command('setup', '--push')
Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should > 1
end
end
it "preserves push access for the `master` repo" do it "preserves push access for the `master` repo" do
output = run_command('setup') output = run_command('setup')
output.should.not.include "push" output.should.not.include "push"
......
...@@ -205,26 +205,72 @@ module Pod ...@@ -205,26 +205,72 @@ module Pod
describe Command::Spec::Cat do describe Command::Spec::Cat do
it_should_check_for_existence("cat") it_should_check_for_existence("cat")
it_should_check_for_ambiguity("cat") it_should_check_for_ambiguity("cat")
it "cats the given podspec" do
lambda { command('spec', 'cat', 'AFNetworking').run }.should.not.raise
UI.output.should.include fixture('spec-repos/master/AFNetworking/1.2.0/AFNetworking.podspec').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/AFNetworking/1.2.0/AFNetworking.podspec').read
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe Command::Spec::Edit do describe Command::Spec::Edit do
before do
@path_saved = ENV['PATH']
end
after do
ENV['PATH'] = @path_saved
end
it_should_check_for_existence("edit") it_should_check_for_existence("edit")
it_should_check_for_ambiguity("edit") it_should_check_for_ambiguity("edit")
it "would execute the editor specified in ENV with the given podspec" do
ENV['EDITOR'] = 'podspeceditor'
lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise SystemExit
UI.output.should.include '/bin/sh -i -c podspeceditor "$@" --'
UI.output.should.include 'fixtures/spec-repos/master/AFNetworking'
end
it "will raise if no editor is found" do
ENV['PATH'] = ''
ENV['EDITOR'] = nil
lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise Informative
end
it "would execute an editor with the first podspec from all podspecs" do
ENV['EDITOR'] = 'podspeceditor'
UI.next_input = "1\n"
lambda { command('spec', 'edit', '--show-all', 'AFNetworking').run }.should.raise SystemExit
UI.output.should.include '/bin/sh -i -c podspeceditor "$@" --'
UI.output.should.include 'fixtures/spec-repos/master/AFNetworking/1.2.0/AFNetworking.podspec'
end
it "complains if it can't find a spec file for the given spec" do
File.stubs(:exists?).returns(false)
lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise Informative
File.unstub(:exists?)
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "Private helpers" do describe "Private helpers" do
describe "#get_path_of_spec" do before do
# TODO Use class methods
@sut = Command::Spec.new(CLAide::ARGV.new([]))
before do end
# TODO Use class methods
@sut = Command::Spec.new(CLAide::ARGV.new([]))
end describe "#get_path_of_spec" do
it "returns the path of the specification with the given name" do it "returns the path of the specification with the given name" do
path = @sut.send(:get_path_of_spec, 'AFNetworking') path = @sut.send(:get_path_of_spec, 'AFNetworking')
...@@ -233,6 +279,24 @@ module Pod ...@@ -233,6 +279,24 @@ module Pod
end end
describe "#choose_from_array" do
it "should return a valid index for the given array" do
UI.next_input = "1\n"
index = @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message')
UI.output.should.include "1: item1\n2: item2\n3: item3\nA message\n"
index.should == 0
end
it "should raise when the index is out of bounds" do
UI.next_input = "4\n"
lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative
UI.next_input = "0\n"
lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative
end
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command do
extend SpecHelper::Command
it "displays the current version number with the --version flag" do
lambda { Pod::Command.run(['--version']) }.should.raise SystemExit
UI.output.should.include VERSION
end
it "reports the location of the AFNetworking spec" do
lambda { Pod::Command.run(['spec', 'which', 'AFNetworking']) }.should.not.raise
UI.output.should.include 'spec/fixtures/spec-repos/master/AFNetworking'
end
end
end
...@@ -89,7 +89,7 @@ end ...@@ -89,7 +89,7 @@ end
# environment. # environment.
# #
def launch_binary(arguments, folder) def launch_binary(arguments, folder)
command = "CP_AGGRESSIVE_CACHE=TRUE #{POD_BINARY} #{arguments} --verbose --no-color 2>&1" command = "CP_AGGRESSIVE_CACHE=TRUE #{POD_BINARY} #{arguments} --verbose --no-ansi 2>&1"
Dir.chdir(TMP_DIR + folder) do Dir.chdir(TMP_DIR + folder) do
output = `#{command}` output = `#{command}`
it "$ pod #{arguments}" do it "$ pod #{arguments}" do
...@@ -186,8 +186,8 @@ end ...@@ -186,8 +186,8 @@ end
# The file in the temporary directory after running the pod command. # The file in the temporary directory after running the pod command.
# #
def yaml_should_match(expected, produced) def yaml_should_match(expected, produced)
expected_yaml = YAML::load(File.open(expected)) expected_yaml = File.open(expected) { |f| YAML.load(f) }
produced_yaml = YAML::load(File.open(produced)) produced_yaml = File.open(produced) { |f| YAML.load(f) }
# Remove CocoaPods version # Remove CocoaPods version
expected_yaml.delete('COCOAPODS') expected_yaml.delete('COCOAPODS')
produced_yaml.delete('COCOAPODS') produced_yaml.delete('COCOAPODS')
......
# Set up coverage analysis # Set up coverage analysis
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("1.9")
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("1.9") # if ENV['CI'] || ENV['GENERATE_COVERAGE']
if ENV['CI'] || ENV['GENERATE_COVERAGE'] # require 'simplecov'
require 'simplecov' # require 'coveralls'
require 'coveralls' #
# if ENV['CI']
if ENV['CI'] # SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.formatter = Coveralls::SimpleCov::Formatter # elsif ENV['GENERATE_COVERAGE']
elsif ENV['GENERATE_COVERAGE'] # SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter # end
end # SimpleCov.start do
SimpleCov.start do # add_filter "/spec_helper/"
add_filter "/spec_helper/" # end
end # end
end # end
end
# Set up # Set up
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
...@@ -35,7 +34,7 @@ $:.unshift((ROOT + 'spec').to_s) ...@@ -35,7 +34,7 @@ $:.unshift((ROOT + 'spec').to_s)
require 'cocoapods' require 'cocoapods'
require 'claide' require 'claide'
require 'awesome_print' #require 'awesome_print'
require 'spec_helper/command' # Allows to run Pod commands and returns their output. require 'spec_helper/command' # Allows to run Pod commands and returns their output.
require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed. require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed.
...@@ -68,6 +67,24 @@ module Pod ...@@ -68,6 +67,24 @@ module Pod
end end
end end
# README!
#
# Adds {Command::Spec::Edit#exec} to fake the {Kernel#exec} call that would
# normally be made during an edit.
#
module Pod
class Command
class Spec
class Edit
def exec(cmd, *args)
UI.puts "#{cmd} #{args.join(' ')}"
raise SystemExit
end
end
end
end
end
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
ENV['SKIP_SETUP'] = 'true' ENV['SKIP_SETUP'] = 'true'
......
...@@ -5,7 +5,7 @@ module SpecHelper ...@@ -5,7 +5,7 @@ module SpecHelper
end end
def command(*argv) def command(*argv)
argv << '--no-color' argv << '--no-ansi'
Pod::Command.parse(argv) Pod::Command.parse(argv)
end end
......
...@@ -9,10 +9,12 @@ module Pod ...@@ -9,10 +9,12 @@ module Pod
module UI module UI
@output = '' @output = ''
@warnings = '' @warnings = ''
@next_input = ''
class << self class << self
attr_accessor :output attr_accessor :output
attr_accessor :warnings attr_accessor :warnings
attr_accessor :next_input
def puts(message = '') def puts(message = '')
@output << "#{message}\n" @output << "#{message}\n"
...@@ -25,6 +27,13 @@ module Pod ...@@ -25,6 +27,13 @@ module Pod
def print(message) def print(message)
@output << message @output << message
end end
def gets
@next_input
end
def print_warnings
end
end end
end end
end end
...@@ -148,6 +148,31 @@ module Pod ...@@ -148,6 +148,31 @@ module Pod
#---------------------------------------------------------------------------# #---------------------------------------------------------------------------#
describe ExternalSources::BazaarSource do
before do
dependency = Dependency.new("BazaarSource", :bzr => fixture('bzr-repo'))
@external_source = ExternalSources.from_dependency(dependency, nil)
end
it "creates a copy of the podspec" do
@external_source.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/BazaarSource.podspec'
path.should.exist?
end
it "marks a LocalPod as downloaded" do
@external_source.fetch(config.sandbox)
config.sandbox.predownloaded_pods.should == ["BazaarSource"]
end
it "returns the description" do
@external_source.description.should.match %r|from `.*/bzr-repo`|
end
end
#---------------------------------------------------------------------------#
describe ExternalSources::PodspecSource do describe ExternalSources::PodspecSource do
before do before do
...@@ -270,7 +295,7 @@ module Pod ...@@ -270,7 +295,7 @@ module Pod
it "raises if the podspec cannot be found" do it "raises if the podspec cannot be found" do
@external_source.stubs(:params).returns(:path => temporary_directory) @external_source.stubs(:params).returns(:path => temporary_directory)
e = lambda { @external_source.send(:podspec_path) }.should.raise Informative e = lambda { @external_source.send(:podspec_path) }.should.raise Informative
e.message.should.match /No podspec found/ e.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/
end end
end end
end end
......
require File.expand_path("../../../../spec_helper", __FILE__) require File.expand_path("../../../../spec_helper", __FILE__)
require 'xcodeproj'
describe Pod::Generator::Plist do describe Pod::Generator::Plist do
before do before do
@file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec') @file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
......
...@@ -331,6 +331,68 @@ module Pod ...@@ -331,6 +331,68 @@ module Pod
#--------------------------------------# #--------------------------------------#
describe "#compute_archs_for_target_definition" do
it "handles a single ARCH defined in a single user target" do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
target.build_configuration_list.set_setting('ARCHS', 'armv7')
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = [target]
archs = @analyzer.send(:compute_archs_for_target_definition, target_definition, user_targets)
archs.should == 'armv7'
end
it "handles a single ARCH defined in multiple user targets" do
user_project = Xcodeproj::Project.new('path')
targeta = user_project.new_target(:application, 'Target', :ios)
targeta.build_configuration_list.set_setting('ARCHS', 'armv7')
targetb = user_project.new_target(:application, 'Target', :ios)
targetb.build_configuration_list.set_setting('ARCHS', 'armv7')
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = [targeta, targetb]
archs = @analyzer.send(:compute_archs_for_target_definition, target_definition, user_targets)
archs.should == 'armv7'
end
it "handles an Array of ARCHs defined in a single user target" do
user_project = Xcodeproj::Project.new('path')
target = user_project.new_target(:application, 'Target', :ios)
target.build_configuration_list.set_setting('ARCHS', 'armv7')
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = [target]
archs = @analyzer.send(:compute_archs_for_target_definition, target_definition, user_targets)
archs.should == 'armv7'
end
it "handles an Array of ARCHs defined multiple user targets" do
user_project = Xcodeproj::Project.new('path')
targeta = user_project.new_target(:application, 'Target', :ios)
targeta.build_configuration_list.set_setting('ARCHS', 'armv7')
targetb = user_project.new_target(:application, 'Target', :ios)
targetb.build_configuration_list.set_setting('ARCHS', ['armv7', 'i386'])
target_definition = Podfile::TargetDefinition.new(:default, nil)
target_definition.set_platform(:ios, '4.0')
user_targets = [targeta, targetb]
archs = @analyzer.send(:compute_archs_for_target_definition, target_definition, user_targets)
archs.should == 'armv7'
end
end
#--------------------------------------#
describe "#compute_platform_for_target_definition" do describe "#compute_platform_for_target_definition" do
it "returns the platform specified in the target definition" do it "returns the platform specified in the target definition" do
......
...@@ -50,7 +50,7 @@ module Pod ...@@ -50,7 +50,7 @@ module Pod
@project.targets.first.name.should == 'Pods-BananaLib' @project.targets.first.name.should == 'Pods-BananaLib'
end end
it "sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets" do it "sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets" do
@installer.install! @installer.install!
target = @project.targets.first target = @project.targets.first
target.build_settings('Release')["VALIDATE_PRODUCT"].should == "YES" target.build_settings('Release')["VALIDATE_PRODUCT"].should == "YES"
...@@ -147,91 +147,91 @@ module Pod ...@@ -147,91 +147,91 @@ module Pod
dummy = config.sandbox.root + 'Pods-BananaLib-dummy.m' dummy = config.sandbox.root + 'Pods-BananaLib-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods') dummy.read.should.include?('@interface PodsDummy_Pods')
end end
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
describe "concerning compiler flags" do describe "concerning compiler flags" do
before do before do
@spec = Pod::Spec.new @spec = Pod::Spec.new
end end
it "flags should not be added to dtrace files" do it "flags should not be added to dtrace files" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true) @installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.install! @installer.install!
dtrace_files = @installer.library.target.source_build_phase.files.reject {|sf| dtrace_files = @installer.library.target.source_build_phase.files.reject {|sf|
!(File.extname(sf.file_ref.path) == '.d') !(File.extname(sf.file_ref.path) == '.d')
} }
dtrace_files.each do |dt| dtrace_files.each do |dt|
dt.settings.should.be.nil dt.settings.should.be.nil
end end
end end
it "adds -w per pod if target definition inhibits warnings for that pod" do 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.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-w') flags.should.include?('-w')
end end
it "doesn't inhibit warnings by default" do it "doesn't inhibit warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-w') flags.should.not.include?('-w')
end end
it "adds -Xanalyzer -analyzer-disable-checker per pod" do it "adds -Xanalyzer -analyzer-disable-checker per pod" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true) @installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-Xanalyzer -analyzer-disable-checker') flags.should.include?('-Xanalyzer -analyzer-disable-checker')
end end
it "doesn't inhibit analyzer warnings by default" do it "doesn't inhibit analyzer warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-Xanalyzer -analyzer-disable-checker') flags.should.not.include?('-Xanalyzer -analyzer-disable-checker')
end end
describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do
it "does not do anything if ARC is *not* required" do it "does not do anything if ARC is *not* required" do
@spec.requires_arc = false @spec.requires_arc = false
@spec.ios.deployment_target = '5' @spec.ios.deployment_target = '5'
@spec.osx.deployment_target = '10.6' @spec.osx.deployment_target = '10.6'
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC' ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC' osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end end
it "does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8" do it "does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8" do
@spec.requires_arc = false @spec.requires_arc = false
@spec.ios.deployment_target = '6' @spec.ios.deployment_target = '6'
@spec.osx.deployment_target = '10.8' @spec.osx.deployment_target = '10.8'
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC' ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC' osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end end
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8" do it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8" do
@spec.requires_arc = true @spec.requires_arc = true
@spec.ios.deployment_target = '5.1' @spec.ios.deployment_target = '5.1'
@spec.osx.deployment_target = '10.7.2' @spec.osx.deployment_target = '10.7.2'
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.include '-DOS_OBJECT_USE_OBJC' ios_flags.should.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.include '-DOS_OBJECT_USE_OBJC' osx_flags.should.include '-DOS_OBJECT_USE_OBJC'
end end
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified" do it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified" do
@spec.requires_arc = true @spec.requires_arc = true
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.include '-DOS_OBJECT_USE_OBJC' ios_flags.should.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.include '-DOS_OBJECT_USE_OBJC' osx_flags.should.include '-DOS_OBJECT_USE_OBJC'
end end
end end
end end
end end
end end
end end
...@@ -89,6 +89,12 @@ module Pod ...@@ -89,6 +89,12 @@ module Pod
it "returns the directory where to store the documentation" do it "returns the directory where to store the documentation" do
@sandbox.documentation_dir.should == temporary_directory + 'Sandbox/Documentation' @sandbox.documentation_dir.should == temporary_directory + 'Sandbox/Documentation'
end end
it "handles symlinks in /tmp" do
tmp_sandbox = Pod::Sandbox.new("/tmp/CocoaPods")
tmp_sandbox.root.should.be == Pathname.new("/private/tmp/CocoaPods")
tmp_sandbox.implode
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -49,6 +49,13 @@ module Pod ...@@ -49,6 +49,13 @@ module Pod
sets.all?{ |s| s.class == Specification::Set}.should.be.true sets.all?{ |s| s.class == Specification::Set}.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true sets.any?{ |s| s.name == 'BananaLib'}.should.be.true
end end
it "can perform a full text regexp search of the sets" do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Ch[aeiou]nky', true)
sets.all?{ |s| s.class == Specification::Set}.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true
end
it "generates the search index before performing a search if it doesn't exits" do it "generates the search index before performing a search if it doesn't exits" do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
...@@ -87,7 +94,7 @@ module Pod ...@@ -87,7 +94,7 @@ module Pod
`git remote add origin #{upstream}` `git remote add origin #{upstream}`
`git remote -v` `git remote -v`
`git fetch -q` `git fetch -q`
`git branch --set-upstream master origin/master` `git branch --set-upstream-to=origin/master master`
end end
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
......
...@@ -69,6 +69,13 @@ module Pod ...@@ -69,6 +69,13 @@ module Pod
sut.results.map(&:to_s).first.should.match /summary.*meaningful/ sut.results.map(&:to_s).first.should.match /summary.*meaningful/
sut.validated?.should.be.true sut.validated?.should.be.true
end end
it "handles symlinks" do
file = write_podspec(stub_podspec)
validator = Validator.new(file)
validator.validate
validator.validation_dir.should.be == Pathname.new("/private/tmp/CocoaPods/Lint")
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -136,7 +143,6 @@ module Pod ...@@ -136,7 +143,6 @@ module Pod
sut.validated?.should.be.true sut.validated?.should.be.true
end end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment