Permalink
Browse files

Add a --force-doc option and add `appledoc` install note to README.

  • Loading branch information...
alloy committed Apr 12, 2012
1 parent a647170 commit a5d34c827c42b761f41e0db679616eca870ac116
Showing with 52 additions and 23 deletions.
  1. +42 −18 README.md
  2. +2 −0 lib/cocoapods/command/install.rb
  3. +3 −1 lib/cocoapods/config.rb
  4. +5 −4 lib/cocoapods/installer.rb
View
@@ -21,8 +21,17 @@ Downloading and installing CocoaPods only takes a few minutes.
CocoaPods runs on [Ruby](http://www.ruby-lang.org/en/). To install it run the following commands:
- $ sudo gem install cocoapods
- $ pod setup
+```
+$ sudo gem install cocoapods
+$ pod setup
+```
+
+If you want to have CocoaPods generate documentation for each library, then install the [appledoc](http://gentlebytes.com/appledoc/) tool:
+
+```
+$ brew install appledoc --HEAD
+$ ln -sf "`brew --prefix`/Cellar/appledoc/HEAD/Templates" ~/Library/Application\ Support/appledoc
+```
Now that you've got CocoaPods installed you can easily add it to your project.
@@ -35,40 +44,55 @@ NOTE 2: CocoaPods re-uses some of the RubyGems 1.3.6 classes. If you have an old
Search for Pods by name or description.
- $ pod search asi
- ==> ASIHTTPRequest (1.8.1)
- Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone
+```
+$ pod search asi
+==> ASIHTTPRequest (1.8.1)
+ Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone
- ==> ASIWebPageRequest (1.8.1)
- The ASIWebPageRequest class included with ASIHTTPRequest lets you download
- complete webpages, including external resources like images and stylesheets.
+==> ASIWebPageRequest (1.8.1)
+ The ASIWebPageRequest class included with ASIHTTPRequest lets you download
+ complete webpages, including external resources like images and stylesheets.
+```
After you've found your favorite dependencies you add them to your [Podfile](https://github.com/CocoaPods/CocoaPods/wiki/A-Podfile).
- $ edit Podfile
- platform :ios
- dependency 'JSONKit', '~> 1.4'
- dependency 'Reachability', '~> 2.0.4'
+```
+$ edit Podfile
+```
+
+```ruby
+platform :ios
+dependency 'JSONKit', '~> 1.4'
+dependency 'Reachability', '~> 2.0.4'
+```
And then you [install the dependencies](https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods) in your project.
- $ pod install App.xcodeproj
+```
+$ pod install App.xcodeproj
+```
_Where ‘App.xcodeproj’ is the name of your actual application project._
The next time you change your Podfile, you can update your project by simply running:
- $ pod install
+```
+$ pod install
+```
Remember to always open the Xcode workspace instead of the project file when you're building.
- $ open App.xcworkspace
+```
+$ open App.xcworkspace
+```
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.
- $ pod spec create Peanuts
- $ edit Peanuts.podspec
- $ pod spec lint Peanuts.podspec
+```
+$ pod spec create Peanuts
+$ edit Peanuts.podspec
+$ pod spec lint Peanuts.podspec
+```
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!
@@ -20,13 +20,15 @@ def self.banner
def self.options
" --no-clean Leave SCM dirs like `.git' and `.svn' in tact after downloading\n" +
" --no-doc Skip documentation generation with appledoc\n" +
+ " --force-doc Force the generation of documentation\n" +
" --no-update Skip running `pod repo update` before install\n" +
super
end
def initialize(argv)
config.clean = !argv.option('--no-clean')
config.doc = !argv.option('--no-doc')
+ config.force_doc = argv.option('--force-doc')
@update_repo = !argv.option('--no-update')
@projpath = argv.shift_argument
super unless argv.empty?
View
@@ -10,12 +10,13 @@ def self.instance=(instance)
@instance = instance
end
- attr_accessor :repos_dir, :project_root, :project_pods_root, :rootspec, :clean, :verbose, :silent, :doc, :doc_install
+ attr_accessor :repos_dir, :project_root, :project_pods_root, :rootspec, :clean, :verbose, :silent, :doc, :doc_install, :force_doc
alias_method :clean?, :clean
alias_method :verbose?, :verbose
alias_method :silent?, :silent
alias_method :doc?, :doc
alias_method :doc_install?, :doc_install
+ alias_method :force_doc?, :force_doc
def initialize
@repos_dir = Pathname.new(File.expand_path("~/.cocoapods"))
@@ -24,6 +25,7 @@ def initialize
@silent = false
@doc = true
@doc_install = true
+ @force_doc = false
end
def project_root
@@ -46,6 +46,7 @@ def install_dependencies!
activated_specifications.map do |spec|
LocalPod.new(spec, sandbox).tap do |pod|
marker = config.verbose ? "\n-> ".green : ''
+
if pod.exists? || spec.local?
puts marker + "Using #{pod}" unless config.silent?
else
@@ -58,11 +59,11 @@ def install_dependencies!
downloader.clean
pod.clean
end
+ end
- if config.doc?
- puts "Installing Documentation for #{spec}".green if config.verbose?
- Generator::Documentation.new(pod).generate(config.doc_install?)
- end
+ if (!pod.exists? && !pod.local? && config.doc?) || config.force_doc?
+ puts "Installing Documentation for #{spec}".green if config.verbose?
+ Generator::Documentation.new(pod).generate(config.doc_install?)
end
end
end

0 comments on commit a5d34c8

Please sign in to comment.