cocoapods 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/CHANGELOG.md +129 -0
  2. data/README.md +58 -54
  3. data/bin/pod +1 -0
  4. data/lib/cocoapods.rb +7 -10
  5. data/lib/cocoapods/bridge_support_generator.rb +3 -5
  6. data/lib/cocoapods/command.rb +1 -1
  7. data/lib/cocoapods/command/repo.rb +22 -12
  8. data/lib/cocoapods/command/setup.rb +14 -3
  9. data/lib/cocoapods/command/spec.rb +8 -7
  10. data/lib/cocoapods/config.rb +2 -2
  11. data/lib/cocoapods/dependency.rb +65 -3
  12. data/lib/cocoapods/downloader.rb +7 -2
  13. data/lib/cocoapods/installer.rb +244 -99
  14. data/lib/cocoapods/podfile.rb +145 -10
  15. data/lib/cocoapods/resolver.rb +10 -6
  16. data/lib/cocoapods/specification.rb +13 -12
  17. data/lib/cocoapods/specification/set.rb +34 -0
  18. data/lib/cocoapods/xcodeproj_ext.rb +99 -0
  19. metadata +32 -35
  20. data/lib/cocoapods/project_template.rb +0 -35
  21. data/lib/cocoapods/xcode/config.rb +0 -33
  22. data/lib/cocoapods/xcode/copy_resources_script.rb +0 -21
  23. data/lib/cocoapods/xcode/project.rb +0 -356
  24. data/lib/cocoapods/xcode/workspace.rb +0 -56
  25. data/xcode-project-templates/cocoa-static-library/Pods-Prefix.pch +0 -7
  26. data/xcode-project-templates/cocoa-static-library/Pods.xcconfig +0 -1
  27. data/xcode-project-templates/cocoa-static-library/Pods.xcodeproj/project.pbxproj +0 -236
  28. data/xcode-project-templates/cocoa-static-library/PodsResources.sh +0 -8
  29. data/xcode-project-templates/cocoa-touch-static-library/Pods-Prefix.pch +0 -7
  30. data/xcode-project-templates/cocoa-touch-static-library/Pods.xcconfig +0 -1
  31. data/xcode-project-templates/cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj +0 -248
  32. data/xcode-project-templates/cocoa-touch-static-library/PodsResources.sh +0 -8
@@ -0,0 +1,129 @@
1
+ ## 0.3.0
2
+
3
+ ### Multiple targets
4
+
5
+ Add support for multiple static library targets in the Pods Xcode project with
6
+ different sets of depedencies. This means that you can create a separate
7
+ library which contains all dependencies, including extra ones that you only use
8
+ in, for instance, a debug or test build. [[docs][1]]
9
+
10
+ ```Ruby
11
+ # This Podfile will build three static libraries:
12
+ # * libPods.a
13
+ # * libPods-debug.a
14
+ # * libPods-test.a
15
+
16
+ # This dependency is included in the `default` target, which generates the
17
+ # `libPods.a` library, and all non-exclusive targets.
18
+ dependency 'SSCatalog'
19
+
20
+ target :debug do
21
+ # This dependency is only included in the `debug` target, which generates
22
+ # the `libPods-debug.a` library.
23
+ dependency 'CocoaLumberjack'
24
+ end
25
+
26
+ target :test, :exclusive => true do
27
+ # This dependency is *only* included in the `test` target, which generates
28
+ # the `libPods-test.a` library.
29
+ dependency 'Kiwi'
30
+ end
31
+ ```
32
+
33
+ ### Install libraries from anywhere
34
+
35
+ A dependency can take a git url if the repo contains a podspec file in its
36
+ root, or a podspec can be loaded from a file or HTTP location. If no podspec is
37
+ available, a specification can be defined inline in the Podfile. [[docs][2]]
38
+
39
+ ```Ruby
40
+ # From a spec repo.
41
+ dependency 'SSToolkit'
42
+
43
+ # Directly from the Pod’s repo (if it contains a podspec).
44
+ dependency 'SSToolkit', :git => 'https://github.com/samsoffes/sstoolkit.git'
45
+
46
+ # Directly from the Pod’s repo (if it contains a podspec) with a specific commit (or tag).
47
+ dependency 'SSToolkit', :git => 'https://github.com/samsoffes/sstoolkit.git',
48
+ :commit => '2adcd0f81740d6b0cd4589af98790eee3bd1ae7b'
49
+
50
+ # From a podspec that's outside a spec repo _and_ the library’s repo. This can be a file or http url.
51
+ dependency 'SSToolkit', :podspec => 'https://raw.github.com/gist/1353347/ef1800da9c5f5d267a642b8d3950b41174f2a6d7/SSToolkit-0.1.1.podspec'
52
+
53
+ # If no podspec is available anywhere, you can define one right in your Podfile.
54
+ dependency do |s|
55
+ s.name = 'SSToolkit'
56
+ s.version = '0.1.3'
57
+ s.platform = :ios
58
+ s.source = { :git => 'https://github.com/samsoffes/sstoolkit.git', :commit => '2adcd0f81740d6b0cd4589af98790eee3bd1ae7b' }
59
+ s.resources = 'Resources'
60
+ s.source_files = 'SSToolkit/**/*.{h,m}'
61
+ s.frameworks = 'QuartzCore', 'CoreGraphics'
62
+
63
+ def s.post_install(target)
64
+ prefix_header = config.project_pods_root + target.prefix_header_filename
65
+ prefix_header.open('a') do |file|
66
+ file.puts(%{#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif})
67
+ end
68
+ end
69
+ end
70
+ ```
71
+
72
+ ### Add a `post_install` hook to the Podfile class
73
+
74
+ This allows the user to customize, for instance, the generated Xcode project
75
+ _before_ it’s written to disk. [[docs][3]]
76
+
77
+ ```Ruby
78
+ # Enable garbage collection support for MacRuby applications.
79
+ post_install do |installer|
80
+ installer.project.targets.each do |target|
81
+ target.buildConfigurations.each do |config|
82
+ config.buildSettings['GCC_ENABLE_OBJC_GC'] = 'supported'
83
+ end
84
+ end
85
+ end
86
+ ```
87
+
88
+ ### Manifest
89
+
90
+ Generate a Podfile.lock file next to the Podfile, which contains a manifest of
91
+ your application’s dependencies and their dependencies.
92
+
93
+ ```
94
+ PODS:
95
+ - JSONKit (1.4)
96
+ - LibComponentLogging-Core (1.1.4)
97
+ - LibComponentLogging-NSLog (1.0.2):
98
+ - LibComponentLogging-Core (>= 1.1.4)
99
+ - RestKit-JSON-JSONKit (0.9.3):
100
+ - JSONKit
101
+ - RestKit (= 0.9.3)
102
+ - RestKit-Network (0.9.3):
103
+ - LibComponentLogging-NSLog
104
+ - RestKit (= 0.9.3)
105
+ - RestKit-ObjectMapping (0.9.3):
106
+ - RestKit (= 0.9.3)
107
+ - RestKit-Network (= 0.9.3)
108
+
109
+ DOWNLOAD_ONLY:
110
+ - RestKit (0.9.3)
111
+
112
+ DEPENDENCIES:
113
+ - RestKit-JSON-JSONKit
114
+ - RestKit-ObjectMapping
115
+ ```
116
+
117
+ ### Generate Xcode projects from scratch
118
+
119
+ We no longer ship template projects with the gem, but instead generate them
120
+ programmatically. This code has moved out into its own [Xcodeproj gem][4],
121
+ allowing you to automate Xcode related tasks.
122
+
123
+
124
+
125
+
126
+ [1]: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/podfile.rb#L151
127
+ [2]: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/podfile.rb#L82
128
+ [3]: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/podfile.rb#L185
129
+ [4]: https://github.com/CocoaPods/Xcodeproj
data/README.md CHANGED
@@ -1,85 +1,89 @@
1
- # CocoaPods
1
+ # CocoaPods – an Objective-C library manager
2
2
 
3
- CocoaPods is an Objective-C library dependency/package manager. It tries to take
4
- away all hard work of maintaining your dependencies.
3
+ CocoaPods manages library dependencies for your Xcode project.
5
4
 
6
- Its goal is to create a more centralized overview of open-source libraries and
7
- unify the way in which we deal with them, like [RubyGems](http://rubygems.org)
8
- does for the Ruby community.
5
+ You specify the dependencies for your project in one easy text file. CocoaPods resolves dependencies between libraries, fetches source code for the dependencies, and creates and maintains an Xcode workspace to build your project.
9
6
 
10
- CocoaPods will:
7
+ Ultimately, the goal is to improve discoverability of, and engagement in, third party open-source libraries, by creating a more centralized ecosystem.
11
8
 
12
- * Calculate the right set of versions of all of your project’s dependencies.
13
- _Currently the resolver is very naive and any conflicts will have to be solved
14
- by you, the user. This will change in the future._
15
- * Install dependencies.
16
- * Set them up to be build as part of a ‘dependency’ static library, which your
17
- project links against.
9
+ See [the wiki](https://github.com/CocoaPods/CocoaPods/wiki) for more in depth information on several topics.
18
10
 
19
- For more in depth information see the [wiki][wiki], specifically the page about
20
- [creating a project that uses CocoaPods][wiki-create].
21
11
 
12
+ ## Installation
22
13
 
23
- ## Installing CocoaPods
14
+ Downloading and installing CocoaPods only takes a few minutes.
24
15
 
25
- You’ll need MacRuby. CocoaPods itself installs through RubyGems, the Ruby
26
- package manager. Download and install [version 0.10][macruby] and then perform
27
- the following commands:
16
+ CocoaPods runs on [MacRuby](http://macruby.org). If you don't have a recent version of MacRuby installed you will need to download it. CocoaPods works best on version 0.10.
17
+
18
+ $ curl -O http://www.macruby.org/files/MacRuby%200.10.zip
19
+ $ open MacRuby%200.10.zip
20
+ # open MacRuby\ 0.10/MacRuby\ 0.10.pkg
21
+
22
+ After that you can install CocoaPods itself.
28
23
 
29
24
  $ sudo macgem install cocoapods
30
25
  $ pod setup
31
26
 
32
- The load time can be improved a bit by compiling the Ruby source files:
27
+ Now that you've got CocoaPods installed you can easily add it to your project.
28
+
29
+
30
+ ## Adding it to your project
31
+
32
+ Search for Pods by name or description.
33
+
34
+ $ pod search asi
35
+ ==> ASIHTTPRequest (1.8.1)
36
+ Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone
37
+
38
+ ==> ASIWebPageRequest (1.8.1)
39
+ The ASIWebPageRequest class included with ASIHTTPRequest lets you download
40
+ complete webpages, including external resources like images and stylesheets.
33
41
 
34
- $ sudo macgem install rubygems-compile
35
- $ sudo macgem compile cocoapods
42
+ After you've found your favorite dependencies you add them to your [Podfile](https://github.com/CocoaPods/CocoaPods/wiki/A-Podfile).
36
43
 
44
+ $ edit Podfile
45
+ platform :ios
46
+ dependency 'JSONKit', '~> 1.4'
47
+ dependency 'Reachability', '~> 2.0.4'
37
48
 
38
- ## Contributing
49
+ And then you [install the dependencies](https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods) in your project.
39
50
 
40
- * We need specifications for as many libraries as possible, which will help in
41
- adoption and finding CocoaPods issues that need to be addressed.
51
+ $ pod install App.xcodeproj
42
52
 
43
- * There needs to be [proper documentation and guides with screenshots][wiki],
44
- screencasts, blog posts, etcetera.
53
+ _Where ‘App.xcodeproj’ is the name of your actual application project._
45
54
 
46
- * The project is still very young, so there's a lot still on the table. Feel
47
- free to create [tickets][tickets] with ideas, feedback, and issues.
55
+ Remember to always open the Xcode workspace instead of the project file when you're building.
48
56
 
49
- * If you're looking for things to do, start by reading this
50
- [setup wiki page][dev-setup], then check the [tickets][tickets] and
51
- [the example specification][example-spec] which contains a lot of ideas we
52
- may, or may not, want to support.
57
+ $ open App.xcworkspace
53
58
 
54
- **I will give out push access to the [cocoapods][cocoapods] and
55
- [master spec-repo][cocoapods-specs] to anyone that has _one_) patch accepted.**
59
+ 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.
56
60
 
61
+ $ pod spec create Peanuts
62
+ $ edit Peanuts.podspec
63
+ $ pod spec lint Peanuts.podspec
57
64
 
58
- ## Contact
65
+ 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!
59
66
 
60
- IRC:
67
+ There are several other ways to start using **any** library without a Pod specification, which can be seen in the [SSCatalog example](https://github.com/CocoaPods/CocoaPods/blob/master/examples/SSCatalog/Podfile).
61
68
 
62
- * #cocoapods on `irc.freenode.net`
63
69
 
64
- Eloy Durán:
70
+ ## Collaborate
65
71
 
66
- * http://github.com/alloy
67
- * http://twitter.com/alloy
68
- * eloy.de.enige@gmail.com
72
+ All CocoaPods development happens on GitHub, there is a repository for [CocoaPods](https://github.com/CocoaPods/CocoaPods) and one for the [CocoaPods specs](https://github.com/CocoaPods/Specs). Contributing patches or Pods is really easy and gratifying. You even get push access when one of your specs or patches is accepted.
69
73
 
74
+ Follow [@CocoaPodsOrg](http://twitter.com/CocoaPodsOrg) to get up to date information about what's going on in the CocoaPods world.
70
75
 
71
- ## LICENSE
76
+ If you're really oldschool and you want to discuss CocoaPods development you can join #cocoapods on irc.freenode.net.
72
77
 
73
- These works are available under the MIT license. See the [LICENSE][license] file
74
- for more info.
75
78
 
79
+ # Endorsements
76
80
 
77
- [macruby]: http://www.macruby.org/files
78
- [cocoapods]: https://github.com/alloy/cocoapods
79
- [cocoapods-specs]: https://github.com/alloy/cocoapods-specs
80
- [tickets]: https://github.com/alloy/cocoapods/issues
81
- [example-spec]: https://github.com/alloy/cocoapods/blob/master/examples/PodSpec.podspec
82
- [dev-setup]: https://github.com/alloy/cocoapods/wiki/Setting-up-for-development-on-CocoaPods
83
- [wiki-create]: https://github.com/alloy/cocoapods/wiki/Creating-a-project-that-uses-CocoaPods
84
- [wiki]: https://github.com/alloy/cocoapods/wiki/_pages
85
- [license]: cocoa-pods/blob/master/LICENSE
81
+ * “I am crazy excited about this. With the growing number of Objective-C libraries, this will make things so much better.” –– [Sam Soffes](http://news.ycombinator.com/item?id=3009154)
82
+ * “Are you doing open source iOS components? You really should support @CocoaPodsOrg!” –– [Matthias Tretter](http://twitter.com/#!/myell0w/status/134955697740840961)
83
+ * “So glad someone has finally done this...” –– [Tom Wilson](http://news.ycombinator.com/item?id=3009349)
84
+ * “Anybody who has tasted the coolness of RubyGems (and @gembundler) understands how cool CocoaPods might be.” –– [StuFF mc](http://twitter.com/#!/stuffmc/status/115374231591731200)
85
+ * “I will be working on getting several of my Objective-C libraries ready for CocoaPods this week!” –– [Luke Redpath](http://twitter.com/#!/lukeredpath/status/115510581921988608)
86
+ * “Really digg how @alloy is building a potential game changer” –– [Klaas Speller](https://twitter.com/#!/spllr/status/115914209438601216)
87
+ * “@alloy's making an Objective-C package manager. This is fantastic news kids!” –– [Josh Abernathy](http://twitter.com/#!/joshaber/status/115273577703555073)
88
+ * “A package manager for Cocoa/Objective-C, built with @MacRuby. Awesomeness!” –– [Johannes Fahrenkrug](http://twitter.com/#!/jfahrenkrug/status/115303240286998528)
89
+ * “This is awesome, I love endorsements!” –– [Appie Durán](http://twitter.com/#!/AppieDuran)
data/bin/pod CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env macruby
2
2
 
3
3
  if $0 == __FILE__
4
+ $:.unshift File.expand_path('../../external/xcodeproj/lib', __FILE__)
4
5
  $:.unshift File.expand_path('../../lib', __FILE__)
5
6
  end
6
7
 
@@ -1,5 +1,5 @@
1
1
  module Pod
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
 
4
4
  class Informative < StandardError
5
5
  end
@@ -12,26 +12,23 @@ module Pod
12
12
  autoload :Executable, 'cocoapods/executable'
13
13
  autoload :Installer, 'cocoapods/installer'
14
14
  autoload :Podfile, 'cocoapods/podfile'
15
- autoload :ProjectTemplate, 'cocoapods/project_template'
16
15
  autoload :Resolver, 'cocoapods/resolver'
17
16
  autoload :Source, 'cocoapods/source'
18
17
  autoload :Spec, 'cocoapods/specification'
19
18
  autoload :Specification, 'cocoapods/specification'
20
19
  autoload :Version, 'cocoapods/version'
21
20
 
22
- module Xcode
23
- autoload :Config, 'cocoapods/xcode/config'
24
- autoload :CopyResourcesScript, 'cocoapods/xcode/copy_resources_script'
25
- autoload :Project, 'cocoapods/xcode/project'
26
- autoload :Workspace, 'cocoapods/xcode/workspace'
27
- end
28
-
29
21
  autoload :Pathname, 'pathname'
30
22
  end
31
23
 
24
+ module Xcodeproj
25
+ autoload :Config, 'cocoapods/xcodeproj_ext'
26
+ autoload :Project, 'cocoapods/xcodeproj_ext'
27
+ autoload :Workspace, 'cocoapods/xcodeproj_ext'
28
+ end
29
+
32
30
  class Pathname
33
31
  def glob(pattern = '')
34
32
  Dir.glob((self + pattern).to_s).map { |f| Pathname.new(f) }
35
33
  end
36
34
  end
37
-
@@ -15,11 +15,9 @@ module Pod
15
15
  @headers.map { |header| "-I '#{header.dirname}'" }.uniq
16
16
  end
17
17
 
18
- def create_in(root)
19
- puts "==> Generating BridgeSupport metadata file" unless config.silent?
20
- file = root + "Pods.bridgesupport"
21
- gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{file}' '#{headers.join("' '")}'}
22
- file
18
+ def save_as(pathname)
19
+ puts "==> Generating BridgeSupport metadata file at `#{pathname}'" unless config.silent?
20
+ gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
23
21
  end
24
22
  end
25
23
  end
@@ -52,7 +52,7 @@ module Pod
52
52
  rescue Exception => e
53
53
  unless e.is_a?(Informative)
54
54
  puts "Oh no, an error occurred. Please run with `--verbose' and report " \
55
- "on https://github.com/alloy/cocoapods/issues."
55
+ "on https://github.com/CocoaPods/CocoaPods/issues."
56
56
  puts ""
57
57
  end
58
58
  puts e.message
@@ -6,15 +6,19 @@ module Pod
6
6
  def self.banner
7
7
  %{Managing spec-repos:
8
8
 
9
- $ pod help repo
9
+ $ pod repo add NAME URL
10
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'.
11
+ Clones `URL' in the local spec-repos directory at `~/.cocoapods'. The
12
+ remote can later be referred to by `NAME'.
14
13
 
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'.}
14
+ $ pod repo update NAME
15
+
16
+ Updates the local clone of the spec-repo `NAME'. If `NAME' is omitted
17
+ this will update all spec-repos in `~/.cocoapods'.
18
+
19
+ $ pod repo set-url NAME URL
20
+
21
+ Updates the remote `URL' of the spec-repo `NAME'.}
18
22
  end
19
23
 
20
24
  extend Executable
@@ -22,12 +26,12 @@ module Pod
22
26
 
23
27
  def initialize(argv)
24
28
  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'."
29
+ when 'add', 'set-url'
30
+ unless (@name = argv.arguments[1]) && (@url = argv.arguments[2])
31
+ raise Informative, "#{@action == 'add' ? 'Adding' : 'Updating the remote of'} a repo needs a `name' and a `url'."
28
32
  end
29
33
  when 'update'
30
- @name = argv[1]
34
+ @name = argv.arguments[1]
31
35
  else
32
36
  super
33
37
  end
@@ -38,7 +42,7 @@ module Pod
38
42
  end
39
43
 
40
44
  def run
41
- send @action
45
+ send @action.gsub('-', '_')
42
46
  end
43
47
 
44
48
  def add
@@ -54,6 +58,12 @@ module Pod
54
58
  Dir.chdir(dir) { git("pull") }
55
59
  end
56
60
  end
61
+
62
+ def set_url
63
+ Dir.chdir(dir) do
64
+ git("remote set-url origin '#{@url}'")
65
+ end
66
+ end
57
67
  end
58
68
  end
59
69
  end
@@ -9,7 +9,10 @@ module Pod
9
9
  Creates a directory at `~/.cocoapods' which will hold your spec-repos.
10
10
  This is where it will create a clone of the public `master' spec-repo from:
11
11
 
12
- https://github.com/alloy/cocoapods-specs}
12
+ https://github.com/CocoaPods/Specs
13
+
14
+ If the clone already exists, it will ensure that it points to the correct
15
+ remote.}
13
16
  end
14
17
 
15
18
  def initialize(argv)
@@ -17,15 +20,23 @@ module Pod
17
20
  end
18
21
 
19
22
  def master_repo_url
20
- 'git://github.com/alloy/cocoapods-specs.git'
23
+ 'git://github.com/CocoaPods/Specs.git'
21
24
  end
22
25
 
23
26
  def add_master_repo_command
24
27
  @command ||= Repo.new(ARGV.new(['add', 'master', master_repo_url]))
25
28
  end
26
29
 
30
+ def update_master_repo_remote_command
31
+ @command ||= Repo.new(ARGV.new(['set-url', 'master', master_repo_url]))
32
+ end
33
+
27
34
  def run
28
- add_master_repo_command.run
35
+ if (config.repos_dir + 'master').exist?
36
+ update_master_repo_remote_command.run
37
+ else
38
+ add_master_repo_command.run
39
+ end
29
40
  end
30
41
  end
31
42
  end