Created
August 7, 2013 19:44
-
-
Save neonichu/6177788 to your computer and use it in GitHub Desktop.
Ruby script which adds documentation for all dependencies from a Podfile to Dash. It's rather hacky and was only tested on Sea Lion, so use at your own risk.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'cocoapods-core' | |
require 'json' | |
require 'mechanize' | |
require 'rest-client' | |
docs = JSON.parse(RestClient.get('http://cocoadocs.org/documents.jsonp')[12..-22]) | |
podfile = Pod::Podfile.from_file('Podfile') | |
for dep in podfile.dependencies().map { |d| d.name } | |
for doc in docs | |
if doc['name'] == dep | |
agent = Mechanize.new | |
page = agent.get(doc['doc_url']) | |
dash_url = page.links_with(:text => 'Dash').first.href | |
system('open', dash_url) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment