cocoapods 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Eloy Durán <eloy.de.enige@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,184 @@
1
+ CocoaPods
2
+ ---------
3
+
4
+ CocoaPods is an Objective-C library package manager. It tries to take away all
5
+ hard work of maintaining your dependencies, but in a lean and flexible way.
6
+
7
+ Its goal is to create a more centralized overview of open-source libraries and
8
+ unify the way in which we deal with them.
9
+
10
+ CocoaPods will:
11
+
12
+ * Calculate the right set of versions of all of your project’s dependencies.
13
+ * Install dependencies.
14
+ * Set them up to be build as part of a ‘dependency’ static library, which your
15
+ project links against.
16
+
17
+
18
+ Installing CocoaPods
19
+ ====================
20
+
21
+ You’ll need MacRuby. CocoaPods itself installs through RubyGems, the Ruby
22
+ package manager:
23
+
24
+ $ brew install macruby [TODO There's actually no MacRuby homebrew formula]
25
+ $ macgem install cocoa-pods
26
+ $ pod setup
27
+
28
+
29
+ Making a Pod
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'.
163
+
164
+
165
+ Contact
166
+ =======
167
+
168
+ Eloy Durán:
169
+
170
+ * http://github.com/alloy
171
+ * http://twitter.com/alloy
172
+ * eloy.de.enige@gmail.com
173
+
174
+
175
+ LICENSE
176
+ =======
177
+
178
+ These works are available under the MIT license. See the [LICENSE][license] file
179
+ for more info.
180
+
181
+
182
+ [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/bin/pod ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env macruby
2
+
3
+ if $0 == __FILE__
4
+ $:.unshift File.expand_path('../../lib', __FILE__)
5
+ end
6
+
7
+ require 'cocoapods'
8
+
9
+ Pod::Command.run(*ARGV)
@@ -0,0 +1,32 @@
1
+ module Pod
2
+ VERSION = '0.0.1'
3
+
4
+ class Informative < StandardError
5
+ end
6
+
7
+ autoload :Command, 'cocoapods/command'
8
+ autoload :Config, 'cocoapods/config'
9
+ autoload :Dependency, 'cocoapods/dependency'
10
+ autoload :Downloader, 'cocoapods/downloader'
11
+ autoload :Executable, 'cocoapods/executable'
12
+ autoload :Installer, 'cocoapods/installer'
13
+ autoload :Resolver, 'cocoapods/resolver'
14
+ autoload :Source, 'cocoapods/source'
15
+ autoload :Spec, 'cocoapods/specification'
16
+ autoload :Specification, 'cocoapods/specification'
17
+ autoload :Version, 'cocoapods/version'
18
+
19
+ module Xcode
20
+ autoload :Config, 'cocoapods/xcode/config'
21
+ autoload :Project, 'cocoapods/xcode/project'
22
+ end
23
+
24
+ autoload :Pathname, 'pathname'
25
+ end
26
+
27
+ class Pathname
28
+ def glob(pattern = '')
29
+ Dir.glob((self + pattern).to_s).map { |f| Pathname.new(f) }
30
+ end
31
+ end
32
+
@@ -0,0 +1,88 @@
1
+ module Pod
2
+ class Command
3
+ autoload :Install, 'cocoapods/command/install'
4
+ autoload :Repo, 'cocoapods/command/repo'
5
+ autoload :Setup, 'cocoapods/command/setup'
6
+ autoload :Spec, 'cocoapods/command/spec'
7
+
8
+ class Help < Informative
9
+ def initialize(command_class, argv)
10
+ @command_class, @argv = command_class, argv
11
+ end
12
+
13
+ def message
14
+ [
15
+ @command_class.banner,
16
+ '',
17
+ 'Options',
18
+ '-------',
19
+ '',
20
+ @command_class.options
21
+ ].join("\n")
22
+ end
23
+ end
24
+
25
+ class ARGV < Array
26
+ def options; select { |x| x.to_s[0,1] == '-' }; end
27
+ def arguments; self - options; end
28
+ def option(name); !!delete(name); end
29
+ def shift_argument; (arg = arguments[0]) && delete(arg); end
30
+ end
31
+
32
+ def self.banner
33
+ "To see help for the available commands run:\n" \
34
+ "\n" \
35
+ " * $ pod setup --help\n" \
36
+ " * $ pod install --help\n" \
37
+ " * $ pod repo --help"
38
+ end
39
+
40
+ def self.options
41
+ " --help Show help information\n" \
42
+ " --silent Print nothing\n" \
43
+ " --verbose Print more information while working\n" \
44
+ " --version Prints the version of CocoaPods"
45
+ end
46
+
47
+ def self.run(*argv)
48
+ parse(*argv).run
49
+ rescue Exception => e
50
+ unless e.is_a?(Informative)
51
+ puts "Oh no, an error occurred. Please run with `--verbose' and report " \
52
+ "on https://github.com/alloy/cocoapods/issues."
53
+ puts ""
54
+ end
55
+ puts e.message
56
+ puts *e.backtrace if Config.instance.verbose
57
+ exit 1
58
+ end
59
+
60
+ def self.parse(*argv)
61
+ argv = ARGV.new(argv)
62
+ raise Informative, VERSION if argv.option('--version')
63
+
64
+ show_help = argv.option('--help')
65
+ Config.instance.silent = argv.option('--silent')
66
+ Config.instance.verbose = argv.option('--verbose')
67
+
68
+ command_class = case argv.shift_argument
69
+ when 'install' then Install
70
+ when 'repo' then Repo
71
+ when 'setup' then Setup
72
+ when 'spec' then Spec
73
+ end
74
+
75
+ if show_help || command_class.nil?
76
+ raise Help.new(command_class || self, argv)
77
+ else
78
+ command_class.new(argv)
79
+ end
80
+ end
81
+
82
+ include Config::Mixin
83
+
84
+ def initialize(argv)
85
+ raise Help.new(self.class, argv)
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,48 @@
1
+ module Pod
2
+ class Command
3
+ class Install < Command
4
+ def self.banner
5
+ %{Installing dependencies of a pod spec:
6
+
7
+ $ pod install [NAME]
8
+
9
+ Downloads all dependencies of the specified podspec file `NAME' and
10
+ creates an Xcode Pods library project in `./Pods'. In case `NAME' is
11
+ omitted it defaults to either `Podfile' or `*.podspec' in the current
12
+ working directory.
13
+ }
14
+ end
15
+
16
+ def self.options
17
+ " --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading\n" +
18
+ super
19
+ end
20
+
21
+ def initialize(argv)
22
+ config.clean = !argv.option('--no-clean')
23
+ if podspec = argv.shift_argument
24
+ @podspec = Pathname.new(podspec)
25
+ end
26
+ super unless argv.empty?
27
+ end
28
+
29
+ def run
30
+ spec = nil
31
+ if @podspec
32
+ if @podspec.exist?
33
+ spec = Specification.from_podspec(@podspec)
34
+ else
35
+ raise Help, "The specified podspec `#{@podspec}' doesn't exist."
36
+ end
37
+ else
38
+ if config.project_podfile.exist?
39
+ spec = Specification.from_podfile(config.project_podfile)
40
+ else
41
+ raise Help, "No Podfile found in current working directory."
42
+ end
43
+ end
44
+ Installer.new(spec).install!
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,60 @@
1
+ require 'fileutils'
2
+
3
+ module Pod
4
+ class Command
5
+ class Repo < Command
6
+ def self.banner
7
+ %{Managing spec-repos:
8
+
9
+ $ pod help repo
10
+
11
+ pod repo add NAME URL
12
+ Clones `URL' in the local spec-repos directory at `~/.cocoapods'. The
13
+ remote can later be referred to by `NAME'.
14
+
15
+ pod repo update NAME
16
+ Updates the local clone of the spec-repo `NAME'. If `NAME' is omitted
17
+ this will update all spec-repos in `~/.cocoapods'.}
18
+ end
19
+
20
+ extend Executable
21
+ executable :git
22
+
23
+ def initialize(argv)
24
+ case @action = argv.arguments[0]
25
+ when 'add'
26
+ unless (@name = argv[1]) && (@url = argv[2])
27
+ raise Help, "Adding a repo needs a `name' and a `url'."
28
+ end
29
+ when 'update'
30
+ @name = argv[1]
31
+ else
32
+ super
33
+ end
34
+ end
35
+
36
+ def dir
37
+ config.repos_dir + @name
38
+ end
39
+
40
+ def run
41
+ send @action
42
+ end
43
+
44
+ def add
45
+ puts "==> Cloning spec repo `#{@name}' from `#{@url}'" unless config.silent?
46
+ config.repos_dir.mkpath
47
+ Dir.chdir(config.repos_dir) { git("clone #{@url} #{@name}") }
48
+ end
49
+
50
+ def update
51
+ dirs = @name ? [dir] : config.repos_dir.children
52
+ dirs.each do |dir|
53
+ puts "==> Updating spec repo `#{dir.basename}'" unless config.silent?
54
+ Dir.chdir(dir) { git("pull") }
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+