Commit cfc48b7e authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into gf-fix-pod-push

* master: (88 commits)
  [Gemspec] Switch back to cocoapods-try in favour of the release fix
  [Gemfile] Add version requirements to rake for Ruby 1.8.7
  [Integration] Update tests
  [Gemspec] Bump Xcodeproj version
  [Gemspec] Bump CLAide version
  [Gemspec] Bump cocoapods-downloader version
  Join the two description paragraphs of
  Required parameters should not contain square braces
  Add different wording for `lib create` command description
  Name is not optional -> no square braces
  Add Changelog note for `pod lib create` template URL
  Add note for `pod lib create` and optional template URL
  Add possibility to specify a template URL
  Convert indention into spaces instead of tabs
  Ensure file descriptors are closed
  [Search] Web search should escape queries
  [Search] Don't validate for valid regex on web searchs
  pod_target_installer: Remove 6-month-old comment.
  validator.rb: Conform to 2-space indentation.
  validator.rb: Print xcodebuild command on -v.
  ...

Conflicts:
	CHANGELOG.md
parents e1ff91d0 ad13bd66
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 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=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=2.0.0-p247 NOEXEC_DISABLE=1 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 - 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 - 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' # - sh -c 'if [ "$RVM_RUBY_VERSION" != "system" ]; then rvm install $RVM_RUBY_VERSION --without-tcl --without-tk; fi'
......
...@@ -3,6 +3,56 @@ ...@@ -3,6 +3,56 @@
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/jverkoey/CocoaPods/compare/0.29.0...master)
###### 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
* `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
...@@ -28,7 +78,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -28,7 +78,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
* The `pod search <query>` command now supports regular expressions * The `pod search <query>` command now supports regular expressions
for the query parameter when searching using the option `--full`. for the query parameter when searching using the option `--full`.
[Florian Hanke](https://github.com/floere) [Florian Hanke](https://github.com/floere)
[#1643][https://github.com/CocoaPods/CocoaPods/pull/1643] [#1643](https://github.com/CocoaPods/CocoaPods/pull/1643)
* Pod lib lint now accepts multiple podspecs in the same folder. * Pod lib lint now accepts multiple podspecs in the same folder.
[kra Larivain/OpenTable](https://github.com/opentable) [kra Larivain/OpenTable](https://github.com/opentable)
...@@ -39,12 +89,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -39,12 +89,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
test doesn't affect the normal workflow. test doesn't affect the normal workflow.
[Fabio Pelosin](https://github.com/irrationalfab) [Fabio Pelosin](https://github.com/irrationalfab)
###### Refactor * 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 command `podfile_info` is now a plugin offered by CocoaPods. * The `pod search <query>` command now supports multiword queries when using
As a result, the command has been removed from CocoaPods. the `--web` option.
[Joshua Kalpin](https://github.com/Kapin) [Florian Hanke](https://github.com/floere)
[#1589](https://github.com/CocoaPods/CocoaPods/issues/1589) [#1643](https://github.com/CocoaPods/CocoaPods/pull/1682)
###### Bug Fixes ###### Bug Fixes
...@@ -100,11 +154,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -100,11 +154,11 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[kra Larivain/OpenTable](https://github.com/opentable) [kra Larivain/OpenTable](https://github.com/opentable)
[#1514](https://github.com/CocoaPods/CocoaPods/pull/1514) [#1514](https://github.com/CocoaPods/CocoaPods/pull/1514)
* `pod push` now properly checks that the repo has changed before attempting * Fixed an incorrect path being used in the example app Podfile generated by
to commit. This only affected pods with special characters (such as `+`) in `pod lib create`.
their names. [Eloy Durán](https://github.com/alloy)
[Gordon Fontenot](https://github.com/gfontenot) [cocoapods-try#5](https://github.com/CocoaPods/cocoapods-try/issues/5)
[#1739](https://github.com/CocoaPods/CocoaPods/pull/1739)
## 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).
...@@ -38,6 +39,12 @@ which doesn't require any ruby knowledge. ...@@ -38,6 +39,12 @@ 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
......
...@@ -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: e1edf213a96e72263d18547bfc4f0fa47f81189c
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: 3f71c7e99a4e7919053ff00787974638fd1fdc16 revision: d281be39c464418c0b0ee8ba4788c4d2ce074de6
branch: master branch: master
specs: specs:
cocoapods-core (0.28.0) cocoapods-core (0.29.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: 985c0c973f27267824500ef5ab1ec399231349f1
branch: master branch: master
specs: specs:
xcodeproj (0.14.1) xcodeproj (0.15.0)
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: 9ae16ffd41f9c056fa3d47c40bdc04aa28d2897c
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: 748f146c173db3cfcdc3f0d15290f9c1fa791130
branch: master
specs:
cocoapods-try (0.1.2)
GIT
remote: https://github.com/alloy/cocoapods-trunk.git
revision: 20b9a8bb60ad6e59df4df7d4a960a4dd4a41afa0
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.29.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.29.0)
cocoapods-downloader (~> 0.2.0) cocoapods-downloader (~> 0.4.0)
cocoapods-try (~> 0.1.0) cocoapods-try (~> 0.1.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) 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)
bacon (1.2.0) bacon (1.2.0)
cocoapods-try (0.1.0)
coderay (1.1.0) coderay (1.1.0)
colored (1.2) colored (1.2)
coveralls (0.7.0) coveralls (0.7.0)
...@@ -83,58 +104,57 @@ GEM ...@@ -83,58 +104,57 @@ GEM
term-ansicolor term-ansicolor
thor thor
diffy (3.0.1) diffy (3.0.1)
docile (1.1.0) docile (1.1.2)
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.0.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.2)
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.0)
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.4.7)
term-ansicolor (1.2.2) term-ansicolor (1.2.2)
tins (~> 0.8) tins (~> 0.8)
thor (0.18.1) thor (0.18.1)
tins (0.13.1) tins (0.13.2)
yajl-ruby (1.1.0) yajl-ruby (1.1.0)
yard (0.8.7.3) yard (0.8.7.3)
...@@ -148,6 +168,8 @@ DEPENDENCIES ...@@ -148,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
...@@ -158,10 +180,10 @@ DEPENDENCIES ...@@ -158,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
# 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)
...@@ -366,10 +366,18 @@ task :bootstrap, :use_bundle_dir? do |t, args| ...@@ -366,10 +366,18 @@ task :bootstrap, :use_bundle_dir? do |t, args|
puts "Installing gems" puts "Installing gems"
if args[:use_bundle_dir?] if args[:use_bundle_dir?]
sh "ruby --version" execute_command "env XCODEPROJ_BUILD=1 bundle install --path ./travis_bundle_dir"
sh "XCODEPROJ_BUILD=1 bundle install --path ./travis_bundle_dir"
else else
execute_command "bundle install" execute_command "env XCODEPROJ_BUILD=1 bundle install"
end
puts "Checking for hg and bzr..."
if `which hg`.strip.empty?
puts "Please install Mercurial: `brew install hg`"
end
if `which bzr`.strip.empty?
puts "Please install Bazaar: `brew install bzr`"
end end
end end
......
...@@ -28,9 +28,9 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA ...@@ -28,9 +28,9 @@ 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.1.0' s.add_runtime_dependency 'cocoapods-try', '~> 0.1.0'
s.add_runtime_dependency 'colored', '~> 1.2' s.add_runtime_dependency 'colored', '~> 1.2'
......
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'
......
...@@ -45,8 +45,8 @@ module Pod ...@@ -45,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
...@@ -80,7 +80,7 @@ module Pod ...@@ -80,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
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
......
...@@ -63,11 +63,11 @@ module Pod ...@@ -63,11 +63,11 @@ module Pod
def test_trunk def test_trunk
return unless @repo == "master" return unless @repo == "master"
require 'rest' require 'rest'
tokens = ["48c432065a97f5281c2b60c5987ec9fc", "07d9732784771e33ffccb5dd280a6cb9"]
base_url = 'https://trunk.cocoapods.org/api/v1' base_url = 'https://trunk.cocoapods.org/api/v1'
podspec_files.each do |spec_file| podspec_files.each do |spec_file|
spec = Pod::Specification.from_file(spec_file) spec = Pod::Specification.from_file(spec_file)
REST.post("#{base_url}/pods", spec.to_yaml, 'Content-Type' => 'text/yaml', 'Authorization' => "Token #{tokens.sample}") REST.post("#{base_url}/pods", spec.to_json, 'Content-Type' => 'application/json; charset=utf-8',
'Authorization' => "Token 9300632274827cd3e6dde24bf9c608c3")
end end
rescue Exception rescue Exception
# Nothing # Nothing
......
...@@ -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,14 +9,15 @@ module Pod ...@@ -9,14 +9,15 @@ 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"],
["--web", "Searches on cocoapods.org"]
].concat(super.reject { |option, _| option == '--silent' }) ].concat(super.reject { |option, _| option == '--silent' })
end end
...@@ -25,7 +26,8 @@ module Pod ...@@ -25,7 +26,8 @@ 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 config.silent = false
super super
end end
...@@ -33,10 +35,40 @@ module Pod ...@@ -33,10 +35,40 @@ module Pod
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
...@@ -57,6 +89,7 @@ module Pod ...@@ -57,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.
......
...@@ -207,7 +207,7 @@ module Pod ...@@ -207,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
...@@ -302,7 +302,7 @@ module Pod ...@@ -302,7 +302,7 @@ module Pod
UI.puts message UI.puts message
index = $stdin.gets.chomp.to_i - 1 index = UI.gets.chomp.to_i - 1
if index < 0 || index > array.count - 1 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
...@@ -485,21 +485,24 @@ Pod::Spec.new do |s| ...@@ -485,21 +485,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
# profile URL.
#
s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" } s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" }
# s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}", "other author" => "email@address.com" } # Or just: s.author = "#{data[:author_name]}"
# s.author = '#{data[:author_name]}', 'other author' # s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" }
# s.social_media_url = "http://twitter.com/#{data[:author_name]}" # s.social_media_url = "http://twitter.com/#{data[:author_name]}"
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# #
...@@ -508,11 +511,11 @@ Pod::Spec.new do |s| ...@@ -508,11 +511,11 @@ 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 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
...@@ -532,10 +535,10 @@ Pod::Spec.new do |s| ...@@ -532,10 +535,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 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
...@@ -558,11 +561,11 @@ Pod::Spec.new do |s| ...@@ -558,11 +561,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 ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
...@@ -573,8 +576,8 @@ Pod::Spec.new do |s| ...@@ -573,8 +576,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
......
...@@ -378,7 +378,7 @@ module Pod ...@@ -378,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.29.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)
......
...@@ -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
......
...@@ -143,19 +143,19 @@ module Pod ...@@ -143,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
......
...@@ -240,6 +240,12 @@ module Pod ...@@ -240,6 +240,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
......
...@@ -60,8 +60,8 @@ module Pod ...@@ -60,8 +60,8 @@ module Pod
# Replace default spec with a subspec if asked for # Replace default spec with a subspec if asked for
a_spec = spec a_spec = spec
if spec && @only_subspec if spec && @only_subspec
a_spec = spec.subspec_by_name(@only_subspec) a_spec = spec.subspec_by_name(@only_subspec)
@subspec_name = a_spec.name @subspec_name = a_spec.name
end end
UI.print " -> #{a_spec ? a_spec.name : file.basename}\r" unless config.silent? UI.print " -> #{a_spec ? a_spec.name : file.basename}\r" unless config.silent?
...@@ -392,9 +392,10 @@ module Pod ...@@ -392,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 d785a348d3288f6bd221011e6de15848c96c042d Subproject commit 214c69d0c2e7abeba1c3df3d3a8809998a405d32
...@@ -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
...@@ -29,6 +27,72 @@ module Pod ...@@ -29,6 +27,72 @@ module Pod
UI.output.should.include "passed validation" UI.output.should.include "passed validation"
end end
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 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
...@@ -5,6 +5,11 @@ module Pod ...@@ -5,6 +5,11 @@ module Pod
extend SpecHelper::Command extend SpecHelper::Command
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
# Don't test push the spec to the trunk app
def command(*a)
super.tap { |cmd| cmd.stubs(:test_trunk) }
end
before do before do
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
end end
...@@ -49,7 +54,7 @@ module Pod ...@@ -49,7 +54,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
...@@ -50,5 +49,49 @@ module Pod ...@@ -50,5 +49,49 @@ module Pod
output = run_command('search', 'BananaLib', '--silent') output = run_command('search', 'BananaLib', '--silent')
output.should.include? 'BananaLib' output.should.include? 'BananaLib'
end 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"
......
...@@ -212,18 +212,52 @@ module Pod ...@@ -212,18 +212,52 @@ module Pod
end end
it "cats the first podspec from all podspecs" do it "cats the first podspec from all podspecs" do
$stdin = StringIO.new("1\n", 'r') UI.next_input = "1\n"
run_command('spec', 'cat', '--show-all', 'AFNetworking') run_command('spec', 'cat', '--show-all', 'AFNetworking')
UI.output.should.include fixture('spec-repos/master/AFNetworking/1.2.0/AFNetworking.podspec').read UI.output.should.include fixture('spec-repos/master/AFNetworking/1.2.0/AFNetworking.podspec').read
$stdin = STDIN
end 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
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -248,19 +282,17 @@ module Pod ...@@ -248,19 +282,17 @@ module Pod
describe "#choose_from_array" do describe "#choose_from_array" do
it "should return a valid index for the given array" do it "should return a valid index for the given array" do
$stdin = StringIO.new("1\n", 'r') UI.next_input = "1\n"
index = @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') index = @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message')
UI.output.should.include "1: item1\n2: item2\n3: item3\nA message\n" UI.output.should.include "1: item1\n2: item2\n3: item3\nA message\n"
index.should == 0 index.should == 0
$stdin = STDIN
end end
it "should raise when the index is out of bounds" do it "should raise when the index is out of bounds" do
$stdin = StringIO.new("4\n", 'r') UI.next_input = "4\n"
lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative
$stdin = StringIO.new("0\n", 'r') UI.next_input = "0\n"
lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative lambda { @sut.send(:choose_from_array, ['item1', 'item2', 'item3'], 'A message') }.should.raise Pod::Informative
$stdin = STDIN
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
...@@ -295,7 +295,7 @@ module Pod ...@@ -295,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')
......
...@@ -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
...@@ -94,7 +94,7 @@ module Pod ...@@ -94,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
......
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