Skip to content

Instantly share code, notes, and snippets.

@neonichu
Created August 7, 2013 19:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neonichu/6177788 to your computer and use it in GitHub Desktop.
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.
#!/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