Created
August 25, 2016 12:50
-
-
Save spilth/7eeba4ed76e842aebcc3eab229f9b6bf to your computer and use it in GitHub Desktop.
Installs the Dash docs for all the Ruby Gems in your Gemfile
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 | |
# | |
# 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 |
https://gist.github.com/jasonnoble/db2317bf81421708a6766d4d9618c9c8 uses Bundler instead of gemnasium-parser.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found this today, works like a charm. Thanks!