Skip to content

Instantly share code, notes, and snippets.

@e28eta
Forked from invalidusrname/install_dash_gem_docs.rb
Created February 15, 2022 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e28eta/0df41538eca1dc8b286c7d5b6d6072ed to your computer and use it in GitHub Desktop.
Save e28eta/0df41538eca1dc8b286c7d5b6d6072ed 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 bundler
# bundle install
dependencies = `bundle show | grep '*' | awk '{print $2, $3}' | sed -e 's/(//' -e 's/)//'`.split("\n")
dependencies.each do |dependency|
(gem_name, version) = dependency.split
next if gem_name =~ /rails-assets/
puts "Installing docs for #{gem_name} #{version} "
system "open -g 'dash-install://repo_name=Ruby Docsets&entry_name=#{gem_name}&version=#{version}'"
sleep 3
end
@e28eta
Copy link
Author

e28eta commented Feb 15, 2022

open -g doesn't bring Dash to the foreground every time it executes

@e28eta
Copy link
Author

e28eta commented Mar 5, 2022

shaved a yak, and created a Bundler plugin to do this. Really not sure how I feel about turning ~10 lines of code into a whole repo, but here it is. https://rubygems.org/gems/bundler-install_dash_docs

@e28eta
Copy link
Author

e28eta commented Mar 5, 2022

not sure how I feel about turning ~10 lines of code into a whole repo

I guess it started when I was unhappy with the system call not breaking the args into separate strings, and then no escaping on the url, and then not using the parser provided by Bundler, and then, and then, and then.

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