Skip to content

Instantly share code, notes, and snippets.

@pelletencate
Last active September 14, 2023 10:01
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 pelletencate/1e1b3dd1a3fafe0cb7df60feab36c2e3 to your computer and use it in GitHub Desktop.
Save pelletencate/1e1b3dd1a3fafe0cb7df60feab36c2e3 to your computer and use it in GitHub Desktop.
Install Gemsets in Dash.app for all ruby gems in your bundle (without cooking your system resources)
#!/usr/bin/env ruby
require 'etc'
dependencies = `bundle show | grep '*' | awk '{print $2, $3}' | sed -e 's/(//' -e 's/)//'`.split("\n")
dependencies.each.with_index(1) do |dependency, i|
(gem_name, version) = dependency.split
next if /rails-assets/.match?(gem_name)
puts "Installing docs for #{gem_name} #{version} "
command = "open -g 'dash-install://repo_name=Ruby%20Docsets&entry_name=#{gem_name}&version=#{version}'"
system(command)
sleep 1
while `pgrep rdocset | wc -l`.to_i >= Etc.nprocessors
sleep 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment