cocoapods 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +18 -146
- data/lib/cocoapods.rb +1 -1
- data/lib/cocoapods/command.rb +3 -0
- data/lib/cocoapods/command/search.rb +35 -0
- data/lib/cocoapods/source.rb +32 -4
- metadata +7 -4
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
CocoaPods
|
2
|
-
---------
|
1
|
+
# CocoaPods
|
3
2
|
|
4
3
|
CocoaPods is an Objective-C library package manager. It tries to take away all
|
5
4
|
hard work of maintaining your dependencies, but in a lean and flexible way.
|
@@ -10,160 +9,34 @@ unify the way in which we deal with them.
|
|
10
9
|
CocoaPods will:
|
11
10
|
|
12
11
|
* Calculate the right set of versions of all of your project’s dependencies.
|
12
|
+
_Currently the resolver is very naive and any conflicts will have to be solved
|
13
|
+
by you, the user. This will change in the future._
|
13
14
|
* Install dependencies.
|
14
15
|
* Set them up to be build as part of a ‘dependency’ static library, which your
|
15
16
|
project links against.
|
16
17
|
|
18
|
+
For more in depth information see the [wiki][wiki].
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
|
21
|
+
**_NOTE: At the moment [only iOS projects are supported][ticket], but this will
|
22
|
+
be fixed in the very near future._**
|
23
|
+
|
24
|
+
## Installing CocoaPods
|
20
25
|
|
21
26
|
You’ll need MacRuby. CocoaPods itself installs through RubyGems, the Ruby
|
22
27
|
package manager:
|
23
28
|
|
24
|
-
$ brew install macruby
|
25
|
-
$ macgem install
|
29
|
+
$ brew install macruby
|
30
|
+
$ macgem install cocoapods
|
26
31
|
$ pod setup
|
27
32
|
|
33
|
+
The load time can be improved a bit by compiling the Ruby source files:
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
A manifest that describes the library and its dependencies is called a Pod.
|
33
|
-
Consider you want to create a new library that retrieves the latest price of
|
34
|
-
your favorite ice cream called IcePop.
|
35
|
-
|
36
|
-
$ pod spec create IcePop
|
37
|
-
$ cd IcePop
|
38
|
-
$ tree .
|
39
|
-
- IcePop
|
40
|
-
|- IcePop.podspec
|
41
|
-
|- LICENSE
|
42
|
-
|- README
|
43
|
-
|\ Source
|
44
|
-
| | - IcePop.h
|
45
|
-
| | - IcePop.m
|
46
|
-
|- Test
|
47
|
-
|
48
|
-
You can also initialize a Pod for an existing library, which will only create a
|
49
|
-
`.podspec` file.
|
50
|
-
|
51
|
-
$ cd IcePop
|
52
|
-
$ pod spec init IcePop
|
53
|
-
|
54
|
-
|
55
|
-
Anatomy of a PodSpec manifest
|
56
|
-
=============================
|
57
|
-
|
58
|
-
class IcePop < Pod::Spec
|
59
|
-
version '1.0.0' # 1
|
60
|
-
summary 'A library that retrieves the current price of your favorite ice cream.' # 2
|
61
|
-
author 'Eloy Durán' => 'eloy.de.enige@gmail.com' # 3
|
62
|
-
source :git => 'https://github.com/alloy/ice-pop.git' # 4
|
63
|
-
dependency 'AsyncSocket', '~> 0.6' # 5
|
64
|
-
end
|
65
|
-
|
66
|
-
1. The version of this pod.
|
67
|
-
2. A short summary of this pod’s description.
|
68
|
-
3. The author of this pod and his/her email address.
|
69
|
-
4. Where to retrieve this pod’s source.
|
70
|
-
5. Defines a dependency of the library itself, with a version requirement
|
71
|
-
of 0.6 trough 0.9.
|
72
|
-
|
73
|
-
See the [example PodSpec file][example] for a full list of the available
|
74
|
-
attributes and more detailed information.
|
75
|
-
|
76
|
-
|
77
|
-
Sharing a Pod
|
78
|
-
=============
|
79
|
-
|
80
|
-
CocoaPod uses git repositories with `.podspec` files as its database. In order
|
81
|
-
to share your pod, its `.podspec` file will have to be added to such a repo.
|
82
|
-
|
83
|
-
$ pod repo add my-spec-repo http://github.com/alloy/spec-repo.git
|
84
|
-
$ pod push my-spec-repo
|
85
|
-
|
86
|
-
This will:
|
87
|
-
|
88
|
-
1. Validate the `.podspec` file.
|
89
|
-
1. Update the clone of the local spec-repo called `my-spec-repo`.
|
90
|
-
2. Add the `.podspec` file to the spec-repo, namespaced by name and version.
|
91
|
-
3. Push the changes from the local spec-repo to its remote.
|
92
|
-
|
93
|
-
|
94
|
-
Share with everyone
|
95
|
-
===================
|
96
|
-
|
97
|
-
CocoaPods, itself, has a [spec-repo][master], called the `master` spec-repo.
|
98
|
-
This repo is meant as a central public place for any open-source pod. All
|
99
|
-
installations of CocoaPods will have a local clone of this repo.
|
100
|
-
|
101
|
-
However, normally you will have read-only access only. Thus to get a PodSpec
|
102
|
-
into the `master` spec-repo you will have to push to your own fork and send
|
103
|
-
a pull request.
|
104
|
-
|
105
|
-
Once your first PodSpec has been merged, you will be given push access to the
|
106
|
-
`master` spec-repo and are allowed to update and add `.podspec` files at your
|
107
|
-
own leisure.
|
108
|
-
|
109
|
-
Once you receive push acces, you will have to change your `master` spec-repo’s
|
110
|
-
remote URL with:
|
111
|
-
|
112
|
-
$ pod repo change master git@github.com:alloy/cocoa-pod-specs.git
|
113
|
-
|
114
|
-
|
115
|
-
Commands overview
|
116
|
-
=================
|
117
|
-
|
118
|
-
### Setup
|
119
|
-
|
120
|
-
$ pod help setup
|
121
|
-
|
122
|
-
pod setup
|
123
|
-
Creates a directory at `~/.cocoa-pods' which will hold your spec-repos.
|
124
|
-
This is where it will create a clone of the public `master' spec-repo.
|
125
|
-
|
126
|
-
### Managing PodSpec files
|
127
|
-
|
128
|
-
$ pod help spec
|
129
|
-
|
130
|
-
pod spec create NAME
|
131
|
-
Creates a directory for your new pod, named `NAME', with a default
|
132
|
-
directory structure and accompanying `NAME.podspec'.
|
133
|
-
|
134
|
-
pod spec init NAME
|
135
|
-
Creates a PodSpec, in the current working dir, called `NAME.podspec'.
|
136
|
-
Use this for existing libraries.
|
137
|
-
|
138
|
-
pod spec lint NAME
|
139
|
-
Validates `NAME.podspec' from a local spec-repo. In case `NAME' is
|
140
|
-
omitted, it defaults to the PodSpec in the current working dir.
|
141
|
-
|
142
|
-
pod spec push REMOTE
|
143
|
-
Validates `NAME.podspec' in the current working dir, copies it to the
|
144
|
-
local clone of the `REMOTE' spec-repo, and pushes it to the `REMOTE'
|
145
|
-
spec-repo. In case `REMOTE' is omitted, it defaults to `master'.
|
146
|
-
|
147
|
-
### Managing spec-repos
|
148
|
-
|
149
|
-
$ pod help repo
|
150
|
-
|
151
|
-
pod repo add NAME URL
|
152
|
-
Clones `URL' in the local spec-repos directory at `~/.cocoa-pods'. The
|
153
|
-
remote can later be referred to by `NAME'.
|
154
|
-
|
155
|
-
pod repo update NAME
|
156
|
-
Updates the local clone of the spec-repo `NAME'.
|
157
|
-
|
158
|
-
pod repo change NAME URL
|
159
|
-
Changes the git remote of local spec-repo `NAME' to `URL'.
|
160
|
-
|
161
|
-
pod repo cd NAME
|
162
|
-
Changes the current working dir to the local spec-repo `NAME'.
|
35
|
+
$ macgem install rubygems-compile
|
36
|
+
$ macgem compile cocoapods
|
163
37
|
|
164
38
|
|
165
|
-
Contact
|
166
|
-
=======
|
39
|
+
## Contact
|
167
40
|
|
168
41
|
Eloy Durán:
|
169
42
|
|
@@ -172,13 +45,12 @@ Eloy Durán:
|
|
172
45
|
* eloy.de.enige@gmail.com
|
173
46
|
|
174
47
|
|
175
|
-
LICENSE
|
176
|
-
=======
|
48
|
+
## LICENSE
|
177
49
|
|
178
50
|
These works are available under the MIT license. See the [LICENSE][license] file
|
179
51
|
for more info.
|
180
52
|
|
181
53
|
|
54
|
+
[ticket]: https://github.com/alloy/cocoapods/issues/3
|
55
|
+
[wiki]: https://github.com/alloy/cocoapods/wiki
|
182
56
|
[license]: cocoa-pods/blob/master/LICENSE
|
183
|
-
[example]: cocoa-pods/blob/master/examples/PodSpec.podspec
|
184
|
-
[master]: http://github.com/alloy/cocoa-pod-specs
|
data/lib/cocoapods.rb
CHANGED
data/lib/cocoapods/command.rb
CHANGED
@@ -2,6 +2,7 @@ module Pod
|
|
2
2
|
class Command
|
3
3
|
autoload :Install, 'cocoapods/command/install'
|
4
4
|
autoload :Repo, 'cocoapods/command/repo'
|
5
|
+
autoload :Search, 'cocoapods/command/search'
|
5
6
|
autoload :Setup, 'cocoapods/command/setup'
|
6
7
|
autoload :Spec, 'cocoapods/command/spec'
|
7
8
|
|
@@ -33,6 +34,7 @@ module Pod
|
|
33
34
|
"To see help for the available commands run:\n" \
|
34
35
|
"\n" \
|
35
36
|
" * $ pod setup --help\n" \
|
37
|
+
" * $ pod search --help\n" \
|
36
38
|
" * $ pod install --help\n" \
|
37
39
|
" * $ pod repo --help"
|
38
40
|
end
|
@@ -68,6 +70,7 @@ module Pod
|
|
68
70
|
command_class = case argv.shift_argument
|
69
71
|
when 'install' then Install
|
70
72
|
when 'repo' then Repo
|
73
|
+
when 'search' then Search
|
71
74
|
when 'setup' then Setup
|
72
75
|
when 'spec' then Spec
|
73
76
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class Search < Command
|
4
|
+
def self.banner
|
5
|
+
%{Search pods:
|
6
|
+
|
7
|
+
$ pod search [QUERY]
|
8
|
+
|
9
|
+
Searches for pods, ignoring case, whose name matches `QUERY'. If the
|
10
|
+
`--full' option is specified, this will also search in the summary and
|
11
|
+
description of the pods.}
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
" --full Search by name, summary, and description\n" +
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
@full_text_search = argv.option('--full')
|
21
|
+
unless @query = argv.arguments.first
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
Source.search_by_name(@query.strip, @full_text_search).each do |set|
|
28
|
+
puts "==> #{set.name} (#{set.versions.reverse.join(", ")})"
|
29
|
+
puts " #{set.specification.read(:summary).strip}"
|
30
|
+
puts
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/cocoapods/source.rb
CHANGED
@@ -12,20 +12,48 @@ module Pod
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.search(dependency)
|
15
|
-
all.map { |
|
15
|
+
all.map { |s| s.search(dependency) }.compact.first ||
|
16
16
|
raise(Informative, "Unable to find a pod named `#{dependency.name}'")
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.search_by_name(query, full_text_search)
|
20
|
+
result = all.map { |s| s.search_by_name(query, full_text_search) }.flatten
|
21
|
+
if result.empty?
|
22
|
+
extra = ", summary, or description" if full_text_search
|
23
|
+
raise(Informative, "Unable to find a pod who's name" \
|
24
|
+
"#{extra} matches `#{query}'")
|
25
|
+
end
|
26
|
+
result
|
27
|
+
end
|
28
|
+
|
19
29
|
attr_reader :repo
|
20
30
|
|
21
31
|
def initialize(repo)
|
22
32
|
@repo = repo
|
23
33
|
end
|
24
34
|
|
35
|
+
def pod_sets
|
36
|
+
@repo.children.map do |child|
|
37
|
+
if child.directory? && child.basename.to_s != '.git'
|
38
|
+
Specification::Set.by_pod_dir(child)
|
39
|
+
end
|
40
|
+
end.compact
|
41
|
+
end
|
42
|
+
|
25
43
|
def search(dependency)
|
26
|
-
|
27
|
-
|
28
|
-
|
44
|
+
pod_sets.find { |set| set.name == dependency.name }
|
45
|
+
end
|
46
|
+
|
47
|
+
def search_by_name(query, full_text_search)
|
48
|
+
pod_sets.map do |set|
|
49
|
+
text = if full_text_search
|
50
|
+
s = set.specification
|
51
|
+
"#{s.read(:name)} #{s.read(:summary)} #{s.read(:description)}"
|
52
|
+
else
|
53
|
+
set.name
|
54
|
+
end
|
55
|
+
set if text.downcase.include?(query.downcase)
|
56
|
+
end.compact
|
29
57
|
end
|
30
58
|
end
|
31
59
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eloy Duran
|
@@ -18,7 +18,9 @@ date: 2011-09-17 00:00:00 +02:00
|
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
21
|
+
description: |-
|
22
|
+
CocoaPods is an Objective-C library package manager. It tries to take away all hard work of maintaining your dependencies, but in a lean and flexible way. Its goal is to create a more centralized overview of open-source libraries and unify the way in which we deal with them.
|
23
|
+
CocoaPods will calculate the right set of versions of all of your project's dependencies, install them, and set them up to be build as part of a dependency static library, which your project links against.
|
22
24
|
email: eloy.de.enige@gmail.com
|
23
25
|
executables:
|
24
26
|
- pod
|
@@ -29,6 +31,7 @@ extra_rdoc_files: []
|
|
29
31
|
files:
|
30
32
|
- lib/cocoapods/command/install.rb
|
31
33
|
- lib/cocoapods/command/repo.rb
|
34
|
+
- lib/cocoapods/command/search.rb
|
32
35
|
- lib/cocoapods/command/setup.rb
|
33
36
|
- lib/cocoapods/command/spec.rb
|
34
37
|
- lib/cocoapods/command.rb
|
@@ -56,7 +59,7 @@ homepage: https://github.com/alloy/cocoapods
|
|
56
59
|
licenses:
|
57
60
|
- MIT
|
58
61
|
post_install_message: |+
|
59
|
-
To speed up load time of
|
62
|
+
To speed up load time of CocoaPods consider compiling the Ruby source files:
|
60
63
|
|
61
64
|
$ sudo macgem install rubygems-compile
|
62
65
|
$ sudo macgem compile cocoapods
|