Skip to content

Instantly share code, notes, and snippets.

@spilth
Created August 25, 2016 12:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spilth/7eeba4ed76e842aebcc3eab229f9b6bf to your computer and use it in GitHub Desktop.
Save spilth/7eeba4ed76e842aebcc3eab229f9b6bf to your computer and use it in GitHub Desktop.
Installs the Dash docs for all the Ruby Gems in your Gemfile
#!/usr/bin/env ruby
#
# Prerequisites:
# gem install gemnasium-parser
require 'gemnasium/parser'
def remove_docless_gems(gemfile)
# rails-assets gems don't have docs and cause Dash to crash
gemfile.dependencies.reject { |dependency| dependency.name.start_with?("rails-assets") }
end
content = File.open("./Gemfile", "rb").read
gemfile = Gemnasium::Parser.gemfile(content)
dependencies = remove_docless_gems(gemfile)
dependencies.each do |dependency|
entry_name = dependency.name
version = dependency.requirement.requirements[0][1].version
puts "Installing docs for #{entry_name} #{version} "
system "open 'dash-install://repo_name=Ruby Docsets&entry_name=#{entry_name}&version=#{version}'"
end
@jasonnoble
Copy link

Found this today, works like a charm. Thanks!

@jasonnoble
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment