cocoapods 0.5.1 → 0.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +229 -2
- data/README.md +50 -20
- data/bin/pod +3 -2
- data/lib/cocoapods.rb +23 -9
- data/lib/cocoapods/command.rb +71 -30
- data/lib/cocoapods/command/error_report.rb +102 -0
- data/lib/cocoapods/command/install.rb +27 -19
- data/lib/cocoapods/command/list.rb +51 -8
- data/lib/cocoapods/command/presenter.rb +61 -0
- data/lib/cocoapods/command/presenter/cocoa_pod.rb +123 -0
- data/lib/cocoapods/command/push.rb +102 -0
- data/lib/cocoapods/command/repo.rb +70 -14
- data/lib/cocoapods/command/search.rb +7 -10
- data/lib/cocoapods/command/setup.rb +76 -15
- data/lib/cocoapods/command/spec.rb +581 -97
- data/lib/cocoapods/config.rb +23 -26
- data/lib/cocoapods/dependency.rb +86 -40
- data/lib/cocoapods/downloader.rb +30 -18
- data/lib/cocoapods/downloader/git.rb +125 -15
- data/lib/cocoapods/downloader/http.rb +73 -0
- data/lib/cocoapods/downloader/mercurial.rb +3 -9
- data/lib/cocoapods/downloader/subversion.rb +3 -9
- data/lib/cocoapods/executable.rb +26 -3
- data/lib/cocoapods/generator/acknowledgements.rb +37 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +38 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +63 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +8 -4
- data/lib/cocoapods/generator/documentation.rb +99 -0
- data/lib/cocoapods/generator/dummy_source.rb +14 -0
- data/lib/cocoapods/installer.rb +140 -109
- data/lib/cocoapods/installer/target_installer.rb +78 -83
- data/lib/cocoapods/installer/user_project_integrator.rb +162 -0
- data/lib/cocoapods/local_pod.rb +240 -0
- data/lib/cocoapods/platform.rb +41 -18
- data/lib/cocoapods/podfile.rb +234 -21
- data/lib/cocoapods/project.rb +67 -0
- data/lib/cocoapods/resolver.rb +62 -32
- data/lib/cocoapods/sandbox.rb +63 -0
- data/lib/cocoapods/source.rb +42 -20
- data/lib/cocoapods/specification.rb +294 -271
- data/lib/cocoapods/specification/set.rb +10 -28
- data/lib/cocoapods/specification/statistics.rb +112 -0
- metadata +124 -11
- data/lib/cocoapods/xcodeproj_pods.rb +0 -111
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,227 @@
|
|
1
|
+
## 0.6.0
|
2
|
+
|
3
|
+
A full list of all the changes since 0.5.1 can be found [here][6].
|
4
|
+
|
5
|
+
|
6
|
+
### Link with specific targets
|
7
|
+
|
8
|
+
CocoaPods can now integrate all the targets specified in your `Podfile`.
|
9
|
+
|
10
|
+
To specify which target, in your Xcode project, a Pods target should be linked
|
11
|
+
with, use the `link_with` method like so:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
platform :ios
|
15
|
+
|
16
|
+
workspace 'MyWorkspace'
|
17
|
+
|
18
|
+
link_with ['MyAppTarget', 'MyOtherAppTarget']
|
19
|
+
dependency 'JSONKit'
|
20
|
+
|
21
|
+
target :test, :exclusive => true do
|
22
|
+
xcodeproj 'TestProject', 'Test' => :debug
|
23
|
+
link_with 'TestRunnerTarget'
|
24
|
+
dependency 'Kiwi'
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
_NOTE: As you can see it can take either one target name, or an array of names._
|
29
|
+
|
30
|
+
* If no explicit Xcode workspace is specified and only **one** project exists in
|
31
|
+
the same directory as the Podfile, then the name of that project is used as the
|
32
|
+
workspace’s name.
|
33
|
+
|
34
|
+
* If no explicit Xcode project is specified for a target, it will use the Xcode
|
35
|
+
project of the parent target. If no target specifies an expicit Xcode project
|
36
|
+
and there is only **one** project in the same directory as the Podfile then that
|
37
|
+
project will be used.
|
38
|
+
|
39
|
+
* If no explicit target is specified, then the Pods target will be linked with
|
40
|
+
the first target in your project. So if you only have one target you do not
|
41
|
+
need to specify the target to link with.
|
42
|
+
|
43
|
+
See [#76](https://github.com/CocoaPods/CocoaPods/issues/76) for more info.
|
44
|
+
|
45
|
+
Finally, CocoaPods will add build configurations to the Pods project for all
|
46
|
+
configurations in the other projects in the workspace. By default the
|
47
|
+
configurations are based on the `Release` configuration, to base them on the
|
48
|
+
`Debug` configuration you will have to explicitely specify them as can be seen
|
49
|
+
above in the following line:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
xcodeproj 'TestProject', 'Test' => :debug
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
### Documentation
|
57
|
+
|
58
|
+
CocoaPods will now generate documentation for every library with the
|
59
|
+
[`appledoc`][5] tool and install it into Xcode’s documentation viewer.
|
60
|
+
|
61
|
+
You can customize the settings used like so:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
s.documentation = { :appledoc => ['--product-name', 'My awesome project!'] }
|
65
|
+
```
|
66
|
+
|
67
|
+
Alternatively, you can specify a URL where an HTML version of the documentation
|
68
|
+
can be found:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
s.documentation = { :html => 'http://example.com/docs/index.html' }
|
72
|
+
```
|
73
|
+
|
74
|
+
See [#149](https://github.com/CocoaPods/CocoaPods/issues/149) and
|
75
|
+
[#151](https://github.com/CocoaPods/CocoaPods/issues/151) for more info.
|
76
|
+
|
77
|
+
|
78
|
+
### Licenses & Documentation
|
79
|
+
|
80
|
+
CocoaPods will now generate two 'Acknowledgements' files for each target specified
|
81
|
+
in your Podfile which contain the License details for each Pod used in that target
|
82
|
+
(assuming details have been specified in the Pod spec).
|
83
|
+
|
84
|
+
There is a markdown file, for general consumption, as well as a property list file
|
85
|
+
that can be added to a settings bundle for an iOS application.
|
86
|
+
|
87
|
+
You don't need to do anything for this to happen, it should just work.
|
88
|
+
|
89
|
+
If you're not happy with the default boilerplate text generated for the title, header
|
90
|
+
and footnotes in the files, it's possible to customise these by overriding the methods
|
91
|
+
that generate the text in your `Podfile` like this:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
class ::Pod::Generator::Acknowledgements
|
95
|
+
def header_text
|
96
|
+
"My custom header text"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
101
|
+
You can even go one step further and customise the text on a per target basis by
|
102
|
+
checking against the target name, like this:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
class ::Pod::Generator::Acknowledgements
|
106
|
+
def header_text
|
107
|
+
if @target_definition.label.end_with?("MyTargetName")
|
108
|
+
"Custom header text for MyTargetName"
|
109
|
+
else
|
110
|
+
"Custom header text for other targets"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
Finally, here's a list of the methods that are available to override:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
header_title
|
120
|
+
header_text
|
121
|
+
footnote_title
|
122
|
+
footnote_text
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
### Introduced two new classes: LocalPod and Sandbox.
|
127
|
+
|
128
|
+
The Sandbox represents the entire contents of the `POD_ROOT` (normally
|
129
|
+
`SOURCE_ROOT/Pods`). A LocalPod represents a pod that has been installed within
|
130
|
+
the Sandbox.
|
131
|
+
|
132
|
+
These two classes can be used as better homes for various pieces of logic
|
133
|
+
currently spread throughout the installation process and provide a better API
|
134
|
+
for working with the contents of this directory.
|
135
|
+
|
136
|
+
|
137
|
+
### Xcodeproj API
|
138
|
+
|
139
|
+
All Xcodeproj APIs are now in `snake_case`, instead of `camelCase`. If you are
|
140
|
+
manipulating the project from your Podfile's `post_install` hook, or from a
|
141
|
+
podspec, then update these method calls.
|
142
|
+
|
143
|
+
|
144
|
+
### Enhancements
|
145
|
+
|
146
|
+
* [#188](https://github.com/CocoaPods/CocoaPods/pull/188): `list` command now
|
147
|
+
displays the specifications introduced in the master repo if it is given as an
|
148
|
+
option the number of days to take into account.
|
149
|
+
|
150
|
+
* [#188](https://github.com/CocoaPods/CocoaPods/pull/188): Transferred search
|
151
|
+
layout improvements and options to `list` command.
|
152
|
+
|
153
|
+
* [#166](https://github.com/CocoaPods/CocoaPods/issues/166): Added printing
|
154
|
+
of homepage and source to search results.
|
155
|
+
|
156
|
+
* [#177](https://github.com/CocoaPods/CocoaPods/issues/177): Added `--stat`
|
157
|
+
option to display watchers and forks for pods hosted on GitHub.
|
158
|
+
|
159
|
+
* [#177](https://github.com/CocoaPods/CocoaPods/issues/177): Introduced colors
|
160
|
+
and tuned layout of search.
|
161
|
+
|
162
|
+
* [#112](https://github.com/CocoaPods/CocoaPods/issues/112): Introduced `--push`
|
163
|
+
option to `$ pod setup`. It configures the master spec repository to use the private
|
164
|
+
push URL. The change is preserved in future calls to `$ pod setup`.
|
165
|
+
|
166
|
+
* [#153](https://github.com/CocoaPods/CocoaPods/issues/153): It is no longer
|
167
|
+
required to call `$ pod setup`.
|
168
|
+
|
169
|
+
* [#163](https://github.com/CocoaPods/CocoaPods/issues/163): Print a template
|
170
|
+
for a new ticket when an error occurs.
|
171
|
+
|
172
|
+
* Added a new Github-specific downloader that can download repositories as a
|
173
|
+
gzipped tarball.
|
174
|
+
|
175
|
+
* No more global state is kept during resolving of dependencies.
|
176
|
+
|
177
|
+
* Updated Xcodeproj to have a friendlier API.
|
178
|
+
|
179
|
+
|
180
|
+
### Fixes
|
181
|
+
|
182
|
+
* [#142](https://github.com/CocoaPods/CocoaPods/issues/142): Xcode 4.3.2 no longer
|
183
|
+
supports passing the -fobj-arc flag to the linker and will fail to build. The
|
184
|
+
addition of this flag was a workaround for a compiler bug in previous versions.
|
185
|
+
This flag is no longer included by default - to keep using this flag, you need to
|
186
|
+
add `set_arc_compatibility_flag!` to your Podfile.
|
187
|
+
|
188
|
+
* [#183](https://github.com/CocoaPods/CocoaPods/issues/183): Fix for
|
189
|
+
`.DS_Store` file in `~/.cocoapods` prevents `$ pod install` from running.
|
190
|
+
|
191
|
+
* [#134](https://github.com/CocoaPods/CocoaPods/issues/134): Match
|
192
|
+
`IPHONEOS_DEPLOYMENT_TARGET` build setting with `deployment_target` option in
|
193
|
+
generated Pods project file.
|
194
|
+
|
195
|
+
* [#142](https://github.com/CocoaPods/CocoaPods/issues/): Add `-fobjc-arc` to
|
196
|
+
`OTHER_LD_FLAGS` if _any_ pods require ARC.
|
197
|
+
|
198
|
+
* [#148](https://github.com/CocoaPods/CocoaPods/issues/148): External encoding
|
199
|
+
set to UTF-8 on Ruby 1.9 to fix crash caused by non-ascii characters in pod
|
200
|
+
description.
|
201
|
+
|
202
|
+
* Ensure all header search paths are quoted in the xcconfig file.
|
203
|
+
|
204
|
+
* Added weak quoting to `ibtool` input paths.
|
205
|
+
|
206
|
+
|
207
|
+
---------------------------------------
|
208
|
+
|
209
|
+
## 0.5.0
|
210
|
+
|
211
|
+
No longer requires MacRuby. Runs on MRI 1.8.7 (OS X system version) and 1.9.3.
|
212
|
+
|
213
|
+
A full list of all the changes since 0.3.0 can be found [here][7].
|
214
|
+
|
215
|
+
|
216
|
+
---------------------------------------
|
217
|
+
|
218
|
+
## 0.4.0
|
219
|
+
|
220
|
+
Oops, accidentally skipped this version.
|
221
|
+
|
222
|
+
|
223
|
+
---------------------------------------
|
224
|
+
|
1
225
|
## 0.3.0
|
2
226
|
|
3
227
|
### Multiple targets
|
@@ -78,8 +302,8 @@ _before_ it’s written to disk. [[docs][3]]
|
|
78
302
|
# Enable garbage collection support for MacRuby applications.
|
79
303
|
post_install do |installer|
|
80
304
|
installer.project.targets.each do |target|
|
81
|
-
target.
|
82
|
-
config.
|
305
|
+
target.build_configurations.each do |config|
|
306
|
+
config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
|
83
307
|
end
|
84
308
|
end
|
85
309
|
end
|
@@ -127,3 +351,6 @@ allowing you to automate Xcode related tasks.
|
|
127
351
|
[2]: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/podfile.rb#L82
|
128
352
|
[3]: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/podfile.rb#L185
|
129
353
|
[4]: https://github.com/CocoaPods/Xcodeproj
|
354
|
+
[5]: https://github.com/tomaz/appledoc
|
355
|
+
[6]: https://github.com/CocoaPods/CocoaPods/compare/0.5.1...HEAD
|
356
|
+
[7]: https://github.com/CocoaPods/CocoaPods/compare/0.3.10...0.5.0
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CocoaPods – an Objective-C library manager
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/CocoaPods/CocoaPods.png)](https://secure.travis-ci.org/CocoaPods/CocoaPods)
|
3
|
+
[![Build Status](https://secure.travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](https://secure.travis-ci.org/CocoaPods/CocoaPods)
|
4
4
|
|
5
5
|
CocoaPods manages library dependencies for your Xcode project.
|
6
6
|
|
@@ -12,7 +12,7 @@ You specify the dependencies for your project in one easy text file. CocoaPods r
|
|
12
12
|
|
13
13
|
Ultimately, the goal is to improve discoverability of, and engagement in, third party open-source libraries, by creating a more centralized ecosystem.
|
14
14
|
|
15
|
-
See [the wiki](https://github.com/CocoaPods/CocoaPods/wiki) for more in depth information on several topics.
|
15
|
+
See the [NSScreencast episode about CocoaPods](http://nsscreencast.com/episodes/5-cocoapods) for a quick overview on how to get started, or [the wiki](https://github.com/CocoaPods/CocoaPods/wiki) for more in depth information on several topics.
|
16
16
|
|
17
17
|
|
18
18
|
## Installation
|
@@ -21,50 +21,80 @@ Downloading and installing CocoaPods only takes a few minutes.
|
|
21
21
|
|
22
22
|
CocoaPods runs on [Ruby](http://www.ruby-lang.org/en/). To install it run the following commands:
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
```
|
25
|
+
$ sudo gem install cocoapods
|
26
|
+
$ pod setup
|
27
|
+
```
|
28
|
+
|
29
|
+
If you want to have CocoaPods generate documentation for each library, then install the [appledoc](http://gentlebytes.com/appledoc/) tool:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ brew install appledoc --HEAD
|
33
|
+
$ ln -sf "`brew --prefix`/Cellar/appledoc/HEAD/Templates" ~/Library/Application\ Support/appledoc
|
34
|
+
```
|
26
35
|
|
27
36
|
Now that you've got CocoaPods installed you can easily add it to your project.
|
28
37
|
|
38
|
+
**NOTES**
|
39
|
+
|
40
|
+
1. If you're using a fresh out of the box Mac with Lion using Xcode from the Mac App Store, you will need to install the Command Line Tools for Xcode first: [here](https://developer.apple.com/downloads/index.action)
|
41
|
+
|
42
|
+
2. CocoaPods re-uses some of the RubyGems 1.3.6 classes. If you have an older version (pre OS X 10.7), you will have to update RubyGems: `$ gem update --system`.
|
43
|
+
|
29
44
|
|
30
45
|
## Adding it to your project
|
31
46
|
|
32
47
|
Search for Pods by name or description.
|
33
48
|
|
34
|
-
|
35
|
-
|
36
|
-
|
49
|
+
```
|
50
|
+
$ pod search asi
|
51
|
+
==> ASIHTTPRequest (1.8.1)
|
52
|
+
Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone
|
37
53
|
|
38
|
-
|
39
|
-
|
40
|
-
|
54
|
+
==> ASIWebPageRequest (1.8.1)
|
55
|
+
The ASIWebPageRequest class included with ASIHTTPRequest lets you download
|
56
|
+
complete webpages, including external resources like images and stylesheets.
|
57
|
+
```
|
41
58
|
|
42
59
|
After you've found your favorite dependencies you add them to your [Podfile](https://github.com/CocoaPods/CocoaPods/wiki/A-Podfile).
|
43
60
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
61
|
+
```
|
62
|
+
$ edit Podfile
|
63
|
+
```
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
platform :ios
|
67
|
+
dependency 'JSONKit', '~> 1.4'
|
68
|
+
dependency 'Reachability', '~> 2.0.4'
|
69
|
+
```
|
48
70
|
|
49
71
|
And then you [install the dependencies](https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods) in your project.
|
50
72
|
|
51
|
-
|
73
|
+
```
|
74
|
+
$ pod install App.xcodeproj
|
75
|
+
```
|
52
76
|
|
53
77
|
_Where ‘App.xcodeproj’ is the name of your actual application project._
|
54
78
|
|
55
79
|
The next time you change your Podfile, you can update your project by simply running:
|
56
80
|
|
57
|
-
|
81
|
+
```
|
82
|
+
$ pod install
|
83
|
+
```
|
58
84
|
|
59
85
|
Remember to always open the Xcode workspace instead of the project file when you're building.
|
60
86
|
|
61
|
-
|
87
|
+
```
|
88
|
+
$ open App.xcworkspace
|
89
|
+
```
|
62
90
|
|
63
91
|
Sometimes CocoaPods doesn't have a Pod for one of your dependencies yet. Fortunately [creating a Pod](https://github.com/CocoaPods/CocoaPods/wiki/A-pod-specification) is really easy.
|
64
92
|
|
65
|
-
|
66
|
-
|
67
|
-
|
93
|
+
```
|
94
|
+
$ pod spec create Peanuts
|
95
|
+
$ edit Peanuts.podspec
|
96
|
+
$ pod spec lint Peanuts.podspec
|
97
|
+
```
|
68
98
|
|
69
99
|
Once you've got it running [create a ticket](https://github.com/CocoaPods/CocoaPods/issues) and upload the Pod. If you're familiar with Git you can also fork the [CocoaPods specs](https://github.com/CocoaPods/Specs) repository and send a pull request. We really love contributions!
|
70
100
|
|
data/bin/pod
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
if $0 == __FILE__
|
4
|
-
|
5
|
-
|
4
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
require "rubygems"
|
6
|
+
require "bundler/setup"
|
6
7
|
$:.unshift File.expand_path('../../lib', __FILE__)
|
7
8
|
end
|
8
9
|
|
data/lib/cocoapods.rb
CHANGED
@@ -1,19 +1,30 @@
|
|
1
|
+
Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION > '1.8.7'
|
2
|
+
|
1
3
|
module Pod
|
2
|
-
VERSION = '0.
|
4
|
+
VERSION = '0.6.0.rc1'
|
5
|
+
|
6
|
+
class PlainInformative < StandardError
|
7
|
+
end
|
3
8
|
|
4
|
-
class Informative <
|
9
|
+
class Informative < PlainInformative
|
10
|
+
def message
|
11
|
+
#TODO: remove formatting from raise calls and remove conditional
|
12
|
+
super !~ /\[!\]/ ? "[!] #{super}\n".red : super
|
13
|
+
end
|
5
14
|
end
|
6
15
|
|
7
|
-
autoload :BridgeSupportGenerator, 'cocoapods/bridge_support_generator'
|
8
16
|
autoload :Command, 'cocoapods/command'
|
9
17
|
autoload :Config, 'cocoapods/config'
|
10
18
|
autoload :Dependency, 'cocoapods/dependency'
|
11
19
|
autoload :Downloader, 'cocoapods/downloader'
|
12
20
|
autoload :Executable, 'cocoapods/executable'
|
13
21
|
autoload :Installer, 'cocoapods/installer'
|
22
|
+
autoload :LocalPod, 'cocoapods/local_pod'
|
14
23
|
autoload :Platform, 'cocoapods/platform'
|
15
24
|
autoload :Podfile, 'cocoapods/podfile'
|
25
|
+
autoload :Project, 'cocoapods/project'
|
16
26
|
autoload :Resolver, 'cocoapods/resolver'
|
27
|
+
autoload :Sandbox, 'cocoapods/sandbox'
|
17
28
|
autoload :Source, 'cocoapods/source'
|
18
29
|
autoload :Spec, 'cocoapods/specification'
|
19
30
|
autoload :Specification, 'cocoapods/specification'
|
@@ -25,18 +36,21 @@ module Pod
|
|
25
36
|
module Generator
|
26
37
|
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
|
27
38
|
autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
|
39
|
+
autoload :Documentation, 'cocoapods/generator/documentation'
|
40
|
+
autoload :Acknowledgements, 'cocoapods/generator/acknowledgements'
|
41
|
+
autoload :Plist, 'cocoapods/generator/acknowledgements/plist'
|
42
|
+
autoload :Markdown, 'cocoapods/generator/acknowledgements/markdown'
|
43
|
+
autoload :DummySource, 'cocoapods/generator/dummy_source'
|
28
44
|
end
|
29
45
|
end
|
30
46
|
|
31
|
-
module Xcodeproj
|
32
|
-
autoload :Config, 'xcodeproj/config'
|
33
|
-
autoload :Project, 'cocoapods/xcodeproj_pods'
|
34
|
-
autoload :Workspace, 'xcodeproj/workspace'
|
35
|
-
end
|
36
|
-
|
37
47
|
class Pathname
|
38
48
|
def glob(pattern = '')
|
39
49
|
Dir.glob((self + pattern).to_s).map { |f| Pathname.new(f) }
|
40
50
|
end
|
41
51
|
end
|
42
52
|
|
53
|
+
if ENV['COCOA_PODS_ENV'] == 'development'
|
54
|
+
require 'pry'
|
55
|
+
require 'awesome_print'
|
56
|
+
end
|
data/lib/cocoapods/command.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
require 'colored'
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
class Command
|
3
|
-
autoload :
|
4
|
-
autoload :
|
5
|
-
autoload :
|
6
|
-
autoload :
|
7
|
-
autoload :
|
8
|
-
autoload :
|
5
|
+
autoload :ErrorReport, 'cocoapods/command/error_report'
|
6
|
+
autoload :Install, 'cocoapods/command/install'
|
7
|
+
autoload :List, 'cocoapods/command/list'
|
8
|
+
autoload :Presenter, 'cocoapods/command/presenter'
|
9
|
+
autoload :Push, 'cocoapods/command/push'
|
10
|
+
autoload :Repo, 'cocoapods/command/repo'
|
11
|
+
autoload :Search, 'cocoapods/command/search'
|
12
|
+
autoload :Setup, 'cocoapods/command/setup'
|
13
|
+
autoload :Spec, 'cocoapods/command/spec'
|
9
14
|
|
10
15
|
class Help < Informative
|
11
16
|
def initialize(command_class, argv)
|
@@ -14,14 +19,24 @@ module Pod
|
|
14
19
|
|
15
20
|
def message
|
16
21
|
[
|
17
|
-
@command_class.banner,
|
18
22
|
'',
|
19
|
-
'
|
20
|
-
'
|
23
|
+
@command_class.banner.gsub(/\$ pod (.*)/, '$ pod \1'.green),
|
24
|
+
'',
|
25
|
+
'Options:',
|
21
26
|
'',
|
22
|
-
|
27
|
+
options,
|
28
|
+
"\n",
|
23
29
|
].join("\n")
|
24
30
|
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def options
|
35
|
+
options = @command_class.options
|
36
|
+
keys = options.map(&:first)
|
37
|
+
key_size = keys.inject(0) { |size, key| key.size > size ? key.size : size }
|
38
|
+
options.map { |key, desc| " #{key.ljust(key_size)} #{desc}" }.join("\n")
|
39
|
+
end
|
25
40
|
end
|
26
41
|
|
27
42
|
class ARGV < Array
|
@@ -32,44 +47,51 @@ module Pod
|
|
32
47
|
end
|
33
48
|
|
34
49
|
def self.banner
|
35
|
-
|
36
|
-
"\n"
|
37
|
-
" * $ pod
|
38
|
-
|
39
|
-
" * $ pod list --help\n" \
|
40
|
-
" * $ pod install --help\n" \
|
41
|
-
" * $ pod repo --help\n" \
|
42
|
-
" * $ pod spec --help"
|
50
|
+
commands = ['install', 'list', 'push', 'repo', 'search', 'setup', 'spec'].sort
|
51
|
+
banner = "\nTo see help for the available commands run:\n\n"
|
52
|
+
commands.each {|cmd| banner << " * $ pod #{cmd.green} --help\n"}
|
53
|
+
banner
|
43
54
|
end
|
44
55
|
|
45
56
|
def self.options
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
57
|
+
[
|
58
|
+
['--help', 'Show help information'],
|
59
|
+
['--silent', 'Print nothing'],
|
60
|
+
['--no-color', 'Print output without color'],
|
61
|
+
['--verbose', 'Print more information while working'],
|
62
|
+
['--version', 'Prints the version of CocoaPods'],
|
63
|
+
]
|
50
64
|
end
|
51
65
|
|
52
66
|
def self.run(*argv)
|
53
|
-
parse(*argv)
|
67
|
+
sub_command = parse(*argv)
|
68
|
+
Setup.new(ARGV.new).run_if_needed
|
69
|
+
sub_command.run
|
70
|
+
|
71
|
+
rescue Interrupt
|
72
|
+
puts "[!] Cancelled".red
|
73
|
+
Config.instance.verbose? ? raise : exit(1)
|
74
|
+
|
54
75
|
rescue Exception => e
|
55
|
-
|
56
|
-
puts
|
57
|
-
|
58
|
-
|
76
|
+
if e.is_a?(PlainInformative) # also catches Informative
|
77
|
+
puts e.message
|
78
|
+
puts *e.backtrace if Config.instance.verbose?
|
79
|
+
else
|
80
|
+
puts ErrorReport.report(e)
|
59
81
|
end
|
60
|
-
puts e.message
|
61
|
-
puts *e.backtrace if Config.instance.verbose
|
62
82
|
exit 1
|
63
83
|
end
|
64
84
|
|
65
85
|
def self.parse(*argv)
|
66
86
|
argv = ARGV.new(argv)
|
67
|
-
raise
|
87
|
+
raise PlainInformative, VERSION if argv.option('--version')
|
68
88
|
|
69
89
|
show_help = argv.option('--help')
|
70
90
|
Config.instance.silent = argv.option('--silent')
|
71
91
|
Config.instance.verbose = argv.option('--verbose')
|
72
92
|
|
93
|
+
String.send(:define_method, :colorize) { |string , _| string } if argv.option( '--no-color' )
|
94
|
+
|
73
95
|
command_class = case argv.shift_argument
|
74
96
|
when 'install' then Install
|
75
97
|
when 'repo' then Repo
|
@@ -77,6 +99,7 @@ module Pod
|
|
77
99
|
when 'list' then List
|
78
100
|
when 'setup' then Setup
|
79
101
|
when 'spec' then Spec
|
102
|
+
when 'push' then Push
|
80
103
|
end
|
81
104
|
|
82
105
|
if show_help || command_class.nil?
|
@@ -91,6 +114,24 @@ module Pod
|
|
91
114
|
def initialize(argv)
|
92
115
|
raise Help.new(self.class, argv)
|
93
116
|
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def print_title(title, only_verbose = true)
|
121
|
+
if config.verbose?
|
122
|
+
puts "\n" + title.yellow
|
123
|
+
elsif !config.silent? && !only_verbose
|
124
|
+
puts title
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def print_subtitle(title, only_verbose = false)
|
129
|
+
if config.verbose?
|
130
|
+
puts "\n" + title.green
|
131
|
+
elsif !config.silent? && !only_verbose
|
132
|
+
puts title
|
133
|
+
end
|
134
|
+
end
|
94
135
|
end
|
95
136
|
end
|
96
137
|
|